コード例 #1
0
 /**
  * put your comment there...
  * 
  * @param mixed $dbDriver
  * @return CJTPackageTable
  */
 public function __construct($dbDriver)
 {
     // Initialize parent.
     parent::__construct($dbDriver, 'block_files');
     // Table key.
     $this->setTableKey(array('id', 'blockId'));
 }
コード例 #2
0
ファイル: form.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  * @param mixed $dbDriver
  * @return CJTPackageTable
  */
 public function __construct($dbDriver)
 {
     // Initialize parent.
     parent::__construct($dbDriver, 'forms');
     // Set table key.
     $this->setTableKey(array('blockId'));
 }
コード例 #3
0
ファイル: group.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize.
     $register = $this->register();
     $paramId = $register['paramId'];
     $groupParamData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     // Find group!
     $factory = $this->getFactory();
     $groups = $factory->getCreatedObjects('form/group');
     $paramGroupName = (string) $this->getNode()->attributes()->name;
     // Find the group to be associated with the parameter.
     foreach ($groups as $group) {
         // Find the group by the given name.
         if ($group->getName() == $paramGroupName) {
             // Check existntance!
             $tblGroupParam = CJTxTable::getInstance('group-parameter')->setTableKey(array('parameterId'))->set('parameterId', $paramId)->load();
             // Add if not exists!
             if (!$tblGroupParam->get('groupId')) {
                 // Get group id.
                 $groupId = $group->register()->offsetGet('groupId');
                 // Prepare data.
                 $groupParamData['parameterId'] = $paramId;
                 $groupParamData['groupId'] = $groupId;
                 // Save to database.
                 $tblGroupParam->setTableKey(array('id'))->setData($groupParamData)->save();
             }
             break;
         }
     }
     return $this;
 }
コード例 #4
0
 /**
  * put your comment there...
  * 
  * @param mixed $tblPackage
  * @param mixed $packageId
  */
 protected function save(CJTxTable &$tblPckObjects, $packageId)
 {
     // Initialize.
     $register =& $this->register();
     // Add Package Ref record,
     // only if this template is not bundled with the package.
     $data = array('packageId' => $packageId, 'objectId' => $register[$this->objectIdKeyName], 'objectType' => $this->objectTypeName);
     $tblPckObjects->loadAsKey($data);
     if (!$tblPckObjects->get('relType')) {
         // Reset object.
         $tblPckObjects->setItem();
         // Save package object ref.
         parent::save($tblPckObjects, $packageId);
     }
     // Chain.
     return $this;
 }
コード例 #5
0
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     CJTxTable::import('author');
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query all dates (without time!) or internal authors.
     $query = " SELECT DISTINCT(DATE(t.creationDate)) `text`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`;";
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
コード例 #6
0
 /**
  * put your comment there...
  * 	
  */
 public function unlink()
 {
     // Delete record!
     $map = CJTxTable::getInstance('block-template')->setData($this->inputs)->delete(array_keys($this->inputs));
     // Delete using compound key!
     // Fields will be cleared when deleted!
     return $map->getKey();
 }
コード例 #7
0
 /**
  * Check weather a template is linked to specific block.
  * 
  * Check database block_templates table for record with the given ids.
  * 
  * @param Integer Block Id.
  * @param Integer Template Id.
  * @return boolean TRUE if linked, FALSE if not.
  */
 public function isLinked($blockId, $templateId)
 {
     // Try to load block template table with the requested Ids.
     $tableBlockTemplate = CJTxTable::getInstance('block-template');
     $tableBlockTemplate->set('blockId', $blockId)->set('templateId', $templateId)->load(array('blockId', 'templateId'));
     // Return TRUE if the blockId and the TemplateId returned from the load process!
     return $tableBlockTemplate->get('blockId') && $tableBlockTemplate->get('templateId');
 }
コード例 #8
0
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     CJTxTable::import('author');
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query CJT Authors + Wordpress build-in local users.
     $query = " SELECT a.id, a.name `text`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tRIGHT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.id = t.authorId\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
     // Get all exists authors
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
コード例 #9
0
 /**
  * put your comment there...
  * 
  * @param mixed $objectId
  * @param mixed $objectType
  * @param mixed $relType
  */
 public function associateObject($objectId, $objectType, $relType)
 {
     // Initialize.
     $tblPckObjects = CJTxTable::getInstance('package-objects');
     // Add Block-Template-Link=>Package reference.
     $tblPckObjects->setData(array('packageId' => $this->getId(), 'objectId' => $objectId, 'objectType' => $objectType, 'relType' => $relType))->save();
     // Chain.
     return $this;
 }
コード例 #10
0
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     // Import dependencies.
     CJTxTable::import('template-revision');
     CJTxTable::import('author');
     $lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query all dates (without time!).
     $query = " SELECT DISTINCT(DATE(r.dateCreated)) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_template_revisions r\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  r.templateId = t.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
コード例 #11
0
 /**
  * put your comment there...
  * 
  */
 public function builtinAuthors()
 {
     // Dependencies!
     cssJSToolbox::import('framework:db:mysql:xtable.inc.php');
     // Add Wordpress author if its not already added!
     $wpAuthor = CJTxTable::getInstance('author')->set('id', CJTAuthorTable::WORDPRESS_AUTHOR_ID)->load();
     // Make sure built-in (attributes = 1) Wordpress author (id = 1) is there!
     if (!$wpAuthor->get('id') || $wpAuthor->get('attributes') != 1) {
         $wpAuthor->setData(array('id' => CJTAuthorTable::WORDPRESS_AUTHOR_ID, 'name' => 'Wordpress', 'attributes' => CJTAuthorTable::FLAG_SYS_AUTHOR))->save(true);
     }
     return $this;
 }
コード例 #12
0
 /**
  * Do nothing!
  * 
  */
 public function transit()
 {
     // Initialize.
     $tblPckObjects = CJTxTable::getInstance('package-objects');
     // Query package id.
     $tblPck = CJTxTable::getInstance('package');
     $pckData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     $tblPck->setData($pckData)->load(array('name'));
     // Add Block-Template-Link=>Package reference.
     $this->save($tblPckObjects, $tblPck->get('id'));
     // Chain.
     return $this;
 }
コード例 #13
0
ファイル: type.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize.
     $register = $this->register();
     $paramId = $register['paramId'];
     $typedefData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     // Prepare data.
     $typedefData['parameterId'] = $paramId;
     // Save to database.
     $tblTypedef = CJTxTable::getInstance('parameter-typedef')->setData($typedefData)->save();
     // Chaining.
     return $this;
 }
コード例 #14
0
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize.
     $register = $this->register();
     $groupId = $register['groupId'];
     // Fetch form data / All scalar elements!
     $groupXFieldsData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     $groupXFieldsData['groupId'] = $groupId;
     // Save Group XFIELDS data.
     CJTxTable::getInstance('form-group-xfields')->setData($groupXFieldsData)->save();
     // Chaining.
     return $this;
 }
コード例 #15
0
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     if (isset($this->options['result']) && $this->options['result'] == 'fullList') {
         $this->items['published']['text'] = cssJSToolbox::getText('published');
         $this->items['draft']['text'] = cssJSToolbox::getText('draft');
         $this->items['trash']['text'] = cssJSToolbox::getText('trash');
     } else {
         CJTxTable::import('author');
         $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
         // Query all template state exluding Internal authors.
         $query = "SELECT DISTINCT(state) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
         $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
     }
 }
コード例 #16
0
ファイル: forms.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  * @param mixed $blockId
  */
 public function delete($blockIds)
 {
     // Initialize.
     $tblForm = CJTxTable::getInstance('form')->setTableKey(array('blockId'));
     // Delete all forms.
     foreach ($blockIds as $blockId) {
         // Delete the form!
         $tblForm->setData(array('blockId' => $blockId))->delete();
     }
     // Delete form groups.
     $mdlGroups = new CJT_Models_Formgroups();
     $mdlGroups->delete($blockIds);
     // Chaining.
     return $this;
 }
コード例 #17
0
ファイル: link.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Transit Link.
     parent::transit();
     $register = $this->register();
     // Add Package Ref record
     // ,only if this template is not bundled with the package.
     $packObjectsTbl = CJTxTable::getInstance('package-objects')->loadAsKey(array('packageId' => $register['packageId'], 'objectId' => $register['linkedTemplateId'], 'objectType' => 'template'));
     if (!$packObjectsTbl->get('relType')) {
         $pckHelper = new CJT_Models_Package_Xml_Definition_PackageHelper($register['packageId']);
         $pckHelper->associateObject($register['linkedTemplateId'], 'template', 'link');
     }
     // Chaining.
     return $this;
 }
コード例 #18
0
 /**
  * put your comment there...
  * 
  */
 public function install()
 {
     // Get template and key refernces!
     $wpTemplate = $this->current();
     $handle = $this->key();
     // Use only templates defined with the internal file systems!!
     $devFile = str_replace(".{$this->type->extension}", ".dev.{$this->type->extension}", $wpTemplate->src);
     // Get display name from Queue name!
     $displayName = ucfirst(str_replace(array('-', '_'), ' ', $handle));
     // Prepare periodically used vars!
     $time = current_time('mysql');
     // Add queue object as CJT template!
     $template = CJTxTable::getInstance('template')->set('name', $displayName)->set('queueName', $handle)->set('type', $this->type->name)->set('creationDate', $time)->set('ownerId', get_current_user_id())->set('authorId', CJTAuthorTable::WORDPRESS_AUTHOR_ID)->set('state', 'published')->set('attributes', CJTTemplateTable::ATTRIBUTES_SYSTEM_FLAG)->save();
     // Add revision for that template.
     $revision = CJTxTable::getInstance('template-revision')->set('templateId', $template->get('id'))->set('revisionNo', 1)->set('version', $wpTemplate->ver)->set('changeLog', 'Cached by CJT installer!')->set('state', 'release')->set('dateCreated', $time)->set('file', is_file(ABSPATH . "/{$devFile}") ? $devFile : $wpTemplate->src)->save();
 }
コード例 #19
0
 /**
  * put your comment there...
  * 
  * @param mixed $name
  */
 public function useTheme($name)
 {
     // Get template name from theme name.
     // Template name is [BLOCKNAME-THEMENAME-theme].
     $templateName = "{$this->source->name} - {$name} theme";
     // Load template record from database.
     $tblTemplate = CJTxTable::getInstance('template')->setData(array('name' => $templateName))->load(array('name'));
     $mdlTemplate = CJTModel::getInstance('template');
     $mdlTemplate->inputs['id'] = $tblTemplate->get('id');
     $template = $mdlTemplate->getItem();
     // Link Style sheet.
     $queueObject = CJTModel::getInstance('coupling')->getQueueObject('styles');
     $queueObject->add($template->queueName, "/{$template->file}");
     $queueObject->enqueue($template->queueName);
     // Chaining.
     return $this;
 }
コード例 #20
0
ファイル: link.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize for linking templates.
     $register = $this->register();
     $link = $this->getNode();
     // Link block templates.
     // Get template object to link.
     $templateToLinkAttributes = (array) $link->attributes();
     $templateToLinkAttributes = $templateToLinkAttributes['@attributes'];
     $tblTemplate = CJTxTable::getInstance('template')->setData($templateToLinkAttributes)->load(array_keys($templateToLinkAttributes));
     if ($register['linkedTemplateId'] = $tblTemplate->get('id')) {
         // Always link as the block should be newely added
         // and in the normal cases its impossible to be alread linked!
         $tableBlockTemplate = CJTxTable::getInstance('block-template');
         $tableBlockTemplate->set('blockId', $register['blockId'])->set('templateId', $register['linkedTemplateId'])->save();
     }
     return $this;
 }
コード例 #21
0
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     if (isset($this->options['result']) && $this->options['result'] == 'fullList') {
         $this->items['release']['text'] = cssJSToolbox::getText('release');
         $this->items['beta']['text'] = cssJSToolbox::getText('beta');
         $this->items['alpha']['text'] = cssJSToolbox::getText('alpha');
         $this->items['release-candidate']['text'] = cssJSToolbox::getText('release-candidate');
         $this->items['revision']['text'] = cssJSToolbox::getText('revision');
     } else {
         // Import dependencies.
         CJTxTable::import('template-revision');
         CJTxTable::import('author');
         $lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
         $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
         $query = "SELECT DISTINCT(r.state) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_template_revisions r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON  r.templateId = t.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
         $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
     }
 }
コード例 #22
0
 /**
  * Delete parameter or group or parameters
  * or all parameters associasted to specific block.
  * 
  * Each Key might has only the parameterId or blockId or both of them.
  * 
  * @param array array('blockId' => ID, 'parameterId' => 'ID).
  * @return
  */
 public function delete($keys)
 {
     // Initialize.
     $tblParams = CJTxTable::getInstance('parameter')->setTableKey(array('blockId', 'parameterId'));
     // Delete parameters.
     foreach ($keys as $key) {
         // Allow only blockId to be passed as scalar!
         if (!is_array($key)) {
             $key = array($key);
         }
         // Blolckid passed @index 0 while parameters id @index 1
         $key = array('blockId' => $key[0], 'parameterId' => isset($key[1]) ? $key[1] : null);
         // Delete record.
         $tblParams->setData($key)->delete();
     }
     // Chaining.
     return $this;
 }
コード例 #23
0
ファイル: form.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Get block element.
     $register = $this->register();
     $blockId = $register['blockId'];
     // Try to load the form
     $tblForm = CJTxTable::getInstance('form');
     $tblForm->set('blockId', $blockId)->load();
     // Add form is not exists.
     if (!$tblForm->get('name')) {
         // Fetch form data / All scalar elements!
         $formData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
         // Use blockId as formId.
         $formData['blockId'] = $blockId;
         // Set form data.
         $tblForm->setData($formData)->setTableKey(array('id'))->save(true);
     }
     // Save form id for the chain!
     $this->register()->offsetSet('formId', $blockId);
     // Chaining.
     return $this;
 }
コード例 #24
0
ファイル: param.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize.
     $register = $this->register();
     $blockId = $register['blockId'];
     $parent = isset($register['paramId']) ? $register['paramId'] : null;
     $paramData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     // Block root parameter and child parameter names is unique
     $tblParam = CJTxTable::getInstance('parameter')->setTableKey(array('blockId', 'parent', 'name'))->set('blockId', $blockId)->set('parent', $parent)->set('name', $paramData['name'])->load();
     // Add if doesn't exists!
     if (!$tblParam->get('id')) {
         // Set relation data.
         $paramData['blockId'] = $blockId;
         $paramData['parent'] = $parent;
         // Save into database.
         $tblParam->setTableKey(array('id'))->setData($paramData)->save();
     }
     // Add (Or Override parent parameter id on the chain!)
     $register['paramId'] = $tblParam->get('id');
     // Chaining.
     return $this;
 }
コード例 #25
0
ファイル: group.php プロジェクト: JSreactor/MarketCrater.com
 /**
  * put your comment there...
  * 
  */
 public function transit()
 {
     // Initialize.
     $register = $this->register();
     $formId = $register['formId'];
     // Fetch form data / All scalar elements!
     $groupData = new CJT_Framework_Xml_Fetchscalars($this->getNode());
     // Try to load the form
     $tblGroup = CJTxTable::getInstance('form-group');
     // Each form has a unique group names!
     $tblGroup->setTableKey(array('formId', 'name'))->set('formId', $formId)->set('name', $groupData['name'])->load();
     // Add form is not exists.
     if (!$tblGroup->get('id')) {
         // Use blockId as formId.
         $groupData['formId'] = $formId;
         // Set form data.
         $tblGroup->setTableKey(array('id'))->setData($groupData)->save();
     }
     // Save form id for the chain!
     $register['groupId'] = $tblGroup->get('id');
     // Chaining.
     return $this;
 }
コード例 #26
0
 /**
  * Delete parameter or group or parameters
  * or all parameters associasted to specific block.
  * 
  * Each Key might has only the parameterId or blockId or both of them.
  * 
  * @param array array('formId' => ID, 'groupId' => 'ID).
  * @return
  */
 public function delete($keys)
 {
     // Initialize.
     $tblFormGroup = CJTxTable::getInstance('form-group')->setTableKey(array('formId', 'groupId'));
     $tblGroupXFields = CJTxTable::getInstance('form-group-xfields')->setTableKey(array('groupId'));
     $tblGroupParam = CJTxTable::getInstance('group-parameter')->setTableKey(array('groupId'));
     $tblParamTypedef = CJTxTable::getInstance('parameter-typedef')->setTableKey(array('parameterId'));
     // Delete groups..
     foreach ($keys as $key) {
         // Allow only blockId to be passed as scalar!
         if (!is_array($key)) {
             $key = array($key);
         }
         // Blolckid passed @index 0 while parameters id @index 1
         $key = array('formId' => $key[0], 'groupId' => isset($key[1]) ? $key[1] : null);
         // Get all exists ids
         $groups = $tblFormGroup->setData($key)->fetchAll();
         // For each group get all assocuated parameters.
         foreach ($groups as $group) {
             // Delete GROUP XFields record associated with the group.
             $tblGroupXFields->set('groupId', $group['id'])->delete();
             // Get all params.
             $params = $tblGroupParam->set('groupId', $group['id'])->fetchAll();
             // Delete parameters typedef!
             foreach ($params as $param) {
                 $tblParamTypedef->set('parameterId', $param['parameterId'])->delete();
             }
             // Delete group parameters.
             $tblGroupParam->delete();
         }
         // Delete groups.
         $tblFormGroup->delete();
     }
     // Chaining.
     return $this;
 }
コード例 #27
0
        if (!is_object($item)) {
            $item = is_array($item) ? (object) $item : new stdClass();
        }
        // Set internal item object!
        $this->item = $item;
        // Chaining!
        return $this;
    }
    /**
     * put your comment there...
     * 
     * @param mixed $key
     */
    public function setTableKey($key)
    {
        $this->key = $key;
        return $this;
    }
    /**
     * put your comment there...
     * 
     */
    public function table()
    {
        return $this->name;
    }
}
// End class.
// Hookable.
CJTxTable::define('CJTxTable', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
コード例 #28
0
ファイル: tinymce-blocks.php プロジェクト: Timfreaky/ThinkTax
 /**
  * put your comment there...
  * 
  */
 protected function getShortcodeAction()
 {
     // Get block id.
     $blockId = $_REQUEST['blockId'];
     // Load block
     $block = CJTxTable::getInstance('block')->setTableKey(array('id'))->setData(array('id' => $blockId))->load()->getData();
     $blockForm = (array) CJTxTable::getInstance('form')->setTableKey(array('blockId'))->setData(array('blockId' => $blockId))->load()->getData();
     // Load block parameters.
     $parameters = new CJT_Models_Block_Parameters_Parameters($blockId);
     $blockParams = new CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Parameters($parameters);
     // The the block has FORM associated
     if (isset($blockForm['blockId'])) {
         // If the data is submitted then load the parameters object with the post data!
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             // Get RAW data from the data submitted (avoid magic_quotes, Why called MAGIC!!!!)!
             $rawPostData = filter_input(INPUT_POST, 'form-data', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY);
             // Fill the form by the posted data
             $blockParams->setValue($rawPostData);
             // Validate the submitted data against their parameters.
             if ($blockParams->validate()) {
                 // Generate and Return Shortcode string!
                 $this->response['state'] = 'shortcode-notation';
                 $this->response['content'] = $blockParams->shortcode($block->name);
             } else {
                 $this->response['state'] = 'invalid';
                 $this->response['content'] = $blockParams->getMessages();
             }
         } else {
             $this->response['state'] = 'show-form';
         }
     } else {
         // If block doesn't has a parameters defined return
         // the Shortcode code string from the parameters loader.
         $this->response['state'] = 'shortcode-notation';
         $this->response['content'] = $blockParams->shortcode($block->name);
     }
 }
コード例 #29
0
 /**
  * put your comment there...
  * 
  * @param mixed $dbDriver
  * @return CJTPackageTable
  */
 public function __construct($dbDriver)
 {
     // Initialize parent.
     parent::__construct($dbDriver, 'parameters');
 }
コード例 #30
0
 /**
  * put your comment there...
  * 
  * @param mixed $dbDriver
  * @return CJTPackageTable
  */
 public function __construct($dbDriver)
 {
     parent::__construct($dbDriver, 'package_objects');
 }