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


PHP JRequest::_stripSlashesRecursive方法代码示例

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


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

示例1: bind

 /** Reads the information from the values of the form
  * The content element will be loaded first and then the values of the override
  * what is actually in the element
  *
  * @param	array	The values which should be bound to the object
  * @param	string	The field prefix
  * @param	string	An optional field
  * @param 	boolean	try to bind the values to the object
  * @param 	boolean	store original values too
  */
 function bind($formArray, $prefix = "", $suffix = "", $tryBind = true, $storeOriginalText = false)
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     if ($tryBind) {
         $this->_jfBindArrayToObject($formArray, $this);
     }
     if ($this->published == "") {
         $this->published = 0;
     }
     // Go thru all the fields of the element and try to copy the content values
     $elementTable = $this->_contentElement->getTable();
     for ($i = 0; $i < count($elementTable->Fields); $i++) {
         $field = $elementTable->Fields[$i];
         $fieldName = $field->Name;
         if (isset($formArray[$prefix . "refField_" . $fieldName . $suffix])) {
             // Handle magic quotes compatability
             if (get_magic_quotes_gpc() && $field->Type !== 'htmltext') {
                 $formArray[$prefix . "refField_" . $fieldName . $suffix] = JRequest::_stripSlashesRecursive($formArray[$prefix . "refField_" . $fieldName . $suffix]);
                 $formArray[$prefix . "origText_" . $fieldName . $suffix] = JRequest::_stripSlashesRecursive($formArray[$prefix . "origText_" . $fieldName . $suffix]);
             } else {
                 $formArray[$prefix . "refField_" . $fieldName . $suffix] = JRequest::getVar($prefix . "refField_" . $fieldName . $suffix, '', 'post', 'string', JREQUEST_ALLOWRAW);
                 $formArray[$prefix . "origText_" . $fieldName . $suffix] = JRequest::getVar($prefix . "origText_" . $fieldName . $suffix, '', 'post', 'string', JREQUEST_ALLOWRAW);
             }
             $translationValue = $formArray[$prefix . "refField_" . $fieldName . $suffix];
             $fieldContent = new jfContent($db);
             // code cleaner for xhtml transitional compliance
             if ($field->Type == 'titletext' || $field->Type == 'text') {
                 jimport('joomla.filter.output');
                 //$translationValue = JFilterOutput::ampReplace( $translationValue );
             }
             if ($field->Type == 'htmltext') {
                 $translationValue = str_replace('<br>', '<br />', $translationValue);
                 // remove <br /> take being automatically added to empty fulltext
                 $length = strlen($translationValue) < 9;
                 $search = strstr($translationValue, '<br />');
                 if ($length && $search) {
                     $translationValue = NULL;
                 }
             }
             if ($field->Type == "params" && is_array($translationValue)) {
                 $registry = new JRegistry();
                 $registry->loadArray($translationValue);
                 $translationValue = $registry->toString();
             }
             if ($field->posthandler != "") {
                 if (method_exists($this, $field->posthandler)) {
                     $handler = $field->posthandler;
                     $this->{$handler}($translationValue, $elementTable->Fields, $formArray, $prefix, $suffix, $storeOriginalText);
                 }
             }
             $originalValue = $formArray[$prefix . "origValue_" . $fieldName . $suffix];
             $originalText = $storeOriginalText ? $formArray[$prefix . "origText_" . $fieldName . $suffix] : "";
             $fieldContent->id = $formArray[$prefix . "id_" . $fieldName . $suffix];
             $fieldContent->reference_id = intval($formArray[$prefix . "reference_id" . $suffix]) > 0 ? intval($formArray[$prefix . "reference_id" . $suffix]) : $this->id;
             $fieldContent->language_id = $this->language_id;
             $fieldContent->reference_table = $db->getEscaped($elementTable->Name);
             $fieldContent->reference_field = $db->getEscaped($fieldName);
             $fieldContent->value = $translationValue;
             // original value will be already md5 encoded - based on that any encoding isn't needed!
             $fieldContent->original_value = $originalValue;
             $fieldContent->original_text = !is_null($originalText) ? $originalText : "";
             $datenow =& JFactory::getDate();
             $fieldContent->modified = $datenow->toMySQL();
             $fieldContent->modified_by = $user->id;
             $fieldContent->published = $this->published;
             $field->translationContent = $fieldContent;
         }
     }
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:80,代码来源:ContentObject.php

示例2: get

 /**
  * Fetches and returns a request array.
  *
  * The default behaviour is fetching variables depending on the
  * current request method: GET and HEAD will result in returning
  * $_GET, POST and PUT will result in returning $_POST.
  *
  * You can force the source by setting the $hash parameter:
  *
  *   post		$_POST
  *   get		$_GET
  *   files		$_FILES
  *   cookie		$_COOKIE
  *   method		via current $_SERVER['REQUEST_METHOD']
  *   default	$_REQUEST
  *
  * @static
  * @param	string	$hash	to get (POST, GET, FILES, METHOD)
  * @param	int		$mask	Filter mask for the variable
  * @return	mixed	Request hash
  * @since	1.5
  */
 function get($hash = 'default', $mask = 0)
 {
     $hash = strtoupper($hash);
     if ($hash === 'METHOD') {
         $hash = strtoupper($_SERVER['REQUEST_METHOD']);
     }
     switch ($hash) {
         case 'GET':
             $input = $_GET;
             break;
         case 'POST':
             $input = $_POST;
             break;
         case 'FILES':
             $input = $_FILES;
             break;
         case 'COOKIE':
             $input = $_COOKIE;
             break;
         case 'REQUEST':
             $input = $_REQUEST;
             break;
         default:
             $input = $GLOBALS['_RSGINSTANCE'];
             $hash = 'rsgInstance';
             break;
     }
     $result = JRequest::_cleanVar($input, $mask);
     // Handle magic quotes compatability
     if (get_magic_quotes_gpc() && $hash != 'FILES') {
         $result = JRequest::_stripSlashesRecursive($result);
     }
     return $result;
 }
开发者ID:realityking,项目名称:rsgallery2,代码行数:56,代码来源:instance.class.php

示例3: get

 /**
  * Fetches and returns a request array.
  *
  * The default behaviour is fetching variables depending on the
  * current request method: GET and HEAD will result in returning
  * $_GET, POST and PUT will result in returning $_POST.
  *
  * You can force the source by setting the $hash parameter:
  *
  *   post		$_POST
  *   get		$_GET
  *   files		$_FILES
  *   cookie		$_COOKIE
  *   env		$_ENV
  *   server		$_SERVER
  *   method		via current $_SERVER['REQUEST_METHOD']
  *   default	$_REQUEST
  *
  * @static
  * @param	string	$hash	to get (POST, GET, FILES, METHOD)
  * @param	int		$mask	Filter mask for the variable
  * @return	mixed	Request hash
  * @since	1.5
  */
 function get($hash = 'default', $mask = 0)
 {
     $hash = strtoupper($hash);
     if ($hash === 'METHOD') {
         $hash = strtoupper($_SERVER['REQUEST_METHOD']);
     }
     switch ($hash) {
         case 'GET':
             $input = $_GET;
             break;
         case 'POST':
             $input = $_POST;
             break;
         case 'FILES':
             $input = $_FILES;
             break;
         case 'COOKIE':
             $input = $_COOKIE;
             break;
         case 'ENV':
             $input =& $_ENV;
             break;
         case 'SERVER':
             $input =& $_SERVER;
             break;
         default:
             $input = $_REQUEST;
             break;
     }
     $result = JRequest::_cleanVar($input, $mask);
     // Handle magic quotes compatability
     if (get_magic_quotes_gpc() && $hash != 'FILES') {
         $result = JRequest::_stripSlashesRecursive($result);
         $result = JRequest::_CleanStrip_tags($result);
         $result = JRequest::_CleanSqlInjection($result);
         $result = JRequest::_CleanHtmlspecialchars($result);
     }
     if ($hash == "GET" || $hash == "POST") {
         $result = JRequest::_stripSlashesRecursive($result);
         $result = JRequest::_CleanStrip_tags($result);
         $result = JRequest::_CleanSqlInjection($result);
         $result = JRequest::_CleanHtmlspecialchars($result);
     }
     return $result;
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:69,代码来源:request.php


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