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


PHP modX::log方法代码示例

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


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

示例1: loadOverrides

    /**
     * A method to load some overrides, when needed, to tweak some RTEs, add some methods...
     *
     * @return void
     */
    public function loadOverrides()
    {
        if (!$this->override) {
            return;
        }
        $override = dirname(__DIR__) . "/assets/{$this->override}";
        if (!file_exists($override)) {
            $this->modx->log(\modX::LOG_LEVEL_INFO, __METHOD__ . ' override not found : ' . $override);
            return;
        }
        $data = file_get_contents($override);
        $this->modx->controller->addHtml(<<<HTML
<script>
{$data}
</script>
HTML
);
    }
开发者ID:blue148,项目名称:MODX-RTE,代码行数:23,代码来源:BaseRTE.php

示例2: __construct

 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, $config = array())
 {
     $this->modx =& $modx;
     $config = array_merge(array('firstClass' => 'first', 'lastClass' => 'last', 'hereClass' => 'active', 'parentClass' => '', 'rowClass' => '', 'outerClass' => '', 'innerClass' => '', 'levelClass' => '', 'selfClass' => '', 'webLinkClass' => '', 'limit' => 0, 'hereId' => 0), $config, array('return' => 'data'));
     if (empty($config['tplInner']) && !empty($config['tplOuter'])) {
         $config['tplInner'] = $config['tplOuter'];
     }
     if (empty($config['hereId']) && !empty($modx->resource)) {
         $config['hereId'] = $modx->resource->id;
     }
     $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true);
     if ($pdoClass = $modx->loadClass($fqn, '', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } elseif ($pdoClass = $modx->loadClass($fqn, MODX_CORE_PATH . 'components/pdotools/model/', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoFetch from "MODX_CORE_PATH/components/pdotools/model/".');
         return false;
     }
     if ($config['hereId'] && ($currentResource = $this->pdoTools->getObject('modResource', $config['hereId']))) {
         $tmp = $modx->getParentIds($currentResource['id'], 100, array('context' => $currentResource['context_key']));
         $tmp[] = $config['hereId'];
         $this->parentTree = array_flip($tmp);
     }
     $modx->lexicon->load('pdotools:pdomenu');
     return true;
 }
开发者ID:bendasvadim,项目名称:pdoTools,代码行数:31,代码来源:pdomenu.class.php

示例3: __construct

 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, $config = array())
 {
     $this->modx =& $modx;
     $fqn = $modx->getOption('pdoTools.class', null, 'pdotools.pdotools', true);
     if ($pdoClass = $modx->loadClass($fqn, '', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } elseif ($pdoClass = $modx->loadClass($fqn, MODX_CORE_PATH . 'components/pdotools/model/', false, true)) {
         $this->pdoTools = new $pdoClass($modx, $config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoTools from "MODX_CORE_PATH/components/pdotools/model/".');
         return false;
     }
     $modx->lexicon->load('pdotools:pdopage');
     return true;
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:19,代码来源:pdopage.class.php

示例4: _getByFsockopen

 /**
  * If for some reason the server does not have allow_url_fopen or cURL
  * enabled, use this function to get the file via fsockopen.
  *
  * @access protected
  * @param string $url The source URL to retrieve
  * @return string The response from the server
  */
 protected function _getByFsockopen($url)
 {
     $purl = parse_url($url);
     $host = $purl['host'];
     $path = !empty($purl['path']) ? $purl['path'] : '/';
     if (!empty($purl['query'])) {
         $path .= '?' . $purl['query'];
     }
     $port = !empty($purl['port']) ? $purl['port'] : '80';
     $timeout = 10;
     $response = '';
     $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
     if (!$fp) {
         $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not retrieve from ' . $url);
     } else {
         fwrite($fp, "GET {$path} HTTP/1.0\r\n" . "Host: {$host}\r\n" . "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n" . "Accept: */*\r\n" . "Accept-Language: en-us,en;q=0.5\r\n" . "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Referer: http://{$host}\r\n\r\n");
         while ($line = fread($fp, 4096)) {
             $response .= $line;
         }
         fclose($fp);
         $pos = strpos($response, "\r\n\r\n");
         $response = substr($response, $pos + 4);
     }
     return $response;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:33,代码来源:modtransportpackage.class.php

示例5: loadDictionary

 /**
  * Load the dictionary storage mechanism
  * @return null|fiDictionary
  */
 public function loadDictionary()
 {
     if ($this->modx->loadClass('formit.fiDictionary', $this->formit->config['modelPath'], true, true)) {
         $this->dictionary = new fiDictionary($this->formit, $this->config);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[FormIt] Could not load Dictionary class.');
     }
     return $this->dictionary;
 }
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:13,代码来源:firequest.class.php

示例6: prepareTvValue

 /**
  * Prepare a JSON encoded object and return a valid JSON encoded Image+ object
  *
  * @param $json JSON value to prepare
  * @param array $opts
  * @param modTemplateVar $tv
  * @return string
  */
 public function prepareTvValue($json, $opts = array(), modTemplateVar $tv)
 {
     // Prepare value
     $decoded = json_decode($json);
     if (!$decoded) {
         // The variable does not contain an Image+ image object
         if ($json != '') {
             // Get Media Source
             /** @var modMediaSource $source */
             if ($tv) {
                 $source = $tv->getSource($this->modx->resource ? $this->modx->resource->get('context_key') : 'mgr');
             } else {
                 $source = $this->modx->getObject('modMediaSource', $this->modx->getOption('default_media_source'));
             }
             if (!($source && $source->getWorkingContext())) {
                 $this->modx->log(xPDO::LOG_LEVEL_ERROR, 'Invalid Media Source', '', 'Image+');
                 return '';
             }
             $source->setRequestProperties($_REQUEST);
             $source->initialize();
             // The variable contains a value and has to be converted to an Image+ image object
             $imgPath = $source->getBasePath() . $json;
             if (file_exists($imgPath)) {
                 $size = getimagesize($imgPath);
             } else {
                 $this->modx->log(xPDO::LOG_LEVEL_INFO, 'The template variabe value does not contain an existing image', '', 'Image+');
             }
             $json = json_encode(array('altTag' => '', 'crop' => array('height' => $size ? $size[1] : 0, 'width' => $size ? $size[0] : 0, 'x' => 0, 'y' => 0), 'sourceImg' => array('height' => $size ? $size[1] : 0, 'width' => $size ? $size[0] : 0, 'source' => $source->get('id'), 'src' => $json), 'targetHeight' => (int) $opts['targetHeight'], 'targetWidth' => (int) $opts['targetWidth']));
         }
     }
     return $json;
 }
开发者ID:hugopeek,项目名称:ImagePlus,代码行数:40,代码来源:imageplus.class.php

示例7: loadErrorHandler

 /**
  * Loads the error handling class for the request.
  *
  * @param string $class The class to use as the error handler.
  */
 public function loadErrorHandler($class = 'modError')
 {
     if ($className = $this->modx->loadClass('error.' . $class, '', false, true)) {
         $this->modx->error = new $className($this->modx);
     } else {
         $this->modx->log(modX::LOG_LEVEL_FATAL, 'Error handling class could not be loaded: ' . $class);
     }
 }
开发者ID:semencov-com,项目名称:affiliate,代码行数:13,代码来源:modrequest.class.php

示例8: array

 /**
  * @param modX $modx
  * @param array $config
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('msprofile_core_path', $config, $this->modx->getOption('core_path') . 'components/msprofile/');
     $assetsUrl = $this->modx->getOption('msprofile_assets_url', $config, $this->modx->getOption('assets_url') . 'components/msprofile/');
     $connectorUrl = $assetsUrl . 'connector.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'templatesPath' => $corePath . 'elements/templates/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/'), $config);
     $this->modx->addPackage('msprofile', $this->config['modelPath']);
     $this->modx->lexicon->load('msprofile:default');
     if ($this->ms2 = $modx->getService('miniShop2')) {
         $this->ms2->initialize($this->modx->context->key);
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, 'msProfile requires installed miniShop2.');
     }
 }
开发者ID:bendasvadim,项目名称:msProfile,代码行数:19,代码来源:msprofile.class.php

示例9: searchAliases

 /**
  * Check if the search string starts with one of the allowed aliases and
  * prepare the url param string if successful.
  *
  * @access public
  * @param string $search A string to search the allowed aliases in
  * @return boolean
  */
 public function searchAliases($search)
 {
     // strip cultureKey i.e. in Babel installations.
     $search = preg_replace('#^' . $this->modx->cultureKey . '/(.*)#i', '$1', $search);
     $valid = false;
     // loop through the allowed aliases
     if (is_array($this->requests) && count($this->requests)) {
         foreach ($this->requests as $request) {
             // check if searched string starts with the alias
             if (0 === strpos($search, $request['alias'])) {
                 // strip alias from seached string
                 $this->urlParams = substr($search, strlen($request['alias']));
                 // set the found resource id
                 $this->resourceId = $request['resourceId'];
                 // set the found alias
                 $this->alias = $request['alias'];
                 // and set the found regEx
                 $this->regEx = $request['regEx'];
                 $valid = true;
                 break;
             }
         }
     } else {
         if ($this->getOption('debug')) {
             $this->modx->log(modX::LOG_LEVEL_INFO, 'CustomRequest Plugin: No valid configs found.');
         }
     }
     return $valid;
 }
开发者ID:Boddlnagg,项目名称:CustomRequest,代码行数:37,代码来源:customrequest.class.php

示例10: validate

 /**
  * Validates a field based on a custom rule, if specified
  *
  * @access public
  * @param string $key The key of the field
  * @param mixed $value The value of the field
  * @param string $type Optional. The type of the validator to apply. Can
  * either be a method name of rsvpmeValidator or a Snippet name.
  * @return boolean True if validation was successful. If not, will store
  * error messages to $this->errors.
  */
 public function validate($key, $value, $type = '')
 {
     $validated = false;
     $hasParams = $this->config['use_multibyte'] ? mb_strpos($type, '=', 0, $this->config['encoding']) : strpos($type, '=');
     $param = null;
     if ($hasParams !== false) {
         $len = $this->config['use_multibyte'] ? mb_strlen($type, $this->config['encoding']) : strlen($type);
         $s = $this->config['use_multibyte'] ? mb_substr($type, $hasParams + 1, $len, $this->config['encoding']) : substr($type, $hasParams + 1, $len);
         $param = str_replace('`', '', $s);
         $type = $this->config['use_multibyte'] ? mb_substr($type, 0, $hasParams, $this->config['encoding']) : substr($type, 0, $hasParams);
     }
     $invNames = array('validate', 'validateFields', '_addError', '__construct');
     if (method_exists($this, $type) && !in_array($type, $invNames)) {
         /* built-in validator */
         $validated = $this->{$type}($key, $value, $param);
     } elseif ($snippet = $this->modx->getObject('modSnippet', array('name' => $type))) {
         /* custom snippet validator */
         $props = array_merge($this->rsvpme->config, array('key' => $key, 'value' => $value, 'param' => $param, 'type' => $type, 'validator' => &$this, 'errors' => &$this->errors));
         $validated = $snippet->process($props);
     } else {
         /* no validator found */
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[RSVPMe] Could not find validator "' . $type . '" for field "' . $key . '".');
         $validated = true;
     }
     if (is_array($validated) && !empty($validated)) {
         foreach ($validated as $key => $errMsg) {
             $this->_addError($key, $errMsg);
         }
         $validated = false;
     } elseif ($validated !== '1' && $validated !== 1 && $validated !== true) {
         $this->_addError($key, $validated);
         $validated = false;
     }
     return $validated;
 }
开发者ID:josht,项目名称:RSVPMe,代码行数:46,代码来源:rsvpmevalidator.class.php

示例11: getImageURL

 /**
  * Return a scaled, cached version of the source image for front-end use
  *
  * @param string $json
  * @param array $opts
  * @param modTemplateVar $tv
  * @internal param array $params
  * @return string
  */
 public function getImageURL($json, $opts = array(), modTemplateVar $tv)
 {
     // Check system settings for crop engine override
     $engineClass = $this->modx->getOption('imageplus.crop_engine_class', null, false);
     // Do some basic intelligent sniffing
     if (!$engineClass) {
         if (CropEngines\PhpThumbsUp::engineRequirementsMet($this->modx)) {
             $engineClass = '\\ImagePlus\\CropEngines\\PhpThumbsUp';
         } else {
             if (CropEngines\PhpThumbOf::engineRequirementsMet($this->modx)) {
                 $engineClass = '\\ImagePlus\\CropEngines\\PhpThumbOf';
             }
         }
     }
     /**
      * @var ImagePlus\CropEngines\AbstractCropEngine $cropEngine
      */
     $cropEngine = new $engineClass($this->modx);
     // Check crop engine is usable
     if (!$cropEngine->engineRequirementsMet($this->modx)) {
         $this->modx->log(xPDO::LOG_LEVEL_ERROR, "Requirements not met for crop engine [{$engineClass}]", '', 'Image+');
         return 'Image+ error - requirements not met for crop engine';
     }
     return $cropEngine->getImageUrl($json, $opts, $tv);
 }
开发者ID:Bruno17,项目名称:ImagePlus,代码行数:34,代码来源:imageplus.class.php

示例12: loadHooks

 /**
  * Loads the Hooks class.
  *
  * @access public
  * @param string $type The type of hook to load.
  * @param array $config An array of configuration parameters for the
  * hooks class
  * @return siHooks An instance of the fiHooks class.
  */
 public function loadHooks($type = 'post', $config = array())
 {
     if (!$this->modx->loadClass('simplesearch.siHooks', $this->config['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[SimpleSearch] Could not load Hooks class.');
         return false;
     }
     $type = $type . 'Hooks';
     $this->{$type} = new siHooks($this, $config);
     return $this->{$type};
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:19,代码来源:simplesearch.class.php

示例13: process

 /**
  * Get a lexicon string by its index.
  *
  * @access public
  * @param string $key The key of the lexicon string.
  * @param array $params An assocative array of placeholder
  * keys and values to parse
  * @return string The text of the lexicon key, blank if not found.
  */
 public function process($key, array $params = array())
 {
     /* make sure key exists */
     if (!is_string($key) || !isset($this->_lexicon[$key])) {
         $this->modx->log(xPDO::LOG_LEVEL_DEBUG, 'Language string not found: "' . $key . '"');
         return $key;
     }
     /* if params are passed, allow for parsing of [[+key]] values to strings */
     return empty($params) ? $this->_lexicon[$key] : $this->_parse($this->_lexicon[$key], $params);
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:19,代码来源:modlexicon.class.php

示例14: loadHooks

 /**
  * Loads the Hooks class.
  *
  * @access public
  * @param $type string The type of hook to load.
  * @param $config array An array of configuration parameters for the
  * hooks class
  * @return fiHooks An instance of the fiHooks class.
  */
 public function loadHooks($type = 'post', $config = array())
 {
     if (!$this->modx->loadClass('formit.fiHooks', $this->config['modelPath'], true, true)) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[FormIt] Could not load Hooks class.');
         return false;
     }
     $typeVar = $type . 'Hooks';
     $this->{$typeVar} = new fiHooks($this, $config, $type);
     return $this->{$typeVar};
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:19,代码来源:formit.class.php

示例15: process

 /**
  * Process the response and format in the proper response format.
  *
  * @param bool $success Whether or not this response is successful.
  * @param string $message Optional. The response message.
  * @param array|xPDOObject $object Optional. The response return object.
  * @param int $status Optional. The response code.
  */
 protected function process($success = true, $message = '', $object = array(), $status = 200)
 {
     $response = array($this->getOption('responseMessageKey', 'message') => $message, $this->getOption('responseObjectKey', 'object') => is_object($object) ? $object->toArray() : $object, $this->getOption('responseSuccessKey', 'success') => $success);
     if (empty($success) && !empty($this->errors)) {
         $response[$this->getOption('responseErrorsKey', 'errors')] = $this->errors;
     }
     $this->modx->log(modX::LOG_LEVEL_DEBUG, '[REST] Sending REST response: ' . print_r($response, true));
     $this->response = $response;
     $this->responseStatus = empty($status) ? empty($success) ? $this->getOption('defaultFailureStatusCode', 200) : $this->getOption('defaultSuccessStatusCode', 200) : $status;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:18,代码来源:modrestcontroller.class.php


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