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


PHP JFilterOutput::stringURLSafe方法代码示例

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


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

示例1: store

 public function store($updateNulls = true)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         $this->modified_time = $date->toSql();
         $this->modified_user_id = $user->get('id');
     } else {
         if (!(int) $this->created_time) {
             $this->created_time = $date->toSql();
         }
         if (empty($this->created_user_id)) {
             $this->created_user_id = $user->get('id');
         }
     }
     $table = JTable::getInstance('Page', 'SppagebuilderTable');
     $alias = JFilterOutput::stringURLSafe($this->alias);
     if ($alias == '') {
         $alias = JFilterOutput::stringURLSafe($this->title);
     }
     $this->alias = $alias;
     if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
开发者ID:spikart,项目名称:spikart.com.ua,代码行数:27,代码来源:page.php

示例2: check

	/**
	 * Overloaded check function
	 *
	 * @access public
	 * @return boolean
	 *
	 */
	function check()
	{
		// Not typed in a category name?
		if (trim($this->catname) == '') {
			$this->_error = JText::_('COM_JEM_ADD_NAME_CATEGORY');
			JError::raiseWarning('SOME_ERROR_CODE', $this->_error);
			return false;
		}

		$alias = JFilterOutput::stringURLSafe($this->catname);

		if(empty($this->alias) || $this->alias === $alias) {
			$this->alias = $alias;
		}

		/** check for existing name */
		/* in fact, it can happen for subcategories
		$query = 'SELECT id FROM #__jem_categories WHERE catname = '.$this->_db->Quote($this->catname);
		$this->_db->setQuery($query);

		$xid = intval($this->_db->loadResult());
		if ($xid && $xid != intval($this->id)) {
			JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('COM_JEM_CATEGORY_NAME_ALREADY_EXIST', $this->catname));
			return false;
		}
		*/

		return true;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:36,代码来源:jem_categories.php

示例3: check

 public function check()
 {
     $result = true;
     //Alias
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $existingAlias = FOFModel::getTmpInstance('Tags', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
     if (!empty($existingAlias)) {
         $count = 0;
         $k = $this->getKeyName();
         foreach ($existingAlias as $item) {
             if ($item->{$k} != $this->{$k}) {
                 $count++;
             }
         }
         if ($count) {
             $this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
             $result = false;
         }
     }
     return $result;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:tag.php

示例4: tranAlias

function tranAlias($easyset)
{
    // set translate language
    $SourceLan = $easyset->params->get('originLan');
    $ResultLan = $easyset->params->get('tranLlan', 'en');
    // get query
    $post = JRequest::get('post');
    if (!isset($post['jform']) || !isset($post['jform']['alias'])) {
        return;
    }
    $alias = $post['jform']['alias'];
    $title = $post['jform']['title'];
    $titleTmp = explode('::', $post['jform']['title']);
    if (!empty($titleTmp[1])) {
        $title = $titleTmp[0];
        $alias = JFilterOutput::stringURLSafe($titleTmp[1]);
    }
    if (trim($alias) == '') {
        $alias = AKHelper::_('lang.translate', $title, $SourceLan, $ResultLan);
        $alias = trim($alias);
        $alias = JFilterOutput::stringURLSafe($alias);
        $replace = array('aquot' => '', 'a39' => '', '--' => '-');
        $alias = strtr($alias, $replace);
        $alias = trim($alias, '-');
    }
    $post['jform']['alias'] = $alias;
    $post['jform']['title'] = $title;
    $input = JFactory::getApplication()->input;
    JRequest::setVar('jform', $post['jform'], 'method', true);
    $input->post->set('jform', $post['jform']);
    $input->request->set('jform', $post['jform']);
}
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:32,代码来源:tranAlias.php

示例5: _getRequest

 protected function _getRequest($hash = 'default', $mask = 0)
 {
     if ($hash == 'post') {
         $post = JRequest::get('post');
         // fix up special html fields
         $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) {
             $post['introtext'] = $text;
             $post['fulltext'] = "";
         } else {
             list($post['introtext'], $post['fulltext']) = preg_split($pattern, $text, 2);
         }
         if (empty($post['alias'])) {
             $post['alias'] = $post['name'];
         }
         $post['alias'] = JFilterOutput::stringURLSafe($post['alias']);
         return $post;
     }
     return parent::_getRequest($hash, $mask);
 }
开发者ID:janssit,项目名称:www.alu-andries.be,代码行数:25,代码来源:item.php

示例6: getBadgeAlias

function getBadgeAlias($id)
{
    $badge = FD::table('Badge');
    $badge->load($id);
    $alias = JFilterOutput::stringURLSafe($badge->alias);
    return $alias;
}
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:7,代码来源:common.php

示例7: display

 function display($tpl = null)
 {
     global $option, $mainframe, $layout;
     // get data
     $model =& $this->getModel();
     $product = $model->getDetail();
     $images = $model->getImages();
     $relative = $model->getRelative();
     $titleCatName = JFilterOutput::stringURLSafe($product->category);
     $titleCatName = str_replace(' ', '-', strtolower(trim($titleCatName)));
     $title = JFilterOutput::stringURLSafe($product->name);
     $title = str_replace(' ', '-', strtolower($title));
     $product->link = JRoute::_('index.php?option=' . $option . '&view=detail&id=' . $product->id . ':' . $title);
     $document =& JFactory::getDocument();
     $document->addScript('components/com_products/js/jquery-1.3.2.js');
     $document->addScript('components/com_products/js/colorbox/jquery.colorbox.js');
     $document->addStyleSheet('components/com_products/js/colorbox/colorbox.css');
     $document->addScriptDeclaration('if($===jQuery){jQuery.noConflict();} jQuery(document).ready(function(){ jQuery("a[rel=\'product_image\']").colorbox({current: "Ảnh {current} / {total}"}); });');
     $titleSEO = '';
     if ($product->name) {
         $titleSEO = $product->name;
         if ($product->category) {
             $titleSEO = $product->name . ' | ' . $product->category;
         }
     }
     $document->setTitle($titleSEO . ' | ' . $mainframe->getCfg('sitename'));
     $app =& JFactory::getApplication();
     $pathway = $app->getPathway();
     $pathway->addItem($product->name);
     $this->assignRef('relative', $relative);
     $this->assignRef('images', $images);
     $this->assignRef('product', $product);
     $this->assignRef('titleCatName', $titleCatName);
     parent::display($tpl);
 }
开发者ID:geilin,项目名称:jooomlashop,代码行数:35,代码来源:view.html.php

示例8: check

 /**
  * Overloaded check method to ensure data integrity
  *
  * @access public
  * @return boolean True on success
  * @since 1.0
  */
 function check()
 {
     if (empty($this->name)) {
         $this->setError(JText::_('NAME REQUIRED'));
         return false;
     }
     // add default middle size name
     if (empty($this->middle_name)) {
         $parts = explode(" ", $this->name);
         $this->middle_name = substr($parts[0], 0, 20);
     }
     // add default short size name
     if (empty($this->short_name)) {
         $parts = explode(" ", $this->name);
         $this->short_name = substr($parts[0], 0, 2);
     }
     // setting alias
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->name);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
         // make sure the user didn't modify it to something illegal...
     }
     return true;
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:32,代码来源:team.php

示例9: check

 public function check()
 {
     if (JString::trim($this->name) == '') {
         $this->setError(JText::_('K2_TAG_MUST_HAVE_A_NAME'));
         return false;
     }
     $this->normalize();
     $this->alias = $this->name;
     if (JFactory::getConfig()->get('unicodeslugs') == 1) {
         $this->alias = JFilterOutput::stringURLUnicodeSlug($this->alias);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select($db->quoteName('id'))->from($db->quoteName('#__k2_tags'))->where($db->quoteName('alias') . ' = ' . $db->quote($this->alias));
     if ($this->id) {
         $query->where($db->quoteName('id') . ' != ' . (int) $this->id);
     }
     $db->setQuery($query);
     if ($db->loadResult()) {
         $this->alias .= '-' . uniqid();
     }
     return true;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:25,代码来源:tags.php

示例10: save

 function save($list)
 {
     if (empty($list->listid)) {
         if (empty($list->userid)) {
             $user =& JFactory::getUser();
             $list->userid = $user->id;
         }
         if (empty($list->alias)) {
             $list->alias = $list->name;
         }
     }
     if (isset($list->alias)) {
         if (empty($list->alias)) {
             $list->alias = $list->name;
         }
         $list->alias = JFilterOutput::stringURLSafe(trim($list->alias));
     }
     if (empty($list->listid)) {
         $status = $this->database->insertObject(acymailing::table('list'), $list);
     } else {
         $status = $this->database->updateObject(acymailing::table('list'), $list, 'listid');
     }
     if ($status) {
         return empty($list->listid) ? $this->database->insertid() : $list->listid;
     }
     return false;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:27,代码来源:list.php

示例11: check

 /**
  * @return boolean
  */
 function check()
 {
     $this->menutype = JFilterOutput::stringURLSafe($this->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:jicheng17,项目名称:comanova,代码行数:30,代码来源:menutypes.php

示例12: translateAlias

 /**
  * translateAlias
  *
  * @return  void
  */
 public static function translateAlias()
 {
     $easyset = \Ezset::getInstance();
     $input = \JFactory::getApplication()->input;
     // Set translate language
     $SourceLan = $easyset->params->get('originLan');
     $ResultLan = $easyset->params->get('tranLan', 'en');
     // Get query
     $jform = $input->post->getRaw('jform', array());
     if (!isset($jform) || !isset($jform['alias']) || !isset($jform['title'])) {
         return;
     }
     $alias = $jform['alias'];
     $title = $jform['title'];
     $titleTmp = explode('::', $jform['title']);
     if (!empty($titleTmp[1])) {
         $title = $titleTmp[0];
         $alias = \JFilterOutput::stringURLSafe($titleTmp[1]);
     }
     if ('' == (string) trim($alias)) {
         $alias = LanguageHelper::translate($title, $SourceLan, $ResultLan);
         $alias = trim($alias);
         $alias = \JFilterOutput::stringURLSafe($alias);
         $alias = strtr($alias, static::$replace);
         $alias = trim($alias, '-');
     }
     $jform['alias'] = $alias;
     $jform['title'] = $title;
     $input = \JFactory::getApplication()->input;
     $input->post->set('jform', $jform, 'method', true);
     $input->request->set('jform', $jform);
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:37,代码来源:Translate.php

示例13: check

 function check()
 {
     $mainframe = JFactory::getApplication();
     // check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('Your Poll must contain a title.'));
         return false;
     }
     // check for valid lag
     $this->lag = floatval($this->lag * 60);
     if ($this->lag == 0) {
         $this->setError(JText::_('Your Poll must have a non-zero lag time.'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JFilterOutput::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $datenow =& JFactory::getDate();
         $datenow->setOffset($mainframe->getCfg('offset'));
         $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
     }
     return true;
 }
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:25,代码来源:poll.php

示例14: store

 /**
  * Override parent's store function
  *
  * @author Jason Rey <jasonrey@stackideas.com>
  * @since  1.2
  * @access public
  */
 public function store($updateNulls = null)
 {
     // Store this flag first because there are some actions that we might need to do only after saving, and that point isNew() won't return the correct flag.
     $isNew = $this->isNew();
     // Check alias
     $alias = !empty($this->alias) ? $this->alias : $this->title;
     $alias = JFilterOutput::stringURLSafe($alias);
     $model = FD::model('clusters');
     $i = 2;
     do {
         $aliasExists = $model->clusterCategoryAliasExists($alias, $this->id);
         if ($aliasExists) {
             $alias .= '-' . $i++;
         }
     } while ($aliasExists);
     $this->alias = $alias;
     if (empty($this->ordering)) {
         $this->ordering = $this->getNextOrder('type = ' . FD::db()->quote($this->type));
     }
     if (empty($this->created)) {
         $this->created = FD::date()->toSql();
     }
     if (empty($this->uid)) {
         $this->uid = FD::user()->id;
     }
     $state = parent::store($updateNulls);
     if ($isNew) {
         // Create default fields
         FD::model('fields')->createDefaultItems($this->id, SOCIAL_TYPE_CLUSTERS, $this->type);
     }
     return $state;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:39,代码来源:clustercategory.php

示例15: check

 /**
  * Check data integrity
  *
  * @access public
  * @return boolean True on success
  */
 public function check()
 {
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->name);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
         // make sure the user didn't modify it to something illegal...
     }
     // check if project is unique
     // by checking if name+league+season alrerady exist
     if (!$this->id) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('name');
         $query->from('#__joomleague_project');
         $query->where('name =' . $db->Quote($this->name));
         $query->where('league_id = ' . $this->league_id);
         $query->where('season_id = ' . $this->season_id);
         $db->setQuery($query);
         $result = $db->loadColumn();
         if ($result) {
             $app = JFactory::getApplication()->enqueueMessage('Project with this name already exists', 'warning');
             return false;
         }
     }
     return true;
 }
开发者ID:hfmprs,项目名称:JoomLeague,代码行数:33,代码来源:project.php


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