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


PHP CTemplate::quote方法代码示例

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


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

示例1: fetch

 /**
  * Open, parse, and return the template file.
  *
  * @param $file string the template file name
  */
 public function fetch($file = null)
 {
     $template = new CTemplateHelper();
     $tmpFile = $file;
     if (empty($file)) {
         $file = $this->file;
     }
     if ($this->mobileTemplate()) {
         $file = $template->getMobileTemplateFile($file);
     } else {
         $file = $template->getTemplateFile($file);
     }
     // Template variable: $my;
     $my = CFactory::getUser();
     $this->setRef('my', $my);
     // Template variable: $config;
     if (!isset($this->vars['config']) && empty($this->vars['config'])) {
         $this->vars['config'] = CFactory::getConfig();
     }
     // Template variable: the rest.
     if ($this->vars) {
         extract($this->vars, EXTR_REFS);
     }
     if (!JFile::exists($file)) {
         $mainframe =& JFactory::getApplication();
         $mainframe->enqueueMessage(JText::sprintf('COM_COMMUNITY_TEMPLATE_FILE_NOT_FOUND', $tmpFile . '.php'), 'error');
         return;
     }
     ob_start();
     // Start output buffering
     require $file;
     // Include the file
     $contents = ob_get_contents();
     // Get the contents of the buffer
     ob_end_clean();
     // End buffering and discard
     // Replace all _QQQ_ to "
     // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility
     $contents = CTemplate::quote($contents);
     return $contents;
     // Return the contents
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:47,代码来源:template.php

示例2: fetch

 /**
  * Open, parse, and return the template file.
  *
  * @param $file string the template file name
  * @param $folder if exists, like the file to view
  * @return type
  */
 public function fetch($file = null)
 {
     if (empty($file)) {
         $file = $this->file;
     }
     $tplFile = $this->_getTemplateFile('layouts/' . $file);
     if ($tplFile) {
         // Template variable: $my;
         $my = CFactory::getUser();
         $this->setRef('my', $my);
         // set Up admin var
         $this->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
         // Template variable: $config;
         if (!isset($this->_vars['config']) && empty($this->vars['config'])) {
             $this->_vars['config'] = CFactory::getConfig();
         }
         // Template variable: the rest.
         if ($this->_vars) {
             extract($this->_vars, EXTR_REFS);
         }
         ob_start();
         // Start output buffering
         require $tplFile;
         // Include the file
         $contents = ob_get_contents();
         // Get the contents of the buffer
         ob_end_clean();
         // End buffering and discard
         // Replace all _QQQ_ to "
         // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility
         $contents = CTemplate::quote($contents);
         return $contents;
         // Return the contents
     }
     return '';
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:43,代码来源:template.php

示例3: _formatTitle

 /**
  * Perform necessary formatting on the title for display in the stream
  * @param type $row 
  */
 private function _formatTitle($row)
 {
     // We will need to replace _QQQ_ here since
     // CKses will reformat the link
     $row->title = CTemplate::quote($row->title);
     // If the title start with actor's name, and it is a normal status, remove them!
     // Otherwise, leave it as the old style
     if (strpos($row->title, '<a class="actor-link"') !== false && isset($row->actor) && $row->app == 'profile') {
         $pattern = '/(<a class="actor-link".*?' . '>.*?<\\/a>)/';
         $row->title = preg_replace($pattern, '', $row->title);
     }
     return CKses::kses($row->title, CKses::allowed());
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:17,代码来源:activities.php

示例4: _saveProfile

 /**
  * Saves a user's profile
  *
  * @access	private
  * @param	none
  */
 private function _saveProfile()
 {
     $model = $this->getModel('profile');
     $usermodel = $this->getModel('user');
     $document = JFactory::getDocument();
     $my = CFactory::getUser();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $input = CFactory::getInput();
     if ($my->id == 0) {
         return $this->blockUnregister();
     }
     $appsLib = CAppPlugins::getInstance();
     $saveSuccess = $appsLib->triggerEvent('onFormSave', array('jsform-profile-edit'));
     if (empty($saveSuccess) || !in_array(false, $saveSuccess)) {
         $values = array();
         $profiles = $model->getEditableProfile($my->id, $my->getProfileType());
         foreach ($profiles['fields'] as $group => $fields) {
             foreach ($fields as $data) {
                 $fieldValue = new stdClass();
                 // Get value from posted data and map it to the field.
                 // Here we need to prepend the 'field' before the id because in the form, the 'field' is prepended to the id.
                 // Grab raw, unfiltered data
                 $postData = $input->post->get('field' . $data['id'], '', 'RAW');
                 //
                 // Retrieve the privacy data for this particular field.
                 $fieldValue->access = JRequest::getInt('privacy' . $data['id'], 0, 'POST');
                 $fieldValue->value = CProfileLibrary::formatData($data['type'], $postData);
                 if (get_magic_quotes_gpc()) {
                     $fieldValue->value = stripslashes($fieldValue->value);
                 }
                 $values[$data['id']] = $fieldValue;
                 // @rule: Validate custom profile if necessary
                 if (!CProfileLibrary::validateField($data['id'], $data['type'], $values[$data['id']]->value, $data['required'], $data['visible'])) {
                     // If there are errors on the form, display to the user.
                     // If it is a drop down selection, use a different message
                     $message = '';
                     switch ($data['type']) {
                         case 'select':
                             $message = JText::sprintf('COM_COMMUNITY_FIELD_SELECT_EMPTY', $data['name']);
                             break;
                         case 'url':
                             $message = JText::sprintf('COM_COMMUNITY_FIELD_INVALID_URL', $data['name']);
                             break;
                         default:
                             $data['value'] = $values[$data['id']]->value;
                             $message = CProfileLibrary::getErrorMessage($data);
                     }
                     $mainframe->enqueueMessage(CTemplate::quote($message), 'error');
                     return false;
                 }
             }
         }
         // Rebuild new $values with field code
         $valuesCode = array();
         foreach ($values as $key => $val) {
             $fieldCode = $model->getFieldCode($key);
             if ($fieldCode) {
                 // For backward compatibility, we can't pass in an object. We need it to behave
                 // like 1.8.x where we only pass values.
                 $valuesCode[$fieldCode] = $val->value;
             }
         }
         $saveSuccess = false;
         $appsLib = CAppPlugins::getInstance();
         $appsLib->loadApplications();
         // Trigger before onBeforeUserProfileUpdate
         $args = array();
         $args[] = $my->id;
         $args[] = $valuesCode;
         $result = $appsLib->triggerEvent('onBeforeProfileUpdate', $args);
         $optionList = $model->getAllList();
         foreach ($optionList as $list) {
             // $optionList return all the list, even if the field is disabled
             // So, need to check if we're using it or not first
             if (isset($values[$list['id']]) && is_array($list['options'])) {
                 $option = $values[$list['id']]->value;
                 $option = str_replace('&amp;', '&', $option);
                 if (JString::strlen(JString::trim($option)) != 0 && !in_array($option, $list['options'])) {
                     if (!in_array($option, CProfile::getCountryList())) {
                         $result[] = false;
                     }
                 }
             }
         }
         // make sure none of the $result is false
         if (!$result || !in_array(false, $result)) {
             $saveSuccess = true;
             $model->saveProfile($my->id, $values);
         }
     }
     // Trigger before onAfterUserProfileUpdate
     $args = array();
     $args[] = $my->id;
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:profile.php

示例5: _saveProfile

 /**
  * Saves a user's profile	
  * 	 	
  * @access	private
  * @param	none 
  */
 private function _saveProfile()
 {
     $model =& $this->getModel('profile');
     $usermodel =& $this->getModel('user');
     $document = JFactory::getDocument();
     $my = CFactory::getUser();
     $mainframe =& JFactory::getApplication();
     if ($my->id == 0) {
         return $this->blockUnregister();
     }
     CFactory::load('libraries', 'apps');
     $appsLib =& CAppPlugins::getInstance();
     $saveSuccess = $appsLib->triggerEvent('onFormSave', array('jsform-profile-edit'));
     if (empty($saveSuccess) || !in_array(false, $saveSuccess)) {
         $values = array();
         $profiles = $model->getEditableProfile($my->id, $my->getProfileType());
         CFactory::load('libraries', 'profile');
         foreach ($profiles['fields'] as $group => $fields) {
             foreach ($fields as $data) {
                 $fieldValue = new stdClass();
                 // Get value from posted data and map it to the field.
                 // Here we need to prepend the 'field' before the id because in the form, the 'field' is prepended to the id.
                 $postData = JRequest::getVar('field' . $data['id'], '', 'POST');
                 // Retrieve the privacy data for this particular field.
                 $fieldValue->access = JRequest::getInt('privacy' . $data['id'], 0, 'POST');
                 $fieldValue->value = CProfileLibrary::formatData($data['type'], $postData);
                 $values[$data['id']] = $fieldValue;
                 // @rule: Validate custom profile if necessary
                 if (!CProfileLibrary::validateField($data['id'], $data['type'], $values[$data['id']]->value, $data['required'])) {
                     // If there are errors on the form, display to the user.
                     $message = JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_IMPROPER_VALUES', $data['name']);
                     $mainframe->enqueueMessage(CTemplate::quote($message), 'error');
                     return;
                 }
             }
         }
         // Rebuild new $values with field code
         $valuesCode = array();
         foreach ($values as $key => $val) {
             $fieldCode = $model->getFieldCode($key);
             if ($fieldCode) {
                 // For backward compatibility, we can't pass in an object. We need it to behave
                 // like 1.8.x where we only pass values.
                 $valuesCode[$fieldCode] = $val->value;
             }
         }
         $saveSuccess = false;
         $appsLib =& CAppPlugins::getInstance();
         $appsLib->loadApplications();
         // Trigger before onBeforeUserProfileUpdate
         $args = array();
         $args[] = $my->id;
         $args[] = $valuesCode;
         $result = $appsLib->triggerEvent('onBeforeProfileUpdate', $args);
         // make sure none of the $result is false
         if (!$result || !in_array(false, $result)) {
             $saveSuccess = true;
             $model->saveProfile($my->id, $values);
         }
     }
     // Trigger before onAfterUserProfileUpdate
     $args = array();
     $args[] = $my->id;
     $args[] = $saveSuccess;
     $result = $appsLib->triggerEvent('onAfterProfileUpdate', $args);
     if ($saveSuccess) {
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('profile.save');
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PROFILE_SAVED'));
     } else {
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PROFILE_NOT_SAVED'), 'error');
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:79,代码来源:profile.php


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