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


PHP XenForo_Helper_String::censorString方法代码示例

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


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

示例1: filterString

 /**
  * Default, empty string filterer.
  *
  * @see XenForo_BbCode_Formatter_Base::filterString()
  */
 public function filterString($string, array $rendererStates)
 {
     if ($this->_censorString) {
         $string = XenForo_Helper_String::censorString($string);
     }
     return $string;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:12,代码来源:Abstract.php

示例2: renderTagCode

 public function renderTagCode(array $tag, array $rendererStates)
 {
     if (strtolower(strval($tag['option'])) == 'html') {
         $tag['option'] = 'html5';
     }
     if (!$tag['option']) {
         $tag['option'] = 'text';
     }
     $content = $this->stringifyTree($tag['children']);
     $content = XenForo_Helper_String::censorString($content);
     $geshi = new GeSHi($content, $tag['option']);
     if (XenForo_Application::get('options')->get('dpSyntaxHighlighterShowLines')) {
         $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
     }
     $geshi->set_link_target('_blank" rel="nofollow');
     $geshi->set_header_type(GESHI_HEADER_NONE);
     $geshi->set_tab_width(4);
     $content = $geshi->parse_code();
     if ($this->_view) {
         $template = $this->_view->createTemplateObject('dp_bb_code_tag_code', array('content' => $content, 'language' => $geshi->get_language_name()));
         return $template->render();
     } else {
         return '<div style="margin: 1em auto" title="Code">' . $content . '</div>';
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:25,代码来源:Base.php

示例3: prepareCollection

 public function prepareCollection(array $collection, $viewingUser = null)
 {
     $this->standardizeViewingUserReference($viewingUser);
     if (!empty($collection)) {
         $collection['title'] = XenForo_Helper_String::censorString($collection['title']);
         $collection['description'] = XenForo_Helper_String::censorString($collection['description']);
     }
     return $collection;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Collection.php

示例4: getContentByIds

 /**
  * Fetches the content required by alerts.
  *
  * @param array $contentIds
  * @param XenForo_Model_Alert $model Alert model invoking this
  * @param integer $userId User ID the alerts are for
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
 {
     $updateModel = $this->_getUpdateModel();
     $updates = $updateModel->getUpdatesByIds($contentIds, array('join' => XenResource_Model_Update::FETCH_RESOURCE | XenResource_Model_Update::FETCH_CATEGORY, 'permissionCombinationId' => $viewingUser['permission_combination_id']));
     foreach ($updates as &$update) {
         $update['resource_title'] = XenForo_Helper_String::censorString($update['resource_title']);
         $update['title'] = XenForo_Helper_String::censorString($update['title']);
     }
     return $updates;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:20,代码来源:Update.php

示例5: _prepareNewsFeedItemAfterAction

 /**
  * Prepares the news feed item for display
  *
  * @param array $item News feed item
  * @param array $content News feed item content
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 protected function _prepareNewsFeedItemAfterAction(array $item, $content, array $viewingUser)
 {
     $item['content'] = array('title' => XenForo_Helper_String::censorString($content['title']));
     foreach ($this->_getContentPrimaryKeynames() as $key) {
         if (isset($content[$key])) {
             $item['content'][$key] = $content[$key];
         }
     }
     return $item;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:19,代码来源:Discussion.php

示例6: _prepareNewsFeedItemAfterAction

 /**
  * Prepares the news feed item for display
  *
  * @param array $item News feed item
  * @param array $content News feed item content
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 protected function _prepareNewsFeedItemAfterAction(array $item, $content, array $viewingUser)
 {
     if (isset($item[$item['action']]['old'])) {
         $item[$item['action']]['old'] = XenForo_Helper_String::censorString($item[$item['action']]['old']);
     }
     if (isset($item[$item['action']]['new'])) {
         $item[$item['action']]['new'] = XenForo_Helper_String::censorString($item[$item['action']]['new']);
     }
     return $item;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:19,代码来源:User.php

示例7: getContentTitle

 /**
  * Gets the title of the specified content.
  *
  * @see XenForo_ReportHandler_Abstract:getContentTitle()
  */
 public function getContentTitle(array $report, array $contentInfo)
 {
     if (!empty($contentInfo['media']['album_id']) && isset($contentInfo['media']['album_title'])) {
         return new XenForo_Phrase('xengallery_media_x_in_album_y', array('title' => XenForo_Helper_String::censorString($contentInfo['media']['media_title']), 'album' => $contentInfo['media']['album_title']));
     } else {
         if (!empty($contentInfo['media']['category_id']) && isset($contentInfo['media']['category_title'])) {
             return new XenForo_Phrase('xengallery_media_x_in_category_y', array('title' => XenForo_Helper_String::censorString($contentInfo['media']['media_title']), 'category' => $contentInfo['media']['category_title']));
         }
     }
     return new XenForo_Phrase('xengallery_media');
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:16,代码来源:Media.php

示例8: prepareAlert

 /**
  * Prepares a news feed item for rendering.
  * Designed to be overriden by extended classes, while retaining the call to _prepareAlert.
  *
  * @param array $alert
  * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 public function prepareAlert(array $item, array $viewingUser)
 {
     $methodName = '_prepare' . ucfirst($item['action']);
     $item = $this->_prepareAlertBeforeAction($item, $item['content'], $viewingUser);
     if (isset($item['content']['title'])) {
         $item['content']['title'] = XenForo_Helper_String::censorString($item['content']['title']);
     }
     if (method_exists($this, $methodName)) {
         $item = call_user_func(array($this, $methodName), $item, $viewingUser);
     }
     return $this->_prepareAlertAfterAction($item, $item['content'], $viewingUser);
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:21,代码来源:Abstract.php

示例9: prepareEntry

 public final function prepareEntry(array $entry)
 {
     $entry['content_title'] = XenForo_Helper_String::censorString($entry['content_title']);
     $entry['ipAddress'] = $entry['ip_address'] ? XenForo_Helper_Ip::convertIpBinaryToString($entry['ip_address']) : '';
     $entry = $this->_prepareEntry($entry);
     if (!isset($entry['actionText'])) {
         $entry['actionText'] = new XenForo_Phrase('moderator_log_' . $entry['content_type'] . '_' . $entry['action'], json_decode($entry['action_params'], true));
     }
     if (!isset($entry['contentUser'])) {
         $entry['contentUser'] = array('user_id' => $entry['content_user_id'], 'username' => $entry['content_username']);
     }
     return $entry;
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:13,代码来源:Abstract.php

示例10: processTagImg

 public function processTagImg(array $tag, array $rendererStates)
 {
     $url = $this->stringifyTree($tag['children']);
     $validUrl = $this->_getValidUrl($url);
     if (!$validUrl) {
         return $this->filterString($url, $rendererStates);
     }
     $censored = XenForo_Helper_String::censorString($validUrl);
     if ($censored != $validUrl) {
         return $this->filterString($url, $rendererStates);
     }
     $this->_urls[$url] = $validUrl;
     return '[IMG]' . $this->_urlPrefix . $url . $this->_urlSuffix . '[/IMG]';
 }
开发者ID:ThemeHouse-XF,项目名称:ImageRestrict,代码行数:14,代码来源:Reverse.php

示例11: getResourceFieldValueHtml

 /**
  * Gets the HTML value of the resource field.
  *
  * @param array $field
  * @param mixed $value Value of the field; if null, pulls from field_value
  *        in field
  */
 public static function getResourceFieldValueHtml(XenForo_View $view, array $field, $value = null)
 {
     if ($value === null && isset($field['field_value'])) {
         $value = $field['field_value'];
     }
     if ($value === '' || $value === null) {
         return '';
     }
     $multiChoice = false;
     $choice = '';
     switch ($field['field_type']) {
         case 'radio':
         case 'select':
             $choice = $value;
             $value = new XenForo_Phrase("resource_field_{$field['field_id']}_choice_{$value}");
             $value->setPhraseNameOnInvalid(false);
             break;
         case 'checkbox':
         case 'multiselect':
             $multiChoice = true;
             if (!is_array($value) || count($value) == 0) {
                 return '';
             }
             $newValues = array();
             foreach ($value as $id => $choice) {
                 $phrase = new XenForo_Phrase("resource_field_{$field['field_id']}_choice_{$choice}");
                 $phrase->setPhraseNameOnInvalid(false);
                 $newValues[$choice] = $phrase;
             }
             $value = $newValues;
             break;
         case 'textbox':
         case 'textarea':
         default:
             $value = nl2br(htmlspecialchars(XenForo_Helper_String::censorString($value)));
     }
     if (!empty($field['display_callback_class']) && !empty($field['display_callback_method'])) {
         $value = call_user_func_array(array($field['display_callback_class'], $field['display_callback_method']), array($view, $field, $value));
     } elseif (!empty($field['display_template'])) {
         if ($multiChoice && is_array($value)) {
             foreach ($value as $choice => &$thisValue) {
                 $thisValue = strtr($field['display_template'], array('{$fieldId}' => $field['field_id'], '{$value}' => $thisValue, '{$valueUrl}' => urlencode($thisValue), '{$choice}' => $choice));
             }
         } else {
             $value = strtr($field['display_template'], array('{$fieldId}' => $field['field_id'], '{$value}' => $value, '{$valueUrl}' => urlencode($value), '{$choice}' => $choice));
         }
     }
     return $value;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:56,代码来源:Resource.php

示例12: bretiPrepareThread

 public function bretiPrepareThread(array $thread, array $nodePermissions = null, array $viewingUser = null)
 {
     $forum = array('node_id' => $thread['node_id']);
     if (isset($thread['node_title'])) {
         $forum['title'] = $thread['node_title'];
         $thread['forum'] = $forum;
     }
     $thread['title'] = XenForo_Helper_String::censorString($thread['title']);
     $thread['titleCensored'] = true;
     $options = XenForo_Application::get('options');
     if ($options->BRETI_showPreview) {
         $thread['hasPreview'] = $this->hasPreview($thread, $forum, $nodePermissions, $viewingUser);
     }
     return $thread;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Thread.php

示例13: getContentByIds

 /**
  * Fetches the content required by alerts.
  *
  * @param array $contentIds
  * @param XenForo_Model_Alert $model Alert model invoking this
  * @param integer $userId User ID the alerts are for
  * @param array $viewingUser Information about the viewing user (keys:
  * user_id, permission_combination_id, permissions)
  *
  * @return array
  */
 public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser)
 {
     $checkOutModel = $this->_getCheckOutModel();
     $checkOuts = $checkOutModel->getCheckOutsByIds($contentIds);
     $resourceIds = array();
     foreach ($checkOuts as $checkOut) {
         $resourceIds[$checkOut['resource_id']] = $checkOut['resource_id'];
     }
     $resources = XenForo_Model::create('XenResource_Model_Resource')->getResourcesByIds($resourceIds, array('permissionCombinationId' => $viewingUser['permission_combination_id']));
     foreach ($checkOuts as $key => &$checkOut) {
         if (!isset($resources[$checkOut['resource_id']])) {
             unset($checkOuts[$key]);
         } else {
             $checkOut['resource'] = $resources[$checkOut['resource_id']];
             $checkOut['resource']['title'] = XenForo_Helper_String::censorString($checkOut['resource']['title']);
         }
     }
     return $checkOuts;
 }
开发者ID:ThemeHouse-XF,项目名称:ResCheckInOut,代码行数:30,代码来源:CheckOut.php

示例14: getPlainText

 public static function getPlainText($bbCode)
 {
     $config = XenForo_Application::getConfig();
     $useSnippet = $config->get('bdApi_useSnippet');
     if (!empty($useSnippet)) {
         return XenForo_Template_Helper_Core::callHelper('snippet', array($bbCode, 0, array('stripQuote' => true, 'stripHtml' => false)));
     } else {
         // from XenForo_Helper_String::bbCodeStrip
         $string = $bbCode;
         $string = preg_replace('#\\[(attach|media|img)[^\\]]*\\].*\\[/\\1\\]#siU', '', $string);
         while ($string != ($newString = preg_replace('#\\[([a-z0-9]+)(=[^\\]]*)?\\](.*)\\[/\\1\\]#siU', '\\3', $string))) {
             $string = $newString;
         }
         $string = str_replace('[*]', '', $string);
         $string = trim($string);
         $string = XenForo_Helper_String::censorString($string);
         return htmlspecialchars($string);
     }
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:19,代码来源:Message.php

示例15: isValidTag

 public function isValidTag($tag)
 {
     $length = utf8_strlen($tag);
     $lengthLimits = XenForo_Application::getOptions()->tagLength;
     $minLength = max($lengthLimits['min'], 1);
     $maxLength = $lengthLimits['max'] <= 0 ? 100 : min($lengthLimits['max'], 100);
     if ($length < $minLength) {
         return false;
     }
     if ($length > $maxLength) {
         return false;
     }
     $validation = XenForo_Application::getOptions()->tagValidation;
     $disallowed = preg_split('/\\r?\\n/', $validation['disallowedWords']);
     if ($disallowed) {
         foreach ($disallowed as $disallowedCheck) {
             $disallowedCheck = trim($disallowedCheck);
             if ($disallowedCheck === '') {
                 continue;
             }
             if (stripos($tag, $disallowedCheck) !== false) {
                 return false;
             }
         }
     }
     if ($validation['matchRegex'] && !preg_match('/\\W[\\s\\w]*e[\\s\\w]*$/', $validation['matchRegex'])) {
         try {
             if (!preg_match($validation['matchRegex'], $tag)) {
                 return false;
             }
         } catch (Exception $e) {
             XenForo_Error::logException($e, false);
         }
     }
     $censored = XenForo_Helper_String::censorString($tag);
     if ($censored != $tag) {
         return false;
     }
     return true;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:40,代码来源:Tag.php


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