Example #1
0
 public static function get_instance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Determine in which mode we are and initialize the right dedicated controller.
  *
  * @since 2.0
  */
 public function on_init()
 {
     if (is_admin()) {
         if (defined('DOING_AJAX')) {
             Types_Ajax::initialize();
         } else {
             Types_Admin::initialize();
         }
     } else {
         Types_Frontend::initialize();
     }
 }
Example #3
0
 /**
  * Determine in which mode we are and initialize the right dedicated controller.
  *
  * @since 2.0
  */
 public function on_init()
 {
     if (is_admin()) {
         if (defined('DOING_AJAX')) {
             $this->mode = self::MODE_AJAX;
             Types_Ajax::initialize();
         } else {
             $this->mode = self::MODE_ADMIN;
             Types_Admin::initialize();
         }
     } else {
         $this->mode = self::MODE_FRONTEND;
         Types_Frontend::initialize();
     }
 }
 /**
  * Build data to be passed to JavaScript.
  *
  * @return array
  * @since 2.1
  */
 private function build_js_data()
 {
     $types_settings_action = Types_Ajax::get_instance()->get_action_js_name(Types_Ajax::CALLBACK_SETTINGS_ACTION);
     return array('ajaxInfo' => array('fieldAction' => array('name' => $types_settings_action, 'nonce' => wp_create_nonce($types_settings_action))));
 }
 /**
  * Build data to be passed to JavaScript.
  * 
  * @return array
  * @since 2.0
  */
 private function build_js_data()
 {
     $field_action_name = Types_Ajax::get_instance()->get_action_js_name(Types_Ajax::CALLBACK_FIELD_CONTROL_ACTION);
     return array('jsIncludePath' => TYPES_RELPATH . '/public/page/field_control', 'fieldDefinitions' => $this->build_field_definitions(), 'fieldTypeDefinitions' => Types_Field_Type_Definition_Factory::get_instance()->get_field_type_definitions(), 'templates' => $this->build_templates(), 'strings' => $this->build_strings_for_js(), 'ajaxInfo' => array('fieldAction' => array('name' => $field_action_name, 'nonce' => wp_create_nonce($field_action_name))), 'currentDomain' => $this->get_current_domain(), 'groups' => $this->build_group_data(), 'typeConversionMatrix' => Types_Field_Type_Converter::get_instance()->get_conversion_matrix(), 'itemsPerPage' => $this->get_items_per_page_setting());
 }