public static function print_pb_css() { 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_metadata(get_post_meta($post->ID, 'pt_pb_sections', true)); foreach ($sections as $key => $section) { $css .= self::build_section_css($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::build_hovericon_css($module); } $css .= apply_filters("pt_pb_css_module_{$module['type']}", '', $module); } } elseif (isset($col['module']['type'])) { if ($col['module']['type'] === 'hovericon') { $css .= self::build_hovericon_css($col['module']); } $css .= apply_filters("pt_pb_css_module_{$col['module']['type']}", '', $col['module']); } } } } echo $css; }
/** * Enqueues required js and css for the pagebuilder * * @return void */ public function enqueue_assets($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('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-droppable'); 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('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('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('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('pt_pb_collections_js'), self::$PT_PB_VERSION, true); wp_localize_script('pt_pb_admin_js', 'ptPbAppSections', PT_PageBuilder_Helper::decode_pb_metadata(get_post_meta($post->ID, 'pt_pb_sections', true))); wp_localize_script('pt_pb_views_js', 'ptPbAppSliders', apply_filters('pt_pb_generic_sliders', array('meta' => array('exists' => class_exists('MetaSliderPlugin'), 'icon' => "<img src=' " . plugins_url("ml-slider/assets/metaslider/matchalabs.png") . "' />", 'sliders' => PT_PageBuilder::get_meta_sliders(), 'name' => 'Meta Slider')))); wp_localize_script('pt_pb_models_js', 'ptPbAppPlugins', apply_filters('pt_pb_wp_plugins', array('Contactform7' => class_exists('WPCF7') ? 1 : 0))); 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); wp_localize_script('pt_pb_models_js', 'ptPbAppLocalization', array('remove_section' => __('Are you sure you want to remove this Section ? This step cannot be undone.', 'quest'), 'remove_row' => __('Are you sure you want to remove this Row ? This step cannot be undone.', 'quest'), 'remove_slide' => __('Are you sure you want to remove this Slide ? This step cannot be undone.', 'quest'), 'remove_image' => __('Are you sure you want to remove this Image ? This step cannot be undone.', 'quest'), 'remove_module' => __('Are you sure you want to remove this Module ? This step cannot be undone.', 'quest'), 'resize_columns' => __('You are about to resize the columns to a lower size than the existing columns, it may remove the last columns and will result in data/module loss. Do you really want to do this ?', 'quest'))); } }