Permalink
Browse files

# [#27410] Don't use DS anymore. Thanks Rouven

  • Loading branch information...
1 parent cc8d883 commit 212f739f8ed028bb28705e3659f21e0f300aae46 @realityking realityking committed with infograf768 Feb 13, 2012
@@ -33,7 +33,7 @@ public function __construct($config = array())
{
parent::__construct($config);
- require_once JPATH_COMPONENT.DS.'helpers'.DS.'jsonresponse.php';
+ require_once JPATH_COMPONENT . '/helpers/jsonresponse.php';
}
/**
@@ -50,7 +50,7 @@ public function getForm($data = array(), $loadData = true)
}
$form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_'.strtoupper($client)));
$form->setValue('language', null, JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language));
- $form->setValue('file', null, JPath::clean(constant('JPATH_'.strtoupper($client)).DS.'language'.DS.'overrides'.DS.$language.'.override.ini'));
+ $form->setValue('file', null, JPath::clean(constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'));
return $form;
}
@@ -89,7 +89,7 @@ public function getItem($pk = null)
require_once JPATH_COMPONENT.'/helpers/languages.php';
$pk = (!empty($pk)) ? $pk : JRequest::getCmd('id');
- $filename = constant('JPATH_'.strtoupper($this->getState('filter.client'))).DS.'language'.DS.'overrides'.DS.$this->getState('filter.language', 'en-GB').'.override.ini';
+ $filename = constant('JPATH_'.strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB').'.override.ini';
$strings = LanguagesHelper::parseFile($filename);
$result = new stdClass();
@@ -122,7 +122,7 @@ public function save($data)
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
// Parse the override.ini file in oder to get the keys and strings
- $filename = constant('JPATH_'.strtoupper($client)).DS.'language'.DS.'overrides'.DS.$language.'.override.ini';
+ $filename = constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini';
$strings = LanguagesHelper::parseFile($filename);
if (isset($strings[$data['id']]))
@@ -56,8 +56,8 @@ public function refresh()
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');
- $base = constant('JPATH_'.strtoupper($client)).DS;
- $path = $base.'language'.DS.$language;
+ $base = constant('JPATH_'.strtoupper($client));
+ $path = $base.'/language/' . $language;
$files = array();
@@ -68,20 +68,16 @@ public function refresh()
}
// Parse language directories of components
- $path = $base.'components';
- $files = array_merge($files, JFolder::files($path, $language.'.*ini$', 3, true));
+ $files = array_merge($files, JFolder::files($base.'/components', $language.'.*ini$', 3, true));
// Parse language directories of modules
- $path = $base.'modules';
- $files = array_merge($files, JFolder::files($path, $language.'.*ini$', 3, true));
+ $files = array_merge($files, JFolder::files($base.'/modules', $language.'.*ini$', 3, true));
// Parse language directories of templates
- $path = $base.'templates';
- $files = array_merge($files, JFolder::files($path, $language.'.*ini$', 3, true));
+ $files = array_merge($files, JFolder::files($base.'/templates', $language.'.*ini$', 3, true));
// Parse language directories of plugins
- $path = JPATH_ROOT.DS.'plugins';
- $files = array_merge($files, JFolder::files($path, $language.'.*ini$', 3, true));
+ $files = array_merge($files, JFolder::files(JPATH_PLUGINS, $language.'.*ini$', 3, true));
// Parse all found ini files and add the strings to the database cache
foreach ($files as $file)
@@ -11,11 +11,11 @@
//Global definitions.
//Joomla framework path definitions.
-$parts = explode(DS, JPATH_BASE);
+$parts = explode(DIRECTORY_SEPARATOR, JPATH_BASE);
array_pop($parts);
//Defines.
-define('JPATH_ROOT', implode(DS, $parts));
+define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
define('JPATH_ADMINISTRATOR', JPATH_ROOT . '/administrator');
View
@@ -496,7 +496,7 @@ public function getTemplate($params = false)
*/
public function setTemplate($template, $styleParams=null)
{
- if (is_dir(JPATH_THEMES.DS.$template)) {
+ if (is_dir(JPATH_THEMES . '/' . $template)) {
$this->template = new stdClass();
$this->template->template = $template;
if ($styleParams instanceof JRegistry) {
View
@@ -15,10 +15,10 @@
//Global definitions.
//Joomla framework path definitions.
-$parts = explode(DS, JPATH_BASE);
+$parts = explode(DIRECTORY_SEPARATOR, JPATH_BASE);
//Defines.
-define('JPATH_ROOT', implode(DS, $parts));
+define('JPATH_ROOT', implode(DIRECTORY_SEPARATOR, $parts));
define('JPATH_SITE', JPATH_ROOT);
define('JPATH_CONFIGURATION', JPATH_ROOT);
View
@@ -29,6 +29,7 @@ $ -> Language fix or change
13-Feb-2012 Jean-Marie Simonet
#$ [#27716] Saving 'Start Publishing' updates 'Finish Publishing' not 'Start Publishing'. Thanks John.
# [#27902] *mod_languages html 5 validation error empty action attribute. Thanks Danilo.
+ # [#27410] Don't use DS anymore. Thanks Rouven
12-Feb-2012 Jean-Marie Simonet
# [#28028] *Entering an article link via the Article button=>links broken in SEF. Thanks Rouven.
@@ -77,7 +77,7 @@ public function detectFtpRoot($options)
}
// Search through the segments of JPATH_SITE looking for root possibilities.
- $parts = explode(DS, JPATH_SITE);
+ $parts = explode(DIRECTORY_SEPARATOR, JPATH_SITE);
$tmp = '';
for ($i = count($parts) - 1; $i >= 0; $i--)
{
@@ -270,7 +270,7 @@ public static function getPath($varname, $user_option = null)
case 'plg_xml':
// Site plugins
$j15path = '/plugins/' . $user_option . '.xml';
- $parts = explode(DS, $user_option);
+ $parts = explode(DIRECTORY_SEPARATOR, $user_option);
$j16path = '/plugins/' . $user_option . '/' . $parts[1] . '.xml';
$j15 = self::_checkPath($j15path, 0);
$j16 = self::_checkPath($j16path, 0);
@@ -497,7 +497,7 @@ protected function _deleteFolder($path)
*
* @since 11.1
*/
- protected function _cleanPath($path, $ds = DS)
+ protected function _cleanPath($path, $ds = DIRECTORY_SEPARATOR)
{
$path = trim($path);
@@ -507,7 +507,7 @@ protected function _cleanPath($path, $ds = DS)
}
else
{
- // Remove double slashes and backslahses and convert all slashes and backslashes to DS
+ // Remove double slashes and backslahses and convert all slashes and backslashes to DIRECTORY_SEPARATOR
$path = preg_replace('#[/\\\\]+#', $ds, $path);
}
@@ -84,7 +84,7 @@ public function __construct($options = array())
if (file_exists($dir . '/favicon.ico'))
{
- $path = str_replace(JPATH_BASE . DS, '', $dir);
+ $path = str_replace(JPATH_BASE . '/', '', $dir);
$path = str_replace('\\', '/', $path);
$favicon = new JOpenSearchImage;
@@ -47,8 +47,8 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
}
// Eliminate trailing directory separators, if any
- $src = rtrim($src, DS);
- $dest = rtrim($dest, DS);
+ $src = rtrim($src, DIRECTORY_SEPARATOR);
+ $dest = rtrim($dest, DIRECTORY_SEPARATOR);
if (!self::exists($src))
{
@@ -661,7 +661,6 @@ public static function listFolderTree($path, $filter, $maxLevel = 3, $level = 0,
*/
public static function makeSafe($path)
{
- //$ds = (DS == '\\') ? '\\/' : DS;
$regex = array('#[^A-Za-z0-9:_\\\/-]#');
return preg_replace($regex, '', $path);
}
@@ -207,7 +207,7 @@ public static function clean($path, $ds = DIRECTORY_SEPARATOR)
}
else
{
- // Remove double slashes and backslashes and convert all slashes and backslashes to DS
+ // Remove double slashes and backslashes and convert all slashes and backslashes to DIRECTORY_SEPARATOR
$path = preg_replace('#[/\\\\]+#', $ds, $path);
}
@@ -236,7 +236,7 @@ public function loadButtonType($type, $new = false)
$dirs = array();
}
- $file = JFilterInput::getInstance()->clean(str_replace('_', DS, strtolower($type)) . '.php', 'path');
+ $file = JFilterInput::getInstance()->clean(str_replace('_', DIRECTORY_SEPARATOR, strtolower($type)) . '.php', 'path');
jimport('joomla.filesystem.path');
if ($buttonFile = JPath::find($dirs, $file))
@@ -113,7 +113,7 @@ public function install()
}
else
{
- $this->parent->setPath('extension_root', JPATH_PLATFORM . '/' . implode(DS, explode('/', $group)));
+ $this->parent->setPath('extension_root', JPATH_PLATFORM . '/' . implode(DIRECTORY_SEPARATOR, explode('/', $group)));
}
// Filesystem Processing Section
@@ -90,7 +90,7 @@ public function install()
$group = (string) $this->manifest->packagename;
if (!empty($group))
{
- $this->parent->setPath('extension_root', JPATH_MANIFESTS . '/packages/' . implode(DS, explode('/', $group)));
+ $this->parent->setPath('extension_root', JPATH_MANIFESTS . '/packages/' . implode(DIRECTORY_SEPARATOR, explode('/', $group)));
}
else
{
View
@@ -117,7 +117,7 @@ public static function import($key, $base = null)
$parts = explode('.', $key);
$class = array_pop($parts);
$base = (!empty($base)) ? $base : dirname(__FILE__);
- $path = str_replace('.', DS, $key);
+ $path = str_replace('.', DIRECTORY_SEPARATOR, $key);
// Handle special case for helper classes.
if ($class == 'helper')
@@ -103,8 +103,8 @@ static function getFolder(&$params)
if (JString::strpos($folder, JPATH_SITE) === 0) {
$folder= str_replace(JPATH_BASE, '', $folder);
}
- $folder = str_replace('\\', DS, $folder);
- $folder = str_replace('/', DS, $folder);
+ $folder = str_replace('\\', DIRECTORY_SEPARATOR, $folder);
+ $folder = str_replace('/', DIRECTORY_SEPARATOR, $folder);
return $folder;
}

0 comments on commit 212f739

Please sign in to comment.