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


PHP modX::invokeEvent方法代码示例

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


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

示例1: __construct

 /**
  * FenomX constructor.
  *
  * @param pdoTools $pdoTools
  */
 public function __construct(pdoTools $pdoTools)
 {
     if (!class_exists('modChunkProvider')) {
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModChunk.php';
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModTemplate.php';
         require dirname(dirname(__FILE__)) . '/fenom/Providers/ModFile.php';
     }
     $provider = new modChunkProvider($pdoTools);
     parent::__construct($provider);
     $this->setCompileDir(rtrim($pdoTools->config['cachePath'], '/') . '/file');
     $this->addProvider('template', new modTemplateProvider($pdoTools));
     $this->addProvider('file', new modFileProvider($pdoTools));
     $default_options = array('disable_cache' => !$pdoTools->config['useFenomCache'], 'force_compile' => !$pdoTools->config['useFenomCache'], 'force_include' => !$pdoTools->config['useFenomCache'], 'auto_reload' => $pdoTools->config['useFenomCache']);
     if ($options = $pdoTools->modx->fromJSON($pdoTools->modx->getOption('pdotools_fenom_options'))) {
         $options = array_merge($default_options, $options);
     } else {
         $options = $default_options;
     }
     if (!$pdoTools->config['useFenomPHP']) {
         $this->removeAccessor('php');
         $options['disable_native_funcs'] = true;
     }
     $this->setOptions($options);
     $this->pdoTools = $pdoTools;
     $this->modx = $pdoTools->modx;
     $this->_addDefaultModifiers();
     $this->modx->invokeEvent('pdoToolsOnFenomInit', array('fenom' => $this, 'config' => $pdoTools->config));
 }
开发者ID:Jako,项目名称:pdoTools,代码行数:33,代码来源:_fenom.php

示例2: processElementTags

 /**
  * Collects and processes any set of tags as defined by a prefix and suffix.
  *
  * @param string $parentTag The tag representing the element processing this
  * tag.  Pass an empty string to allow parsing without this recursion check.
  * @param string $content The content to process and act on (by reference).
  * @param boolean $processUncacheable Determines if noncacheable tags are to
  * be processed (default= false).
  * @param boolean $removeUnprocessed Determines if unprocessed tags should
  * be left in place in the content, or stripped out (default= false).
  * @param string $prefix The characters that define the start of a tag
  * (default= "[[").
  * @param string $suffix The characters that define the end of a tag
  * (default= "]]").
  * @param array $tokens Indicates that the parser should only process tags
  * with the tokens included in this array.
  * @param integer $depth The maximum iterations to recursively process tags
  * returned by prior passes, 0 by default.
  * @return int The number of processed tags
  */
 public function processElementTags($parentTag, &$content, $processUncacheable = false, $removeUnprocessed = false, $prefix = "[[", $suffix = "]]", $tokens = array(), $depth = 0)
 {
     $_processingTag = $this->_processingTag;
     $_processingUncacheable = $this->_processingUncacheable;
     $_removingUnprocessed = $this->_removingUnprocessed;
     $this->_processingTag = true;
     $this->_processingUncacheable = (bool) $processUncacheable;
     $this->_removingUnprocessed = (bool) $removeUnprocessed;
     $depth = $depth > 0 ? $depth - 1 : 0;
     $processed = 0;
     $tags = array();
     /* invoke OnParseDocument event */
     $this->modx->documentOutput = $content;
     $this->modx->invokeEvent('OnParseDocument', array('content' => &$content));
     $content = $this->modx->documentOutput;
     unset($this->modx->documentOutput);
     if ($collected = $this->collectElementTags($content, $tags, $prefix, $suffix, $tokens)) {
         $tagMap = array();
         foreach ($tags as $tag) {
             $token = substr($tag[1], 0, 1);
             if (!$processUncacheable && $token === '!') {
                 if ($removeUnprocessed) {
                     $tagMap[$tag[0]] = '';
                 }
             } elseif (!empty($tokens) && !in_array($token, $tokens)) {
                 $collected--;
                 continue;
             }
             if ($tag[0] === $parentTag) {
                 $tagMap[$tag[0]] = '';
                 $processed++;
                 continue;
             }
             $tagOutput = $this->processTag($tag, $processUncacheable);
             if (($tagOutput === null || $tagOutput === false) && $removeUnprocessed) {
                 $tagMap[$tag[0]] = '';
                 $processed++;
             } elseif ($tagOutput !== null && $tagOutput !== false) {
                 $tagMap[$tag[0]] = $tagOutput;
                 if ($tag[0] !== $tagOutput) {
                     $processed++;
                 }
             }
         }
         $this->mergeTagOutput($tagMap, $content);
         if ($depth > 0) {
             $processed += $this->processElementTags($parentTag, $content, $processUncacheable, $removeUnprocessed, $prefix, $suffix, $tokens, $depth);
         }
     }
     $this->_removingUnprocessed = $_removingUnprocessed;
     $this->_processingUncacheable = $_processingUncacheable;
     $this->_processingTag = $_processingTag;
     return $processed;
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:74,代码来源:modparser.class.php

示例3: changePassword

 /**
  * Change the user password.
  *
  * @access public
  * @param string $newPassword Password to set.
  * @param string $oldPassword Current password for validation.
  * @return boolean Indicates if password was successfully changed.
  * @todo Add support for configurable password encoding.
  */
 public function changePassword($newPassword, $oldPassword)
 {
     $changed = false;
     if ($this->passwordMatches($oldPassword)) {
         if (!empty($newPassword)) {
             $this->set('password', $newPassword);
             $changed = $this->save();
             if ($changed) {
                 $this->xpdo->invokeEvent('OnUserChangePassword', array('user' => &$this, 'newpassword' => $newPassword, 'oldpassword' => $oldPassword, 'userid' => $this->get('id'), 'username' => $this->get('username'), 'userpassword' => $newPassword));
             }
         }
     }
     return $changed;
 }
开发者ID:e-gob,项目名称:chilesinpapeleo-ayuda,代码行数:23,代码来源:moduser.class.php

示例4: getElement

 /**
  * Get a modElement instance taking advantage of the modX::$sourceCache.
  *
  * @param string $class The modElement derivative class to load.
  * @param string $name An element name or raw tagName to identify the modElement instance.
  * @return modElement|null An instance of the specified modElement derivative class.
  */
 public function getElement($class, $name)
 {
     $realname = $this->realname($name);
     if (array_key_exists($class, $this->modx->sourceCache) && array_key_exists($realname, $this->modx->sourceCache[$class])) {
         /** @var modElement $element */
         $element = $this->modx->newObject($class);
         $element->fromArray($this->modx->sourceCache[$class][$realname]['fields'], '', true, true);
         $element->setPolicies($this->modx->sourceCache[$class][$realname]['policies']);
         if (!empty($this->modx->sourceCache[$class][$realname]['source'])) {
             if (!empty($this->modx->sourceCache[$class][$realname]['source']['class_key'])) {
                 $sourceClassKey = $this->modx->sourceCache[$class][$realname]['source']['class_key'];
                 $this->modx->loadClass('sources.modMediaSource');
                 /* @var modMediaSource $source */
                 $source = $this->modx->newObject($sourceClassKey);
                 $source->fromArray($this->modx->sourceCache[$class][$realname]['source'], '', true, true);
                 $element->addOne($source, 'Source');
             }
         }
     } else {
         /** @var modElement $element */
         $element = $this->modx->getObjectGraph($class, array('Source' => array()), array('name' => $realname), true);
         if ($element && array_key_exists($class, $this->modx->sourceCache)) {
             $this->modx->sourceCache[$class][$realname] = array('fields' => $element->toArray(), 'policies' => $element->getPolicies(), 'source' => $element->Source ? $element->Source->toArray() : array());
         } elseif (!$element) {
             $evtOutput = $this->modx->invokeEvent('OnElementNotFound', array('class' => $class, 'name' => $realname));
             $element = false;
             if ($evtOutput != false) {
                 foreach ((array) $evtOutput as $elm) {
                     if (!empty($elm) && is_string($elm)) {
                         $element = $this->modx->newObject($class, array('name' => $realname, 'snippet' => $elm));
                     } elseif ($elm instanceof modElement) {
                         $element = $elm;
                     }
                     if ($element) {
                         break;
                     }
                 }
             }
         }
     }
     if ($element instanceof modElement) {
         $element->set('name', $name);
     }
     return $element;
 }
开发者ID:OptimusCrime,项目名称:revolution,代码行数:52,代码来源:modparser.class.php

示例5: getRenderDirectories

 /**
  * Finds the correct directories for renders
  *
  * @param string $event The plugin event to fire
  * @param string $subdir The subdir to search
  * @return array The found render directories
  */
 public function getRenderDirectories($event, $subdir)
 {
     $context = $this->xpdo->context->get('key');
     $renderPath = $this->xpdo->getOption('processors_path') . 'element/tv/renders/' . $context . '/' . $subdir . '/';
     $renderDirectories = array($renderPath, $this->xpdo->getOption('processors_path') . 'element/tv/renders/' . ($subdir == 'input' ? 'mgr' : 'web') . '/' . $subdir . '/');
     $pluginResult = $this->xpdo->invokeEvent($event, array('context' => $context));
     $pathsKey = serialize($pluginResult) . $context . $event . $subdir;
     /* return cached value if exists */
     if (isset(self::$_renderPaths[$pathsKey])) {
         return self::$_renderPaths[$pathsKey];
     }
     /* process if there is no cached value */
     if (!is_array($pluginResult) && !empty($pluginResult)) {
         $pluginResult = array($pluginResult);
     }
     if (!empty($pluginResult)) {
         foreach ($pluginResult as $result) {
             if (empty($result)) {
                 continue;
             }
             $renderDirectories[] = $result;
         }
     }
     /* search directories */
     $renderPaths = array();
     foreach ($renderDirectories as $renderDirectory) {
         if (empty($renderDirectory) || !is_dir($renderDirectory)) {
             continue;
         }
         try {
             $dirIterator = new DirectoryIterator($renderDirectory);
             foreach ($dirIterator as $file) {
                 if (!$file->isReadable() || !$file->isFile()) {
                     continue;
                 }
                 $renderPaths[] = dirname($file->getPathname()) . '/';
             }
         } catch (UnexpectedValueException $e) {
         }
     }
     self::$_renderPaths[$pathsKey] = array_unique($renderPaths);
     return self::$_renderPaths[$pathsKey];
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:50,代码来源:modtemplatevar.class.php

示例6: invokeEvent

 /**
  * Shorthand for original modX::invokeEvent() method with some useful additions.
  *
  * @param $eventName
  * @param array $params
  * @param $glue
  *
  * @return array
  */
 public function invokeEvent($eventName, array $params = array(), $glue = '<br/>')
 {
     if (isset($this->modx->event->returnedValues)) {
         $this->modx->event->returnedValues = null;
     }
     $response = $this->modx->invokeEvent($eventName, $params);
     if (is_array($response) && count($response) > 1) {
         foreach ($response as $k => $v) {
             if (empty($v)) {
                 unset($response[$k]);
             }
         }
     }
     $message = is_array($response) ? implode($glue, $response) : trim((string) $response);
     if (isset($this->modx->event->returnedValues) && is_array($this->modx->event->returnedValues)) {
         $params = array_merge($params, $this->modx->event->returnedValues);
     }
     return array('success' => empty($message), 'message' => $message, 'data' => $params);
 }
开发者ID:bendasvadim,项目名称:miniShop2,代码行数:28,代码来源:minishop2.class.php

示例7: load

 /**
  * Instantiate the appropriate RTE class/handler
  *
  * @return void
  */
 public function load()
 {
     $this->editor = str_replace(' ', '', $this->getEditorName());
     if (!$this->editor || empty($this->editor)) {
         return;
     }
     $supported = $this->getSupportedRTEs();
     if (in_array($this->editor, $supported)) {
         $this->rtePrefix = $this->getRTEPrefix();
         $editor = '\\Melting\\MODX\\RTE\\Type\\' . $this->editor;
         /** @var BaseRTE $rte */
         $rte = new $editor($this);
         $options = $rte->getOptions();
         $result = $this->modx->invokeEvent('OnRichTextEditorInit', $options);
         if (!empty($result)) {
             if (is_array($result)) {
                 $result = implode('', $result);
             }
             $this->modx->controller->addHtml($result);
         }
         $rte->loadOverrides();
     }
 }
开发者ID:blue148,项目名称:MODX-RTE,代码行数:28,代码来源:Loader.php

示例8: getRenderDirectories

 /**
  * Finds the correct directories for renders
  *
  * @param string $event The plugin event to fire
  * @param string $subdir The subdir to search
  * @return array The found render directories
  */
 public function getRenderDirectories($event, $subdir)
 {
     $renderPath = $this->xpdo->getOption('processors_path') . 'element/tv/renders/' . $this->xpdo->context->get('key') . '/' . $subdir . '/';
     $renderDirectories = array($renderPath, $this->xpdo->getOption('processors_path') . 'element/tv/renders/' . ($subdir == 'input' ? 'mgr' : 'web') . '/' . $subdir . '/');
     $pluginResult = $this->xpdo->invokeEvent($event, array('context' => $this->xpdo->context->get('key')));
     if (!is_array($pluginResult) && !empty($pluginResult)) {
         $pluginResult = array($pluginResult);
     }
     if (!empty($pluginResult)) {
         foreach ($pluginResult as $result) {
             if (empty($result)) {
                 continue;
             }
             $renderDirectories[] = $result;
         }
     }
     /* search directories */
     $types = array();
     $renderPaths = array();
     foreach ($renderDirectories as $renderDirectory) {
         if (empty($renderDirectory) || !is_dir($renderDirectory)) {
             continue;
         }
         try {
             $dirIterator = new DirectoryIterator($renderDirectory);
             foreach ($dirIterator as $file) {
                 if (!$file->isReadable() || !$file->isFile()) {
                     continue;
                 }
                 $renderPaths[] = dirname($file->getPathname()) . '/';
             }
         } catch (UnexpectedValueException $e) {
         }
     }
     $renderPaths = array_unique($renderPaths);
     return $renderPaths;
 }
开发者ID:semencov-com,项目名称:affiliate,代码行数:44,代码来源:modtemplatevar.class.php

示例9: getProperties

 /**
  * Get the properties on this source
  * @param boolean $parsed
  * @return array
  */
 public function getProperties($parsed = false)
 {
     $properties = $this->get('properties');
     $defaultProperties = $this->getDefaultProperties();
     if (!empty($properties) && is_array($properties)) {
         foreach ($properties as &$property) {
             $property['overridden'] = 0;
             if (array_key_exists($property['name'], $defaultProperties)) {
                 if ($defaultProperties[$property['name']]['value'] != $property['value']) {
                     $property['overridden'] = 1;
                 }
             } else {
                 $property['overridden'] = 2;
             }
         }
         $properties = array_merge($defaultProperties, $properties);
     } else {
         $properties = $defaultProperties;
     }
     /** @var array $results Allow manipulation of media source properties via event */
     $results = $this->xpdo->invokeEvent('OnMediaSourceGetProperties', array('properties' => $this->xpdo->toJSON($properties)));
     if (!empty($results)) {
         foreach ($results as $result) {
             $result = is_array($result) ? $result : $this->xpdo->fromJSON($result);
             $properties = array_merge($properties, $result);
         }
     }
     if ($parsed) {
         $properties = $this->parseProperties($properties);
     }
     return $this->prepareProperties($properties);
 }
开发者ID:WhisperingTree,项目名称:blog,代码行数:37,代码来源:modmediasource.class.php

示例10: getResource


//.........这里部分代码省略.........
     } else {
         $resourceId = $identifier;
     }
     if (!is_numeric($resourceId)) {
         $this->modx->sendErrorPage();
     }
     $isForward = array_key_exists('forward', $options) && !empty($options['forward']);
     $fromCache = false;
     $cacheKey = $this->modx->context->get('key') . "/resources/{$resourceId}";
     $cachedResource = $this->modx->cacheManager->get($cacheKey, array(xPDO::OPT_CACHE_KEY => $this->modx->getOption('cache_resource_key', null, 'resource'), xPDO::OPT_CACHE_HANDLER => $this->modx->getOption('cache_resource_handler', null, $this->modx->getOption(xPDO::OPT_CACHE_HANDLER)), xPDO::OPT_CACHE_FORMAT => (int) $this->modx->getOption('cache_resource_format', null, $this->modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))));
     if (is_array($cachedResource) && array_key_exists('resource', $cachedResource) && is_array($cachedResource['resource'])) {
         /** @var modResource $resource */
         $resource = $this->modx->newObject($cachedResource['resourceClass']);
         if ($resource) {
             $resource->fromArray($cachedResource['resource'], '', true, true, true);
             $resource->_content = $cachedResource['resource']['_content'];
             $resource->_isForward = isset($cachedResource['resource']['_isForward']) && !empty($cachedResource['resource']['_isForward']);
             if (isset($cachedResource['contentType'])) {
                 $contentType = $this->modx->newObject('modContentType');
                 $contentType->fromArray($cachedResource['contentType'], '', true, true, true);
                 $resource->addOne($contentType, 'ContentType');
             }
             if (isset($cachedResource['resourceGroups'])) {
                 $rGroups = array();
                 foreach ($cachedResource['resourceGroups'] as $rGroupKey => $rGroup) {
                     $rGroups[$rGroupKey] = $this->modx->newObject('modResourceGroupResource', $rGroup);
                 }
                 $resource->addMany($rGroups);
             }
             if (isset($cachedResource['policyCache'])) {
                 $resource->setPolicies(array($this->modx->context->get('key') => $cachedResource['policyCache']));
             }
             if (isset($cachedResource['elementCache'])) {
                 $this->modx->elementCache = $cachedResource['elementCache'];
             }
             if (isset($cachedResource['sourceCache'])) {
                 $this->modx->sourceCache = $cachedResource['sourceCache'];
             }
             if ($resource->get('_jscripts')) {
                 $this->modx->jscripts = $this->modx->jscripts + $resource->get('_jscripts');
             }
             if ($resource->get('_sjscripts')) {
                 $this->modx->sjscripts = $this->modx->sjscripts + $resource->get('_sjscripts');
             }
             if ($resource->get('_loadedjscripts')) {
                 $this->modx->loadedjscripts = array_merge($this->modx->loadedjscripts, $resource->get('_loadedjscripts'));
             }
             $isForward = $resource->_isForward;
             $resource->setProcessed(true);
             $fromCache = true;
         }
     }
     if (!$fromCache || !is_object($resource)) {
         $criteria = $this->modx->newQuery('modResource');
         $criteria->select(array($this->modx->escape('modResource') . '.*'));
         $criteria->where(array('id' => $resourceId, 'deleted' => '0'));
         if (!$this->modx->hasPermission('view_unpublished') || $this->modx->getSessionState() !== modX::SESSION_STATE_INITIALIZED) {
             $criteria->where(array('published' => 1));
         }
         if ($resource = $this->modx->getObject('modResource', $criteria)) {
             if ($resource instanceof modResource) {
                 if ($resource->get('context_key') !== $this->modx->context->get('key')) {
                     if (!$isForward || $isForward && !$this->modx->getOption('allow_forward_across_contexts', $options, false)) {
                         if (!$this->modx->getCount('modContextResource', array($this->modx->context->get('key'), $resourceId))) {
                             return null;
                         }
                     }
                 }
                 $resource->_isForward = $isForward;
                 if (!$resource->checkPolicy('view')) {
                     $this->modx->sendUnauthorizedPage();
                 }
                 if ($tvs = $resource->getMany('TemplateVars', 'all')) {
                     /** @var modTemplateVar $tv */
                     foreach ($tvs as $tv) {
                         $resource->set($tv->get('name'), array($tv->get('name'), $tv->getValue($resource->get('id')), $tv->get('display'), $tv->get('display_params'), $tv->get('type')));
                     }
                 }
                 $this->modx->resourceGenerated = true;
             }
         }
     } elseif ($fromCache && $resource instanceof modResource && !$resource->get('deleted')) {
         if ($resource->checkPolicy('load') && ($resource->get('published') || $this->modx->getSessionState() === modX::SESSION_STATE_INITIALIZED && $this->modx->hasPermission('view_unpublished'))) {
             if ($resource->get('context_key') !== $this->modx->context->get('key')) {
                 if (!$isForward || $isForward && !$this->modx->getOption('allow_forward_across_contexts', $options, false)) {
                     if (!$this->modx->getCount('modContextResource', array($this->modx->context->get('key'), $resourceId))) {
                         return null;
                     }
                 }
             }
             if (!$resource->checkPolicy('view')) {
                 $this->modx->sendUnauthorizedPage();
             }
         } else {
             return null;
         }
         $this->modx->invokeEvent('OnLoadWebPageCache');
     }
     return $resource;
 }
开发者ID:semencov-com,项目名称:affiliate,代码行数:101,代码来源:modrequest.class.php

示例11: outputContent

 /**
  * Prepare the final response after the resource has been processed.
  *
  * @param array $options Various options that can be set.
  */
 public function outputContent(array $options = array())
 {
     if (!($this->contentType = $this->modx->resource->getOne('ContentType'))) {
         if ($this->modx->getDebug() === true) {
             $this->modx->log(modX::LOG_LEVEL_DEBUG, "No valid content type for RESOURCE: " . print_r($this->modx->resource->toArray(), true));
         }
         $this->modx->log(modX::LOG_LEVEL_FATAL, "The requested resource has no valid content type specified.");
     }
     if (!$this->contentType->get('binary')) {
         $this->modx->resource->_output = $this->modx->resource->process();
         $this->modx->resource->_jscripts = $this->modx->jscripts;
         $this->modx->resource->_sjscripts = $this->modx->sjscripts;
         $this->modx->resource->_loadedjscripts = $this->modx->loadedjscripts;
         /* collect any uncached element tags in the content and process them */
         $this->modx->getParser();
         $maxIterations = intval($this->modx->getOption('parser_max_iterations', $options, 10));
         $this->modx->parser->processElementTags('', $this->modx->resource->_output, true, false, '[[', ']]', array(), $maxIterations);
         $this->modx->parser->processElementTags('', $this->modx->resource->_output, true, true, '[[', ']]', array(), $maxIterations);
         /*FIXME: only do this for HTML content ?*/
         if (strpos($this->contentType->get('mime_type'), 'text/html') !== false) {
             /* Insert Startup jscripts & CSS scripts into template - template must have a </head> tag */
             if (($js = $this->modx->getRegisteredClientStartupScripts()) && strpos($this->modx->resource->_output, '</head>') !== false) {
                 /* change to just before closing </head> */
                 $this->modx->resource->_output = preg_replace("/(<\\/head>)/i", $js . "\n\\1", $this->modx->resource->_output, 1);
             }
             /* Insert jscripts & html block into template - template must have a </body> tag */
             if (strpos($this->modx->resource->_output, '</body>') !== false && ($js = $this->modx->getRegisteredClientScripts())) {
                 $this->modx->resource->_output = preg_replace("/(<\\/body>)/i", $js . "\n\\1", $this->modx->resource->_output, 1);
             }
         }
         $this->modx->beforeRender();
         /* invoke OnWebPagePrerender event */
         if (!isset($options['noEvent']) || empty($options['noEvent'])) {
             $this->modx->invokeEvent('OnWebPagePrerender');
         }
         $totalTime = $this->modx->getMicroTime() - $this->modx->startTime;
         $queryTime = $this->modx->queryTime;
         $queryTime = sprintf("%2.4f s", $queryTime);
         $queries = isset($this->modx->executedQueries) ? $this->modx->executedQueries : 0;
         $totalTime = sprintf("%2.4f s", $totalTime);
         $phpTime = $totalTime - $queryTime;
         $phpTime = sprintf("%2.4f s", $phpTime);
         $source = $this->modx->resourceGenerated ? "database" : "cache";
         $this->modx->resource->_output = str_replace("[^q^]", $queries, $this->modx->resource->_output);
         $this->modx->resource->_output = str_replace("[^qt^]", $queryTime, $this->modx->resource->_output);
         $this->modx->resource->_output = str_replace("[^p^]", $phpTime, $this->modx->resource->_output);
         $this->modx->resource->_output = str_replace("[^t^]", $totalTime, $this->modx->resource->_output);
         $this->modx->resource->_output = str_replace("[^s^]", $source, $this->modx->resource->_output);
     } else {
         $this->modx->beforeRender();
         /* invoke OnWebPagePrerender event */
         if (!isset($options['noEvent']) || empty($options['noEvent'])) {
             $this->modx->invokeEvent("OnWebPagePrerender");
         }
     }
     /* send out content-type, content-disposition, and custom headers from the content type */
     if ($this->modx->getOption('set_header')) {
         $type = $this->contentType->get('mime_type') ? $this->contentType->get('mime_type') : 'text/html';
         $header = 'Content-Type: ' . $type;
         if (!$this->contentType->get('binary')) {
             $charset = $this->modx->getOption('modx_charset', null, 'UTF-8');
             $header .= '; charset=' . $charset;
         }
         header($header);
         if (!$this->checkPreview()) {
             $dispositionSet = false;
             if ($customHeaders = $this->contentType->get('headers')) {
                 foreach ($customHeaders as $headerKey => $headerString) {
                     header($headerString);
                     if (strpos($headerString, 'Content-Disposition:') !== false) {
                         $dispositionSet = true;
                     }
                 }
             }
             if (!$dispositionSet && $this->modx->resource->get('content_dispo')) {
                 if ($alias = array_search($this->modx->resourceIdentifier, $this->modx->aliasMap)) {
                     $name = basename($alias);
                 } elseif ($this->modx->resource->get('alias')) {
                     $name = $this->modx->resource->get('alias');
                     if ($ext = $this->contentType->getExtension()) {
                         $name .= ".{$ext}";
                     }
                 } elseif ($name = $this->modx->resource->get('pagetitle')) {
                     $name = $this->modx->resource->cleanAlias($name);
                     if ($ext = $this->contentType->getExtension()) {
                         $name .= ".{$ext}";
                     }
                 } else {
                     $name = 'download';
                     if ($ext = $this->contentType->getExtension()) {
                         $name .= ".{$ext}";
                     }
                 }
                 $header = 'Cache-Control: public';
                 header($header);
//.........这里部分代码省略.........
开发者ID:semencov-com,项目名称:affiliate,代码行数:101,代码来源:modresponse.class.php

示例12: parseSignature

 /**
  * Parse and return the signature for this user
  * @return string
  */
 public function parseSignature()
 {
     $message = $this->get('signature');
     $maxLength = $this->xpdo->getOption('discuss.signatures.max_length', null, 2000);
     if (strlen($message) > $maxLength) {
         $message = substr($message, 0, $maxLength);
     }
     if (!empty($message)) {
         $message = str_replace(array('&#91;', '&#93;'), array('[', ']'), $message);
         /* Check custom content parser setting */
         if ($this->xpdo->getOption('discuss.use_custom_post_parser', null, false)) {
             /* Load custom parser */
             $parsed = $this->xpdo->invokeEvent('OnDiscussPostCustomParser', array('content' => &$message));
             if (is_array($parsed)) {
                 foreach ($parsed as $msg) {
                     if (!empty($msg)) {
                         $message = $msg;
                     }
                 }
             } else {
                 if (!empty($parsed)) {
                     $message = $parsed;
                 }
             }
         } else {
             if (true) {
                 $message = $this->parseBBCode($message);
             }
         }
         /* Allow for plugin to change content of posts after it has been parsed */
         $rs = $this->xpdo->invokeEvent('OnDiscussPostFetchContent', array('content' => &$message));
         if (is_array($rs)) {
             foreach ($rs as $msg) {
                 if (!empty($msg)) {
                     $message = $msg;
                 }
             }
         } else {
             if (!empty($rs)) {
                 $message = $rs;
             }
         }
     }
     return $message;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:49,代码来源:disuser.class.php

示例13: dirname

 * Shopkeeper frontend connector
 *
 * @package shopkeeper
 */
//ini_set( 'display_errors', 1 );
//error_reporting( E_ALL );
//if( !isset( $_POST['shk_action'] ) ) exit;
require dirname(dirname(dirname(dirname(__FILE__)))) . "/config.core.php";
if (!defined('MODX_CORE_PATH')) {
    require_once '../../../config.core.php';
}
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->invokeEvent("OnLoadWebDocument");
define('SHOPKEEPER_PATH', MODX_BASE_PATH . "core/components/shopkeeper3/");
define('SHOPKEEPER_URL', MODX_BASE_URL . "core/components/shopkeeper3/");
$manager_language = $modx->config['manager_language'];
$charset = $modx->config['modx_charset'];
header("Content-Type: text/html; charset={$charset}");
require_once SHOPKEEPER_PATH . "model/shopkeeper.class.php";
//Определяем параметры сниппета Shopkeeper
$sys_property_sets = $modx->getOption('shk3.property_sets', null, 'default');
$sys_property_sets = explode(',', $sys_property_sets);
$sys_property_sets = array_map('trim', $sys_property_sets);
$propertySerNum = isset($_POST['psn']) && is_numeric($_POST['psn']) ? intval($_POST['psn']) : 1;
$propertySetName = isset($sys_property_sets[$propertySerNum - 1]) ? $sys_property_sets[$propertySerNum - 1] : $sys_property_sets[0];
$snippet = $modx->getObject('modSnippet', array('name' => 'Shopkeeper3'));
$properties = $snippet->getProperties();
if ($propertySetName != 'default' && $modx->getCount('modPropertySet', array('name' => $propertySetName)) > 0) {
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:31,代码来源:connector_fe.php

示例14: modX

     $modx = new modX();
     $modx->initialize('web');
     $modx->addPackage('shopkeeper3', $modx->getOption('core_path') . 'components/shopkeeper3/model/');
     $order_id = $_POST['m_orderid'];
     $order = $modx->getObject('shk_order', $order_id);
     if (!(isset($order) && $order > 0)) {
         $message .= "ордер не существует\n";
         $err = true;
     } else {
         // проверка статуса
         switch ($_POST['m_status']) {
             case 'success':
                 $status = 5;
                 $change_status = $order->set('status', $status);
                 $order->save();
                 $modx->invokeEvent('OnSHKChangeStatus', array('order_id' => $order_id, 'status' => $status));
                 break;
             default:
                 $message .= " - статус платежа не является success\n";
                 $err = true;
                 break;
         }
     }
 }
 if ($err) {
     $to = PAYEER_EMAILERR;
     if (!empty($to)) {
         $message = "Не удалось провести платёж через систему Payeer по следующим причинам:\n\n" . $message . "\n" . $log_text;
         $headers = "From: no-reply@" . $_SERVER['HTTP_HOST'] . "\r\n" . "Content-type: text/plain; charset=utf-8 \r\n";
         mail($to, 'Ошибка оплаты', $message, $headers);
     }
开发者ID:dldemoks,项目名称:Modx-Revolution-2.4.2-pl-Shopkeeper-3.2.3-pl,代码行数:31,代码来源:payeer_status.php

示例15: tagManagerBase

//get resource
$criteria = $modx->newQuery('modResource');
$criteria->select(array($modx->escape('modResource') . '.*'));
$criteria->where(array('id' => $resource_id, 'deleted' => false, 'published' => true));
$modx->resource = $modx->getObject('modResource', $criteria);
if (!is_object($modx->resource) || !$modx->resource->checkPolicy('view')) {
    echo json_encode($output);
    exit;
}
$modx->resourceIdentifier = $modx->resource->get('id');
$modx->getService('error', 'error.modError');
$modx->getRequest();
$modx->getParser();
$modx->resourceMethod = 'id';
$modx->resource->_contextKey = $modx->context->get('key');
$modx->invokeEvent('OnLoadWebDocument');
require_once MODX_CORE_PATH . "components/tag_manager2/model/tm_base.class.php";
$tag_manager = new tagManagerBase($modx);
$properties = $tag_manager->getSnippetProperties();
$output['prod_list'] = $modx->runSnippet('tmCatalog', $properties);
$output['prod_list'] .= '<div class="clearfix"></div>';
$output['onPageLimit'] = intval($properties['limit']);
if (isset($modx->placeholders[$properties['pageNavVar']])) {
    $output['pages'] = $modx->placeholders[$properties['pageNavVar']];
    if (isset($modx->sanitizePatterns['tags1'])) {
        $output['pages'] = preg_replace($modx->sanitizePatterns['tags1'], '', $output['pages']);
    }
    if (isset($modx->sanitizePatterns['tags2'])) {
        $output['pages'] = preg_replace($modx->sanitizePatterns['tags2'], '', $output['pages']);
    }
}
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:31,代码来源:ajax_resources.php


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