private function __construct(){
            
                $wpcb_public = WPCB_Public::get_instance();
                $this->wpcb_boxes_table = $wpcb_public->get_boxes_table_name();
                $this->wpcb_tracking_table = $wpcb_public->get_tracking_table_name();
                
                add_action( 'wp_ajax_flush_stats', array( $this, 'flush_stats') );
                
                add_action( 'wp_ajax_update_visit_type', array( $this, 'update_visit_type') );
                add_action( 'wp_ajax_nopriv_update_visit_type', array( $this, 'update_visit_type') );
                
                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

        }
Exemple #2
0
 private function __construct()
 {
     /**************************************
      * Call variables from public plugin class.
      **************************************/
     $wpcb_public = WPCB_Public::get_instance();
     $this->wpcb_main_slug = $wpcb_public->get_wpcb_main_slug();
     $this->wpcb_edit_slug = $wpcb_public->get_wpcb_edit_slug();
     $this->wpcb_settings_slug = $wpcb_public->get_wpcb_settings_slug();
     $this->template_directory_1 = $wpcb_public->get_template_directory(1);
     $this->template_directory_2 = $wpcb_public->get_template_directory(2);
     $this->template_directory_3 = $wpcb_public->get_template_directory(3);
     $this->template_directory_4 = $wpcb_public->get_template_directory(4);
     $this->template_directory_5 = $wpcb_public->get_template_directory(5);
     $this->template_directory_6 = $wpcb_public->get_template_directory(6);
     $this->wpcb_boxes_table = $wpcb_public->get_boxes_table_name();
     $this->wpcb_tracking_table = $wpcb_public->get_tracking_table_name();
     /**************************************		
      * Load admin style sheet and JavaScript.
      ***************************************/
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     /**************************************		
      * Add the options page and menu item.
      ***************************************/
     add_action('admin_menu', array($this, 'wpcb_add_admin_menu'));
     /**************************************		
      * Add an action link pointing to the
      * options page.
      **************************************/
     $wpcb_basename = plugin_basename(plugin_dir_path(realpath(dirname(__FILE__))) . $this->wpcb_main_slug . '.php');
     add_filter('plugin_action_links_' . $wpcb_basename, array($this, 'add_action_links'));
     /***************************************
      * Admin actions and filters.
      ***************************************/
     add_action('wp_ajax_create_new_box', array($this, 'create_new_box'));
     add_action('wp_ajax_update_box_template', array($this, 'update_box_template'));
     add_action('wp_ajax_update_box_customizations', array($this, 'update_box_customizations'));
     add_action('wp_ajax_restore_to_default', array($this, 'restore_to_default'));
     add_action('wp_ajax_update_box_settings', array($this, 'update_box_settings'));
     add_action('wp_ajax_update_global_settings', array($this, 'update_global_settings'));
     add_action('wp_ajax_delete_it', array($this, 'delete_it'));
     add_action('wp_ajax_publish_the_box', array($this, 'publish_the_box'));
     add_action('wp_ajax_disable_box', array($this, 'disable_box'));
     add_action('admin_init', array($this, 'export_boxes_to_xml'));
 }
<?php

$wpcb_public = WPCB_Public::get_instance();
// Step 2
$wpcb_the_row = $wpdb->get_row($wpdb->prepare("SELECT `box_type`,`box_template`,`box_customizations`  from {$wpcb_tbl_name} WHERE id = %d", array($id)));
$box_type = $wpcb_the_row->box_type;
$box_template = $wpcb_the_row->box_template;
if ($wpcb_the_row->box_customizations != null && $wpcb_the_row->box_customizations != 'defaults') {
    $box_customizations = unserialize($wpcb_the_row->box_customizations);
    $box_customizations = $wpcb_public->sanitise_array($box_customizations);
    $box_customizations['defaults'] = 'custom';
} else {
    $box_customizations['defaults'] = 'defaults';
}
if ($id and $box_type != null and $box_template != null) {
    // Editing is on
    // Will show two meta boxes : Template design and customizations
    $this->include_the_template_and_settings($box_type, $box_template, $box_customizations, $id);
} else {
    echo "<p>" . __('No box template selected yet. Please select a box template first to customize it.', 'wp-conversion-boxes') . "</p>";
}