Permalink
Browse files

Split methods.php into two files.

  • Loading branch information...
1 parent 7c1de24 commit bf15347fbe1c335307194f6d676e6218aca16ae9 @realityking realityking committed Feb 23, 2012
Showing with 104 additions and 92 deletions.
  1. +2 −2 libraries/import.php
  2. +97 −0 libraries/joomla/application/route.php
  3. +5 −90 libraries/joomla/{methods.php → language/text.php}
@@ -53,8 +53,8 @@ class_exists('JLoader') or die;
JLoader::register('JRequest', JPATH_PLATFORM . '/joomla/environment/request.php');
// Register classes that don't follow one file per class naming conventions.
-JLoader::register('JText', JPATH_PLATFORM . '/joomla/methods.php');
-JLoader::register('JRoute', JPATH_PLATFORM . '/joomla/methods.php');
+JLoader::register('JText', JPATH_PLATFORM . '/joomla/language/text.php');
+JLoader::register('JRoute', JPATH_PLATFORM . '/joomla/application/route.php');
// Register classes where the names have been changed to fit the autoloader rules
// @deprecated 12.3
@@ -0,0 +1,97 @@
+<?php
+/**
+ * @package Joomla.Platform
+ * @subpackage Application
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+defined('JPATH_PLATFORM') or die;
+
+/**
+ * Route handling class
+ *
+ * @package Joomla.Platform
+ * @subpackage Application
+ * @since 11.1
+ */
+class JRoute
+{
+ /**
+ * Translates an internal Joomla URL to a humanly readible URL.
+ *
+ * @param string $url Absolute or Relative URI to Joomla resource.
+ * @param boolean $xhtml Replace & by &amp; for XML compilance.
+ * @param integer $ssl Secure state for the resolved URI.
+ * 1: Make URI secure using global secure site URI.
+ * 0: Leave URI in the same secure state as it was passed to the function.
+ * -1: Make URI unsecure using the global unsecure site URI.
+ *
+ * @return The translated humanly readible URL.
+ *
+ * @since 11.1
+ */
+ public static function _($url, $xhtml = true, $ssl = null)
+ {
+ // Get the router.
+ $app = JFactory::getApplication();
+ $router = $app->getRouter();
+
+ // Make sure that we have our router
+ if (!$router)
+ {
+ return null;
+ }
+
+ if ((strpos($url, '&') !== 0) && (strpos($url, 'index.php') !== 0))
+ {
+ return $url;
+ }
+
+ // Build route.
+ $uri = $router->build($url);
+ $url = $uri->toString(array('path', 'query', 'fragment'));
+
+ // Replace spaces.
+ $url = preg_replace('/\s/u', '%20', $url);
+
+ /*
+ * Get the secure/unsecure URLs.
+ *
+ * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
+ * https and need to set our secure URL to the current request URL, if not, and the scheme is
+ * 'http', then we need to do a quick string manipulation to switch schemes.
+ */
+ if ((int) $ssl)
+ {
+ $uri = JURI::getInstance();
+
+ // Get additional parts.
+ static $prefix;
+ if (!$prefix)
+ {
+ $prefix = $uri->toString(array('host', 'port'));
+ }
+
+ // Determine which scheme we want.
+ $scheme = ((int) $ssl === 1) ? 'https' : 'http';
+
+ // Make sure our URL path begins with a slash.
+ if (!preg_match('#^/#', $url))
+ {
+ $url = '/' . $url;
+ }
+
+ // Build the URL.
+ $url = $scheme . '://' . $prefix . $url;
+ }
+
+ if ($xhtml)
+ {
+ $url = htmlspecialchars($url);
+ }
+
+ return $url;
+ }
+}
@@ -1,101 +1,16 @@
<?php
/**
- * @package Joomla.Platform
+ * @package Joomla.Platform
+ * @subpackage Language
*
- * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
- * Route handling class
- *
- * @package Joomla.Platform
- * @since 11.1
- */
-class JRoute
-{
- /**
- * Translates an internal Joomla URL to a humanly readible URL.
- *
- * @param string $url Absolute or Relative URI to Joomla resource.
- * @param boolean $xhtml Replace & by &amp; for XML compilance.
- * @param integer $ssl Secure state for the resolved URI.
- * 1: Make URI secure using global secure site URI.
- * 0: Leave URI in the same secure state as it was passed to the function.
- * -1: Make URI unsecure using the global unsecure site URI.
- *
- * @return The translated humanly readible URL.
- *
- * @since 11.1
- */
- public static function _($url, $xhtml = true, $ssl = null)
- {
- // Get the router.
- $app = JFactory::getApplication();
- $router = $app->getRouter();
-
- // Make sure that we have our router
- if (!$router)
- {
- return null;
- }
-
- if ((strpos($url, '&') !== 0) && (strpos($url, 'index.php') !== 0))
- {
- return $url;
- }
-
- // Build route.
- $uri = $router->build($url);
- $url = $uri->toString(array('path', 'query', 'fragment'));
-
- // Replace spaces.
- $url = preg_replace('/\s/u', '%20', $url);
-
- /*
- * Get the secure/unsecure URLs.
- *
- * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
- * https and need to set our secure URL to the current request URL, if not, and the scheme is
- * 'http', then we need to do a quick string manipulation to switch schemes.
- */
- if ((int) $ssl)
- {
- $uri = JURI::getInstance();
-
- // Get additional parts.
- static $prefix;
- if (!$prefix)
- {
- $prefix = $uri->toString(array('host', 'port'));
- }
-
- // Determine which scheme we want.
- $scheme = ((int) $ssl === 1) ? 'https' : 'http';
-
- // Make sure our URL path begins with a slash.
- if (!preg_match('#^/#', $url))
- {
- $url = '/' . $url;
- }
-
- // Build the URL.
- $url = $scheme . '://' . $prefix . $url;
- }
-
- if ($xhtml)
- {
- $url = htmlspecialchars($url);
- }
-
- return $url;
- }
-}
-
-/**
- * Text handling class.
+ * Text handling class.
*
* @package Joomla.Platform
* @subpackage Language

0 comments on commit bf15347

Please sign in to comment.