Sindbad~EG File Manager

Current Path : /home/copmadinaarea/www/wp-content__80fcb17/plugins/adorechurch-core/
Upload File :
Current File : /home/copmadinaarea/www/wp-content__80fcb17/plugins/adorechurch-core/includes.php

<?php
class AdoreChurchFeatures
{
    function __construct()
    {
        if ( current_user_can('edit_posts') &&  current_user_can('edit_pages') )  
        {  
            add_filter('mce_external_plugins', array($this, 'imic_add_tinymce_plugin'));  
            add_filter('mce_buttons', array($this, 'imic_register_shortcode_button'));  
        }
        if ( ! function_exists( 'rwmb_meta_shortcode' ) ) {
            add_shortcode( 'rwmb_meta', 'rwmb_meta_shortcode' );
        }
        if ( class_exists( 'Woocommerce' ) ) {
            add_action( 'admin_init', array($this, 'adorechurch_core_disable_shop_redirect'), 0 );
        }
        add_action('admin_init', array($this, 'add_nav_menu_meta_boxes'));
    }
	
    

    public function add_nav_menu_meta_boxes() {
        add_meta_box(
        'mega_nav_link',
        __('Mega Menu','adorechurch-core'),
        array( $this, 'nav_menu_link'),
        'nav-menus',
        'side',
        'low'
        );
    }

    public function nav_menu_link() {
        global $_nav_menu_placeholder, $nav_menu_selected_id;
        $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
        ?>
        <div id="posttype-wl-login" class="posttypediv">
            <div id="tabs-panel-wishlist-login" class="tabs-panel tabs-panel-active">
                <ul id ="wishlist-login-checklist" class="categorychecklist form-no-clear">
                    <li>
                        <label class="menu-item-title">
                            <input type="checkbox" class="menu-item-object-id" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-object-id]" value="<?php echo ''.$_nav_menu_placeholder; ?>"> <?php _e('Create Column','adorechurch-core'); ?>
                        </label>
                        <input type="hidden" class="menu-item-db-id" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-db-id]" value="0">
                        <input type="hidden" class="menu-item-object" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-object]" value="page">
                        <input type="hidden" class="menu-item-parent-id" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-parent-id]" value="0">
                        <input type="hidden" class="menu-item-type" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-type]" value="">
                        <input type="hidden" class="menu-item-title" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-title]" value="<?php _e('Column','adorechurch-core'); ?>">
                        <input type="hidden" class="menu-item-classes" name="menu-item[<?php echo ''.$_nav_menu_placeholder; ?>][menu-item-classes]" value="custom_mega_menu">
                    </li>
                </ul>
            </div>
            <p class="button-controls">
                <span class="add-to-menu">
                    <input type="submit" class="button-secondary submit-add-to-menu right" value="<?php _e('Add to Menu','adorechurch-core'); ?>" name="add-post-type-menu-item" id="submit-posttype-wl-login">
                    <span class="spinner"></span>
                </span>
            </p>
        </div>
    <?php }

	function imic_register_shortcode_button($button) {  
	    array_push($button, 'separator', 'imicframework_shortcodes' );  
	    return $button;  
	}
	
	function imic_add_tinymce_plugin($plugins) {  
	    $plugins['imicframework_shortcodes'] = ADORECHURCH_CORE__PLUGIN_URL . 'shortcodes/imic-shortcodes/imic-tinymce.editor.plugin.js';  
	    return $plugins;  
	}
    
    //Below are the shortcodes that are defined outside of imic-shortcode file
    
	function rwmb_meta_shortcode( $atts ) {
		$atts = wp_parse_args( $atts, array(
			'post_id' => get_the_ID(),
		) );
		if ( empty( $atts['meta_key'] ) ) {
			return '';
		}

		$field_id = $atts['meta_key'];
		$post_id  = $atts['post_id'];
		unset( $atts['meta_key'], $atts['post_id'] );

		return rwmb_the_value( $field_id, $atts, $post_id, false );
	}
    
    function adorechurch_core_remove_class_filters( $tag, $class, $method ) {
		$filters = $GLOBALS['wp_filter'][ $tag ];
		if ( empty ( $filters ) ) {
			return;
		}
		foreach ( $filters as $priority => $filter ) {
			foreach ( $filter as $identifier => $function ) {
				if ( is_array( $function )  ) {

					if ( is_array( $function['function'] ) || is_string( $function['function'] ) ) {

						if ( is_a( $function['function'][0], $class ) and $method === $function['function'][1] ) {

							remove_filter(
								$tag,
								array ( $function['function'][0], $method ),
								$priority
							);

						}

					}

				}

			}

		}
	}
        
    function adorechurch_core_disable_shop_redirect() {
		$this->adorechurch_core_remove_class_filters(
			'admin_init',
			'WC_Admin',
			'admin_redirects'
		);
	}
}
$options = get_option('imic_options');
$event_feature = (isset($options['enable_event_feature'])) ? $options['enable_event_feature'] : '1';
$sermon_feature = (isset($options['enable_sermon_feature'])) ? $options['enable_sermon_feature'] : '1';
function adorechurch_core_initialize_features()
{
    new AdoreChurchFeatures;
    require_once ADORECHURCH_CORE__PLUGIN_PATH . 'shortcodes/shortcodes.php';
    if (!function_exists('imic_audio_soundcloud')) {
        function imic_audio_soundcloud($url, $width = "100%", $height = 450) {
			return '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url='.$url.'&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>';
        }
     }
}
add_action('init', 'adorechurch_core_initialize_features');
//add_action('admin_init', 'adorechurch_core_initialize_features');

//Contact Event Manager
if (!function_exists('imic_contact_event_manager')) {
function imic_contact_event_manager(){
	$event_id = $_POST['itemnumber'];
	$event_id = explode('-',$event_id);
	$event_id_dt = explode('|',$event_id[1]);
	$event_id = $event_id_dt[0];
	$event_id = $event_id-2648;
	$name = $_POST['name'];
	$lname = $_POST['lastname'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	//$address = $_POST['address'];
	$notes = $_POST['notes'];
	$event_title = get_the_title($event_id);
	$event_manager_email = get_post_meta($event_id,'imic_event_manager',true);
	$manager_email = esc_attr($event_manager_email);
	$e_subject = __('Query for Event','framework');
	$e_body = __("You have been contacted for ","framework").$event_title. PHP_EOL . PHP_EOL;
	$body = __("Your message has been delivered to Event Manager for ","framework").$event_title. PHP_EOL . PHP_EOL;
	$e_content = '';
	$e_content .= __("Name: ","framework").$name.' '. $lname. PHP_EOL . PHP_EOL;
	$e_content .= __("Email: ","framework").$email. PHP_EOL . PHP_EOL;
	$e_content .= __("Phone: ","framework").$phone. PHP_EOL . PHP_EOL;
	$e_content .= __("Notes: ","framework").$notes. PHP_EOL . PHP_EOL;
	$e_reply = __("You can contact ","framework").$name.__(" via email, ","framework").$email;
	$reply = __("You can contact manager via email, ","framework").$manager_email;
	$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
	$user_msg = wordwrap( $body . $e_content . $reply, 70 );
	$headers = __("From: ","framework").$email. PHP_EOL;
	$headers .= __("Reply-To: ","framework").$email. PHP_EOL;
	$headers .= "MIME-Version: 1.0" . PHP_EOL;
	$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
	$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
	$user_headers = "From: $manager_email" . PHP_EOL;
	$user_headers .= "Reply-To: $email" . PHP_EOL;
	$user_headers .= "MIME-Version: 1.0" . PHP_EOL;
	$user_headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
	$user_headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
	if(wp_mail($manager_email, $e_subject, $msg, $headers)&&wp_mail($email, $e_subject, $user_msg, $user_headers)) {
		echo '<div class=\"alert alert-success\">'.__('Thank you ','framework').'<strong>'.$name.'</strong>'.__(' your message has been submitted to us.','framework').'</div>';
	} else {
		echo '<div class="alert alert-error">ERROR!</div>';
	}
		die();
	}
	add_action('wp_ajax_nopriv_imic_contact_event_manager', 'imic_contact_event_manager');
	add_action('wp_ajax_imic_contact_event_manager', 'imic_contact_event_manager');
}

//Book Event Ticket
if (!function_exists('imic_book_event_ticket')) {
function imic_book_event_ticket() {
	$event_id = $_POST['itemnumber'];
	$event_id = explode('-',$event_id);
	$event_id_dt = explode('|',$event_id[1]);
	$event_id = $event_id_dt[0];
	$event_dt = $event_id_dt[1];
	$event_dt = adorechurch_date_localization(get_option('date_format'),$event_dt);
	$event_id = $event_id-2648;
	$date = $_POST['date'];
	$name = $_POST['name'];
	$lname = $_POST['lastname'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	$members = $_POST['members'];
	$event_title = get_the_title($event_id);
	$reg_old = get_post_meta($event_id,'imic_reg_number',true);
	if(isset($reg_old)||!empty($reg_old)) {
		$reg_no = intval($reg_old)+2648+intval($event_id);
		update_post_meta($event_id,'imic_reg_number',$reg_no); }
	$event_registration = get_post_meta($event_id,'imic_reg_number',true);
	$event_manager_email = get_post_meta($event_id,'imic_event_manager',true);
	$admin_email = ($event_manager_email!='')?$event_manager_email:get_option('admin_email');
	$e_subject = __('Registration for Event','framework');
	$e_body = $name.__(" has been registered for ","framework").$event_title. PHP_EOL . PHP_EOL;
	$body = __("You have been registered successfully for ","framework").$event_title. PHP_EOL . PHP_EOL;
	$e_content = '';
	$e_content .= __("Registration Number: ","framework").$event_registration. PHP_EOL . PHP_EOL;
	$e_content .= __("Event: ","framework").$event_title. PHP_EOL . PHP_EOL;
	$e_content .= __("Event Date: ","framework").$event_dt. PHP_EOL . PHP_EOL;
	$e_content .= __("Name: ","framework").$name.' '. $lname. PHP_EOL . PHP_EOL;
	$e_content .= __("Email: ","framework").$email. PHP_EOL . PHP_EOL;
	$e_content .= __("Phone: ","framework").$phone. PHP_EOL . PHP_EOL;
	$e_content .= __("Ticket Count: ","framework").$members. PHP_EOL . PHP_EOL;
	$e_reply = __("You can contact ","framework").$name.__(" via email, ","framework").$email;
	$reply = __("You can contact via email, ","framework").$admin_email;
	$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
	$user_msg = wordwrap( $body . $e_content . $reply, 70 );
	$headers = __("From: ","framework").$email. PHP_EOL;
	$headers .= __("Reply-To: ","framework").$email. PHP_EOL;
	$headers .= "MIME-Version: 1.0" . PHP_EOL;
	$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
	$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
	$user_headers = "From: $admin_email" . PHP_EOL;
	$user_headers .= "Reply-To: $email" . PHP_EOL;
	$user_headers .= "MIME-Version: 1.0" . PHP_EOL;
	$user_headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
	$user_headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
	if(wp_mail($admin_email, $e_subject, $msg, $headers)&&wp_mail($email, $e_subject, $user_msg, $user_headers)) {
		echo ''.$event_registration;
	} else {
		echo 'ERROR!';
	}
		die();
	}
	add_action('wp_ajax_nopriv_imic_book_event_ticket', 'imic_book_event_ticket');
	add_action('wp_ajax_imic_book_event_ticket', 'imic_book_event_ticket');
}

if(!function_exists('adore_register_paid_event'))
{
	function adore_register_paid_event()
	{
		$event_id = (isset($_POST['event_id']))?$_POST['event_id']:'';
		$event_date = (isset($_POST['edate']))?$_POST['edate']:'';
		$firstname = (isset($_POST['firstname']))?$_POST['firstname']:'';
		$lastname = (isset($_POST['lastname']))?$_POST['lastname']:'';
		$email = (isset($_POST['email']))?$_POST['email']:'';
		$phone = (isset($_POST['phone']))?$_POST['phone']:'';
		$platinum = (isset($_POST['platinum']))?$_POST['platinum']:'';
		$gold = (isset($_POST['golds']))?$_POST['golds']:'';
		$silver = (isset($_POST['silvers']))?$_POST['silvers']:'';
		$registrant_post = array('post_type'=>'adore_registrant');
		$registrant_id = wp_insert_post($registrant_post);
		$ticket1 = get_post_meta($event_id, 'adore_event_ticket1', true);
		$ticket2 = get_post_meta($event_id, 'adore_event_ticket2', true);
		$ticket3 = get_post_meta($event_id, 'adore_event_ticket3', true);
		$ticket_booked1 = get_post_meta($event_id, 'adore_event_booked1', true);
		$ticket_booked2 = get_post_meta($event_id, 'adore_event_booked2', true);
		$ticket_booked3 = get_post_meta($event_id, 'adore_event_booked3', true);
		update_post_meta($event_id, 'adore_event_ticket1', $ticket1-$platinum);
		update_post_meta($event_id, 'adore_event_ticket2', $ticket2-$gold);
		update_post_meta($event_id, 'adore_event_ticket3', $ticket3-$silver);
		update_post_meta($event_id, 'adore_event_booked1', $ticket_booked1+$platinum);
		update_post_meta($event_id, 'adore_event_booked2', $ticket_booked2+$gold);
		update_post_meta($event_id, 'adore_event_booked3', $ticket_booked3+$silver);
		update_post_meta($registrant_id, 'adore_registrant_event', $event_id);
		update_post_meta($registrant_id, 'adore_event_date', $event_date);
		update_post_meta($registrant_id, 'adore_registrant_name', $firstname.' '.$lastname);
		update_post_meta($registrant_id, 'adore_registrant_email', $email);
		update_post_meta($registrant_id, 'adore_registrant_phone', $phone);
		update_post_meta($registrant_id, 'adore_registrant_ticket1', $platinum);
		update_post_meta($registrant_id, 'adore_registrant_ticket2', $gold);
		update_post_meta($registrant_id, 'adore_registrant_ticket3', $silver);
		$event_title = get_the_title($event_id);
		$reg_old = get_post_meta($event_id,'imic_reg_number',true);
		if(isset($reg_old)||!empty($reg_old)) 
		{
			$reg_no = intval($reg_old)+2648+intval($event_id);
			update_post_meta($event_id,'imic_reg_number',$reg_no); 
		}
		$event_registration = get_post_meta($event_id,'imic_reg_number',true);
		echo ''.$registrant_id.'-'.$event_registration;
		$event_manager_email = get_post_meta($event_id,'imic_event_manager',true);
		$admin_email = ($event_manager_email!='')?$event_manager_email:get_option('admin_email');
		$e_subject = __('Registration for Event','framework');
		$e_body = $name.__(" has been registered for ","framework").$event_title. PHP_EOL . PHP_EOL;
		$body = __("You have been registered successfully for ","framework").$event_title. PHP_EOL . PHP_EOL;
		$e_content = '';
		$e_content .= __("Registration Number: ","framework").$event_registration. PHP_EOL . PHP_EOL;
		$e_content .= __("Event: ","framework").$event_title. PHP_EOL . PHP_EOL;
		$e_content .= __("Event Date: ","framework").$event_date. PHP_EOL . PHP_EOL;
		$e_content .= __("Name: ","framework").$firstname.' '. $lastname. PHP_EOL . PHP_EOL;
		$e_content .= __("Email: ","framework").$email. PHP_EOL . PHP_EOL;
		$e_content .= __("Phone: ","framework").$phone. PHP_EOL . PHP_EOL;
		$e_reply = __("You can contact ","framework").$firstname.__(" via email, ","framework").$email;
		$reply = __("You can contact via email, ","framework").$admin_email;
		$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
		$user_msg = wordwrap( $body . $e_content . $reply, 70 );
		$headers = __("From: ","framework").$email. PHP_EOL;
		$headers .= __("Reply-To: ","framework").$email. PHP_EOL;
		$headers .= "MIME-Version: 1.0" . PHP_EOL;
		$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
		$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
		$user_headers = "From: $admin_email" . PHP_EOL;
		$user_headers .= "Reply-To: $email" . PHP_EOL;
		$user_headers .= "MIME-Version: 1.0" . PHP_EOL;
		$user_headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
		$user_headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;
		if(wp_mail($admin_email, $e_subject, $msg, $headers)&&wp_mail($email, $e_subject, $user_msg, $user_headers)) {

		} else {
			echo 'ERROR!';
		}
		die();
	}
	add_action('wp_ajax_nopriv_adore_register_paid_event', 'adore_register_paid_event');
	add_action('wp_ajax_adore_register_paid_event', 'adore_register_paid_event');
}

// INCLUDES
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/meta-box/meta-box.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/meta-box-show-hide/meta-box-show-hide.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/meta-box-conditional-logic/meta-box-conditional-logic.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/mb-admin-columns/mb-admin-columns.php');

if ( is_admin() ) {
    include_once ADORECHURCH_CORE__PLUGIN_PATH . 'imi-admin/admin.php';
}
// Widgets Registration
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/twitter_feeds/twitter_feeds.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/custom_category.php');
($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/event_counter.php') : '';
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/Newsletter/newsletter.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/selected_post.php');
($sermon_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/sermon_widget.php') : '';
($sermon_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/speaker_widget.php') : '';
($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'widgets/upcoming_events.php') : '';

($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'event_registrant.php') : '';

($sermon_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'podcasting/podcast-functions.php') : '';
($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/tickets_clone_fields.php') : '';
($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/event_clone.php') : '';
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'meta-boxes/clone_fields.php');
    
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'custom-post-types/gallery-type.php');
require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'custom-post-types/speaker-type.php');
($sermon_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'custom-post-types/sermon-type.php') : '';
($event_feature == '1') ? require_once(ADORECHURCH_CORE__PLUGIN_PATH . 'custom-post-types/event-type.php') : '';

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists