Пример #1
0
 public static function PrintPBCss()
 {
     global $post;
     if (!quest_is_pb_template()) {
         return;
     }
     do_action('quest_pb_header_css');
     $css = "\n/* Hover Icons */\n";
     $sections = PT_PageBuilder_Helper::decode_pb_section_metadata(get_post_meta($post->ID, 'pt_pb_sections', true));
     foreach ($sections as $key => $section) {
         $css .= self::BuildSectionCss($section);
         if (!is_numeric($key) || !array_key_exists('row', $section) || empty($section['row'])) {
             continue;
         }
         foreach ($section['row'] as $j => $row) {
             if (!is_numeric($j) || !array_key_exists('col', $row) || empty($row['col'])) {
                 continue;
             }
             foreach ($row['col'] as $k => $col) {
                 if (!is_numeric($k) || !array_key_exists('module', $col) || empty($col['module'])) {
                     continue;
                 }
                 if (is_array($col['module']) && !array_key_exists('id', $col['module'])) {
                     foreach ($col['module'] as $l => $module) {
                         if ($module['type'] === 'hovericon') {
                             $css .= self::BuildHoverIconCss($module);
                         }
                         $css .= apply_filters("pt_pb_css_module_{$module['type']}", '', $module);
                     }
                 } elseif (isset($col['module']['type'])) {
                     if ($col['module']['type'] === 'hovericon') {
                         $css .= self::BuildHoverIconCss($col['module']);
                     }
                     $css .= apply_filters("pt_pb_css_module_{$col['module']['type']}", '', $col['module']);
                 }
             }
         }
     }
     echo $css;
 }
Пример #2
0
 /**
  * Enqueues required js and css for the pagebuilder
  *
  * @return void
  */
 public function EnqueueAssets($hook)
 {
     global $typenow, $post;
     if (!in_array($hook, array('post-new.php', 'post.php'))) {
         return;
     }
     $post_types = apply_filters('pt_pb_builder_post_types', array('page'));
     /*
      * Load the builder javascript and css files for custom post types
      * custom post types can be added using pt_pb_builder_post_types filter
      */
     if (isset($typenow) && in_array($typenow, $post_types)) {
         wp_enqueue_script('jquery-ui-core');
         wp_enqueue_script('underscore');
         wp_enqueue_script('backbone');
         wp_enqueue_style('wp-color-picker');
         wp_enqueue_script('wp-color-picker-alpha', get_template_directory_uri() . '/assets/plugins/wp-color-picker-alpha/wp-color-picker-alpha.min.js', array('wp-color-picker'), '1.1');
         wp_enqueue_style('animate-css', get_template_directory_uri() . '/assets/plugins/animate/animate.css');
         wp_enqueue_script('pt_pb_tour', self::$PT_PB_URI . '/assets/js/jquery-tourbus.js', array('jquery'), self::$PT_PB_VERSION, true);
         wp_enqueue_script('pt_pb_util_js', self::$PT_PB_URI . '/assets/js/util.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone'), self::$PT_PB_VERSION, true);
         wp_enqueue_script('pt_pb_models_js', self::$PT_PB_URI . '/assets/js/models.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone', 'pt_pb_util_js'), self::$PT_PB_VERSION, true);
         wp_enqueue_script('pt_pb_collections_js', self::$PT_PB_URI . '/assets/js/collections.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone', 'pt_pb_models_js'), self::$PT_PB_VERSION, true);
         wp_enqueue_script('pt_pb_views_js', self::$PT_PB_URI . '/assets/js/views.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone', 'pt_pb_collections_js'), self::$PT_PB_VERSION, true);
         wp_enqueue_script('pt_pb_admin_js', self::$PT_PB_URI . '/assets/js/app.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone', 'pt_pb_collections_js'), self::$PT_PB_VERSION, true);
         wp_localize_script('pt_pb_admin_js', 'ptPbAppSections', PT_PageBuilder_Helper::decode_pb_section_metadata(get_post_meta($post->ID, 'pt_pb_sections', true)));
         wp_localize_script('pt_pb_views_js', 'ptPbAppMetaSlider', array('exists' => class_exists('MetaSliderPlugin'), 'icon' => "<img src=' " . plugins_url("ml-slider/assets/metaslider/matchalabs.png") . "' />"));
         wp_enqueue_style('pt_pb_tour_css', self::$PT_PB_URI . '/assets/css/jquery-tourbus.css', array(), self::$PT_PB_VERSION);
         wp_enqueue_style('pt_pb_admin_css', self::$PT_PB_URI . '/assets/css/style.css', array(), self::$PT_PB_VERSION);
     }
 }