/**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     // extended by CSV2POST_Forms
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     parent::setup($action, $data);
     // using array register many meta boxes
     foreach (self::meta_box_array() as $key => $metabox) {
         // the $metabox array includes required capability to view the meta box
         if (isset($metabox[7]) && current_user_can($metabox[7])) {
             $this->add_meta_box($metabox[0], $metabox[1], $metabox[2], $metabox[3], $metabox[4], $metabox[5]);
         }
     }
 }
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     // load the current project row and settings from that row
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
         parent::setup($action, $data);
         // using array register many meta boxes
         foreach (self::meta_box_array() as $key => $metabox) {
             // the $metabox array includes required capability to view the meta box
             if (isset($metabox[7]) && current_user_can($metabox[7])) {
                 $this->add_meta_box($metabox[0], $metabox[1], $metabox[2], $metabox[3], $metabox[4], $metabox[5]);
             }
         }
     } else {
         $this->add_meta_box('customfields-nocurrentproject', __('No Current Project', 'csv2post'), array($this->UI, 'metabox_nocurrentproject'), 'normal', 'default', array('formid' => 'nocurrentproject'));
     }
 }
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // set current project values
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
     }
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     parent::setup($action, $data);
     // create a data table ( use "head" to position before any meta boxes and outside of meta box related divs)
     $this->add_text_box('head', array($this, 'datatables'), 'normal');
     // using array register many meta boxes
     foreach (self::meta_box_array() as $key => $metabox) {
         // the $metabox array includes required capability to view the meta box
         if (isset($metabox[7]) && current_user_can($metabox[7])) {
             $this->add_meta_box($metabox[0], $metabox[1], $metabox[2], $metabox[3], $metabox[4], $metabox[5]);
         }
     }
 }
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     // load the current project row and settings from that row
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
         parent::setup($action, $data);
         // query the last post
         $result = $this->DB->selectorderby($this->CSV2POST->get_project_main_table($csv2post_settings['currentproject']), 'c2p_postid != 0', 'c2p_applied', 'c2p_postid', 1);
         if ($result) {
             $this->lastpost = get_post($result[0]->c2p_postid);
         } else {
             $this->add_meta_box('lastpost-nopostscreated', __('No Posts Created', 'csv2post'), array($this, 'parent'), 'normal', 'default', array('formid' => 'nopostscreated'));
         }
     } else {
         $this->add_meta_box('lastpost-nocurrentproject', __('No Current Project', 'csv2post'), array($this->UI, 'metabox_nocurrentproject'), 'normal', 'default', array('formid' => 'nocurrentproject'));
     }
 }
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // set current project values
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
     }
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     parent::setup($action, $data);
     $this->add_text_box('head1', array($this, 'intro'), 'normal');
     // create a data table ( use "head" to position before any meta boxes and outside of meta box related divs)
     $this->add_text_box('head2', array($this, 'checklist'), 'normal');
 }
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     // extended by CSV2POST_Forms
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // add view introduction
     $this->add_text_box('viewintroduction', array($this, 'viewintroduction'), 'normal');
     // load the current project row and settings from that row
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
         parent::setup($action, $data);
         // only output meta boxes
         if ($this->purpose == 'normal') {
             self::metaboxes();
         } elseif ($this->purpose == 'dashboard') {
             //self::dashboard();
         } elseif ($this->purpose == 'customdashboard') {
             return self::meta_box_array();
         } else {
             // do nothing - can call metaboxes() manually and place them
         }
     } else {
         $this->add_meta_box('tools-nocurrentproject', __('No Current Project', 'csv2post'), array($this->UI, 'metabox_nocurrentproject'), 'normal', 'default', array('formid' => 'nocurrentproject'));
     }
 }
Exemple #7
0
 /**
  * Set up the view with data and do things that are specific for this view
  *
  * @since 8.1.3
  *
  * @param string $action Action for this view
  * @param array $data Data for this view
  */
 public function setup($action, array $data)
 {
     global $csv2post_settings;
     // create constant for view name
     if (!defined("WTG_CSV2POST_VIEWNAME")) {
         define("WTG_CSV2POST_VIEWNAME", $this->view_name);
     }
     // create class objects
     $this->CSV2POST = CSV2POST::load_class('CSV2POST', 'class-csv2post.php', 'classes');
     $this->UI = CSV2POST::load_class('CSV2POST_UI', 'class-ui.php', 'classes');
     $this->DB = CSV2POST::load_class('CSV2POST_DB', 'class-wpdb.php', 'classes');
     $this->PHP = CSV2POST::load_class('CSV2POST_PHP', 'class-phplibrary.php', 'classes');
     $this->TabMenu = CSV2POST::load_class('C2P_TabMenu', 'class-pluginmenu.php', 'classes');
     $this->FORMS = CSV2POST::load_class('CSV2POST_FORMS', 'class-forms.php', 'classes');
     // set current project values
     if (isset($csv2post_settings['currentproject']) && $csv2post_settings['currentproject'] !== false) {
         $this->project_object = $this->CSV2POST->get_project($csv2post_settings['currentproject']);
         if (!$this->project_object) {
             $this->current_project_settings = false;
         } else {
             $this->current_project_settings = maybe_unserialize($this->project_object->projectsettings);
         }
     }
     parent::setup($action, $data);
     // only output meta boxes
     if ($this->purpose == 'normal') {
         self::metaboxes();
         // register meta boxes for the current view
     } elseif ($this->purpose == 'dashboard') {
         // do nothing - add_dashboard_widgets() in class-ui.php calls dashboard_widgets() from this class
     } elseif ($this->purpose == 'customdashboard') {
         return self::meta_box_array();
         // return meta box array
     } else {
         // do nothing
     }
 }