Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /home/claqxcrl/confenda.com/wp-content/themes/beevent/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/claqxcrl/confenda.com/wp-content/themes/beevent/functions.php
<?php 

/*

Theme Name:BeEvent

Theme URI:http://themes.webmasterdriver.net/BeEventwp/

Author:wmd team

Author URI: https://themeforest.net/user/webmasterdriver

Description: this theme create on 2017  

Version: 4.1

License:GNU General Public License v2 or later

/*-----------------------------------------------------------------------------------*/

/*  - Define Constants

/*-----------------------------------------------------------------------------------*/

	// Assets Paths

	define( 'BEEVENT_JS_DIR_URI', get_template_directory_uri() .'/assets/js/' );

	define( 'BEEVENT_CSS_DIR_UIR', get_template_directory_uri() .'/assets/css/' );

	// Theme Paths

	define( 'BEEVENT_THEME_DIR_UIR', get_template_directory_uri());

	// Theme Post Type Paths

	define( 'BEEVENT_FUNCTION_DIR', get_template_directory() .'/functions/' );

	define( 'BEEVENT_FUNCTION_DIR_URI', get_template_directory_uri() .'/functions/' );

	// Define branding constant based on theme options

	define( 'BEEVENT_THEME_BRANDING', get_theme_mod( 'theme_branding', 'beevent' ) );

	 /**

	 * Defines the site content width

	 *

	 * beevent version @since 1.0 

	 */

	 if ( ! isset( $content_width ) ) {

		$content_width = 640;

		}

	add_filter('pre_get_posts','SearchFilter');

	/**

	 * Main Theme Class

	 *

	 * beevent version @since 1.0 

	 */

	 class beevent_Theme_Setup {

		public function __construct() {

	  // Run class functions

			add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );

			add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );

			add_action( 'widgets_init', array( $this, 'beevent_register_sidebars' ) );

			add_action( 'init', array( $this, 'beevent_include_files' ),0);

		} 

		public function wp_enqueue_scripts() {

		$this->beevent_css();

		$this->beevent_js();

		}

		public function beevent_css() {

		 	// Main Style.css File
			wp_enqueue_style( 'beevent-style', get_stylesheet_uri() );
			wp_enqueue_style( 'bootstrap', BEEVENT_CSS_DIR_UIR.'bootstrap.min.css' );
			wp_enqueue_style( 'custome-style', BEEVENT_CSS_DIR_UIR.'beevent-style.css' );
			wp_enqueue_style( 'owl-carousel-slider', BEEVENT_CSS_DIR_UIR.'owl.carousel.css' );
			wp_enqueue_style( 'owl-transitions-style', BEEVENT_CSS_DIR_UIR.'owl.transitions.css' );
			wp_enqueue_style( 'all-main', BEEVENT_CSS_DIR_UIR.'all.min.css' );
			wp_enqueue_style( 'solid-main', BEEVENT_CSS_DIR_UIR.'solid.min.css' );
			wp_enqueue_style( 'v4-shims', BEEVENT_CSS_DIR_UIR.'v4-shims.min.css' );
			wp_enqueue_style( 'brand-font', BEEVENT_CSS_DIR_UIR.'brands.min.css' );
			wp_enqueue_style( 'pretty-Photo', BEEVENT_CSS_DIR_UIR.'prettyPhoto.css' );

			global $beevent_options;
			if ( isset($beevent_options['map_option']) ) {
				$mapOption = $beevent_options['map_option'];
				if ( $mapOption == 'mapbox' ) {
					wp_enqueue_style( 'mapbox', BEEVENT_CSS_DIR_UIR . 'mapbox.css' );
					wp_enqueue_style( 'mapbox-gl', '//api.mapbox.com/mapbox-gl-js/v2.5.1/mapbox-gl.css' ); 
				} elseif ( $mapOption == 'openstreet' ) {
					wp_enqueue_style( 'leaflet', '//unpkg.com/leaflet@1.6.0/dist/leaflet.css' ); 
				}
			}
		}

		public function beevent_js() { 
			wp_enqueue_script( 'fontawesome', BEEVENT_JS_DIR_URI.'c83d468820.js' );
			wp_enqueue_script( 'popper-js', BEEVENT_JS_DIR_URI.'popper.min.js', array('jquery' ), true, true );
			wp_enqueue_script( 'bootstrap-js', BEEVENT_JS_DIR_URI.'bootstrap.min.js', array('jquery' ), true, true );
			wp_enqueue_script( 'owl-carousel-slider', BEEVENT_JS_DIR_URI.'owl.carousel.min.js', array('jquery' ), true, true );

			global $beevent_options;
			if ( isset($beevent_options['map_option']) ) {
				$mapOption    = $beevent_options['map_option'];
				if ( $mapOption == 'mapbox' ) {
					wp_enqueue_script( 'mapbox-sdk', '//api.mapbox.com/mapbox-gl-js/v2.5.1/mapbox-gl.js', array( 'jquery' ), true, true );
				} elseif ( $mapOption == 'openstreet' ) {
					wp_enqueue_script( 'mapbox-sdk', '//unpkg.com/leaflet@1.6.0/dist/leaflet.js', array( 'jquery' ), true, true );
				}
			}
			wp_enqueue_script( 'mapbox-inline', BEEVENT_JS_DIR_URI. 'mapbox-inline.js', array( 'jquery' ), true, true );
			wp_enqueue_script( 'beevent-custom', BEEVENT_JS_DIR_URI.'beevent-interface.js', array( 'jquery' ), true, true );

			wp_enqueue_script( 'beevent-fcustom', BEEVENT_JS_DIR_URI.'custom.js', array( 'jquery' ), true, true );
			wp_localize_script( 'beevent-fcustom', 'ajax_search_term_object', array( 
				'ajaxurl' => admin_url( 'admin-ajax.php' ),
			));
			wp_enqueue_script('pretty-Photo', BEEVENT_JS_DIR_URI.'jquery.prettyPhoto.js', array( 'jquery' ), true, true );

			if(in_array('wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php', apply_filters('active_plugins', get_option('active_plugins')))){
				$stripe_png   = get_template_directory_uri().'/assets/images/stripe.png';
				$paystack_png = get_template_directory_uri().'/assets/images/paystack-icon.png';
				$payfast_png  = get_template_directory_uri().'/assets/images/payfast-icon.png';

				$defaultCurrency = get_option( 'cart_payment_currency' );
				$defaultSymbol   = get_option( 'cart_currency_symbol' );

				if ( ! empty( $defaultCurrency ) ) {
					$paypal_currency = $defaultCurrency;
				} else {
					$paypal_currency = __( 'USD', 'beevent' );
				}
				if ( ! empty( $defaultSymbol ) ) {
					$paypal_symbol = $defaultSymbol;
				} else {
					$paypal_symbol = __( '$', 'beevent' );
				}

				$total_items = 0;
				$total       = 0;
				$decimal     = '.';
				$item_total_shipping = 0;
				$postage_cost        = 0;
				
				$wspsc_cart = WSPSC_Cart::get_instance();

				if ( isset( $wspsc_cart ) && ! empty( $wspsc_cart ) ) {
					if ( $wspsc_cart->get_items() ) {
						$products = $wspsc_cart->get_items();
					  	if ( is_array( $products ) ) {
					    	foreach ( $products as $key => $item ) {

					    		$itemName     = $item->get_name();
						        $quantity     = $item->get_quantity();
						        $ItemPrice    = $item->get_price();
						        $ItemShipping = $item->get_shipping();
						        $ItemNumber   = $item->get_item_number();
						        $Itemcartlink = $item->get_cart_link();

								$total               += $ItemPrice * $quantity;
								$item_total_shipping += $ItemShipping * $quantity;
								$total_items         += $quantity;
								$itemName            = $itemName;
								$itemNo              = $ItemNumber;

								$url        = $Itemcartlink;
								$event_id   = url_to_postid( $url );
								$event_name = get_the_title( $event_id );
							}
						}
					}

					if ( ! empty( $item_total_shipping ) ) {
						$baseShipping = get_option( 'cart_base_shipping_cost' );
						$postage_cost = $item_total_shipping + $baseShipping;
					}

					$cart_free_shipping_threshold = get_option( 'cart_free_shipping_threshold' );
					if ( ! empty( $cart_free_shipping_threshold ) && $total > $cart_free_shipping_threshold ) {
						$postage_cost = 0;
					}

					$formatted_total            = wpspsc_number_format_price($total);
			        $formatted_postage_cost     = wpspsc_number_format_price($postage_cost);
			        $totalpluspostage           = ($total + $postage_cost);
			        $formatted_totalpluspostage = wpspsc_number_format_price($totalpluspostage);

				} else {
					$formatted_total            = '';
			        $formatted_totalpluspostage = '';
			        $itemName                   = '';
			        $itemNo                     = '';
			        $event_name                 = '';
				}

				global $beevent_options;
				$payfast_api = $beevent_options['payfast_api'];
				if ( $payfast_api == 'live' ) {
					$payfastBaseUrl = 'https://www.payfast.co.za/eng/process';
				} else {
					$payfastBaseUrl = 'https://sandbox.payfast.co.za/eng/process';
				}

				$stripe_enable   = $beevent_options['enable_stripe'];
				$paystack_enable = $beevent_options['enable_paystack'];
				$payfast_enable  = $beevent_options['enable_payfast'];
				$merchantid      = isset( $beevent_options['payfast_merchant_id'] ) ? $beevent_options['payfast_merchant_id'] : '';
				$merchantkey     = isset( $beevent_options['payfast_merchant_key'] ) ? $beevent_options['payfast_merchant_key'] : '';
				$stripeskey      = isset( $beevent_options['stripe_secrit_key'] ) ? $beevent_options['stripe_secrit_key'] : '';
				$stripepkey      = isset( $beevent_options['stripe_pubishable_key'] ) ? $beevent_options['stripe_pubishable_key'] : '';
				$paystackpkey    = isset( $beevent_options['paystack_pubishable_key'] ) ? $beevent_options['paystack_pubishable_key'] : '';

				$start     = 11111111;
        $end       = 999999999;
        $ord_num   = random_int($start, $end);
        $returnurl = get_option( 'cart_return_from_paypal_url' );
        $cancelurl = get_option( 'cart_cancel_from_paypal_url' );
        $notifyurl = 'http://themes.webmasterdriver.net/BeEventwp/payment-notify/';

				wp_enqueue_style( 'bpex-front-style', BEEVENT_CSS_DIR_UIR . 'front-style.css' );
		    wp_enqueue_script( 'bpex-front-script', BEEVENT_JS_DIR_URI . 'front-script.js', array( 'jquery' ), true, true );
		    wp_localize_script( 'bpex-front-script', 'ajax_admin', array(
		        'ajax_url'        => admin_url( 'admin-ajax.php' ),
		        'bpexfront_nonce' => wp_create_nonce( 'bpexfront_ajax_nonce' ),
		        'stripeimg'       => $stripe_png,
		        'paystackimg'     => $paystack_png,
		        'payfastimg'      => $payfast_png,
		        'price'           => $formatted_total,
		        'tprice'          => $formatted_totalpluspostage,
		        'name'            => isset( $itemName ) ? $itemName : '',
		        'quantity'        => $total_items,
		        'itemno'          => isset( $itemNo ) ? $itemNo : '',
		        'paystackbaseurl' => $payfastBaseUrl,
		        'ord_num'         => $ord_num,
		        'returnurl'       => $returnurl,
		        'cancelurl'       => $cancelurl,
		        'notifyurl'       => $notifyurl,
		        'merchantid'      => $merchantid,
		        'merchantkey'     => $merchantkey,
		        'stripepkey'      => $stripepkey,
		        'stripeskey'      => $stripeskey,
		        'paystackpkey'    => $paystackpkey,
		        'eventname'       => isset( $event_name ) ? $event_name : '',
		        'stripe'          => $stripe_enable,
		        'paystack'        => $paystack_enable,
		        'payfast'         => $payfast_enable,
		    ));
	  	}
		}

		function is_admin() {
			if ( isset( $GLOBALS['current_screen'] ) )

			 return $GLOBALS['current_screen']->in_admin();

			 elseif ( defined( 'WP_ADMIN' ) )

			 return WP_ADMIN;

			 return false; 

			}

	 	public function beevent_include_files() {

			$this->beevent_theme_functions();

		}	

	/**

	* Functions called during each page load, after the theme is initialized

	* Perform basic setup, registration, and init actions for the theme

	* @since   1.0.0

	*/

	public function after_setup_theme() {

		// if(in_array('elementor/elementor.php', apply_filters('active_plugins', get_option('active_plugins')))){

		// 	$cpt_support = get_option( 'elementor_cpt_support');
		// 	if ( empty( $cpt_support ) ) {
		// 		update_option( 'elementor_cpt_support', [ 'page', 'post', 'event' ] );
		// 	} else {
		// 		array_push( $cpt_support, 'event' );
		// 		update_option( 'elementor_cpt_support', $cpt_support );
		// 	}
		// }

		//add textdomain

        load_theme_textdomain('beevent', get_template_directory() . '/lang');

	// Register navigation menus

		register_nav_menus (

			array(

				'primary'=> esc_html__('primary Menu','beevent'),

				'secondary'=> esc_html__('Secondary Menu','beevent'),

				)

			);

			// Enable some useful post formats for the blog

			add_theme_support( 'post-formats', array( 'video', 'gallery', 'audio', 'quote', 'link' ) );

			// Add automatic feed links in the header - for themecheck nagg

			add_theme_support( 'automatic-feed-links' );

			// Enable featured image support

			add_theme_support( 'post-thumbnails' ); 

			add_image_size( 'beevent_small',  300, 300, array( 'left', 'top' ) );

			// And HTML5 support

			add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) );

			// Enable excerpts for pages.

	    	add_post_type_support( 'page', 'excerpt' );

			// Title tag

			add_theme_support( 'title-tag' );

			add_theme_support( "custom-background" );

			add_theme_support( "custom-header" ) ;

			}

		public function beevent_register_sidebars(){

		register_sidebar(

		 array( 

			'name'          => esc_html__('BeEvent Main Sidebar', 'beevent'),

			'id'            => 'beevent_main',

			'before_widget' => '<div class="sidebar_widgets">',

			'after_widget'  => '</div>',

			'before_title'  => '<div class="widget_title white_text secondary-bg"><h6>',

			'after_title'   => '</h6></div>',

			) );

		}

		private function beevent_theme_functions() {
			require_once( BEEVENT_FUNCTION_DIR .'metacore/core-options.php');
			require_once( BEEVENT_FUNCTION_DIR .'theme-options.php');
			require_once( BEEVENT_FUNCTION_DIR .'blog-style.php');
			require_once( BEEVENT_FUNCTION_DIR .'header-functions.php');
			require_once( BEEVENT_FUNCTION_DIR .'footer-functions.php');
			require_once( BEEVENT_FUNCTION_DIR .'social-share.php');
			require_once( BEEVENT_FUNCTION_DIR .'favorite-function.php');

			require_once( get_template_directory(). '/appss.php' );
			require_once( get_template_directory(). '/app_setup.php' );
			require_once( BEEVENT_FUNCTION_DIR .'app.php');

			//Element File
			require_once( BEEVENT_FUNCTION_DIR .'element/speakers.php');
			require_once( BEEVENT_FUNCTION_DIR .'element/schedule.php');
			require_once( BEEVENT_FUNCTION_DIR .'element/sponsors.php');
			require_once( BEEVENT_FUNCTION_DIR .'element/testimonial.php');
			require_once( BEEVENT_FUNCTION_DIR .'element/gallery.php');
			require_once( BEEVENT_FUNCTION_DIR .'classes/install-plugin.php' );

			if(in_array('wordpress-simple-paypal-shopping-cart/wp_shopping_cart.php', apply_filters('active_plugins', get_option('active_plugins')))){ 
				require_once( BEEVENT_FUNCTION_DIR .'payment-actions.php' );
			}

		}

		/**

		* my site feed function

		*

		*https://wordpress.org/support/topic/custom-post-types

		*/

		public  function beevent_myfeed_request($qv) {

		if (isset($qv['feed']) && !isset($qv['post_type']))

				$qv['post_type'] = array('post', 'sponsor', 'speaker', 'testimonial', 'gallery', 'page');

				return $qv;

		}

	 }

		$beevent_theme_setup = new beevent_Theme_Setup();

/*Theme Option Framwork start ********/

	function beevent_defaults( $id ){	

	$defaults = array(

		'footer_facebook' =>esc_html__('','beevent'), 

		'footer_twitter' =>esc_html__('','beevent'), 

		'footer_linkedin' => esc_html__('','beevent'),

	 	'site_favicon' => array('url' => esc_html__('','beevent')),

		'site_logo' => array('url' => esc_html__('','beevent')),

	);

	if( isset( $defaults[$id] ) ){

		return $defaults[$id];

		}

		else

		{

			return '';

			}

		}

/* get option from theme options */

	function beevent_get_option($id){

		global $beevent_options;

		if( isset( $beevent_options[$id] ) ){

			$value = $beevent_options[$id];

			if( isset( $value ) ){

				return apply_filters( 'beevent_get_options', $value, $id );

				}

				else

				{

					return apply_filters( 'beevent_get_options', '', $id );

					}

					}

					else{

						return apply_filters( 'beevent_get_options',beevent_defaults( $id ), $id );

						}

						}

/** Theme Option Framwork  end***********/

/**********Paging Nav******/

if ( ! function_exists( 'beevent_paging_nav' ) ) :

function beevent_paging_nav() {

	global $wp_query, $wp_rewrite;

	// Don't print empty markup if there's only one page.

	if ( $wp_query->max_num_pages < 2 ) {

		return;

	}

	$paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;

	$pagenum_link = html_entity_decode( get_pagenum_link() );

	$query_args   = array();

	$url_parts    = explode( '?', $pagenum_link );

	if ( isset( $url_parts[1] ) ) {

		wp_parse_str( $url_parts[1], $query_args );

	}

	$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );

	$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';

	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';

	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';



	// Set up paginated links.

	$links = paginate_links( array(

		'base'     => $pagenum_link,

		'format'   => $format,

		'total'    => $wp_query->max_num_pages,

		'current'  => $paged,

		'mid_size' => 1,

		'add_args' => array_map( 'urlencode', $query_args ),

		'prev_text' => esc_html__( 'Previous', 'beevent' ),

		'next_text' => esc_html__( 'Next', 'beevent' ),

	) );



	if ( $links ) :

	?>

<nav class=" paging-navigation">

  <h2 class="screen-reader-text">

    <?php esc_html_e( 'Posts navigation', 'beevent' ); ?>

  </h2>

  <div class="pagination loop-pagination"> <?php echo esc_htm($links); ?> </div>

 </nav>

<!-- .navigation -->

<?php

	endif;

	}

	endif;

// Numbered Pagination

if ( !function_exists( 'beevent_pagination' ) ) {

function beevent_pagination() {

	$prev_arrow = is_rtl() ? 'Previous' : 'Previous';

	$next_arrow = is_rtl() ? 'Next' : 'Next';

	global $wp_query, $my_query1;

if ( $my_query1 ) {

   $total = $my_query1->max_num_pages;

} else {

   $total = $wp_query->max_num_pages;

}

	$big = 999999999;

		if( $total > 1 )  {

			 if( !$current_page = get_query_var('paged') )

				 $current_page = 1;

			 if( get_option('permalink_structure') ) {

				 $format = 'page/%#%/';

			 } else {

			 $format = '&paged=%#%';

			 }

			echo paginate_links(array(

				'base'			=> str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),

				'format'		=> $format,

				'current'		=> max( 1, get_query_var('paged') ),

				'total' 		=> $total,

				'mid_size'		=> 3,

				'type' 			=> 'list',

				'prev_text'		=> $prev_arrow,

				'next_text'		=> $next_arrow,

			 ) );

		}

	}

}

if ( ! function_exists( 'beevent_post_nav' ) ) :

function beevent_post_nav() {

	global $post;

	$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );

	$next     = get_adjacent_post( false, '', false );

	if ( ! $next && ! $previous )

	return;

	?>

   <div class="wp_nav_links">

    <?php previous_post_link( '%link', esc_attr_x( 'Previous', 'Previous post link', 'beevent' ) ); ?>

    <?php next_post_link( '%link', esc_attr_x( 'Next', 'Next post link', 'beevent' ) ); ?>

  </div>

<?php

}

endif;



if ( ! function_exists( 'beevent_comment_nav' ) ) :

function beevent_comment_nav() {

	// Are there comments to navigate through?

	if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :

	?>

<nav class="navigation comment-navigation" role="navigation">

  <h2 class="screen-reader-text">

    <?php esc_html_e( 'Comment navigation', 'beevent' ); ?>

  </h2>

  <div class="nav-links">

    <?php

		if ( $prev_link = get_previous_comments_link( esc_html__( 'Older Comments', 'beevent' ) ) ) :

			printf( '<div class="nav-previous">%s</div>', $prev_link );

		endif;

		if ( $next_link = get_next_comments_link( esc_html__( 'Newer Comments', 'beevent' ) ) ) :

			printf( '<div class="nav-next">%s</div>', $next_link );

		endif;

	?>

  </div>

 </nav>

<!-- .comment-navigation -->

<?php

	endif;

}

endif;



/*Editor styles start*/

add_action( 'dbeevent_init', 'beevent_add_editor_styles' );

/**

 * Apply theme's stylesheet to the visual editor.

 *

 * @uses add_editor_style() Links a stylesheet to visual editor

 * @uses get_stylesheet_uri() Returns URI of theme stylesheet

 */

function beevent_add_editor_styles() {

    add_beevent_style( get_stylesheet_uri() );

}

/* Editor styles End */

/* Tags function start */

function beevent_tags(){

	the_tags();

}

/* Tags function End */



/* Javascript Google Fonts Url Function Start */

function beevent_fonts_url() {

		$fonts_url = '';

		$font_style = beevent_get_option('font_style');	

		//Montserrat font family

		if($font_style=='Montserrat'):

			if ('off' !== $Montserrat):

				$font_families = array();

					if ('off' !== $Montserrat ) {

						$font_families[] = 'Montserrat:300,400,500,700,800';

					}

				$query_args = array(

					'family' => urlencode( implode( '|', $font_families ) ),

					);

				$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );

			endif;

		//Lato font family

		elseif($font_style=='Lato'):

			if ('off' !== $Lato):

				$font_families = array();

					if ('off' !== $Lato ) {

						$font_families[] = 'Lato:300,400,700,900';

					}

				$query_args = array(

					'family' => urlencode( implode( '|', $font_families ) ),

					);

				$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );

			endif;

		//OpenSans font family

		elseif($font_style=='OpenSans'):

			if ('off' !== $OpenSans):

				$font_families = array();

					if ('off' !== $OpenSans ) {

						$font_families= 'Open+Sans:300,400,600,700,800';

					}

				$query_args = array(

					'family' => $font_families,

					);

				$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );

			endif;

		//MartelSans font family	

		elseif($font_style=='MartelSans'):

			if ('off' !== $MartelSans):

				$font_families = array();

					if ('off' !== $MartelSans ) {

						$font_families= 'Martel+Sans:400,600,700,800';

					}

				$query_args = array(

					'family' => $font_families,

					);

				$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );

			endif;

		//Roboto font family

		else:

			$Roboto = esc_attr_x( 'on', 'Roboto font: on or off', 'beevent' );

			if ('off' !== $Roboto):

				$font_families = array();

					if ('off' !== $Roboto ) {

						$font_families[] = 'Roboto:300,400,500,700,900';

					}

				$query_args = array(

					'family' => urlencode( implode( '|', $font_families ) ),

					);

				$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );

			endif;

				

		endif;

		

		

		return esc_url_raw( $fonts_url );

		}

		/*Enqueue scripts and styles.*/

function beevent_add_google_fonts() {

			wp_enqueue_style( 'beevent-fonts', beevent_fonts_url(), array(), '1.0.0' );

		}

add_action( 'wp_enqueue_scripts', 'beevent_add_google_fonts' );

/* Javascript Google Fonts Url Function Start */





function SearchFilter($query) {

	if ($query->is_search) {

			$query->set('post_type', 'post');

	}

	return $query;

}

function beevent_enqueue_comments_reply() {

    // on single blog post pages with comments open and threaded comments

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 

        // enqueue the javascript that performs in-link comment reply fanciness

        wp_enqueue_script( 'comment-reply' ); 

    }

}

// Hook into wp_enqueue_scripts

add_action( 'comment_form_before', 'beevent_enqueue_comments_reply' );

// Header  

if(is_admin()){

	

	

	if(!class_exists('CsCoreControl')){

		/* add mete core */

		require_once( BEEVENT_FUNCTION_DIR .'metacore/core-options.php');

		/* add meta options */

		// require_once( BEEVENT_FUNCTION_DIR .'meta/meta-options.php');

	}

}



// Excerpt

function beevent_excerpt( $len=15, $trim = "&hellip;" ) {

$limit = $len+1;

$excerpt = explode( ' ', get_the_excerpt(), $limit );

$num_words = count( $excerpt );

if ( $num_words >= $len ) {

	$last_item = array_pop( $excerpt );

} else {

	$trim="";

}

$excerpt = implode( " ", $excerpt ) . $trim ;

return $excerpt;

}



// Scripts  File

function beevent_scripts_basic()

{

    wp_enqueue_script('jquery-plugin', BEEVENT_JS_DIR_URI .'jquery.plugin.min.js');

    wp_enqueue_script('jquery-countdown', BEEVENT_JS_DIR_URI .'jquery.countdown.min.js');

}

add_action( 'wp_enqueue_scripts', 'beevent_scripts_basic' );

/**

 * Get meta data.

 */

function beevent_meta_data(){

    global $post, $beevent_meta;

    if(!isset($post->ID)) return ;

    $beevent_meta = json_decode(get_post_meta($post->ID, '_cms_meta_data', true));

    if(empty($beevent_meta)) return ;

    foreach ($beevent_meta as $key => $meta){

        $beevent_meta->$key = rawurldecode($meta);

    }

}

add_action('wp', 'beevent_meta_data');

/**

 * Get post meta data.

 */

function beevent_post_meta_data($post_id = null){

    global $post;

    if(!$post_id){

    	if(isset($post->ID)){

    		$post_id=$post->ID;

    	}else{

    		return null;

    	}

    }

    $post_meta = json_decode(get_post_meta($post_id, '_cms_meta_data', true));

    if(empty($post_meta)) return null;

    foreach ($post_meta as $key => $meta){

        $post_meta->$key = rawurldecode($meta);

    }

    return $post_meta;

}

// Sub Menu li add Class dropdown togal

function beevent_menu_set_dropdown( $sorted_menu_items ) {

    $last_top = 0;

    foreach ( $sorted_menu_items as $key => $obj ) {

        // it is a top lv item?

        if ( 0 == $obj->menu_item_parent ) {

            // set the key of the parent

            $last_top = $key;

        } else {
        	if (isset($sorted_menu_items[$last_top])) {
            $sorted_menu_items[$last_top]->classes['dropdown'] = 'dropdown';
        	}

        }

    }

    return $sorted_menu_items;

}

add_filter( 'wp_nav_menu_objects', 'beevent_menu_set_dropdown');

// Menu li  a tag add Class js-target-scroll Togal

function beevent_add_nav_class($output) {

    $output= preg_replace('/<a/', '<a class="js-target-scroll"', $output);

    return $output;

}

add_filter('wp_nav_menu', 'beevent_add_nav_class');

function beevent_InnerHeader(){

	$beevent_Inner_Img = beevent_get_option('InnerPageImg');

	if(!empty($beevent_Inner_Img)){

		$beevent_Inner = $beevent_Inner_Img['url'];

		echo esc_url($beevent_Inner);

	}	

}

// Unset URL from comment form

function beevent_move_comment_form_below( $beevent_fields ) { 

    $comment_field = $beevent_fields['comment']; 

    unset( $beevent_fields['comment'] ); 

    $beevent_fields['comment'] = $comment_field; 

    return $beevent_fields; 

}

add_filter( 'comment_form_fields', 'beevent_move_comment_form_below' ); 

// Add placeholder for Name and Email

function beevent_comment_form_fields($beevent_fields){

	global $beevent_fields, $beevent_commenter, $beevent_aria_req, $beevent_req;

    $beevent_fields['author'] = '<div class="comment-form-author form-group">' . '<input id="author" class="form-control" placeholder="Full Name" name="author" type="text" value="' .

				esc_attr( $beevent_commenter['comment_author'] ) . '" size="30"' . $beevent_aria_req . ' />'.

				( $beevent_req ? '<span class="required">*</span>' : '' )  .

				'</div>';

    $beevent_fields['email'] = '<div class="comment-form-email form-group">' . '<input id="email" class="form-control" placeholder="Email Address" name="email" type="text" value="' . esc_attr(  $beevent_commenter['comment_author_email'] ) .

				'" size="30"' . $beevent_aria_req . ' />'  .

				($beevent_req ? '<span class="required">*</span>' : '') 

				 .

				'</div>';

	

    return $beevent_fields;

}

add_filter('comment_form_default_fields','beevent_comment_form_fields');

// contact form 7 

function beevent_form_elements($html) {

    $text = esc_html('Select Option', 'beevent');

    $html = str_replace('---',  $text , $html);

    return $html;

}

add_filter('wpcf7_form_elements', 'beevent_form_elements');


add_action( 'admin_enqueue_scripts', 'beevent_admin_enqueue_assets' );
function beevent_admin_enqueue_assets() {
	wp_enqueue_script( 'beevent-app', get_template_directory_uri(). '/assets/js/app.js', array( 'jquery' ), true, true );
	wp_localize_script( 'beevent-app', 'ajax_admin', array(
      'ajax_url'    => admin_url( 'admin-ajax.php' ),
      'event_nonce' => wp_create_nonce( 'event_ajax_nonce' ),
      'path_url'    => get_template_directory(),
  ));
}

add_action( 'init', 'beevent_set_wp_shopping_cart_default_values' );
function beevent_set_wp_shopping_cart_default_values() {

	$cart_products_page_url = get_option( 'cart_products_page_url' );
	if ( empty( $cart_products_page_url ) ) {
		$cartPageURL = site_url( 'payment-checkout/' );
		update_option( 'cart_products_page_url', $cartPageURL );
	}

	$cart_products_page_url = get_option( 'cart_cancel_from_paypal_url' );
	if ( empty( $cart_products_page_url ) ) {
		$cartPageURL = site_url( 'payment-cancel/' );
		update_option( 'cart_cancel_from_paypal_url', $cartPageURL );
	}

	$cart_products_page_url = get_option( 'cart_return_from_paypal_url' );
	if ( empty( $cart_products_page_url ) ) {
		$cartPageURL = site_url( 'payment-success/' );
		update_option( 'cart_return_from_paypal_url', $cartPageURL );
	}

	$cart_products_page_url = get_option( 'cart_checkout_page_url' );
	if ( empty( $cart_products_page_url ) ) {
		$cartPageURL = site_url( 'payment-checkout/' );
		update_option( 'cart_checkout_page_url', $cartPageURL );
	}

	update_option('wp_shopping_cart_auto_redirect_to_checkout_page', 'checked="checked"' );
	
}

ZeroDay Forums Mini