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


PHP JFilterInput::clean方法代码示例

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


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

示例1: saveContentPrep

 function saveContentPrep(&$row)
 {
     // Get submitted text from the request variables
     $text = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW);
     // Clean text for xhtml transitional compliance
     $text = str_replace('<br>', '<br />', $text);
     // Search for the {readmore} tag and split the text up accordingly.
     $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
     $tagPos = preg_match($pattern, $text);
     if ($tagPos == 0) {
         $row->introtext = $text;
     } else {
         list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);
     }
     // Filter settings
     jimport('joomla.application.component.helper');
     $config = JComponentHelper::getParams('com_content');
     $user =& JFactory::getUser();
     $gid = $user->get('gid');
     $filterGroups = $config->get('filter_groups');
     // convert to array if one group selected
     if (!is_array($filterGroups) && (int) $filterGroups > 0) {
         $filterGroups = array($filterGroups);
     }
     if (is_array($filterGroups) && in_array($gid, $filterGroups)) {
         $filterType = $config->get('filter_type');
         $filterTags = preg_split('#[,\\s]+#', trim($config->get('filter_tags')));
         $filterAttrs = preg_split('#[,\\s]+#', trim($config->get('filter_attritbutes')));
         switch ($filterType) {
             case 'NH':
                 $filter = new JFilterInput();
                 break;
             case 'WL':
                 $filter = new JFilterInput($filterTags, $filterAttrs, 0, 0, 0);
                 // turn off xss auto clean
                 break;
             case 'BL':
             default:
                 $filter = new JFilterInput($filterTags, $filterAttrs, 1, 1);
                 break;
         }
         $row->introtext = $filter->clean($row->introtext);
         $row->fulltext = $filter->clean($row->fulltext);
     } elseif (empty($filterGroups) && $gid != '25') {
         // no default filtering for super admin (gid=25)
         $filter = new JFilterInput(array(), array(), 1, 1);
         $row->introtext = $filter->clean($row->introtext);
         $row->fulltext = $filter->clean($row->fulltext);
     }
     return true;
 }
开发者ID:jicheng17,项目名称:comanova,代码行数:51,代码来源:helper.php

示例2: search

 function search()
 {
     $post['searchword'] = JRequest::getString('searchword', null, 'post');
     $post['ordering'] = JRequest::getWord('ordering', null, 'post');
     $post['searchphrase'] = JRequest::getWord('searchphrase', 'all', 'post');
     $post['limit'] = JRequest::getInt('limit', null, 'post');
     if ($post['limit'] === null) {
         unset($post['limit']);
     }
     $areas = JRequest::getVar('areas', null, 'post', 'array');
     if ($areas) {
         foreach ($areas as $area) {
             $post['areas'][] = JFilterInput::clean($area, 'cmd');
         }
     }
     // set Itemid id for links
     $menu =& JSite::getMenu();
     $items = $menu->getItems('link', 'index.php?option=com_search_lucene&view=search');
     if (isset($items[0])) {
         $post['Itemid'] = $items[0]->id;
     }
     unset($post['task']);
     unset($post['submit']);
     $uri = JURI::getInstance();
     $uri->setQuery($post);
     $uri->setVar('option', 'com_search_lucene');
     $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false));
 }
开发者ID:beingsane,项目名称:com-search-lucene,代码行数:28,代码来源:controller.php

示例3: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get project id.
     $this->projectId = $this->input->getUint("pid");
     // Prepare log object
     $registry = JRegistry::getInstance("com_crowdfunding");
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     $file = JPath::clean(JFactory::getApplication()->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new ITPrismLog();
     $this->log->addWriter(new ITPrismLogWriterDatabase(JFactory::getDbo(), $tableName));
     $this->log->addWriter(new ITPrismLogWriterFile($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = CrowdFundingConstants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd("payment_service")));
     $paymentService = $filter->clean($paymentService, "ALNUM");
     $this->context = !empty($paymentService) ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams("com_crowdfunding");
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:27,代码来源:notifier.raw.php

示例4: getArray

 /**
  * Gets an array of values from the request.
  *
  * @param   array  $vars        Associative array of keys and filter types to apply.
  *                              If empty and datasource is null, all the input data will be returned
  *                              but filtered using the default case in JFilterInput::clean.
  * @param   mixed  $datasource  Array to retrieve data from, or null
  *
  * @return  mixed  The filtered input data.
  *
  * @since   11.1
  */
 public function getArray(array $vars = array(), $datasource = null)
 {
     if (empty($vars) && is_null($datasource)) {
         $vars = $this->data;
     }
     $results = array();
     foreach ($vars as $k => $v) {
         if (is_array($v)) {
             if (is_null($datasource)) {
                 $results[$k] = $this->getArray($v, $this->get($k, null, 'array'));
             } else {
                 $results[$k] = $this->getArray($v, $datasource[$k]);
             }
         } else {
             if (is_null($datasource)) {
                 $results[$k] = $this->get($k, null, $v);
             } elseif (isset($datasource[$k])) {
                 $results[$k] = $this->filter->clean($datasource[$k], $v);
             } else {
                 $results[$k] = $this->filter->clean(null, $v);
             }
         }
     }
     return $results;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:37,代码来源:input.php

示例5: process

 /**
  * do the plugin action
  *
  */
 function process(&$data, &$tableModel)
 {
     $params =& $this->getParams();
     $file = JFilterInput::clean($params->get('cronphp_file'), 'CMD');
     eval($params->get('cronphp_params'));
     require_once COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'cron' . DS . 'cronphp' . DS . 'scripts' . DS . $file;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:11,代码来源:cronphp.php

示例6: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project ID.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object.
     $this->log = new Prism\Log\Log();
     // Set database log adapter if Joomla! debug is enabled.
     if ($this->logTable !== null and $this->logTable !== '' and JDEBUG) {
         $this->log->addAdapter(new Prism\Log\Adapter\Database(\JFactory::getDbo(), $this->logTable));
     }
     // Set file log adapter.
     if ($this->logFile !== null and $this->logFile !== '') {
         $file = \JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . basename($this->logFile));
         $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     }
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = $filter->clean(trim(strtolower($this->input->getCmd('payment_service'))), 'ALNUM');
     $this->context = Joomla\String\StringHelper::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
     // Prepare container and some of the most used objects.
     $this->container = Prism\Container::getContainer();
     $this->prepareCurrency($this->container, $this->params);
     $this->prepareMoneyFormatter($this->container, $this->params);
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:28,代码来源:notifier.raw.php

示例7: addElements

 /**
  * if new elements found in the CSV file and user decided to
  * add them to the table then do it here
  * @param object import model
  * @param array existing headings
  * @return unknown_type
  */
 protected function addElements($model, $headings)
 {
     $user =& JFactory::getUser();
     $c = 0;
     $tableModel =& $this->getModel('Table');
     $tableModel->setId(JRequest::getInt('fabrik_table'));
     $tableModel->getTable();
     $formModel =& $tableModel->getForm();
     $groupId = current(array_keys($formModel->getGroupsHiarachy()));
     $plugins = JRequest::getVar('plugin');
     $elementModel =& $this->getModel('element');
     $element =& $elementModel->getElement();
     $elementsCreated = 0;
     $newElements = JRequest::getVar('createElements', array());
     $dataRemoved = false;
     foreach ($newElements as $elname => $add) {
         if ($add) {
             $element->id = 0;
             $element->name = JFilterInput::clean($elname);
             $element->label = strtolower($elname);
             $element->plugin = $plugins[$c];
             $element->group_id = $groupId;
             $element->eval = 0;
             $element->state = 1;
             $element->width = 255;
             $element->created = date('Y-m-d');
             $element->created_by = $user->get('id');
             $element->created_by_alias = $user->get('username');
             $element->checked_out = 0;
             $element->show_in_table_summary = 1;
             $element->ordering = 0;
             $headings[] = $element->name;
             $element->store();
             $where = " group_id = '" . $element->group_id . "'";
             $element->move(1, $where);
             $elementModel->addToDBTable();
             $elementsCreated++;
         } else {
             //need to remove none selected element's (that dont already appear in the table structure
             // data from the csv data
             $session =& JFactory::getSession();
             $allHeadings = $session->get('com_fabrik.csvheadings');
             $index = array_search($elname, $allHeadings);
             if ($index !== false) {
                 $dataRemoved = true;
                 foreach ($model->data as &$d) {
                     unset($d[$index]);
                 }
             }
         }
         $c++;
     }
     if ($dataRemoved) {
         //reindex data array
         foreach ($model->data as $k => $d) {
             $model->data[$k] = array_reverse(array_reverse($d));
         }
     }
     return $headings;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:67,代码来源:import.php

示例8: __construct

 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project id.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance('com_crowdfunding');
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get('logger.file');
     $tableName = $registry->get('logger.table');
     $file = JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addAdapter(new Prism\Log\Adapter\Database(JFactory::getDbo(), $tableName));
     $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $this->app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd('payment_service')));
     $paymentService = $filter->clean($paymentService, 'ALNUM');
     $this->context = JString::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:26,代码来源:notifier.raw.php

示例9: _getSearchData

 protected function _getSearchData()
 {
     // clean html tags
     $filter = new JFilterInput();
     $value = $filter->clean($this->_data->get('value', ''));
     return empty($value) ? null : $value;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:7,代码来源:textarea.php

示例10: requestSent

 function requestSent()
 {
     $jfbcRequestId = JRequest::getInt('jfbcId');
     $fbRequestId = JRequest::getString('requestId');
     $inToList = JRequest::getVar('to');
     // Get the from user id from the request
     $to = $inToList[0];
     $requestInfo = JFBCFactory::provider('facebook')->api('/' . $fbRequestId . "_" . $to);
     $fbFrom = $requestInfo['from']['id'];
     // Not using the model, as we're doing a simple store.
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jfbconnect/tables');
     $data = array();
     $data['fb_request_id'] = $fbRequestId;
     $data['fb_user_from'] = $fbFrom;
     $data['jfbc_request_id'] = $jfbcRequestId;
     $data['created'] = JFactory::getDate()->toSql();
     $data['modified'] = null;
     //        $data['destination_url'] = JRequest::getString('destinationUrl');
     foreach ($inToList as $fbTo) {
         $row =& JTable::getInstance('JFBConnectNotification', 'Table');
         $to = JFilterInput::clean($fbTo, 'ALNUM');
         $data['fb_user_to'] = $to;
         $row->save($data);
         $point = new JFBConnectPoint();
         $point->set('name', 'facebook.request.create');
         $point->set('key', $to);
         $point->award();
     }
     $app = JFactory::getApplication();
     $app->close();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:31,代码来源:request.php

示例11: check

 /**
  * @return boolean
  */
 function check()
 {
     $this->menutype = JFilterInput::clean($this->menutype, 'menutype');
     if (empty($this->menutype)) {
         $this->setError("Cannot save: Empty menu type");
         return false;
     }
     // correct spurious data
     if (trim($this->title) == '') {
         $this->title = $this->menutype;
     }
     $db =& JFactory::getDBO();
     // check for unique menutype for new menu copy
     $query = 'SELECT menutype' . ' FROM #__menu_types';
     if ($this->id) {
         $query .= ' WHERE id != ' . (int) $this->id;
     }
     $db->setQuery($query);
     $menus = $db->loadResultArray();
     foreach ($menus as $menutype) {
         if ($menutype == $this->menutype) {
             $this->setError("Cannot save: Duplicate menu type '{$this->menutype}'");
             return false;
         }
     }
     return true;
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:30,代码来源:menutypes.php

示例12: getStart

 /**
  * Here starts the processing
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		3.0
  */
 public function getStart()
 {
     $jinput = JFactory::getApplication()->input;
     // Load the data
     $this->loadData();
     // Load the helper
     $this->helper = new Com_VirtueMart();
     // Get the logger
     $csvilog = $jinput->get('csvilog', null, null);
     $this->virtuemart_vendor_id = $this->helper->getVendorId();
     // Process data
     foreach ($this->csvi_data as $name => $value) {
         // Check if the field needs extra treatment
         switch ($name) {
             case 'name':
                 $this->{$name} = strtolower(JFilterInput::clean($value, 'alnum'));
                 break;
             default:
                 $this->{$name} = $value;
                 break;
         }
     }
     // Check if we have a field ID
     if (empty($this->virtuemart_userfield_id)) {
         $this->_getFieldId();
     }
     // All is good
     return true;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:41,代码来源:shopperfieldimport.php

示例13: _loadEditor

 /**
  * Load the editor
  *
  * @access	private
  * @param	array	Associative array of editor config paramaters
  * @since	1.5
  */
 function _loadEditor($config = array())
 {
     //check if editor is already loaded
     if (!is_null($this->_editor)) {
         return;
     }
     jimport('joomla.filesystem.file');
     // Build the path to the needed editor plugin
     $name = JFilterInput::clean($this->_name, 'cmd');
     $path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php';
     if (!JFile::exists($path)) {
         $message = JText::_('Cannot load the editor');
         JCKHelper::error($message);
         return false;
     }
     // Require plugin file
     require_once $path;
     // Build editor plugin classname
     $name = 'plgEditor' . $this->_name;
     if ($this->_editor = new $name($this, $config)) {
         // load plugin parameters
         $this->initialise();
         JPluginHelper::importPlugin('editors-xtd');
     }
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:32,代码来源:editor.php

示例14: render

 /**
  * Render the document
  *
  * @access public
  * @param boolean 	$cache		If true, cache the output
  * @param array		$params		Associative array of attributes
  */
 function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (!isset($this->_error)) {
         return;
     }
     //Set the status header
     JResponse::setHeader('status', $this->_error->code . ' ' . str_replace("\n", ' ', $this->_error->message));
     $file = 'error.php';
     // check template
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = isset($params['template']) ? JFilterInput::clean($params['template'], 'cmd') : 'system';
     if (!file_exists($directory . DS . $template . DS . $file)) {
         $template = 'system';
     }
     //set variables
     $this->baseurl = JURI::base(true);
     $this->template = $template;
     $this->debug = isset($params['debug']) ? $params['debug'] : false;
     $this->error = $this->_error;
     // load
     $data = $this->_loadTemplate($directory . DS . $template, $file);
     parent::render();
     return $data;
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:32,代码来源:error.php

示例15: getArrayRecursive

 /**
  * Gets an array of values from the request.
  *
  * @param   array   $vars           Associative array of keys and filter types to apply.
  *                                  If empty and datasource is null, all the input data will be returned
  *                                  but filtered using the filter given by the parameter defaultFilter in
  *                                  JFilterInput::clean.
  * @param   mixed   $datasource     Array to retrieve data from, or null.
  * @param   string  $defaultFilter  Default filter used in JFilterInput::clean if vars is empty and
  *                                  datasource is null. If 'unknown', the default case is used in
  *                                  JFilterInput::clean.
  * @param   bool    $recursion      Flag to indicate a recursive function call.
  *
  * @return  mixed  The filtered input data.
  *
  * @since   3.4.2
  */
 protected function getArrayRecursive(array $vars = array(), $datasource = null, $defaultFilter = 'unknown', $recursion = false)
 {
     if (empty($vars) && is_null($datasource)) {
         $vars = $this->data;
     } else {
         if (!$recursion) {
             $defaultFilter = null;
         }
     }
     $results = array();
     foreach ($vars as $k => $v) {
         if (is_array($v)) {
             if (is_null($datasource)) {
                 $results[$k] = $this->getArrayRecursive($v, $this->get($k, null, 'array'), $defaultFilter, true);
             } else {
                 $results[$k] = $this->getArrayRecursive($v, $datasource[$k], $defaultFilter, true);
             }
         } else {
             $filter = isset($defaultFilter) ? $defaultFilter : $v;
             if (is_null($datasource)) {
                 $results[$k] = $this->get($k, null, $filter);
             } elseif (isset($datasource[$k])) {
                 $results[$k] = $this->filter->clean($datasource[$k], $filter);
             } else {
                 $results[$k] = $this->filter->clean(null, $filter);
             }
         }
     }
     return $results;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:47,代码来源:input.php


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