/** * 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(); } }
/** * 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(); } }
/** * Summary. * * Description. * * @since x.x.x * @access (for functions: only use if private) * * @see Function/method/class relied on * @link URL * @global type $varname Description. * @global type $varname Description. * * @param type $var Description. * @param type $var Optional. Description. * @return type Description. */ public function __construct() { parent::__construct(); /** * set type */ if (isset($_REQUEST['type'])) { $this->type = $_REQUEST['type']; } /** * actions */ add_action('wp_ajax_wpcf_edit_field_choose', array($this, 'field_choose')); add_action('wp_ajax_wpcf_edit_field_insert', array($this, 'field_insert')); add_action('wp_ajax_wpcf_edit_field_select', array($this, 'field_select')); add_action('wp_ajax_wpcf_edit_field_add_existed', array($this, 'field_add_existed')); }