示例#1
0
 /**
  * Add ajax callbacks.
  *
  * @since 3.0.0
  */
 public function add_callbacks()
 {
     $calendars = simcal_get_calendar_types();
     foreach ($calendars as $calendar => $views) {
         foreach ($views as $view) {
             $the_view = simcal_get_calendar_view(0, $calendar . '-' . $view);
             if ($the_view instanceof Calendar_View) {
                 $the_view->add_ajax_actions();
             }
         }
     }
     do_action('simcal_add_ajax_callbacks');
 }
 /**
  * Get widgets assets.
  *
  * @since 3.0.0
  */
 public function get_widgets_assets()
 {
     $widgets = get_option('widget_gce_widget');
     if (!empty($widgets) && is_array($widgets)) {
         foreach ($widgets as $settings) {
             if (!empty($settings) && is_array($settings)) {
                 if (isset($settings['calendar_id'])) {
                     $view = simcal_get_calendar_view(absint($settings['calendar_id']));
                     if ($view instanceof Calendar_View) {
                         add_filter('simcal_front_end_scripts', function ($scripts, $min) use($view) {
                             return array_merge($scripts, $view->scripts($min));
                         }, 100, 2);
                         add_filter('simcal_front_end_styles', function ($styles, $min) use($view) {
                             return array_merge($styles, $view->styles($min));
                         }, 100, 2);
                     }
                 }
             }
         }
     }
 }