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


PHP CStringHelper::escape方法代码示例

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


在下文中一共展示了CStringHelper::escape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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' : '';
        $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;">&nbsp;</span>';
        return $html;
    }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:32,代码来源:list.php

示例3: 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)
 {
     $mainframe = JFactory::getApplication();
     $filter_order = $mainframe->getUserStateFromRequest("com_community.eventcategories.filter_order", 'filter_order', 'name', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.eventcategories.filter_order_Dir", 'filter_order_Dir', '', 'word');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $categories = $this->get('Categories');
     $pagination = $this->get('Pagination');
     $catCount = $this->get('CategoriesCount');
     // Escape the output
     CFactory::load('helpers', 'string');
     foreach ($categories as $row) {
         $row->name = CStringHelper::escape($row->name);
         $row->description = CStringHelper::escape($row->description);
         if ($row->parent == 0) {
             $row->pname = JText::_("COM_COMMUNITY_NO_PARENT");
         } else {
             $parent =& JTable::getInstance('eventcategories', 'CommunityTable');
             $parent->load($row->parent);
             $row->pname = CStringHelper::escape($parent->name);
         }
     }
     $this->assignRef('lists', $lists);
     $this->assignRef('categories', $categories);
     $this->assignRef('catCount', $catCount);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:36,代码来源:view.html.php

示例4: 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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:28,代码来源:checkbox.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;">&nbsp;</span>';
     $html .= '</div>';
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:30,代码来源:radio.php

示例6: 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

示例7: 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

示例8: 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

示例9: onActivityContentDisplay

 function onActivityContentDisplay($args)
 {
     $model =& CFactory::getModel('Wall');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $my = CFactory::getUser();
     if (empty($args->content)) {
         return '';
     }
     $wall->load($args->cid);
     CFactory::load('libraries', 'privacy');
     CFactory::load('libraries', 'comment');
     $comment = CComment::stripCommentData($wall->comment);
     $config = CFactory::getConfig();
     $commentcut = false;
     if (strlen($comment) > $config->getInt('streamcontentlength')) {
         $origcomment = $comment;
         $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
         $commentcut = true;
     }
     if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
         CFactory::load('helpers', 'videos');
         CFactory::load('libraries', 'videos');
         CFactory::load('libraries', 'wall');
         $videoContent = '';
         $params = new CParameter($args->params);
         $videoLink = $params->get('videolink');
         $image = $params->get('url');
         // For older activities that does not have videoLink , we need to process it the old way.
         if (!$videoLink) {
             $html = CWallLibrary::_processWallContent($comment);
             $tmpl = new CTemplate();
             $html = CStringHelper::escape($html);
             if ($commentcut) {
                 //add read more/less link for content
                 $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
                 $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
                 $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
             }
             $tmpl->set('comment', $html);
             $html = $tmpl->fetch('activity.wall.post');
         } else {
             $html = '<ul class ="cDetailList clrfix">';
             $html .= '<li>';
             $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
             $videoLib = new CVideoLibrary();
             $provider = $videoLib->getProvider($videoLink);
             $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
             $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
             $comment = CString::str_ireplace($videoLink, '', $comment);
             $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
             if (!empty($videoPlayer)) {
                 $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
             }
             $html .= '</li>';
             $html .= '</ul>';
         }
         return $html;
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:59,代码来源:walls.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;">&nbsp;</span>';
     return $html;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:8,代码来源:label.php

示例11: 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

示例12: 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;">&nbsp;</span>';
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:text.php

示例13: 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

示例14: 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;">&nbsp;</span>';
        return $html;
    }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:48,代码来源:select.php

示例15: getFieldHTML

 function getFieldHTML($field, $required)
 {
     $config = CFactory::getConfig();
     $js = 'assets/validate-1.5';
     $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
     CAssets::attach($js, 'js');
     // If maximum is not set, we define it to a default
     $field->max = empty($field->max) ? 200 : $field->max;
     $class = $field->required == 1 ? ' required' : '';
     $class .= !empty($field->tips) ? ' jomTips tipRight' : '';
     CFactory::load('helpers', 'string');
     $html = '<textarea id="field' . $field->id . '" name="field' . $field->id . '" class="inputbox textarea' . $class . '" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">' . $field->value . '</textarea>';
     $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;">&nbsp;</span>';
     $html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $field->max . '");</script>';
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:16,代码来源:textarea.php


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