本文整理汇总了PHP中CStringHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CStringHelper类的具体用法?PHP CStringHelper怎么用?PHP CStringHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CStringHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _getAllEvents
private function _getAllEvents()
{
$mainframe = JFactory::getApplication();
$rows = $this->model->getEvents();
$items = array();
foreach ($rows as $row) {
$item = new stdClass();
$table =& JTable::getInstance('Event', 'CTable');
$table->bind($row);
$table->thumbnail = $table->getThumbAvatar();
$table->avatar = $table->getAvatar();
$author = CFactory::getUser($table->creator);
$item->id = $row->id;
$item->created = $row->created;
$item->creator = CStringHelper::escape($author->getDisplayname());
$item->title = $row->title;
$item->description = CStringHelper::escape($row->description);
$item->location = CStringHelper::escape($row->location);
$tiem->startdate = $row->startdate;
$item->enddate = $row->enddate;
$item->thumbnail = $table->thumbnail;
$tiem->avatar = $table->avatar;
$item->ticket = $row->ticket;
$item->invited = $row->invitedcount;
$item->confirmed = $row->confirmedcount;
$item->declined = $row->declinedcount;
$item->maybe = $row->maybecount;
$item->latitude = $row->latitude;
$item->longitude = $row->longitude;
$items[] = $item;
}
return $items;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:33,代码来源:view.raw.php
示例2: getFieldHTML
public function getFieldHTML($field, $required)
{
$class = $field->required == 1 ? ' required validate-custom-checkbox' : '';
$lists = is_array($field->value) ? $field->value : explode(',', $field->value);
$html = '';
$elementSelected = 0;
$elementCnt = 0;
$style = ' style="margin: 0 5px 5px 0;' . $this->getStyle() . '" ';
$cnt = 0;
CFactory::load('helpers', 'string');
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
$html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
if (is_array($field->options)) {
foreach ($field->options as $option) {
$selected = in_array(JString::trim($option), $lists) ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$html .= '<label class="lblradio-block">';
$html .= '<input type="checkbox" name="field' . $field->id . '[]" value="' . $option . '"' . $selected . ' class="checkbox ' . $class . $style . ' />';
$html .= JText::_($option) . '</label>';
$elementCnt++;
}
}
$html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>';
$html .= '</div>';
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:28,代码来源:checkbox.php
示例3: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$elementSelected = 0;
$elementCnt = 0;
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' disabled="disabled"' : '';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$elementCnt++;
}
$cnt = 0;
$html .= '<div style="display:inline-block" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = html_entity_decode($option) == html_entity_decode($field->value) ? ' checked="checked"' : '';
$html .= '<label class="lblradio-block">';
$html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
}
$html .= '</div>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:radio.php
示例4: getFieldHTML
public function getFieldHTML($field, $required)
{
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
$lists = explode(',', $field->value);
CFactory::load('helpers', 'string');
$html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="jomNameTips tipRight select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
$elementSelected = 0;
foreach ($field->options as $option) {
$selected = in_array($option, $lists) ? ' selected="selected"' : '';
if (empty($selected)) {
$elementSelected++;
}
$html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>';
}
if ($elementSelected == 0) {
//if nothing is selected, we default the 1st option to be selected.
$elementName = 'field' . $field->id;
$html .= <<<HTML
\t\t\t\t
\t\t\t\t <script type='text/javascript'>
\t\t\t\t\t var slt = document.getElementById('{$elementName}');
\t\t\t\t\t if(slt != null){
\t\t\t\t\t slt.options[0].selected = true;\t\t\t\t\t
\t\t\t\t\t }
\t\t\t\t </script>
HTML;
}
$html .= '</select>';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:32,代码来源:list.php
示例5: getFieldHTML
function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$class = $field->required == 1 ? ' required validate-custom-radio' : '';
$elementSelected = 0;
$elementCnt = 0;
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$elementCnt++;
}
$cnt = 0;
CFactory::load('helpers', 'string');
$class = !empty($field->tips) ? 'jomTips tipRight' : '';
$html .= '<div class="' . $class . '" style="display: inline-block;" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
$html .= '<label class="lblradio-block">';
$html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . ' class="radio ' . $class . '" style="margin: 0 5px 0 0;" />';
$html .= JText::_($option) . '</label>';
}
$html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>';
$html .= '</div>';
return $html;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:30,代码来源:radio.php
示例6: display
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
public function display($tpl = null)
{
$document = JFactory::getDocument();
$config =& CFactory::getConfig();
// Get required data's
$events = $this->get('Events');
$categories = $this->get('Categories');
$pagination = $this->get('Pagination');
$mainframe =& JFactory::getApplication();
$filter_order = $mainframe->getUserStateFromRequest("com_community.events.filter_order", 'filter_order', 'a.title', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.events.filter_order_Dir", 'filter_order_Dir', '', 'word');
$search = $mainframe->getUserStateFromRequest("com_community.events.search", 'search', '', 'string');
// table ordering
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
// We need to assign the users object to the groups listing to get the users name.
for ($i = 0; $i < count($events); $i++) {
$row =& $events[$i];
$row->user = JFactory::getUser($row->creator);
// Truncate the description
CFactory::load('helpers', 'string');
$row->description = CStringHelper::truncate($row->description, $config->get('tips_desc_length'));
}
$catHTML = $this->_getCategoriesHTML($categories);
$this->assignRef('events', $events);
$this->assignRef('categories', $catHTML);
$this->assignRef('search', $search);
$this->assignRef('lists', $lists);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:37,代码来源:view.html.php
示例7: send
/**
* Do a batch send
*/
function send($total = 100)
{
$mailqModel = CFactory::getModel('mailq');
$userModel = CFactory::getModel('user');
$mails = $mailqModel->get($total);
$jconfig = JFactory::getConfig();
$mailer = JFactory::getMailer();
$config = CFactory::getConfig();
$senderEmail = $jconfig->getValue('mailfrom');
$senderName = $jconfig->getValue('fromname');
if (empty($mails)) {
return;
}
CFactory::load('helpers', 'string');
foreach ($mails as $row) {
// @rule: only send emails that is valid.
// @rule: make sure recipient is not blocked!
$userid = $userModel->getUserFromEmail($row->recipient);
$user = CFactory::getUser($userid);
if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
$mailer->setSender(array($senderEmail, $senderName));
$mailer->addRecipient($row->recipient);
$mailer->setSubject($row->subject);
$tmpl = new CTemplate();
$raw = isset($row->params) ? $row->params : '';
$params = new JParameter($row->params);
$base = $config->get('htmlemail') ? 'email.html' : 'email.text';
if ($config->get('htmlemail')) {
$row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
$mailer->IsHTML(true);
} else {
//@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
$row->body = CStringHelper::escape(strip_tags($row->body));
}
$tmpl->set('content', $row->body);
$tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
$tmpl->set('sitename', $config->get('sitename'));
$row->body = $tmpl->fetch($base);
// Replace any occurences of custom variables within the braces scoe { }
if (!empty($row->body)) {
preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
$replaceWith = $params->get($val[1], null);
//if the replacement start with 'index.php', we can CRoute it
if (strpos($replaceWith, 'index.php') === 0) {
$replaceWith = CRoute::getExternalURL($replaceWith);
}
if (!is_null($replaceWith)) {
$row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
}
}
}
unset($tmpl);
$mailer->setBody($row->body);
$mailer->send();
}
$mailqModel->markSent($row->id);
$mailer->ClearAllRecipients();
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:mailq.php
示例8: getFieldHTML
public function getFieldHTML($field, $required)
{
$required = $field->required == 1 ? ' data-required="true"' : '';
//a fix for wrong data
$field->value = JString::trim($field->value);
if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) {
$field->value = JString::substr($field->value, 0, -1);
}
$lists = explode(',', $field->value);
//CFactory::load( 'helpers' , 'string' );
$html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="joms-select joms-select--multiple" title="' . CStringHelper::escape(JText::_($field->tips)) . '" ' . $required . '>';
$elementSelected = 0;
foreach ($field->options as $option) {
$selected = in_array($option, $lists) ? ' selected="selected"' : '';
if (empty($selected)) {
$elementSelected++;
}
$html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>';
}
if ($elementSelected == 0) {
//if nothing is selected, we default the 1st option to be selected.
$elementName = 'field' . $field->id;
$html .= <<<HTML
<script type='text/javascript'>
var slt = document.getElementById('{$elementName}');
if(slt != null){
slt.options[0].selected = true;
}
</script>
HTML;
}
$html .= '</select>';
return $html;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:35,代码来源:list.php
示例9: onDiscussionDisplay
public function onDiscussionDisplay($row)
{
CError::assert($row->message, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->message)) {
$row->message = CStringHelper::nl2br($row->message);
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:8,代码来源:groups.trigger.php
示例10: getFieldHTML
public function getFieldHTML($field, $required)
{
//CFactory::load( 'helpers' , 'string' );
$class = !empty($field->tips) ? ' jomNameTips tipRight' : '';
$html = '<textarea title="' . CStringHelper::escape(JText::_($field->tips)) . '" id="field' . $field->id . '" name="field' . $field->id . '" class="textarea' . $class . '" cols="20" rows="5" readonly="readonly">' . CStringHelper::escape($field->tips) . '</textarea>';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:8,代码来源:label.php
示例11: check
public function check()
{
//CFactory::load( 'helpers', 'string');
// Santinise data
$safeHtmlFilter = CFactory::getInputFilter();
$this->caption = CStringHelper::nl2br($safeHtmlFilter->clean($this->caption));
return true;
}
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:8,代码来源:photo.php
示例12: onMessageDisplay
public function onMessageDisplay($row)
{
CFactory::load('helpers', 'string');
CError::assert($row->body, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->body)) {
$row->body = CStringHelper::nl2br($row->body);
}
}
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:inbox.trigger.php
示例13: onWallDisplay
public function onWallDisplay($row)
{
//CFactory::load( 'helpers' , 'string' );
CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
if (!CStringHelper::isHTML($row->comment)) {
$row->comment = CStringHelper::nl2br($row->comment);
}
}
开发者ID:Jougito,项目名称:DynWeb,代码行数:9,代码来源:wall.trigger.php
示例14: onWallDisplay
public function onWallDisplay($row)
{
//CFactory::load( 'helpers' , 'string' );
CError::assert($row->comment, '', '!empty', __FILE__, __LINE__);
// @rule: Only nl2br text that doesn't contain html tags
//@since 4.1 new rule added, to ignore newline replace
if (!CStringHelper::isHTML($row->comment) && !isset($row->newlineReplace)) {
$row->comment = CStringHelper::nl2br($row->comment);
}
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:10,代码来源:wall.trigger.php
示例15: getThumb
static function getThumb($userId, $imageClass = '', $anchorClass = '')
{
CFactory::load('helpers', 'string');
$user = CFactory::getUser($userId);
$imageClass = !empty($imageClass) ? ' class="' . $imageClass . '"' : '';
$anchorClass = !empty($anchorClass) ? ' class="' . $anchorClass . '"' : '';
$data = '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id) . '"' . $anchorClass . '>';
$data .= '<img src="{user:thumbnail:' . $userId . '}" alt="' . CStringHelper::escape($user->getDisplayName()) . '"' . $imageClass . ' />';
$data .= '</a>';
return $data;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:user.php
示例16: getFieldHTML
function getFieldHTML($field, $required)
{
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
CFactory::load('helpers', 'string');
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomTips tipRight' : '';
$html = '<input title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '" type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" size="40" class="inputbox' . $class . '" />';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:text.php
示例17: timeLapse
/**
*
* @param JDate $date
*
*/
public static function timeLapse($date)
{
$now = new JDate();
$dateDiff = CTimeHelper::timeDifference($date->toUnix(), $now->toUnix());
if ($dateDiff['days'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['days']) ? 'CC LAPSED DAY MANY' : 'CC LAPSED DAY', $dateDiff['days']);
} elseif ($dateDiff['hours'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['hours']) ? 'CC LAPSED HOUR MANY' : 'CC LAPSED HOUR', $dateDiff['hours']);
} elseif ($dateDiff['minutes'] > 0) {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['minutes']) ? 'CC LAPSED MINUTE MANY' : 'CC LAPSED MINUTE', $dateDiff['minutes']);
} else {
$lapse = JText::sprintf(CStringHelper::isPlural($dateDiff['seconds']) ? 'CC LAPSED SECOND MANY' : 'CC LAPSED SECOND', $dateDiff['seconds']);
}
return $lapse;
}
开发者ID:bizanto,项目名称:Hooked,代码行数:20,代码来源:time.php
示例18: display
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
function display($tpl = null)
{
$document =& JFactory::getDocument();
$categories =& $this->get('Categories');
$pagination =& $this->get('Pagination');
// Escape the output
CFactory::load('helpers', 'string');
foreach ($categories as $row) {
$row->name = CStringHelper::escape($row->name);
$row->description = CStringHelper::escape($row->description);
}
$this->assignRef('categories', $categories);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
开发者ID:bizanto,项目名称:Hooked,代码行数:21,代码来源:view.html.php
示例19: getFieldHTML
public function getFieldHTML($field, $required, $isDropDown = true)
{
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
$optionSize = 1;
// the default 'select below'
if (!empty($field->options)) {
$optionSize += count($field->options);
}
$dropDown = $isDropDown ? '' : ' size="' . $optionSize . '"';
CFactory::load('helpers', 'string');
$html = '<select id="field' . $field->id . '" name="field' . $field->id . '"' . $dropDown . ' class="select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '" style="' . $this->getStyle() . '" size="' . $this->params->get('size') . '">';
$defaultSelected = '';
//@rule: If there is no value, we need to default to a default value
if (empty($field->value)) {
$defaultSelected .= ' selected="selected"';
}
if ($isDropDown) {
$html .= '<option value="" ' . $defaultSelected . '>' . JText::_('COM_COMMUNITY_SELECT_BELOW') . '</option>';
}
if (!empty($field->options)) {
$selectedElement = 0;
CFactory::load('libraries', 'template');
foreach ($field->options as $option) {
$selected = $option == $field->value ? ' selected="selected"' : '';
if (!empty($selected)) {
$selectedElement++;
}
$html .= '<option value="' . CTemplate::escape($option) . '"' . $selected . '>' . JText::_($option) . '</option>';
}
if ($selectedElement == 0) {
//if nothing is selected, we default the 1st option to be selected.
$eleName = 'field' . $field->id;
$html .= <<<HTML
\t\t\t\t\t <script type='text/javascript'>
\t\t\t\t\t\t var slt = document.getElementById('{$eleName}');
\t\t\t\t\t\t if(slt != null)
\t\t\t\t\t\t {
\t\t\t\t\t\t slt.options[0].selected = true;
\t\t\t\t\t\t }
\t\t\t\t\t </script>
HTML;
}
}
$html .= '</select>';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:48,代码来源:select.php
示例20: saveWall
public function saveWall($uniqueId, $message, $appType, &$creator, $isOwner, $processFunc = '', $templateFile = 'wall.content', $wallId = 0)
{
$my = CFactory::getUser();
// Add some required parameters, otherwise assert here
CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
CError::assert($appType, '', '!empty', __FILE__, __LINE__);
CError::assert($message, '', '!empty', __FILE__, __LINE__);
CError::assert($my->id, '', '!empty', __FILE__, __LINE__);
// Load the models
CFactory::load('models', 'wall');
CFactory::load('helpers', 'url');
$wall =& JTable::getInstance('Wall', 'CTable');
$wall->load($wallId);
if ($wallId == 0) {
// Get current date
$now =& JFactory::getDate();
$now = $now->toMySQL();
// Set the wall properties
$wall->type = $appType;
$wall->contentid = $uniqueId;
$wall->post_by = $creator->id;
$wall->date = $now;
$wall->published = 1;
// @todo: set the ip address
$wall->ip = $_SERVER['REMOTE_ADDR'];
}
$wall->comment = $message;
$filter = CFactory::getInputFilter();
$wall->comment = $filter->clean($wall->comment);
// Store the wall message
$wall->store();
// Convert it to array so that the walls can be processed by plugins
$args = array();
$args[0] =& $wall;
//Process wall comments
CFactory::load('libraries', 'comment');
$comment = new CComment();
$wallComments = $wall->comment;
$wall->comment = $comment->stripCommentData($wall->comment);
// Trigger the wall comments
CWall::triggerWallComments($args);
$wallData = new stdClass();
$wallData->id = $wall->id;
$wallData->content = CWallLibrary::_getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile);
CFactory::load('helpers', 'string');
$wallData->content = CStringHelper::replaceThumbnails($wallData->content);
return $wallData;
}
开发者ID:Simarpreet05,项目名称:joomla,代码行数:48,代码来源:wall.php
注:本文中的CStringHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论