本文整理汇总了PHP中cssJSToolbox::resolvePath方法的典型用法代码示例。如果您正苦于以下问题:PHP cssJSToolbox::resolvePath方法的具体用法?PHP cssJSToolbox::resolvePath怎么用?PHP cssJSToolbox::resolvePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cssJSToolbox
的用法示例。
在下文中一共展示了cssJSToolbox::resolvePath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: database
/**
* put your comment there...
*
*/
public function database()
{
// Install Database structure!
cssJSToolbox::import('framework:installer:dbfile.class.php');
CJTDBFileInstaller::getInstance(cssJSToolbox::resolvePath('includes:installer:installer:db:mysql:structure.sql'))->exec();
return $this;
}
示例2: __toString
/**
* put your comment there...
*
*/
public function __toString()
{
// Initialize.
$attributes =& $this->attributes;
// Default Class.
if (!isset($attributes['class'])) {
$shortcodeClass = 'block';
}
// Get Shortcode class file, check existance!
$shortcodeClassFile = cssJSToolbox::resolvePath('controllers:coupling:shortcode:block:block.php');
if (!file_exists($shortcodeClassFile)) {
throw new Exception('Shortcode Type is not supported!! Only (block) type is currently available!!!');
}
// Import shortcodee handler file.
require_once $shortcodeClassFile;
// Import class.
$className = "CJT_Controllers_Coupling_Shortcode_{$shortcodeClass}";
// Load shortcode 'CLASS' handler.
$shortcode = new $className($this->attributes, $this->content);
// Return Shortcode replacements.
return (string) $shortcode;
}
示例3: linkFooterStyleSheets
/**
* put your comment there...
*
*/
public function linkFooterStyleSheets()
{
// Initialize.
$styles = array();
// Get queued style sheets!
global $wp_styles;
$queuedStyles =& $wp_styles->queue;
// Process only 'cjt' templates,
foreach ($queuedStyles as $index => $styleName) {
if (strpos($styleName, 'cjt-css-template-') === 0) {
// Get style name src file, prepend to Wordpress absolute path.
$style = $wp_styles->registered[$styleName];
$styles[] = home_url($style->src);
// Stop Wordpress from output <link> tag outside head tag
// as it has no effect.
unset($queuedStyles[$index]);
}
}
// Enqueue Style Sheet loader javascript if there is any
// styles need to be loaded.
if (!empty($styles)) {
// jQuery is dpendency object required by the loader.
wp_enqueue_script('jquery');
// Enqueue footer style sheet loader.
wp_enqueue_script('cjt-coupling-footer-css-loader', cssJSToolbox::getURI('controllers:coupling:js:footer-stylesheet-loader.js'));
// Output Javascript array to be filled with the styles!
$jsStyleSheetsList = json_encode($styles);
require cssJSToolbox::resolvePath('controllers:coupling:html:load-footer-style.html.php');
}
}
示例4: useScripts
/**
* put your comment there...
*
*/
protected static function useScripts($className, $scripts = null)
{
wp_enqueue_script('Just Load Default Scripts, this works great!!!!');
// Use current class name is $className is not provided!
if (!$className) {
$className = __CLASS__;
}
// Accept variable number of args of script list.
$allPassedArgs = func_get_args();
$scripts = self::trigger("{$className}.usescripts", is_array($scripts) ? $scripts : array_slice($allPassedArgs, 1));
$stack =& $GLOBALS['wp_scripts']->registered;
if (!$scripts) {
throw new Exception('CJTView::useScripts method must has at least on script parameter passed!');
}
// Script name Reg Exp pattern.
$nameExp = '/\\:?(\\{((\\w+)-)\\})?([\\w\\-\\.]+)(\\(.+\\))?(\\;(\\d))?$/';
// For every script, Enqueue and localize, only if localization file found/exists.
foreach ($scripts as $script) {
// Get script name.
preg_match($nameExp, $script, $scriptObject);
// [[2]Prefix], [4] name. Prefix may be not presented.
$name = "{$scriptObject[2]}{$scriptObject[4]}";
$location = isset($scriptObject[7]) ? $scriptObject[7] : null;
$scriptParameters = isset($scriptObject[5]) ? $scriptObject[5] : '';
if (!isset($stack[$name])) {
// Any JS lib file should named the same as the parent folder with the extension added.
// Except files with _ at the begning
$libPath = ':' . (strpos($scriptObject[4], '_') === 0 ? substr($scriptObject[4], 1) : "{$scriptObject[4]}:{$scriptObject[4]}");
// Pass virtual path to getURI and resolvePath to
// get JS file URI and localization file path.
$jsFile = cssJSToolbox::getURI(preg_replace($nameExp, "{$libPath}.js", $script));
$localizationFile = cssJSToolbox::resolvePath(preg_replace($nameExp, "{$libPath}.localization.php", $script));
// Enqueue script file.
wp_enqueue_script($name, $jsFile, null, null, $location);
// Set script parameters.
if (preg_match_all('/(\\w+)=(\\w+)/', $scriptParameters, $params, PREG_SET_ORDER)) {
// Set parameters.
foreach ($params as $param) {
$stack[$name]->cjt[$param[1]] = $param[2];
}
// Initialize CJT for the script data object.
// This object caryy other informations so that the other
// Plugin parts/components can use it to know how script file work.
$stack[$name]->cjt = (object) $stack[$name]->cjt;
}
// If localization file exists localize JS.
if (file_exists($localizationFile)) {
// Get localization text array.
$localization = (require $localizationFile);
// Object name is the script name with .'s and -'s stripped.
// Capitalize first char after each - or . and append I18N postfix.
$objectName = str_replace(' ', '', ucwords(str_replace(array('.', '-'), ' ', "{$name}I18N")));
// Ask Wordpress to localize the script file.
wp_localize_script($name, $objectName, $localization);
}
} else {
wp_enqueue_script($name, null, null, null, $location);
}
}
}
示例5: getOperations
/**
* Get installer operations for current CJT version!
*
* @return array Operations list metadata.
*/
public function getOperations()
{
// Read all install/upgrade operations for all versions!
$operations = get_option(self::INSTALLATION_STATE);
$operations = is_array($operations) ? $operations : array();
// Check if cached: Use only installer cache for 'current' CJT version.
if (!isset($operations[CJTPlugin::DB_VERSION])) {
// Import installer reflection!
cssJSToolbox::import('framework:installer:reflection.class.php');
// Get Installer operations.
cssJSToolbox::import('includes:installer:installer:installer.class.php');
$operations[CJTPlugin::DB_VERSION]['operations']['install'] = CJTInstallerReflection::getInstance('CJTInstaller', 'CJTInstaller')->getOperations();
if ($this->isUpgrade()) {
// Get upgrade operations , Also cache upgrader info for later use!
$operations[CJTPlugin::DB_VERSION]['upgrader'] = $upgrader = $this->getUpgrader();
// Check if upgrader exists!
if (!file_exists(cssJSToolbox::resolvePath($upgrader['file']))) {
throw new Exception("Could not find upgrade/downgrade agent for installer '{$this->installedDbVersion}'! Incompatible version numbers! Upgrader/Downgrwader is no being supported by current versions!!");
}
// Import upgrader + reflect its operations!
cssJSToolbox::import($upgrader['file']);
$operations[CJTPlugin::DB_VERSION]['operations']['upgrade'] = CJTInstallerReflection::getInstance($upgrader['class'], 'CJTUpgradeNonTabledVersions')->getOperations();
}
update_option(self::INSTALLATION_STATE, $operations);
}
return $operations[CJTPlugin::DB_VERSION];
}