/**
  * Constructor
  *
  * @param   WP_Post  $post  WordPress's post object.
  *
  * @return  void
  */
 public function __construct($post)
 {
     parent::__construct($post);
     // Register filter to prepare Visual Composer data
     add_filter("wr_pb_parse_data_{$this->converter}", array(&$this, 'prepare_visual_composer_data'));
     // Register filters to convert Visual Composer shortcodes
     add_filter('wr_pb_convert_vc_row_shortcode', array(&$this, 'convert_vc_row_shortcode'));
     add_filter('wr_pb_convert_vc_column_shortcode', array(&$this, 'convert_vc_column_shortcode'));
     add_filter('wr_pb_convert_vc_separator_shortcode', array(&$this, 'convert_vc_separator_shortcode'));
     add_filter('wr_pb_convert_vc_text_separator_shortcode', array(&$this, 'convert_vc_separator_shortcode'));
     add_filter('wr_pb_convert_vc_single_image_shortcode', array(&$this, 'convert_vc_single_image_shortcode'));
     add_filter('wr_pb_convert_vc_gallery_shortcode', array(&$this, 'convert_vc_gallery_shortcode'));
     add_filter('wr_pb_convert_vc_images_carousel_shortcode', array(&$this, 'convert_vc_gallery_shortcode'));
     add_filter('wr_pb_convert_vc_tabs_shortcode', array(&$this, 'convert_vc_tabs_shortcode'));
     add_filter('wr_pb_convert_vc_tour_shortcode', array(&$this, 'convert_vc_tabs_shortcode'));
     add_filter('wr_pb_convert_vc_posts_grid_shortcode', array(&$this, 'convert_vc_posts_grid_shortcode'));
     add_filter('wr_pb_convert_vc_carousel_shortcode', array(&$this, 'convert_vc_posts_grid_shortcode'));
     add_filter('wr_pb_convert_vc_posts_slider_shortcode', array(&$this, 'convert_vc_posts_grid_shortcode'));
     add_filter('wr_pb_convert_vc_button_shortcode', array(&$this, 'convert_vc_button_shortcode'));
     add_filter('wr_pb_convert_vc_button2_shortcode', array(&$this, 'convert_vc_button_shortcode'));
     add_filter('wr_pb_convert_vc_cta_button_shortcode', array(&$this, 'convert_vc_cta_button_shortcode'));
     add_filter('wr_pb_convert_vc_cta_button2_shortcode', array(&$this, 'convert_vc_cta_button_shortcode'));
     add_filter('wr_pb_convert_vc_video_shortcode', array(&$this, 'convert_vc_video_shortcode'));
     add_filter('wr_pb_convert_vc_gmaps_shortcode', array(&$this, 'convert_vc_gmaps_shortcode'));
     add_filter('wr_pb_convert_vc_raw_html_shortcode', array(&$this, 'convert_vc_raw_html_shortcode'));
     add_filter('wr_pb_convert_vc_raw_js_shortcode', array(&$this, 'convert_vc_raw_html_shortcode'));
     add_filter('wr_pb_convert_vc_progress_bar_shortcode', array(&$this, 'convert_vc_progress_bar_shortcode'));
     add_filter('wr_pb_convert_vc_pie_shortcode', array(&$this, 'convert_vc_pie_shortcode'));
     // Register action to finalize data conversion
     add_action("wr_pb_after_convert_{$this->converter}_data", array(&$this, 'finalize'));
 }
 /**
  * Constructor
  *
  * @param   WP_Post  $post  WordPress's post object.
  *
  * @return  void
  */
 public function __construct($post)
 {
     parent::__construct($post);
     // Register filter to parse Site Origin data
     add_filter("wr_pb_parse_data_{$this->converter}", array(&$this, 'parse_site_origin_data'));
     // Register action to finalize data conversion
     add_action("wr_pb_after_convert_{$this->converter}_data", array(&$this, 'finalize'));
 }
Beispiel #3
0
 /**
  * Convert other page builder data to WR PageBuilder data.
  *
  * @return  void
  */
 public static function convert_data()
 {
     // Set custom error reporting level
     error_reporting(E_ALL ^ E_NOTICE);
     // Get current post
     $post = isset($_REQUEST['post']) ? get_post($_REQUEST['post']) : null;
     if (!$post) {
         die(json_encode(array('success' => false, 'message' => __('Missing post ID.', WR_PBL))));
     }
     // Get converter
     $converter = isset($_REQUEST['converter']) ? WR_Pb_Converter::get_converter($_REQUEST['converter'], $post) : null;
     if (!$converter) {
         die(json_encode(array('success' => false, 'message' => __('Missing data converter.', WR_PBL))));
     }
     // Handle conversion of other page builder data to WR PageBuilder
     $result = $converter->convert();
     if (!is_integer($result) || !$result) {
         $response = array('success' => false, 'message' => $result);
     } else {
         if (isset($_REQUEST['do']) && 'convert-and-publish' != $_REQUEST['do']) {
             $result = __('Data has been successfully converted!', WR_PBL);
         } else {
             $result = __('Data has been successfully converted and published!', WR_PBL);
         }
         $response = array('success' => true, 'message' => $result);
     }
     die(json_encode($response));
 }
Beispiel #4
0
 /**
  * Content file for WR PageBuilder Metabox
  */
 function page_builder_html()
 {
     // Get available data converters
     $converters = WR_Pb_Converter::get_converters();
     if (@count($converters)) {
         // Load script initialization for data conversion
         WR_Pb_Init_Assets::load('wr-pb-convert-data-js');
     }
     // Load script initialization for undo / redo action
     WR_Pb_Init_Assets::load('wr-pb-activity-js');
     include WR_PB_TPL_PATH . '/page-builder.php';
 }