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


PHP modX::toPlaceholders方法代码示例

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


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

示例1: getUserTop

 public function getUserTop()
 {
     /* topbar profile links. Moved from class Discuss */
     if ($this->discuss->user->isLoggedIn) {
         $authphs = array('authLink' => '<a href="' . $this->discuss->request->makeUrl('logout') . '">Logout</a>');
         $authphs = array_merge($this->discuss->user->toArray('user.'), $authphs);
         $authphs['user.avatar_url'] = $this->discuss->user->getAvatarUrl();
         /* Get counts */
         $authphs['user.unread_messages_count'] = $newMessages = $this->discuss->user->countUnreadMessages();
         $authphs['user.unread_posts_count'] = $unreadPosts = $this->discuss->user->countUnreadPosts();
         $authphs['user.new_replies_count'] = $newReplies = $this->discuss->user->countNewReplies();
         $authphs['user.unanswered_questions_count'] = $unansweredQuestions = $this->discuss->user->countUnansweredQuestions();
         $authphs['user.no_replies_count'] = $noReplies = $this->discuss->user->countWithoutReplies();
         /* Format counts nicely */
         $authphs['user.unread_messages'] = $newMessages > 1 ? $this->modx->lexicon('discuss.user.new_messages', array('total' => $newMessages)) : ($newMessages == 1 ? $this->modx->lexicon('discuss.user.one_new_message') : $this->modx->lexicon('discuss.user.no_new_messages'));
         $authphs['user.unread_posts'] = $unreadPosts > 1 ? $this->modx->lexicon('discuss.user.new_posts', array('total' => $unreadPosts)) : ($unreadPosts == 1 ? $this->modx->lexicon('discuss.user.one_new_post') : $this->modx->lexicon('discuss.user.no_new_posts'));
         $authphs['user.new_replies'] = $newReplies > 1 ? $this->modx->lexicon('discuss.user.new_replies', array('total' => $newReplies)) : ($newReplies == 1 ? $this->modx->lexicon('discuss.user.one_new_reply') : $this->modx->lexicon('discuss.user.no_new_replies'));
         $authphs['user.unanswered_questions'] = $unansweredQuestions > 1 ? $this->modx->lexicon('discuss.user.unanswered_questions', array('total' => $unansweredQuestions)) : ($unansweredQuestions == 1 ? $this->modx->lexicon('discuss.user.one_unanswered_question') : $this->modx->lexicon('discuss.user.no_unanswered_questions'));
         $authphs['user.no_replies'] = $noReplies > 1 ? $this->modx->lexicon('discuss.user.no_replies', array('total' => $noReplies)) : ($noReplies == 1 ? $this->modx->lexicon('discuss.user.one_no_reply') : $this->modx->lexicon('discuss.user.no_no_replies'));
         $this->discuss->user->isGlobalModerator();
         $this->discuss->user->isAdmin();
     } else {
         $authphs = array('authLink' => '<a href="' . $this->discuss->request->makeUrl('login') . '">Login</a>', 'user.avatar_url' => '', 'user.unread_messages' => '');
     }
     $this->modx->toPlaceholders($authphs, 'discuss');
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:26,代码来源:discusscontroller.class.php

示例2: process

 /**
  * Process the template variable and return the output.
  *
  * {@inheritdoc}
  */
 public function process($properties = null, $content = null)
 {
     parent::process($properties, $content);
     if (!$this->_processed) {
         $this->_content = $this->renderOutput($this->xpdo->resourceIdentifier);
         /* copy the content source to the output buffer */
         $this->_output = $this->_content;
         if (is_string($this->_output) && !empty($this->_output)) {
             /* turn the processed properties into placeholders */
             $scope = $this->xpdo->toPlaceholders($this->_properties, '', '.', true);
             /* collect element tags in the content and process them */
             $maxIterations = intval($this->xpdo->getOption('parser_max_iterations', null, 10));
             $this->xpdo->parser->processElementTags($this->_tag, $this->_output, $this->xpdo->parser->isProcessingUncacheable(), $this->xpdo->parser->isRemovingUnprocessed(), '[[', ']]', array(), $maxIterations);
             /* remove the placeholders set from the properties of this element and restore global values */
             if (isset($scope['keys'])) {
                 $this->xpdo->unsetPlaceholders($scope['keys']);
             }
             if (isset($scope['restore'])) {
                 $this->xpdo->toPlaceholders($scope['restore']);
             }
         }
         /* apply output filtering */
         $this->filterOutput();
         /* cache the content */
         $this->cache();
         $this->_processed = true;
     }
     $this->xpdo->parser->setProcessingElement(false);
     /* finally, return the processed element content */
     return $this->_output;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:36,代码来源:modtemplatevar.class.php

示例3: processErrors

 /**
  * Process the errors that have occurred and setup the appropriate placeholders
  * @return void
  */
 public function processErrors()
 {
     $this->modx->toPlaceholders($this->getErrors(), $this->config['placeholderPrefix'] . 'error');
     $bulkErrTpl = $this->getOption('validationErrorBulkTpl');
     $errs = array();
     foreach ($this->getRawErrors() as $field => $err) {
         $errs[] = str_replace(array('[[+field]]', '[[+error]]'), array($field, $err), $bulkErrTpl);
     }
     $errs = implode($this->getOption('validationErrorBulkSeparator'), $errs);
     $validationErrorMessage = str_replace('[[+errors]]', $errs, $this->getOption('validationErrorMessage'));
     $this->modx->setPlaceholder($this->getOption('placeholderPrefix') . 'validation_error', true);
     $this->modx->setPlaceholder($this->getOption('placeholderPrefix') . 'validation_error_message', $validationErrorMessage);
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:17,代码来源:fivalidator.class.php

示例4: processErrors

 /**
  * Process the errors that have occurred and setup the appropriate placeholders
  * @return void
  */
 public function processErrors()
 {
     $this->modx->toPlaceholders($this->getErrors(), $this->config['placeholderPrefix'] . 'error');
     $errs = array();
     foreach ($this->getRawErrors() as $field => $err) {
         $err = $field . ': ' . $err;
         $errs[] = str_replace('[[+error]]', $err, $this->config['validationErrorBulkTpl']);
     }
     $errs = implode($this->config['validationErrorBulkSeparator'], $errs);
     $validationErrorMessage = str_replace('[[+errors]]', $errs, $this->config['validationErrorMessage']);
     $this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'validation_error', true);
     $this->modx->setPlaceholder($this->config['placeholderPrefix'] . 'validation_error_message', $validationErrorMessage);
 }
开发者ID:DeFi-ManriquezLuis,项目名称:MTLTransfer,代码行数:17,代码来源:loginvalidator.class.php

示例5: gatherFields

 /**
  * Gather fields and set them into placeholders for pre-fetching
  * @return array
  */
 public function gatherFields()
 {
     if (empty($this->fields)) {
         return array();
     }
     $fs = $this->getValues();
     /* better handling of checkbox values when input name is an array[] */
     foreach ($fs as $f => $v) {
         if (is_array($v)) {
             $v = implode(',', $v);
         }
         $fs[$f] = $v;
     }
     $this->modx->toPlaceholders($fs, $this->config['placeholderPrefix'], '');
     return $this->getValues();
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:20,代码来源:fihooks.class.php

示例6: toPlaceholders

 /**
  * @param $subject
  * @param string $prefix
  * @param string $separator
  * @param bool|false $restore
  *
  * @return array
  */
 public function toPlaceholders($subject, $prefix = '', $separator = '.', $restore = false)
 {
     return $this->modx->toPlaceholders($subject, $prefix, $separator, $restore);
 }
开发者ID:suasti,项目名称:pdoTools,代码行数:12,代码来源:_micromodx.php


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