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


PHP JApplication::stringURLSafe方法代码示例

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


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

示例1: check

 /**
  * Overloaded check function
  *
  * @return    boolean    True on success, false on failure
  */
 public function check()
 {
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_PROJECTFORK_WARNING_PROVIDE_VALID_TITLE'));
         return false;
     }
     if (trim($this->alias) == '') {
         $this->alias = $this->title;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JApplication::stringURLSafe(JFactory::getDate()->format('Y-m-d-H-i-s'));
     }
     // Check attribs
     $registry = new JRegistry();
     $registry->loadString($this->attribs);
     $this->attribs = (string) $registry;
     // Check if a project is selected
     if ((int) $this->project_id <= 0) {
         $this->setError(JText::_('COM_PROJECTFORK_WARNING_SELECT_PROJECT'));
         return false;
     }
     // Check for selected access level
     if ($this->access <= 0) {
         $this->access = $this->_getParentAccess();
     }
     return true;
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:33,代码来源:directory.php

示例2: check

 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     if (empty($this->name)) {
         $this->name = "form_" . self::getNextOrder();
     }
     // Remove accented UTF-8 charachters in field name
     $this->name = JApplication::stringURLSafe($this->name, ENT_QUOTES);
     // Set label
     if (empty($this->title)) {
         $this->title = $this->name;
     }
     // Check upload directory
     JLoader::import('joomla.filesystem.folder');
     //convert backslashes to slashes
     $uploadpath = preg_replace('#\\\\#', '/', $this->uploadpath);
     $this->uploadpath = $uploadpath;
     //remove slashes at the beginning and the end of string
     $this->uploadpath = rtrim($this->uploadpath, '/');
     $this->uploadpath = ltrim($this->uploadpath, '/');
     $check = trim($this->uploadpath);
     if (!empty($check)) {
         $check = JPath::clean($check);
         if (!JFolder::exists($this->uploadpath)) {
             $directory = JPATH_SITE . '/' . $this->uploadpath;
             if (!JFolder::exists($directory)) {
                 $this->setError(JText::_('COM_VISFORMS_DIRECTORY_DOESNT_EXISTS'));
                 return false;
             }
         }
     } else {
         $this->setError(JText::_('COM_VISFORMS_DIRECTORY_EMPTY'));
         return false;
     }
     return true;
 }
开发者ID:shamusdougan,项目名称:GDMCWebsite,代码行数:42,代码来源:visform.php

示例3: check

 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     // Set name
     $this->name = htmlspecialchars_decode($this->name, ENT_QUOTES);
     // Set alias
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (empty($this->alias)) {
         $this->alias = JApplication::stringURLSafe($this->name);
     }
     // Check the publish down date is not earlier than publish up.
     if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     // Set ordering
     if ($this->state < 0) {
         // Set ordering to 0 if state is archived or trashed
         $this->ordering = 0;
     } elseif (empty($this->ordering)) {
         // Set ordering to last if ordering was 0
         $this->ordering = self::getNextOrder($this->_db->quoteName('catid') . '=' . $this->_db->Quote($this->catid) . ' AND state>=0');
     }
     return true;
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:33,代码来源:banner.php

示例4: check

	/**
	 * Overloaded check function
	 *
	 * @return  boolean  True on success, false on failure
	 *
	 * @see     JTable::check
	 * @since   11.1
	 */
	public function check()
	{
		$this->menutype = JApplication::stringURLSafe($this->menutype);
		if (empty($this->menutype))
		{
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENUTYPE_EMPTY'));
			return false;
		}

		// Sanitise data.
		if (trim($this->title) == '')
		{
			$this->title = $this->menutype;
		}

		// Check for unique menutype.
		$query = $this->_db->getQuery(true);
		$query->select('COUNT(id)');
		$query->from($this->_db->quoteName('#__menu_types'));
		$query->where($this->_db->quoteName('menutype') . ' = ' . $this->_db->quote($this->menutype));
		$query->where($this->_db->quoteName('id') . ' <> ' . (int) $this->id);
		$this->_db->setQuery($query);

		if ($this->_db->loadResult())
		{
			$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENUTYPE_EXISTS', $this->menutype));
			return false;
		}

		return true;
	}
开发者ID:robschley,项目名称:joomla-platform,代码行数:39,代码来源:type.php

示例5: check

 /**
  * Check if a category exists 
  * 
  * @copyright 
  * @author 		RolandD
  * @todo 
  * @see 
  * @access 		public
  * @param 
  * @return 
  * @since 		4.3
  */
 public function check()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     // Check if the category exists
     $query->select('id');
     $query->from('#__ezrealty_catg');
     $query->where($db->qn('name') . ' = ' . $db->quote($this->name));
     $db->setQuery($query);
     $catid = $db->loadResult();
     if ($catid > 0) {
         $this->id = $catid;
     } else {
         // Check the alias
         if (empty($this->alias)) {
             $this->alias = JApplication::stringURLSafe($this->name);
             if (trim(str_replace('-', '', $this->alias)) == '') {
                 $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
             }
         }
         // Check the access
         if (empty($this->access)) {
             $this->access = 1;
         }
     }
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:38,代码来源:categories.php

示例6: check

	/**
	 * Overloaded check function
	 *
	 * @return  boolean  True on success, false on failure
	 *
	 * @see     JTable::check
	 * @since   11.1
	 */
	function check()
	{
		$this->menutype = JApplication::stringURLSafe($this->menutype);
		if (empty($this->menutype)) {
			$this->setError(JText::_('JLIB_DATABASE_ERROR_MENUTYPE_EMPTY'));
			return false;
		}

		// Sanitise data.
		if (trim($this->title) == '') {
			$this->title = $this->menutype;
		}

		$db	= $this->getDbo();

		// Check for unique menutype.
		$db->setQuery(
			'SELECT COUNT(id)' .
			' FROM #__menu_types' .
			' WHERE menutype = '.$db->quote($this->menutype).
			'  AND id <> '.(int) $this->id
		);

		if ($db->loadResult())
		{
			$this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENUTYPE_EXISTS', $this->menutype));
			return false;
		}

		return true;
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:39,代码来源:menutype.php

示例7: check

 public function check()
 {
     // Check for valid name
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_FIELDS_LOCATION_ERR_TABLES_TITLE'));
         return false;
     }
     if (empty($this->alias)) {
         $this->alias = $this->title;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JString::increment($alias, 'dash');
     }
     $this->alias = str_replace(',', '-', $this->alias);
     if (empty($this->type)) {
         $this->type = 'text';
     }
     // Check the publish down date is not earlier than publish up.
     if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) {
         $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
         return false;
     }
     if (is_array($this->catid)) {
         $this->catid = implode(',', $this->catid);
     }
     return true;
 }
开发者ID:beingsane,项目名称:DPFields,代码行数:28,代码来源:field.php

示例8: check

 /**
  * Overloaded check function
  *
  * @return  boolean  True on success
  *
  * @see     JTable::check
  * @since   11.1
  */
 public function check()
 {
     // If the alias field is empty, set it to the title.
     $this->alias = trim($this->alias);
     if (empty($this->alias) && ($this->type != 'alias' && $this->type != 'url')) {
         $this->alias = $this->title;
     }
     // Make the alias URL safe.
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     // Cast the home property to an int for checking.
     $this->home = (int) $this->home;
     // Verify that a first level menu item alias is not 'component'.
     if ($this->parent_id == 1 && $this->alias == 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT'));
         return false;
     }
     // Verify that a first level menu item alias is not the name of a folder.
     jimport('joomla.filesystem.folder');
     if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) {
         $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias));
         return false;
     }
     // Verify that the home item a component.
     if ($this->home && $this->type != 'component') {
         $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT'));
         return false;
     }
     return true;
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:40,代码来源:menu.php

示例9: check

 function check()
 {
     jimport('joomla.filter.output');
     $this->name = htmlspecialchars_decode($this->name, ENT_QUOTES);
     if (empty($this->ordering)) {
         $this->ordering = self::getNextOrder();
     }
     if (empty($this->alias)) {
         $this->alias = $this->name;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('1', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
     }
     $this->alias = str_replace("-", "_", $this->alias);
     if ($this->type == '0') {
         return false;
     }
     if (is_array($_REQUEST['jform']['type_' . $this->type])) {
         $_REQUEST['jform']['type_' . $this->type]['value'] = $this->remove_array_empty_values($_REQUEST['jform']['type_' . $this->type]['value']);
         $_REQUEST['jform']['type_' . $this->type] = serialize($_REQUEST['jform']['type_' . $this->type]);
     }
     if ($this->type != 'image') {
         $this->default_values = $_REQUEST['jform']['type_' . $this->type];
     }
     return true;
 }
开发者ID:juanferden,项目名称:adoperp,代码行数:27,代码来源:userfield.php

示例10: check

 public function check()
 {
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_JUDOWNLOAD_TITLE_MUST_NOT_BE_EMPTY'));
         return false;
     }
     if (trim($this->alias) == '') {
         $this->alias = $this->title;
     }
     $this->alias = JApplication::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     if (trim(str_replace('&nbsp;', '', $this->description)) == '') {
         $this->description = '';
     }
     if (!empty($this->metakeyword)) {
         $bad_characters = array("\n", "\r", "\"", "<", ">");
         $after_clean = JString::str_ireplace($bad_characters, "", $this->metakeyword);
         $keys = explode(',', $after_clean);
         $clean_keys = array();
         foreach ($keys as $key) {
             if (trim($key)) {
                 $clean_keys[] = trim($key);
             }
         }
         $this->metakeyword = implode(", ", $clean_keys);
     }
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:license.php

示例11: check

 /**
  * Check
  */
 public function check()
 {
     // check title
     if (trim($this->title) == '') {
         $this->setError(JText::_('COM_JKIT_TAG_ERROR_TITLE'));
         return false;
     }
     // / create alias from title, and make safe
     $this->alias = JApplication::stringURLSafe($this->title);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->setError(JText::_('COM_JKIT_TAG_ERROR_ALIAS'));
         return false;
     }
     // verify unique alias
     $table = JTable::getInstance('Tag', 'JKitTable', array('dbo' => $this->getDbo()));
     if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_JKIT_TAG_ERROR_ALIAS'));
         return false;
     }
     // check translations titles and alias
     if ($this->language != '*') {
         $db = JFactory::getDbo();
         $langs = JKitHelperLangs::getLangs();
         foreach ($langs as $lang) {
             if ($this->language != $lang->lang_code) {
                 // check translation title
                 $t_title = trim(JRequest::getString('translation_title_' . $lang->lang_code));
                 if ($t_title == '') {
                     $this->setError(JText::sprintf('COM_JKIT_TAG_ERROR_TRANSLATION_TITLE', $lang->title));
                     return false;
                 }
                 // check translation alias
                 $t_alias = JApplication::stringURLSafe($t_title);
                 if (trim(str_replace('-', '', $t_alias)) == '') {
                     $this->setError(JText::sprintf('COM_JKIT_TAG_ERROR_TRANSLATION_ALIAS', $lang->title));
                     return false;
                 }
                 // check translation repeated alias
                 $q_l = $db->quote($lang->lang_code);
                 $q_a = $db->quote($t_alias);
                 $ref_id = $this->id ? " AND `ref_id` != {$this->id}" : '';
                 $q1 = "SELECT `ref_id` FROM `#__jkit_translations` WHERE `ref_table` = 'tags' AND `alias` = {$q_a} AND `lang` = {$q_l} {$ref_id}";
                 $t_ids1 = $db->setQuery($q1)->loadColumn();
                 if ($t_ids1) {
                     $this->setError(JText::sprintf('COM_JKIT_TAG_ERROR_TRANSLATION_ALIAS', $lang->title));
                     return false;
                 }
                 // check duplicated tags in different languages
                 $tid = $this->id ? " AND id != {$this->id}" : '';
                 $q2 = "SELECT `id` FROM `#__jkit_tags` WHERE `alias` = {$q_a} AND `language` = {$q_l} {$tid}";
                 $t_ids2 = $db->setQuery($q2)->loadColumn();
                 if ($t_ids2) {
                     $this->setError(JText::sprintf('COM_JKIT_TAG_ERROR_TRANSLATION_ALIAS', $lang->title));
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:radabass,项目名称:JKit,代码行数:63,代码来源:tag.php

示例12: store

 public function store($updateNulls = false)
 {
     $isNew = false;
     if (!$this->id) {
         // New document
         $this->downloaded = 0;
         $isNew = true;
     }
     if (isset($this->alias) && isset($this->name) && $this->alias == "") {
         $this->alias = preg_replace("/ /", "-", strtolower($this->name));
     }
     if (version_compare(JVERSION, '3.0', '>=')) {
         $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     } else {
         $this->alias = JApplication::stringURLSafe($this->alias);
     }
     // Trigger events to osdownloads plugins
     $dispatcher = $this->getDispatcher();
     $pluginResults = $dispatcher->trigger('onOSDownloadsBeforeSaveFile', array(&$this, $isNew));
     $result = false;
     if ($pluginResults !== false) {
         $result = parent::store($updateNulls);
         $dispatcher->trigger('onOSDownloadsAfterSaveFile', array($result, &$this));
     }
     return $result;
 }
开发者ID:patricmutwiri,项目名称:OSDownloads-1,代码行数:26,代码来源:abstractdocument.php

示例13: check

 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     if (empty($this->name)) {
         $this->name = "field-" . self::getNextOrder($this->_db->quoteName('fid') . '=' . $this->_db->Quote($this->fid));
     }
     //When we submit a form fields are added to the $Request with the field name as request parameter name.
     //If a field name matches a default request parameter (like id) this will be overridden with the user input for the form field.
     //This can cause strange errors
     $forbiddenFieldNames = array('id', 'fid', 'view', 'task', 'option', 'lang', 'language', 'itemid', 'restrictions');
     foreach ($forbiddenFieldNames as $fvalue) {
         if ($this->name == $fvalue) {
             $this->name = "field-" . self::getNextOrder($this->_db->quoteName('fid') . '=' . $this->_db->Quote($this->fid));
             JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_VISFORMS_INVALID_FIELD_NAME_REPLACED', $fvalue, $this->name), 'warning');
         }
     }
     // Remove accented UTF-8 charachters in field name
     $this->name = JApplication::stringURLSafe($this->name, ENT_QUOTES);
     // Set label
     if (empty($this->label)) {
         $this->label = $this->name;
     }
     // Set ordering
     if (empty($this->ordering)) {
         // Set ordering to last if ordering was 0
         $this->ordering = self::getNextOrder($this->_db->quoteName('fid') . '=' . $this->_db->Quote($this->fid));
     }
     return true;
 }
开发者ID:shamusdougan,项目名称:GDMCWebsite,代码行数:35,代码来源:visfield.php

示例14: check

 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     // Require helper
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'je_content.php';
     jimport('joomla.filter.output');
     // Set title
     $this->title = htmlspecialchars_decode($this->title, ENT_QUOTES);
     // Set alias
     $this->alias = JE_ContentHelper::convertAlias($this->title);
     $this->alias = JApplication::stringURLSafe($this->alias);
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     // Set ordering
     if ($this->state < 0) {
         // Set ordering to 0 if state is archived or trashed
         $this->ordering = 0;
     } else {
         if (empty($this->ordering)) {
             // Set ordering to last if ordering was 0
             $this->ordering = self::getNextOrder('`catid`=' . $this->_db->Quote($this->catid) . ' AND state>=0');
         }
     }
     return true;
 }
开发者ID:ngxuanmui,项目名称:hanhphuc.vn,代码行数:36,代码来源:article.php

示例15: prepareTable

 protected function prepareTable($table)
 {
     jimport('joomla.filter.output');
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
     $table->alias = JApplication::stringURLSafe($table->alias);
     if (empty($table->alias)) {
         $table->alias = JApplication::stringURLSafe($table->title);
     }
     if (intval($table->date) == 0) {
         $table->date = JFactory::getDate()->toSql();
     }
     if (empty($table->id)) {
         // Set the values
         //$table->created	= $date->toSql();
         // Set ordering to the last item if not set
         if (empty($table->ordering)) {
             $db = JFactory::getDbo();
             $db->setQuery('SELECT MAX(ordering) FROM #__phocagallery_comments WHERE catid = ' . (int) $table->catid);
             $max = $db->loadResult();
             $table->ordering = $max + 1;
         }
     } else {
         // Set the values
         //$table->modified	= $date->toSql();
         //$table->modified_by	= $user->get('id');
     }
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:29,代码来源:phocagalleryco.php


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