本文整理汇总了PHP中cssJSToolbox类的典型用法代码示例。如果您正苦于以下问题:PHP cssJSToolbox类的具体用法?PHP cssJSToolbox怎么用?PHP cssJSToolbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cssJSToolbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadCodeFileAction
/**
* put your comment there...
*
*/
public function downloadCodeFileAction()
{
// BlockId, currentActiveFile.
$blockId = $_GET['blockId'];
$fileId = $_GET['fileId'];
$returnAs = $_GET['returnAs'];
// Get current File Code.
$tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
$codeFile = $tblCodeFile->set('id', $fileId)->set('blockId', $blockId)->load()->getData();
// Return as downloadable-file or JSON.
if ($returnAs == 'file') {
// Get Download File info.
$extension = $codeFile->type ? cssJSToolbox::$config->templates->types[$codeFile->type]->extension : 'txt';
$file = "{$codeFile->name}.{$extension}";
// Response Header parameters.
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=\"{$file}\"");
//<<< Note the " " surrounding the file name
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . strlen($codeFile->code));
// AJAX Controller parameters.
$this->httpContentType = 'application/octet-stream';
}
// Output code.
$this->response = $codeFile->code;
}
示例2: create
/**
* put your comment there...
*
* @param mixed $blockId
*/
public function create(&$pin = null)
{
// Import dependecnes.
cssJSToolbox::import('tables:block-pins.php');
// Change metabox status to be created.
$this->setState(self::STATE_CREATED);
// Add post pin to pins table.
$blockPinsTable = new CJTBlockPinsTable($this->dbDriver);
// Pin data.
$pin = (object) array();
// Import CJTBlockModel class.
CJTModel::import('block');
/** @todo Only temporary in version 6.0. Later versions should group all post types by post type name! */
switch ($this->getPost()->post_type) {
case 'page':
$pin->pin = 'pages';
$pin->flag = CJTBlockModel::PINS_PAGES_CUSTOM_PAGE;
break;
default:
$pin->pin = 'posts';
$pin->flag = CJTBlockModel::PINS_POSTS_CUSTOM_POST;
break;
}
$pin->value = $this->getPost()->ID;
// Add pin record.
$blockPinsTable->insertRaw($this->getMetaboxId(), array($pin));
// Chains!
return $this;
}
示例3: loadString
/**
* put your comment there...
*
* @param mixed $strings
* @param mixed $content
* @return CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Parameters
*/
public function loadString($strings, $content)
{
// Get the name of the CONTENT PARAMETER -- If EXISTS!
// THEN PUSH IT AS ITS PASSED AS SHORTCODR ATTRIBUTE.
if ($contentParameter = $this->getContentParameter()) {
$strings[$contentParameter->getDefinition()->getName(true)] = $content;
}
// Load all parameters with shortcde parameters.
foreach ($this->getParams() as $name => $param) {
// Dont override default value unless parameter is passed!
if (isset($strings[$name])) {
$param->loadString($strings[$name]);
}
// Validate type!
if (!$param->validate()) {
echo cssJSToolbox::getText("Invalid Shortcode parameter: {$type->getMessage()}");
}
// Remove the value from the stringsValue allow validating if
// any invalid parameter name is passed!
// See after the loop.
unset($strings[$name]);
}
// If there is any string values still exists then invalid parameter is passed.
if (!empty($strings)) {
echo cssJSToolbox::getText("Invalid Shortcode parameter(s) has been passed! Please check parameters name.");
}
return $this;
}
示例4: getBlocksIterator
/**
* put your comment there...
*
* @param mixed $blocks
*/
protected function getBlocksIterator($blocks)
{
// Import iterator class file!
cssJSToolbox::import('includes:installer:upgrade:0.2:includes:block.class.php');
// Instantiate blocks iterator object!
return new CJTInstallerBlocks02($blocks);
}
示例5: menu
/**
* put your comment there...
*
*/
public function menu()
{
// Setup Page.
$pageHookId = add_submenu_page(CJTPlugin::PLUGIN_REQUEST_ID, cssJSToolbox::getText('CJT Manage - Packages'), cssJSToolbox::getText('Packages'), 'administrator', CJTPlugin::PLUGIN_REQUEST_ID . '-packages', array(&$this->controller, '_doAction'));
// Process when its installed!!
add_action("load-{$pageHookId}", array($this, 'getPage'));
}
示例6: upgrade
/**
* put your comment there...
*
*/
public function upgrade()
{
// Save backup in backup table!
$backup = $this->current();
// Change 'time' field to 'created'!
// Convert formatted date to mysal date!
$backup['created'] = $backup['time'];
// User author Id instead of name and change 'author' field to 'owner'!
$backup['owner'] = get_user_by('login', $backup['author'])->ID;
$backup['type'] = 'blocks';
// For now we support only blocks backups!
// Load blocks into blocks iterator before destroying deprectaed fields.
$blocks = new CJTInstallerBlocks03($backup['data'], CJTInstallerBlocks03::BLOCK_TYPE_BACKUP);
// Remove deprecated fields!
$backup = array_diff_key($backup, array_flip(array('time', 'author', 'data')));
/// Add backup and get its ID using OLD style table (not xTable)!!
// Import dependecneis.
cssJSToolbox::import('tables:backups.php');
// Insert backup record.
$backupsTable = new CJTBackupsTable(cssJSToolbox::getInstance()->getDBDriver());
$backupsTable->insert($backup);
$backupId = $backupsTable->getDBDriver()->processQueue()->getInsertId();
// Insert all blocks!
foreach ($blocks as &$block) {
// Associate every block with the created backup!
$block['backupId'] = $backupId;
// Upgrade block!
$blocks->upgrade();
$blocks->model->save();
}
return $this;
}
示例7: delete
/**
* Delete single package.
*
* This method is going to delete the package
* and all the templates and blocks associated to it,
* therefor it'll unlink/break-down the relationship
* between those templates and blocks.
*
* @param Integer Package Id.
* @return CJTPackageModel Return $this.
*/
public function delete($id)
{
// Initialize.
$modelTemplates = CJTModel::getInstance('templates-manager');
$dbd = cssJSToolbox::getInstance()->getDBDriver();
$assoObjectsQueryTmp = 'SELECT objectId
FROM #__cjtoolbox_package_objects
WHERE packageId = %d AND objectType = "%s" AND relType = "%s";';
// Delete the package.
CJTxTable::getInstance('package')->set('id', $id)->delete();
// Delete blocks.
$blockIds = array_keys($dbd->select(sprintf($assoObjectsQueryTmp, $id, 'block', 'add')));
if (!empty($blockIds)) {
// Delete blocks!
CJTModel::getInstance('blocks')->delete($blockIds)->save();
}
// Delete templates.
$modelTemplates->inputs['ids'] = array_keys($dbd->select(sprintf($assoObjectsQueryTmp, $id, 'template', 'add')));
// Templates muct be in trash state before deleted!
$modelTemplates->inputs['state'] = 'trash';
// Move to Trash + Delete only if there is at least one Id!
empty($modelTemplates->inputs['ids']) or $modelTemplates->changeState() and $modelTemplates->delete();
// Delete package objects map.
CJTxTable::getInstance('package-objects')->set('packageId', $id)->delete(array('packageId'));
}
示例8: enableAction
/**
* put your comment there...
*
*/
protected function enableAction()
{
// Initializing!
$model = $this->model;
$cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
$extensions =& CJTPlugin::getInstance()->extensions();
// Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
// license key!
$activeLicenses = $model->getStatedLicenses();
// Import EDD updater Class!
cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
// Activate Automatic upgrade for all activated licenses/components!
foreach ($activeLicenses as $name => $state) {
// Get extension def doc.
// Act only if extension has XMl DOC! This might happened i fthe extension
// removed while its key still in the database
if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
// Check CJT Server only if updateSrc points to Wordpress Repository
$updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
if (!$updateSrcServer || $updateSrcServer == 'CJT') {
// Initializingn vars for a single state/component!
$pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
// Stop using Cached Data as it causes issue, always
// get fresh plugin data.
$plugin = get_plugin_data($pluginFile);
$license =& $state['license'];
// Edd API parameter to be send along with he check!
$requestParams = array('version' => $plugin['Version'], 'author' => $plugin['AuthorName'], 'license' => $license['key'], 'item_name' => $name);
// Set EDD Automatic Updater!
$updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams);
}
}
}
}
示例9: enableAction
/**
* put your comment there...
*
*/
protected function enableAction()
{
// Initializing!
$model = $this->model;
$cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
$extensions =& CJTPlugin::getInstance()->extensions();
// Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
// license key!
$activeLicenses = $model->getStatedLicenses();
// Activate Automatic upgrade for all activated licenses/components!
foreach ($activeLicenses as $name => $state) {
// Get extension def doc.
// Act only if extension has XMl DOC! This might happened i fthe extension
// removed while its key still in the database
if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
// Check CJT Server only if updateSrc points to Wordpress Repository
$updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
if (!$updateSrcServer || $updateSrcServer == 'CJT') {
// Initializingn vars for a single state/component!
$pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
$license =& $state['license'];
// Set EDD Automatic Updater!
try {
CJTStoreUpdate::autoUpgrade($name, $license['key'], $pluginFile);
} catch (CJTServicesAPICallException $exception) {
die('CJT AUTO-UPGRADE EXCAPTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
}
}
}
}
}
示例10: display
/**
* put your comment there...
*
* @param mixed $tpl
*/
public function display($tpl = null)
{
$this->component = $this->getModel('setup')->getCJTComponentData();
$this->securityToken = cssJSToolbox::getSecurityToken();
// Display view.
echo $this->getTemplate($tpl);
}
示例11: menu
/**
* put your comment there...
*
*/
public function menu()
{
// Blocks Manager page! The only Wordpress menu item we've.
$pageHookId = add_menu_page(cssJSToolbox::getText('CSS & Javascript Toolbox'), cssJSToolbox::getText('CSS & Javascript Toolbox'), 'administrator', CJTPlugin::PLUGIN_REQUEST_ID, array(&$this->controller, '_doAction'), CJTOOLBOX_VIEWS_URL . '/blocks/manager/public/images/menu.png');
// Process request if installed!
add_action("load-{$pageHookId}", array($this, 'getPage'));
}
示例12: prepareItems
/**
* 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);
}
示例13: database
/**
* put your comment there...
*
*/
public function database()
{
// Upgrade database tables.
cssJSToolbox::import('framework:installer:dbfile.class.php');
CJTDBFileInstaller::getInstance(cssJSToolbox::resolvePath('includes:installer:upgrade:1.0-CE:db:mysql:structure.sql'))->exec();
// Chaining.
return $this;
}
示例14: menu
/**
* put your comment there...
*
*/
public function menu()
{
// Extensions page.
add_submenu_page(CJTPlugin::PLUGIN_REQUEST_ID, null, cssJSToolbox::getText('Extensions'), 'administrator', null);
// Hack Extensions menu item to point to Plugins page!
$GLOBALS['submenu'][CJTPlugin::PLUGIN_REQUEST_ID][self::MENU_POSITION_INDEX][2] = admin_url('plugins.php?s=' . self::PLUGINS_PAGE_SEARCH_TERM);
// When plugins page loaded!
add_action('load-plugins.php', array($this, 'route'), 10, 0);
}
示例15: finalize
/**
* put your comment there...
*
*/
public function finalize()
{
// Upgrade database internal version number using
// installer class.
cssJSToolbox::import('includes:installer:installer:installer.class.php');
CJTInstaller::getInstance()->finalize();
// Chaining.
return $this;
}