/** * put your comment there... * * @param mixed $info * @return CJTInstallerNoticeView */ public function __construct($info) { // CJTView class! parent::__construct($info); // Enqueue scripts. add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); }
/** * put your comment there... * * @param mixed $viewInfo * @return CJTTinymceParamsView */ public function __construct($viewInfo, $params) { // Parent procedure! parent::__construct($viewInfo, $params); // Prepare groups array. foreach ($params['groups'] as $group) { // Initialize group info array. $group['params'] = array(); // Group Key. $group['key'] = strtolower(str_replace(array(' '), '-', $group['name'])); // Get group data cxopy. $this->groups[$group['id']] = $group; } // Put the Group woth the loest ID first, // Display in the same order they're added! ksort($this->groups); // Prepare groups from the passed parameters. foreach ($params['params'] as $param) { // Add parameter under its group! $this->groups[$param->getDefinition()->getGroupId()]['params'][] = $param; } // Instantiate grouper. // Only tab grouper is supported for now! $grouperFactory = new CJT_Framework_View_Block_Parameter_Grouper_Factory(); $this->grouper = $grouperFactory->create($params['form']->groupType, $this->groups); }
/** * put your comment there... * * @param mixed $info * @return CJTInstallerInstallView */ public function __construct($info) { parent::__construct($info); // Link scripts & styles. self::enququeScripts(); self::enququeStyles(); }
/** * put your comment there... * * @param mixed $info * @return CJTInstallerNoticeView */ public function __construct($info) { // CJTView class! parent::__construct($info); // Enqueue scripts. self::enqueueScripts(); }
/** * put your comment there... * * @param mixed $info * @return CJTInstallerNoticeView */ public function __construct($info) { // CJTView class! parent::__construct($info); // register callback to show styles needed for the admin page add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles')); // Load scripts for admin panel working add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); }
/** * put your comment there... * */ public function __construct($viewInfo) { parent::__construct($viewInfo); // Enqueue Styles & Scripts. add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles')); add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); // Cast params to object $this->params = (object) $this->params; // Load localization text. $this->localization = (require $this->getPath('public/js/jquery.block/jquery.block.localization.php')); }
/** * put your comment there... * * @param mixed $viewInfo * @return CJTBlocksCjtBlock */ public function __construct($viewInfo) { parent::__construct($viewInfo); // Aggregate block view object! $this->blockView = self::create('blocks/block'); // Register actions. add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles')); // Read input params. $this->isLoading = isset($_REQUEST['isLoading']) ? true : false; }
/** * put your comment there... * * @param mixed $viewInfo * @return CJTBlockMetaBoxView */ public function __construct($viewInfo) { parent::__construct($viewInfo); // Initialize vars. $this->options = (object) array(); // Add scripts ands styles actions. add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts')); add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles')); // Create block view. $this->blockView = self::create('blocks/block'); }
/** * put your comment there... * * @param mixed $info * @return CJTTinymceShortcodesView */ public function __construct($info) { // Initialize parent! parent::__construct($info); // Register TinyMCE Plugin with Wordpress! add_filter('mce_external_plugins', array($this, 'registerPlugin'), 1, 11); // Add TinyMCE button for adding shortcode! add_filter('mce_buttons', array($this, 'addButton')); // Enqueue dependencies scripts. self::enqueueScripts(); self::enqueueStyles(); }
/** * put your comment there... * */ public function __construct($parameters) { parent::__construct($parameters); // Import other dependencies views. self::Import('blocks/cjt-block'); // register callback to show styles needed for the admin page add_action('admin_print_styles', array(__CLASS__, 'enququeStyles')); // Load scripts for admin panel working add_action('admin_print_scripts', array(__CLASS__, 'enququeScripts')); // Blocks order is common for all users, override user meta-boxes order // by meta-box-order site option. add_filter('get_user_option_meta-box-order_cjtoolbox', array(&$this, 'getBlocksOrder')); }
/** * put your comment there... * */ protected function getBlockParametersFormAction() { // Get block id. $blockId = (int) $_REQUEST['blockId']; // Get block form! $form = CJTxTable::getInstance('form')->setTableKey(array('blockId'))->setData(array('blockId' => $blockId))->load(); // Set HTTP header $this->httpContentType = 'text/html'; // Display form view. if ($form->get('blockId')) { // Load parameters form. $groups = new CJT_Models_Block_Parameters_Form_Groups($blockId); $params = new CJT_Models_Block_Parameters_Form_Parameters($blockId); $blockParams = new CJT_Framework_View_Block_Parameter_Parameters($params); // Return view content! $paramsView = CJTView::getInstance('tinymce/params', array('groups' => $groups, 'params' => $blockParams->getParams(), 'form' => $form->getData(), 'blockId' => $blockId)); // Return paramters form content! $this->response = $paramsView->getTemplate('default'); } else { // Error loading form! $this->response = cssJSToolbox::getText('The requested Block doesnt has parameters form!'); } }
/** * put your comment there... * */ public function __construct($info) { parent::__construct($info); // Define setting pages. $this->pages = array(array('name' => 'uninstall', 'displayName' => cssJSToolbox::getText('Uninstall')), array('name' => 'metabox', 'displayName' => cssJSToolbox::getText('MetaBox'))); }
/** * put your comment there... * * @param mixed $vInfo * @return CJTTemplatesInfoView */ public function __construct($vInfo) { parent::__construct($vInfo); }
/** * put your comment there... * * @param mixed $id */ public function getMetaboxId() { // Use the same id as regular CJT block. $blockView = CJTView::create('blocks/block'); // To avoid outputing script and styles for block box Remove scripts and styles actions! remove_action('admin_print_scripts', array('CJTBlocksBlockView', 'enqueueScripts')); remove_action('admin_print_styles', array('CJTBlocksBlockView', 'enqueueStyles')); // Get metabox id. $blockView->setBlock($this->getBlock()); return $blockView->getMetaboxId(); }
/** * put your comment there... * */ public function dashboardMetaboxAction() { // Create View. $view = CJTView::getInstance('dashboard/metabox/statistics'); $view->display('default'); }
throw new Exception('CJTView::useStyles method must has at least on script parameter passed!'); } // Script name Reg Exp pattern. $nameExp = '/\\:?(\\{((\\w+)-)\\})?([\\w\\-\\.]+)$/'; // For every script, Enqueue and localize, only if localization file found/exists. foreach ($styles as $style) { // Get script name. preg_match($nameExp, $style, $styleObject); // [[2]Prefix], [4] name. Prefix may be not presented. $name = "{$styleObject[2]}{$styleObject[4]}"; if (!isset($GLOBALS['wp_styles']->registered[$name])) { // Make all enqueued styles names unique from enqueued scripts. // This is useful when merging styles & scripts is required. $name = "CSS-{$name}"; // Any JS lib file should named the same as the parent folder with the extension added. $libPath = ":{$styleObject[4]}"; // Get css file URI. $cssFile = cssJSToolbox::getURI(preg_replace($nameExp, "{$libPath}.css", $style)); // Register + Enqueue style. wp_enqueue_style($name, $cssFile); } else { // Enqueue already registered styles. wp_enqueue_style($name); } } } } // End class. // Initialize CJTView Event! CJTView::define('CJTView', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
/** * put your comment there... * */ public function loadBlockAction() { // Block Id. $blockId = (int) $_GET['blockId']; // Get block content. $view = CJTView::getInstance('blocks/cjt-block'); $view->setBlock(CJTModel::create('blocks')->getBlock($blockId, array('returnCodeFile' => true))); // Return View content. $view->getTemplate('default'); $this->response = $view->structuredContent; }
/** * put your comment there... * * @param mixed $parameters * @return CJTBlockView */ public function __construct($parameters) { parent::__construct($parameters); }
/** * Select which metabox to load. * * create-metabox view will be loaded if user doesnt * created a block for current post yet. * * metabox view will be loaded if there is a block * already created for current post. * * Callback for add_meta_boxes action. */ public function showMetabox() { // Import blocks view. CJTView::import('blocks/manager'); /// Get block id. $metaboxId = $this->model->reservedMetaboxBlockId(); // User didn't create block for this post yet. // Show create-metabox view. if (!$this->model->hasBlock()) { // Set view template name. $viewName = 'create-metabox'; // Create DUMMY block object. $block = (object) array(); $block->id = $metaboxId; $block->name = cssJSToolbox::getText('CJT Block'); } else { // Set view template name. $viewName = 'metabox'; // Get real block data. $block = CJTModel::create('blocks')->getBlock($metaboxId, array('returnCodeFile' => true)); } // Get block meta box view object instance. $this->view = CJTView::create("blocks/{$viewName}"); // Push view vars. $this->view->setBlock($block); $this->view->setSecurityToken($this->createSecurityToken()); // Add metabox. add_meta_box($this->view->getMetaboxId(), $this->view->getMetaboxName(), array(&$this->view, 'display'), $this->model->getPost()->post_type, 'normal'); }