本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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(' ', '', $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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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');
}
}