mage-eventpress/inc/mep_enque.php

114 lines
5.9 KiB
PHP
Raw Normal View History

2020-01-15 06:24:11 -05:00
<?php
2020-05-24 04:17:41 -04:00
if (!defined('ABSPATH')) {
die;
} // Cannot access pages directly.
2018-07-02 05:44:24 -04:00
2020-04-28 06:37:33 -04:00
/**
* The Admin Enqueue Scripts & Style Files are Hooked up below for WooOCmmerce Event Manager Plugin
*/
add_action('admin_enqueue_scripts', 'mep_add_admin_scripts', 10, 1);
function mep_add_admin_scripts($hook)
{
global $post;
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
2018-08-10 12:12:04 -04:00
2020-04-28 06:37:33 -04:00
/**
* Load Only when the New Event Add Page Open.
*/
if ($hook == 'post-new.php' || $hook == 'post.php') {
if ('mep_events' === $post->post_type) {
wp_enqueue_style('mep-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
wp_enqueue_script('gmap-scripts', plugin_dir_url(__DIR__) . 'js/mkb-admin.js', array('jquery', 'jquery-ui-core'), 1, true);
2018-08-10 12:12:04 -04:00
}
2020-04-28 06:37:33 -04:00
}
2018-08-10 12:12:04 -04:00
2020-04-28 06:37:33 -04:00
/**
* If Your Save Google API Then Load the Google Map API
*/
if ($user_api) {
wp_enqueue_script('gmap-libs', 'https://maps.googleapis.com/maps/api/js?key=' . $user_api . '&libraries=places&callback=initMap', array('jquery', 'gmap-scripts'), 1, true);
}
2018-08-10 12:12:04 -04:00
2020-04-28 06:37:33 -04:00
/**
* Enquue Admin Styles
*/
2020-08-05 08:06:45 -04:00
2020-04-28 06:37:33 -04:00
wp_enqueue_style('mage-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
wp_enqueue_style('mage-options-framework', plugin_dir_url(__DIR__) . 'css/mage-options-framework.css');
wp_enqueue_style('jquery-ui', plugin_dir_url(__DIR__) . 'css/jquery-ui.css');
wp_enqueue_style('select2.min', plugin_dir_url(__DIR__) . 'css/select2.min.css');
wp_enqueue_style('codemirror', plugin_dir_url(__DIR__) . 'css/codemirror.css');
wp_enqueue_style('font-awesome-css-cdn', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.2.0/css/all.min.css", null, 1);
wp_enqueue_style('mep-admin-style', plugin_dir_url(__DIR__) . 'css/admin_style.css', array());
2018-08-10 12:12:04 -04:00
2018-07-02 05:44:24 -04:00
2020-04-28 06:37:33 -04:00
/**
* Enquue Admin Scripts
*/
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('wp-color-picker');
wp_enqueue_script('magepeople-options-framework', plugins_url('js/mage-options-framework.js', __DIR__), array('jquery'));
wp_localize_script('PickpluginsOptionsFramework', 'PickpluginsOptionsFramework_ajax', array('PickpluginsOptionsFramework_ajaxurl' => admin_url('admin-ajax.php')));
2020-08-18 08:08:58 -04:00
// wp_enqueue_script('select2.min', plugins_url('js/select2.min.js', __DIR__), array('jquery'));
2020-04-28 06:37:33 -04:00
wp_enqueue_script('codemirror', plugin_dir_url(__DIR__) . 'js/codemirror.min.js', array('jquery'), null, false);
wp_enqueue_script('form-field-dependency', plugins_url('js/form-field-dependency.js', __DIR__), array('jquery'), null, false);
2020-07-12 06:42:13 -04:00
wp_localize_script('jquery', 'mep_ajax', array( 'mep_ajaxurl' => admin_url( 'admin-ajax.php')));
2021-09-26 05:42:42 -04:00
wp_localize_script('mep_ajax', 'mep_ajax_var', array( 'url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('mep-ajax-nonce')));
2018-07-02 05:44:24 -04:00
}
2020-04-28 06:37:33 -04:00
/**
* Woocommerce Event Manager Style & Scripts Hooked up below for the Frontend
*/
add_action('wp_enqueue_scripts', 'mep_event_enqueue_scripts', 90);
function mep_event_enqueue_scripts()
{
2020-08-05 08:06:45 -04:00
$owlThemeLoad = mep_get_option('mep_load_carousal_from_theme', 'carousel_setting_sec', 'no');
2020-04-28 06:37:33 -04:00
wp_enqueue_script('jquery');
2020-07-12 06:42:13 -04:00
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-core');
2020-04-28 06:37:33 -04:00
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_style('mep-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
wp_enqueue_style('mep-event-style', plugin_dir_url(__DIR__) . 'css/style.css', array());
wp_enqueue_style('filter_pagination', plugin_dir_url(__DIR__) . 'css/filter_pagination.css', array());
2020-04-28 06:37:33 -04:00
wp_enqueue_style('mep-event-timeline-min-style', plugin_dir_url(__DIR__) . 'css/timeline.min.css', array('mep-event-style'));
wp_enqueue_style('font-awesome-css-cdn', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css", null, 1);
2021-03-22 08:13:03 -04:00
wp_enqueue_style('font-awesome-css-cdn-5.2.0', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.2.0/css/all.min.css", null, 1);
2020-04-28 06:37:33 -04:00
wp_enqueue_style('mep-calendar-min-style', plugin_dir_url(__DIR__) . 'css/calendar.min.css', array());
wp_enqueue_script('mep-moment-js', plugin_dir_url(__DIR__) . 'js/moment.js', array(), 1, true);
wp_enqueue_script('mep-calendar-scripts', plugin_dir_url(__DIR__) . 'js/calendar.min.js', array('jquery', 'mep-moment-js'), 1, false);
wp_enqueue_script('mep-mixitup-min-js', plugin_dir_url(__DIR__) . 'js/mixitup.min.js', array(), 1, true);
2021-09-03 06:25:05 -04:00
wp_enqueue_script('mep-countdown-js', plugin_dir_url(__DIR__) . 'js/countdown.jquery.min.js', array(), 1, true);
//wp_enqueue_script('mep-lazysizes', plugin_dir_url(__DIR__) . 'js/lazysizes.min.js', array(), 1, true);
2020-08-05 08:06:45 -04:00
wp_enqueue_script('filter_pagination', plugin_dir_url(__DIR__) . 'js/filter_pagination.js', array(), time(), true);
2021-09-20 01:52:52 -04:00
wp_enqueue_script('mp_event_custom_script', plugin_dir_url(__DIR__) . 'js/mp_event_custom_script.js', array(), 1.1, true);
2020-11-24 04:23:05 -05:00
2020-08-05 08:06:45 -04:00
2020-04-28 06:37:33 -04:00
wp_enqueue_script('mep-timeline-min', plugin_dir_url(__DIR__) . 'js/timeline.min.js', array('jquery'), 1, true);
wp_enqueue_script('mep-event-custom-scripts', plugin_dir_url(__DIR__) . 'js/mkb-scripts.js', array(), 1, true);
2020-07-12 06:42:13 -04:00
wp_localize_script('jquery', 'mep_ajax', array( 'mep_ajaxurl' => admin_url( 'admin-ajax.php')));
2020-08-05 08:06:45 -04:00
if($owlThemeLoad == 'no'){
wp_enqueue_style('mep-event-owl-carousal-main-style', plugin_dir_url(__DIR__) . 'css/owl.carousel.min.css', array('mep-event-style'));
wp_enqueue_style('mep-event-owl-carousal-default-style', plugin_dir_url(__DIR__) . 'css/owl.theme.default.min.css', array('mep-event-style'));
wp_enqueue_script('mep-owl-carousel-min', plugin_dir_url(__DIR__) . 'js/owl.carousel.min.js', array('jquery'), 1, true);
}
2020-07-12 06:42:13 -04:00
}
2020-08-18 08:08:58 -04:00
// Ajax Issue
add_action('wp_head','mep_ajax_url',5);
add_action('admin_head','mep_ajax_url',5);
function mep_ajax_url(){
?>
<script type="text/javascript">
// WooCommerce Event Manager Ajax URL
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
</script>
<?php
}