本文整理汇总了PHP中JComponentHelper::filterText方法的典型用法代码示例。如果您正苦于以下问题:PHP JComponentHelper::filterText方法的具体用法?PHP JComponentHelper::filterText怎么用?PHP JComponentHelper::filterText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JComponentHelper
的用法示例。
在下文中一共展示了JComponentHelper::filterText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($data = 0)
{
$fileModel = VmModel::getModel('media');
//Now we try to determine to which this media should be long to
$data = array_merge(vRequest::getRequest(), vRequest::get('media'));
//$data['file_title'] = vRequest::getVar('file_title','','post','STRING',JREQUEST_ALLOWHTML);
if (!empty($data['file_description'])) {
$data['file_description'] = JComponentHelper::filterText($data['file_description']);
//vRequest::filter(); vRequest::getHtml('file_description','');
}
/*$data['media_action'] = vRequest::getCmd('media[media_action]');
$data['media_attributes'] = vRequest::getCmd('media[media_attributes]');
$data['file_type'] = vRequest::getCmd('media[file_type]');*/
if (empty($data['file_type'])) {
$data['file_type'] = $data['media_attributes'];
}
$msg = '';
if ($id = $fileModel->store($data)) {
$msg = vmText::_('COM_VIRTUEMART_FILE_SAVED_SUCCESS');
}
$cmd = vRequest::getCmd('task');
if ($cmd == 'apply') {
$redirection = 'index.php?option=com_virtuemart&view=media&task=edit&virtuemart_media_id=' . $id;
} else {
$redirection = 'index.php?option=com_virtuemart&view=media';
}
$this->setRedirect($redirection, $msg);
}
示例2: sanitize
/**
* Sanitize a value
*
* @param mixed $value Input string/array-of-string to be 'cleaned'
* @return mixed 'Cleaned' version of input parameter
*/
public function sanitize($value)
{
$value = (string) $value;
if (!empty($value)) {
$value = JComponentHelper::filterText($value);
}
return $value;
}
示例3: getInputData
protected function getInputData()
{
$data = parent::getInputData();
$params = JComponentHelper::getParams('com_k2');
if ($params->get('mergeEditors')) {
$data['text'] = JComponentHelper::filterText($this->input->get('text', '', 'raw'));
} else {
$data['introtext'] = JComponentHelper::filterText($this->input->get('introtext', '', 'raw'));
$data['fulltext'] = JComponentHelper::filterText($this->input->get('fulltext', '', 'raw'));
}
$data['media'] = JComponentHelper::filterText($this->input->get('media', '', 'raw'));
return $data;
}
示例4: save
/**
* We want to allow html so we need to overwrite some request data
*
* @author Max Milbers
*/
function save($data = 0)
{
$data = JRequest::get('post');
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (Permissions::getInstance()->check('admin')) {
$data['product_desc'] = JRequest::getVar('product_desc', '', 'post', 'STRING', 2);
$data['product_s_desc'] = JRequest::getVar('product_s_desc', '', 'post', 'STRING', 2);
$data['customtitle'] = JRequest::getVar('customtitle', '', 'post', 'STRING', 2);
} else {
$data['product_desc'] = JRequest::getVar('product_desc', '', 'post', 'STRING', 2);
$data['product_desc'] = JComponentHelper::filterText($data['product_desc']);
//Why we have this?
$multix = Vmconfig::get('multix', 'none');
if ($multix != 'none') {
//in fact this shoudl be used, when the mode is administrated and the sysetm is so that
//every product must be approved by an admin.
unset($data['published']);
//unset($data['childs']);
}
}
parent::save($data);
}
示例5: saveAddressInCart
function saveAddressInCart($data, $type, $putIntoSession = true,$prefix='') {
// VirtueMartModelUserfields::getUserFields() won't work
if(!class_exists('VirtueMartModelUserfields')) require(VMPATH_ADMIN.DS.'models'.DS.'userfields.php' );
$userFieldsModel = VmModel::getModel('userfields');
if ($type == 'STaddress' or $type == 'BTaddress'){
vmTrace('STaddress found, seek and destroy');
}
$prepareUserFields = $userFieldsModel->getUserFieldsFor('cart',$type);
if(!is_array($data)){
$data = get_object_vars($data);
}
if ($type =='ST') {
$this->STsameAsBT = 0;
} else { // BT
if(empty($data['email'])){
$jUser = JFactory::getUser();
$address['email'] = $jUser->email;
}
}
$address = array();
if(!class_exists('vmFilter'))require(VMPATH_ADMIN.DS.'helpers'.DS.'vmfilter.php');
foreach ($prepareUserFields as $fld) {
if(!empty($fld->name)){
$name = $fld->name;
if(!isset($data[$prefix.$name])){
$tmp = vRequest::getString($prefix.$name,false);
if($tmp){
$data[$prefix.$name] = $tmp;
}
else if($fld->required and isset($this->{$type}[$name])){ //Why we have this fallback to the already stored value?
$data[$prefix.$name] = $this->{$type}[$name];
}
/*if($fld->type=='text'){
} else {
vmdebug('my fld ',$fld);
}*/
}
if(isset($data[$prefix.$name])){
if(!empty($data[$prefix.$name])){
$value = vmFilter::hl( $data[$prefix.$name],array('deny_attribute'=>'*'));
//to strong
/* $value = preg_replace('@<[\/\!]*?[^<>]*?>@si','',$value);//remove all html tags */
//lets use instead
$value = JComponentHelper::filterText($value);
$value = (string)preg_replace('#on[a-z](.+?)\)#si','',$value);//replace start of script onclick() onload()...
$value = trim(str_replace('"', ' ', $value),"'") ;
$data[$prefix.$name] = (string)preg_replace('#^\'#si','',$value);
}
$address[$name] = $data[$prefix.$name];
} else {
vmdebug('Data not found for type '.$type.' and name '.$prefix.$name.' ');
}
}
}
//dont store passwords in the session
unset($address['password']);
unset($address['password2']);
$this->{$type} = $address;
if($putIntoSession){
$this->setCartIntoSession(true);
}
}
示例6: saveForm
function saveForm()
{
$template = new stdClass();
$template->tempid = acymailing_getCID('tempid');
$formData = JRequest::getVar('data', array(), '', 'array');
if (!empty($formData['template']['category']) && $formData['template']['category'] == -1) {
$formData['template']['category'] = JRequest::getString('newcategory', '');
}
foreach ($formData['template'] as $column => $value) {
acymailing_secureField($column);
$template->{$column} = strip_tags($value);
}
$styles = JRequest::getVar('styles', array(), '', 'array');
foreach ($styles as $class => $oneStyle) {
$styles[$class] = str_replace('"', "'", $oneStyle);
if (empty($oneStyle)) {
unset($styles[$class]);
}
}
$newStyles = JRequest::getVar('otherstyles', array(), '', 'array');
if (!empty($newStyles)) {
foreach ($newStyles['classname'] as $id => $className) {
if (!empty($className) and $className != JText::_('CLASS_NAME') and !empty($newStyles['style'][$id]) and $newStyles['style'][$id] != JText::_('CSS_STYLE')) {
$className = str_replace(array(',', ' ', ':', '.', '#'), '', $className);
$styles[$className] = str_replace('"', "'", $newStyles['style'][$id]);
}
}
}
$template->styles = serialize($styles);
if (empty($template->thumb)) {
unset($template->thumb);
} elseif ($template->thumb == 'delete') {
$template->thumb = '';
}
if (empty($template->readmore)) {
unset($template->readmore);
} elseif ($template->readmore == 'delete') {
$template->readmore = '';
}
$template->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
if (ACYMAILING_J25) {
$template->body = JComponentHelper::filterText($template->body);
}
if (!empty($styles['color_bg'])) {
$pat1 = '#^([^<]*<[^>]*background-color:)([^;">]{1,30})#i';
$found = false;
if (preg_match($pat1, $template->body)) {
$template->body = preg_replace($pat1, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
$pat2 = '#^([^<]*<[^>]*bgcolor=")([^;">]{1,10})#i';
if (preg_match($pat2, $template->body)) {
$template->body = preg_replace($pat2, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
if (!$found) {
$template->body = '<div style="background-color:' . $styles['color_bg'] . ';" width="100%">' . $template->body . '</div>';
}
}
$acypluginsHelper = acymailing_get('helper.acyplugins');
$acypluginsHelper->cleanHtml($template->body);
$template->description = JRequest::getVar('editor_description', '', '', 'string', JREQUEST_ALLOWHTML);
$tempid = $this->save($template);
if (!$tempid) {
return false;
}
if (empty($template->tempid)) {
$orderClass = acymailing_get('helper.order');
$orderClass->pkey = 'tempid';
$orderClass->table = 'template';
$orderClass->reOrder();
}
$this->createTemplateFile($tempid);
JRequest::setVar('tempid', $tempid);
return true;
}
示例7: getInputData
protected function getInputData()
{
$data = parent::getInputData();
$data['description'] = JComponentHelper::filterText($this->input->get('description', '', 'raw'));
return $data;
}
示例8: add
//.........这里部分代码省略.........
// passed all from $tmpProduct and relaoding it second time ????
// $tmpProduct = $this->getProduct((int) $virtuemart_product_id); seee before !!!
// $product = $this->getProduct((int) $virtuemart_product_id);
// Who ever noted that, yes that is exactly right that way, before we have a full object, with all functions
// of all its parents, we only need the data of the product, so we create a dummy class which contains only the data
// This is extremly important for performance reasons, else the sessions becomes too big.
// Check if we have a product
if ($product) {
if (!empty($post['virtuemart_category_id'][$p_key])) {
$virtuemart_category_idPost = (int) $post['virtuemart_category_id'][$p_key];
$product->virtuemart_category_id = $virtuemart_category_idPost;
}
$productKey = $product->virtuemart_product_id;
// INDEX NOT FOUND IN JSON HERE
// changed name field you know exactly was this is
if (isset($post['customPrice'])) {
$product->customPrices = $post['customPrice'];
if (isset($post['customPlugin'])) {
//if(!class_exists('vmFilter'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmfilter.php');
if (!is_array($post['customPlugin'])) {
$customPluginPost = (array) $post['customPlugin'];
} else {
$customPluginPost = $post['customPlugin'];
}
foreach ($customPluginPost as &$customPlugin) {
if (is_array($customPlugin)) {
foreach ($customPlugin as &$customPlug) {
if (is_array($customPlug)) {
foreach ($customPlug as &$customPl) {
//$value = vmFilter::hl( $customPl,array('deny_attribute'=>'*'));
//to strong
/* $value = preg_replace('@<[\/\!]*?[^<>]*?>@si','',$value);//remove all html tags */
//lets use instead
$value = JComponentHelper::filterText($customPl);
$value = (string) preg_replace('#on[a-z](.+?)\\)#si', '', $value);
//replace start of script onclick() onload()...
$value = trim(str_replace('"', ' ', $value), "'");
$customPl = (string) preg_replace('#^\'#si', '', $value);
}
}
}
}
}
$product->customPlugin = json_encode($customPluginPost);
}
$productKey .= '::';
foreach ($product->customPrices as $customPrice) {
foreach ($customPrice as $customId => $custom_fieldId) {
//MarkerVarMods
if (is_array($custom_fieldId)) {
foreach ($custom_fieldId as $userfieldId => $userfield) {
//$productKey .= (int)$customId . ':' . (int)$userfieldId . ';';
$productKey .= (int) $custom_fieldId . ':' . (int) $customId . ';';
}
} else {
//TODO productCartId
$productKey .= (int) $custom_fieldId . ':' . (int) $customId . ';';
}
}
}
}
// Add in the quantity in case the customfield plugins need it
$product->quantity = (int) $quantityPost;
if (!class_exists('vmCustomPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
}
示例9: saveastmpl
function saveastmpl()
{
$tmplClass = acymailing_get('class.template');
$newTmpl = new stdClass();
$formData = JRequest::getVar('data', array(), '', 'array');
if (!empty($formData['mail']['tempid'])) {
$template = $tmplClass->get($formData['mail']['tempid']);
$newTmpl->styles = $template->styles;
$newTmpl->stylesheet = $template->stylesheet;
$newTmpl->category = $template->category;
}
if (!empty($formData['mail']['subject'])) {
$formData['mail']['subject'] = str_replace(chr(226) . chr(128) . chr(168), '', $formData['mail']['subject']);
$newTmpl->subject = strip_tags($formData['mail']['subject']);
$newTmpl->name = strip_tags($formData['mail']['subject']);
}
$newTmpl->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
if (ACYMAILING_J25) {
$newTmpl->body = JComponentHelper::filterText($newTmpl->body);
}
$acypluginsHelper = acymailing_get('helper.acyplugins');
$acypluginsHelper->cleanHtml($newTmpl->body);
if (!empty($formData['mail']['thumb']) && $formData['mail']['thumb'] == 'delete') {
$newTmpl->thumb = null;
} elseif (!empty($formData['mail']['thumb'])) {
$newTmpl->thumb = strip_tags($formData['mail']['thumb']);
} else {
$mailid = acymailing_getCID('mailid');
if (!empty($mailid)) {
$mail = $this->get($mailid);
$newTmpl->thumb = $mail->thumb;
}
}
if (!empty($formData['mail']['altbody'])) {
$newTmpl->altbody = strip_tags($formData['mail']['altbody']);
}
if (!empty($formData['mail']['fromname'])) {
$newTmpl->fromname = strip_tags($formData['mail']['fromname']);
}
if (!empty($formData['mail']['fromemail'])) {
$newTmpl->fromemail = strip_tags($formData['mail']['fromemail']);
}
if (!empty($formData['mail']['replyname'])) {
$newTmpl->replyname = strip_tags($formData['mail']['replyname']);
}
if (!empty($formData['mail']['replyemail'])) {
$newTmpl->replyemail = strip_tags($formData['mail']['replyemail']);
}
if (!empty($formData['mail']['summary'])) {
$newTmpl->description = strip_tags($formData['mail']['summary']);
}
$newTmpl->ordering = 1;
$tempid = $tmplClass->save($newTmpl);
if (!empty($tempid)) {
$formData['mail']['tempid'] = $tempid;
acymailing_enqueueMessage(JText::_('ACY_SAVEASTMPL_VALID'), 'message');
} else {
acymailing_enqueueMessage(JText::_('ERROR_SAVING'), 'error');
}
return true;
}
示例10: cleanText
function cleanText($text)
{
if (version_compare(JVERSION, '2.5.0', 'ge')) {
$text = JComponentHelper::filterText($text);
} else {
if (version_compare(JVERSION, '2.5.0', 'lt') && version_compare(JVERSION, '1.6.0', 'ge')) {
JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'content.php');
$text = ContentHelper::filterText($text);
} else {
$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);
break;
case 'BL':
default:
$filter = new JFilterInput($filterTags, $filterAttrs, 1, 1);
break;
}
$text = $filter->clean($text);
} elseif (empty($filterGroups) && $gid != '25') {
// no default filtering for super admin (gid=25)
$filter = new JFilterInput(array(), array(), 1, 1);
$text = $filter->clean($text);
}
}
}
return $text;
}
示例11: getHtml
/**
* - Encodes all characters that has a numerical value <32.
* - keeps "secure" html
*/
public static function getHtml($name, $default = ''){
$tmp = self::get($name, $default,FILTER_UNSAFE_RAW,FILTER_FLAG_ENCODE_LOW);
return JComponentHelper::filterText($tmp);
}
示例12: save
function save($data)
{
$db = $this->getDbo();
$row = $this->getTable('igallery_img');
if (!$row->bind($data)) {
$this->setError($db->getErrorMsg());
return false;
}
if (strpos($row->description, 'class="des_div"') > 0) {
JError::raise(2, 500, 'Error: Html formatting has been copied from the gallery frontend into the description, please paste plain text');
}
$row->alt_text = htmlspecialchars($row->alt_text, ENT_QUOTES);
$raw = JRequest::getVar('jform', array(), 'post', 'NONE', JREQUEST_ALLOWRAW);
$row->description = JComponentHelper::filterText($raw['description']);
if (!$row->store()) {
$this->setError($db->getErrorMsg());
return false;
}
if (JFactory::getApplication()->isSite()) {
$data = JRequest::getVar('jform', array(), 'post', 'NONE', 4);
$id = (int) $data['id'];
} else {
$id = JRequest::getInt('id', 0);
}
$query = 'SELECT gallery_id, ordering from #__igallery_img WHERE id = ' . (int) $id;
$db->setQuery($query);
$currentRow = $db->loadObject();
$nextOrdering = $currentRow->ordering + 1;
$query = 'SELECT id from #__igallery_img WHERE gallery_id = ' . (int) $currentRow->gallery_id . ' AND ordering = ' . (int) $nextOrdering . ' LIMIT 1';
$db->setQuery($query);
$nextRow = $db->loadObject();
return $nextRow->id;
}
示例13: getHtml
public static function getHtml($name, $default = '')
{
$tmp = self::get($name, $default);
return JComponentHelper::filterText($tmp);
}
示例14: saveForm
function saveForm()
{
$app = JFactory::getApplication();
$config = acymailing_config();
$template = new stdClass();
$template->tempid = acymailing_getCID('tempid');
$formData = JRequest::getVar('data', array(), '', 'array');
foreach ($formData['template'] as $column => $value) {
acymailing_secureField($column);
$template->{$column} = strip_tags($value);
}
$styles = JRequest::getVar('styles', array(), '', 'array');
foreach ($styles as $class => $oneStyle) {
$styles[$class] = str_replace('"', "'", $oneStyle);
if (empty($oneStyle)) {
unset($styles[$class]);
}
}
$newStyles = JRequest::getVar('otherstyles', array(), '', 'array');
if (!empty($newStyles)) {
foreach ($newStyles['classname'] as $id => $className) {
if (!empty($className) and $className != JText::_('CLASS_NAME') and !empty($newStyles['style'][$id]) and $newStyles['style'][$id] != JText::_('CSS_STYLE')) {
$className = str_replace(array(',', ' ', ':', '.', '#'), '', $className);
$styles[$className] = str_replace('"', "'", $newStyles['style'][$id]);
}
}
}
$template->styles = serialize($styles);
$files = JRequest::getVar('pictures', array(), 'files', 'array');
if (!empty($files)) {
jimport('joomla.filesystem.file');
$uploadFolder = JPath::clean(html_entity_decode($config->get('uploadfolder')));
$uploadFolder = trim($uploadFolder, DS . ' ') . DS;
$uploadPath = JPath::clean(ACYMAILING_ROOT . $uploadFolder);
acymailing_createDir($uploadPath, true);
if (!is_writable($uploadPath)) {
@chmod($uploadPath, '0755');
if (!is_writable($uploadPath)) {
$app->enqueueMessage(JText::sprintf('WRITABLE_FOLDER', $uploadPath), 'notice');
}
}
$allowedExtensions = array('jpg', 'gif', 'png', 'jpeg', 'ico', 'bmp');
foreach ($files['name'] as $id => $filename) {
if (empty($filename)) {
continue;
}
$extension = strtolower(substr($filename, strrpos($filename, '.') + 1));
if (!in_array($extension, $allowedExtensions)) {
$app->enqueueMessage(JText::sprintf('ACCEPTED_TYPE', $extension, implode(', ', $allowedExtensions)), 'notice');
continue;
}
$pictname = strtolower(substr(JFile::makeSafe($filename), 0, strrpos($filename, '.') + 1));
$pictname = preg_replace('#[^0-9a-z]#i', '_', $pictname);
$pictfullname = $pictname . '.' . $extension;
if (file_exists($uploadPath . $pictfullname)) {
$pictfullname = $pictname . time() . '.' . $extension;
}
if (!JFile::upload($files['tmp_name'][$id], $uploadPath . $pictfullname)) {
if (!move_uploaded_file($files['tmp_name'][$id], $uploadPath . $pictfullname)) {
$app->enqueueMessage(JText::sprintf('FAIL_UPLOAD', '<b><i>' . $files['tmp_name'][$id] . '</i></b>', '<b><i>' . $uploadPath . $pictfullname . '</i></b>'), 'error');
continue;
}
}
$template->{$id} = str_replace(DS, '/', $uploadFolder) . $pictfullname;
}
}
$template->body = JRequest::getVar('editor_body', '', '', 'string', JREQUEST_ALLOWRAW);
if (ACYMAILING_J25) {
$template->body = JComponentHelper::filterText($template->body);
}
if (!empty($styles['color_bg'])) {
$pat1 = '#^([^<]*<[^>]*background-color:)([^;">]{1,30})#i';
$found = false;
if (preg_match($pat1, $template->body)) {
$template->body = preg_replace($pat1, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
$pat2 = '#^([^<]*<[^>]*bgcolor=")([^;">]{1,10})#i';
if (preg_match($pat2, $template->body)) {
$template->body = preg_replace($pat2, '$1' . $styles['color_bg'], $template->body);
$found = true;
}
if (!$found) {
$template->body = '<div style="background-color:' . $styles['color_bg'] . ';" width="100%">' . $template->body . '</div>';
}
}
$acypluginsHelper = acymailing_get('helper.acyplugins');
$acypluginsHelper->cleanHtml($template->body);
$template->description = JRequest::getVar('editor_description', '', '', 'string', JREQUEST_ALLOWHTML);
$tempid = $this->save($template);
if (!$tempid) {
return false;
}
if (empty($template->tempid)) {
$orderClass = acymailing_get('helper.order');
$orderClass->pkey = 'tempid';
$orderClass->table = 'template';
$orderClass->reOrder();
}
$this->createTemplateFile($tempid);
//.........这里部分代码省略.........
示例15: filterText
protected function filterText($var)
{
$text = JRequest::getVar($var, '', 'post', 'STRING', 2);
return JComponentHelper::filterText($text);
}