Ejemplo n.º 1
0
 /**
  * Autosave the revisioned meta fields.
  *
  * Iterates thru the revisioned meta fields and checks each to see if they are set,
  * and have a changed value. If so, the meta value is saved and attached to the autosave.
  *
  * @param Post object $new_autosave The new post being autosaved.
  */
 public function _wp_autosave_post_revisioned_meta_fields($new_autosave)
 {
     /**
      * The post data arrives as either $_POST['data']['wp_autosave'] or the $_POST
      * itself. This sets $posted_data to the correct variable.
      */
     $posted_data = isset($_POST['data']) ? $_POST['data']['wp_autosave'] : $_POST;
     /**
      * Go thru the revisioned meta keys and save them as part of the autosave, if
      * the meta key is part of the posted data, the meta value is not blank and
      * the the meta value has changes from the last autosaved value.
      */
     foreach ($this->_wp_post_revision_meta_keys() as $meta_key) {
         if (isset($posted_data[$meta_key]) && '' !== $posted_data[$meta_key] && get_post_meta($new_autosave['ID'], $meta_key, true) != wp_unslash($posted_data[$meta_key])) {
             /*
              * Use the underlying delete_metadata() and add_metadata() functions
              * vs delete_post_meta() and add_post_meta() to make sure we're working
              * with the actual revision meta.
              */
             delete_metadata('post', $new_autosave['ID'], $meta_key);
             /**
              * One last check to ensure meta value not empty().
              */
             if (!empty($posted_data[$meta_key])) {
                 /**
                  * Add the revisions meta data to the autosave.
                  */
                 $encoded = PT_PageBuilder_Helper::encode_pb_section_metadata($posted_data[$meta_key]);
                 add_metadata('post', $new_autosave['ID'], $meta_key, $encoded);
             }
         }
     }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 /**
  * 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')));
     }
 }
Ejemplo n.º 4
0
 public function get_content()
 {
     $color = $this->_module['color'];
     $content = PT_PageBuilder_Helper::get_content($this->_module);
     return "<div class='feature-box size-{$this->_module['size']}' id='{$this->_module['id']}'>\n\t\t\t\t\t<div class='icon-wrap'><i class='fa fa-{$this->_module['size']}x {$this->_module['icon']}' style='color:{$color};'>&nbsp;</i></div>\n\t\t\t\t\t<div class='feature-box-content'>\n\t\t\t\t\t\t<h3 class='feature-box-title' style='color:{$color};'>{$this->_module['title']}</h3>\n\t\t\t\t\t\t<div class='feature-box-text'>{$content}</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
 }
Ejemplo n.º 5
0
 /**
  * Generates Slide markup
  *
  * @return string $content
  */
 public function generate_slide($slide_html, $slide)
 {
     $cls = isset($slide['content_pos_x']) ? "content-x-{$slide['content_pos_x']} " : '';
     $cls .= isset($slide['content_pos_y']) ? "content-y-{$slide['content_pos_y']} " : '';
     $cls .= $slide['css_class'];
     $content = "<div class='sl-slide {$cls}'" . PT_PageBuilder_Helper::generate_data_attr($slide, array('orientation', 'slice1_rotation', 'slice2_rotation', 'slice1_scale', 'slice2_scale')) . "><div class='sl-slide-inner'>";
     $content .= "<div class='sl-slide-inner' style='" . PT_PageBuilder_Helper::generate_css($slide) . "'>";
     $content .= "<div class='sl-slide-content'>";
     if (!empty($slide['heading'])) {
         $content .= "<h2 class='sl-slide-title' style='" . PT_PageBuilder_Helper::generate_css(array('text_color' => $slide['heading_color'], 'text_size' => $slide['heading_size'])) . "'> <span style='" . PT_PageBuilder_Helper::generate_css(array('bg_color' => $slide['heading_bg_color'])) . "'>" . $slide['heading'] . '</span></h2>';
     }
     $content .= "<div class='sl-slide-text' style='" . PT_PageBuilder_Helper::generate_css(array('text_color' => $slide['text_color'], 'text_size' => $slide['text_size'])) . "'> <span style='" . PT_PageBuilder_Helper::generate_css(array('bg_color' => $slide['text_bg_color'])) . "'>" . PT_PageBuilder_Helper::get_content($slide) . '</span></div></div>';
     $content .= "</div></div></div>\n";
     return $content;
 }
Ejemplo n.º 6
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);
     }
 }
Ejemplo n.º 7
0
 public function getContent()
 {
     $cls = $this->_module['animation'] != '' ? " wow {$this->_module['animation']}" : "";
     $color = $this->_module['color'];
     $color_alt = $this->_module['hover_color'];
     $content = PT_PageBuilder_Helper::getContent($this->_module);
     $url = esc_url($this->_module['href']);
     return "<div class='hover-icon{$cls}' id='{$this->_module['id']}'>\n\t\t\t\t\t<a href='{$url}' class='fa fa-{$this->_module['size']}x {$this->_module['icon']}'>&nbsp;</a><h3 class='icon-title'>{$this->_module['title']}</h3>{$content}\n\t\t\t\t</div>";
 }
Ejemplo n.º 8
0
 public function getContent()
 {
     $image = $this->_module;
     $content = "<figure style='text-align:{$image['align']}'>";
     $image['class'] = $image['animation'] != '' ? "wow {$image['animation']}" : "";
     if ($image['lightbox'] == 'true' || $image['href'] !== '') {
         $content .= "<a" . PT_PageBuilder_Helper::GetAttributes($image, array('target'));
         $content .= $image['lightbox'] == 'true' ? " href='{$image['src']}'" : " href='" . esc_url($image['href']) . "'";
         $content .= $image['lightbox'] == 'true' ? " class='lightbox gallery'>" : '>';
     }
     $content .= "<img" . PT_PageBuilder_Helper::GetAttributes($image, array('src', 'title', 'alt', 'class')) . " />";
     if ($image['lightbox'] == 'true' || $image['href'] !== '') {
         $content .= "</a>";
     }
     $content .= "</figure>";
     return $content;
 }