当前位置: 首页>>代码示例>>PHP>>正文


PHP modX::fromJson方法代码示例

本文整理汇总了PHP中modX::fromJson方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::fromJson方法的具体用法?PHP modX::fromJson怎么用?PHP modX::fromJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在modX的用法示例。


在下文中一共展示了modX::fromJson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * RememberThis constructor
  *
  * @param modX $modx A reference to the modX instance.
  * @param array $options An array of options. Optional.
  */
 public function __construct(modX &$modx, array $options = array())
 {
     $this->modx =& $modx;
     $this->modx->lexicon->load('rememberthis:default');
     $corePath = $this->getOption('core_path', $options, $this->modx->getOption('core_path') . 'components/rememberthis/');
     $assetsPath = $this->getOption('assets_path', $options, $this->modx->getOption('assets_path') . 'components/rememberthis/');
     $assetsUrl = $this->getOption('assets_url', $options, $this->modx->getOption('assets_url') . 'components/rememberthis/');
     // Load some default paths for easier management
     $this->options = array_merge(array('namespace' => $this->namespace, 'version' => '1.1.6', 'assetsPath' => $assetsPath, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'pagesPath' => $corePath . 'elements/pages/', 'snippetsPath' => $corePath . 'elements/snippets/', 'pluginsPath' => $corePath . 'elements/plugins/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'cachePath' => $this->modx->getOption('core_path') . 'cache/', 'connectorUrl' => $assetsUrl . 'connector.php'), $options);
     // Load parameters
     $this->options = array_merge($this->options, array('wrapperTpl' => $this->getOption('wrapperTpl', $options, 'tplRememberThisWrapper'), 'noResultsTpl' => $this->getOption('noResultsTpl', $options, 'tplRememberThisNoResults'), 'scriptTpl' => $this->getOption('scriptTpl', $options, 'tplRememberThisScript'), 'showZeroCount' => intval($this->getOption('showZeroCount', $options, 1)), 'rowTpl' => $this->getOption('rowTpl', $options, 'tplRememberThisRow'), 'outerTpl' => $this->getOption('outerTpl', $options, 'tplRememberThisOuter'), 'addTpl' => $this->getOption('addTpl', $options, 'tplRememberThisAdd'), 'itemTitleTpl' => $this->getOption('itemTitleTpl', $options, 'tplRememberThisItemTitle'), 'packagename' => $this->getOption('packagename', null, ''), 'classname' => $this->getOption('classname', null, ''), 'keyname' => $this->getOption('keyname', null, 'id'), 'joins' => $this->modx->fromJson($this->getOption('joins', null, '')), 'jQueryPath' => $this->getOption('jQueryPath', null, ''), 'includeScripts' => intval($this->getOption('includeScripts', null, 1)), 'includeCss' => intval($this->getOption('includeCss', null, 1)), 'debug' => intval($this->getOption('debug', null, 0)), 'tvPrefix' => $this->getOption('tvPrefix', $options, 'tv.'), 'ajaxLoaderImg' => $this->getOption('ajaxLoaderImg', null, ''), 'language' => $modx->getOption('language', $options, $this->modx->getOption('cultureKey')), 'languages' => array('de', 'en'), 'notRememberRedirect' => intval($modx->getOption('notRememberRedirect', $options, false)), 'argSeparator' => $this->modx->getOption('xhtml_urls') ? '&' : '&', 'queryAdd' => $this->getOption('queryAdd', $options, 'add'), 'queryDelete' => $this->getOption('queryDelete', $options, 'delete'), 'useCookie' => intval($this->getOption('useCookie', null, 0)), 'cookieName' => $this->getOption('cookieName', $options, 'rememberlist'), 'cookieExpireDays' => intval($this->getOption('cookieExpireDays', $options, 90))));
     // Custom options
     $this->setOption('language', in_array($this->getOption('language'), $this->getOption('languages')) ? $this->getOption('language') : 'en');
     // Set script options
     $this->setOption('scriptOptions', array('connectorUrl' => $this->getOption('connectorUrl'), 'language' => $this->getOption('language')));
     if ($this->getOption('ajaxLoaderImg')) {
         $this->setOption('scriptOptions', array_merge($this->getOption('scriptOptions'), array('ajaxLoaderImg' => $this->getOption('ajaxLoaderImg'))));
     }
     if (!isset($_SESSION['rememberThis'])) {
         $_SESSION['rememberThis'] = array();
     }
 }
开发者ID:Vitaliz,项目名称:RememberThis,代码行数:28,代码来源:rememberthis.class.php

示例2: array

 /**
  * CustomRequest constructor
  *
  * @param modX $modx A reference to the modX instance.
  * @param array $options An array of options. Optional.
  */
 function __construct(modX &$modx, array $options = array())
 {
     $this->modx =& $modx;
     $this->modx->lexicon->load('customrequest:default');
     $corePath = $this->getOption('core_path', $options, $this->modx->getOption('core_path') . 'components/customrequest/');
     $assetsPath = $this->getOption('assets_path', $options, $this->modx->getOption('assets_path') . 'components/customrequest/');
     $assetsUrl = $this->getOption('assets_url', $options, $this->modx->getOption('assets_url') . 'components/customrequest/');
     // Load some default paths for easier management
     $this->options = array_merge(array('namespace' => $this->namespace, 'assetsPath' => $assetsPath, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'pagesPath' => $corePath . 'elements/pages/', 'snippetsPath' => $corePath . 'elements/snippets/', 'pluginsPath' => $corePath . 'elements/plugins/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'configsPath' => $this->getOption('configsPath', null, $corePath . 'configs/', true), 'cachePath' => $this->modx->getOption('core_path') . 'cache/', 'connectorUrl' => $assetsUrl . 'connector.php'), $options);
     // Load (system) properties
     $this->options = array_merge($this->options, array('debug' => $this->getOption('debug', null, false)));
     $this->modx->addPackage('customrequest', $this->getOption('modelPath'));
     if (isset($this->options['aliases'])) {
         $this->requests = $this->modx->fromJson($this->options['aliases'], true);
     }
     if (!$this->requests) {
         $this->requests = array();
     }
     // Import old config files if no configuration is set
     if (!$this->modx->getCount('CustomrequestConfigs')) {
         $i = 0;
         $configFiles = glob($this->getOption('configsPath') . '*.config.inc.php');
         // Import old config files
         foreach ($configFiles as $configFile) {
             // $settings will be defined in each config file
             $settings = array();
             include $configFile;
             foreach ($settings as $key => $setting) {
                 // fill urlParams if defined
                 $urlParams = isset($setting['urlParams']) && is_array($setting['urlParams']) ? $setting['urlParams'] : array();
                 $regEx = isset($setting['regEx']) ? $setting['regEx'] : '';
                 if (isset($setting['alias'])) {
                     // if alias is defined, calculate the other values
                     if (isset($setting['resourceId'])) {
                         $resourceId = $setting['resourceId'];
                     } elseif ($res = $this->modx->getObject('modResource', array('uri' => $setting['alias']))) {
                         $resourceId = $res->get('id');
                     } else {
                         // if resourceId could not be calculated, don't use that setting
                         if ($this->getOption('debug')) {
                             $this->modx->log(modX::LOG_LEVEL_INFO, 'CustomRequest Plugin: Could not calculate the resourceId for the given alias');
                         }
                         break;
                     }
                     $alias = $setting['alias'];
                 } elseif (isset($setting['resourceId'])) {
                     $resourceId = $setting['resourceId'];
                     if (isset($setting['alias'])) {
                         $alias = $setting['alias'];
                     } else {
                         $alias = '';
                     }
                 }
                 $config = $this->modx->newObject('CustomrequestConfigs');
                 $config->fromArray(array('name' => ucfirst($key), 'menuindex' => $i, 'alias' => $alias, 'resourceid' => $resourceId, 'urlparams' => json_encode($urlParams), 'regex' => $regEx));
                 $config->save();
                 $i++;
             }
         }
         return;
     }
 }
开发者ID:Boddlnagg,项目名称:CustomRequest,代码行数:68,代码来源:customrequest.class.php

示例3: die

if (!defined('MODX_CORE_PATH')) {
    session_write_close();
    die('build.config.php is not correct');
}
/*
@include dirname(__file__) . '/config/current.project.php';

if (!$currentProject) {
session_write_close();
die('Could not get current project');
}
*/
$helper = new BuildHelper($modx);
$modx->lexicon->load('mycomponent:default');
//$props = $helper->getProps(dirname(__FILE__) . '/config/' . $currentProject . '.config.php');
$props = $modx->fromJson(file_get_contents(dirname(__FILE__) . '/config/config.json'));
$props['install.options'] = '1';
$props['packageName'] = $modx->getOption('package', $props);
$props['packageNameLower'] = strtolower($modx->getOption('package', $props));
//$props['targetRoot'] = $modx->getOption('assets_path') . 'mypackages/' . $props['packageNameLower'] . '/';
//$props = isset($configArray) ? $configArray : false;
if (!is_array($props)) {
    session_write_close();
    die($modx->lexicon('mc_no_config_file'));
}
$criticalSettings = array('packageNameLower', 'packageName', 'version', 'release');
foreach ($criticalSettings as $setting) {
    if (!isset($setting)) {
        session_write_close();
        die($modx->lexicon('mc_critical_setting_not_set') . ': ' . $setting);
    }
开发者ID:pixelfanatiker,项目名称:migxmultilang,代码行数:31,代码来源:build.transport.php

示例4: array

 /**
  * CustomRequest constructor
  *
  * @param modX &$modx A reference to the modX instance.
  * @param array $config An array of configuration options. Optional.
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('customrequest.core_path', NULL, MODX_CORE_PATH . 'components/customrequest/');
     /* loads some default paths for easier management */
     $this->config = array_merge(array('corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'pluginsPath' => $corePath . 'elements/plugins/', 'configsPath' => $this->modx->getOption('customrequest.configsPath', NULL, $corePath . 'configs/'), 'debug' => $this->modx->getOption('customrequest.debug', NULL, FALSE)), $config);
     $this->requests = $this->modx->fromJson($this->config['aliases']);
 }
开发者ID:vgrish,项目名称:CustomRequest,代码行数:14,代码来源:customrequest.class.php


注:本文中的modX::fromJson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。