7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package Magic3 Framework
10 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11 * @copyright Copyright 2006-2013 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: JParameter.php 5552 2013-01-14 12:37:43Z fishbone $
14 * @link http://www.magic3.org
16 require_once($this->gEnv->getJoomlaRootPath() . '/class/error.php');
17 require_once($this->gEnv->getJoomlaRootPath() . '/class/exception.php');
18 require_once($this->gEnv->getJoomlaRootPath() . '/class/object.php');
19 require_once($this->gEnv->getJoomlaRootPath() . '/class/registry.php');
21 function jimport($path)
23 //return JLoader::import($path);
28 private $params = array();
33 * @param string $data 初期化データ
34 * @param string $path 初期設定ファイル
36 function __construct($data = '', $path = '')
40 $lines = explode("\n", $data);
41 $count = count($lines);
42 for ($i = 0; $i < $count; $i++){
43 list($key, $value) = explode("=", $lines[$i]);
44 $this->params[$key] = $value;
51 * @param string $key 取得キー
55 public function set($key, $value)
57 $this->params[$key] = $value;
63 * @param string $key 取得キー
66 public function get($key)
68 return isset($this->params[$key]) ? $this->params[$key] : '';
73 * @param string $key 取得キー
74 * @param string $default デフォルト値
77 public function def($key, $default = '')
79 // 値が設定されていなければデフォルト値を設定
80 $this->params[$key] = $default;
82 $value = $this->get($key);
93 public function authorize()
100 public static function _($url, $xhtml = true, $ssl = null)
105 abstract class ContentHelperRoute
107 public static function getArticleRoute($id, $catid = 0, $language = 0)
111 public static function getCategoryRoute($catid, $language = 0)
118 /* private static $_strings = array( 'DATE_FORMAT_LC' => '%A, %d %B %Y',
119 'DATE_FORMAT_LC1' => '%A, %d %B %Y',
120 'DATE_FORMAT_LC2' => '%A, %d %B %Y %H:%M',
121 'DATE_FORMAT_LC3' => '%d %B %Y',
122 'DATE_FORMAT_LC4' => '%d.%m.%y',
123 'DATE_FORMAT_JS1' => 'y-m-d');*/
125 public static function _($string, $jsSafe = false)
127 global $gInstanceManager;
129 /* $key = strtoupper($string);
130 $key = substr($key, 0, 1) == '_' ? substr($key, 1) : $key;
132 if (isset(self::$_strings[$key])) $string = self::$_strings[$key];*/
134 $value = $gInstanceManager->getMessageManager()->getJoomlaText($string);
135 if (!empty($value)) $string = $value;
137 if ($jsSafe) $string = addslashes($string);
140 public static function sprintf($string)
142 global $gInstanceManager;
144 // $lang =& JFactory::getLanguage();
145 $args = func_get_args();
146 if (count($args) > 0) {
147 // $args[0] = $lang->_($args[0]);
148 $value = $gInstanceManager->getMessageManager()->getJoomlaText($args[0]);
149 if (!empty($value)) $args[0] = $value;
150 return call_user_func_array('sprintf', $args);
154 public static function printf($string)
156 $lang =& JFactory::getLanguage();
157 $args = func_get_args();
158 if (count($args) > 0) {
159 $args[0] = $lang->_($args[0]);
160 return call_user_func_array('printf', $args);
167 public static function getURI()
171 return $gEnvManager->getCurrentRequestUri();
173 public static function getMethod()
175 $method = strtoupper($_SERVER['REQUEST_METHOD']);
178 public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0)
180 global $gRequestManager;
182 return $gRequestManager->trimValueOf($name);
184 public static function getInt($name, $default = 0, $hash = 'default')
186 return intval(self::getVar($name, $default, $hash, 'int'));
188 public static function getFloat($name, $default = 0.0, $hash = 'default')
190 return self::getVar($name, $default, $hash, 'float');
192 public static function getBool($name, $default = false, $hash = 'default')
194 return self::getVar($name, $default, $hash, 'bool');
196 public static function getWord($name, $default = '', $hash = 'default')
198 return self::getVar($name, $default, $hash, 'word');
200 public static function getCmd($name, $default = '', $hash = 'default')
202 return self::getVar($name, $default, $hash, 'cmd');
204 public static function getString($name, $default = '', $hash = 'default', $mask = 0)
206 return self::getVar($name, $default, $hash, 'string', $mask);
211 * -------------------------------------------------------------------------
212 * Site configuration section
213 * -------------------------------------------------------------------------
217 var $offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';
218 var $sitename = 'Joomla!'; // Name of Joomla site
219 var $editor = 'tinymce';
220 var $list_limit = '20';
224 * -------------------------------------------------------------------------
225 * Database configuration section
226 * -------------------------------------------------------------------------
228 /* Database Settings */
229 var $dbtype = 'mysql'; // Normally mysql
230 var $host = 'localhost'; // This is normally set to localhost
231 var $user = ''; // MySQL username
232 var $password = ''; // MySQL password
233 var $db = ''; // MySQL database name
234 var $dbprefix = 'jos_'; // Do not change unless you need to!
236 /* Server Settings */
237 var $secret = 'FBVtggIk5lAzEU9H'; //Change this to something more secure
239 var $error_reporting = '-1';
240 var $helpurl = 'http://help.joomla.org';
241 var $xmlrpc_server = '1';
247 var $ftp_enable = '';
248 var $tmp_path = '/tmp';
249 var $log_path = '/var/logs';
251 var $live_site = ''; // Optional, Full url to Joomla install.
252 var $force_ssl = 0; //Force areas of the site to be SSL ONLY. 0 = None, 1 = Administrator, 2 = Both Site and Administrator
254 /* Session settings */
255 var $lifetime = '15'; // Session time
256 var $session_handler = 'database';
259 var $mailer = 'mail';
262 var $sendmail = '/usr/sbin/sendmail';
266 var $smtphost = 'localhost';
270 var $cachetime = '15';
271 var $cache_handler = 'file';
276 var $debug_lang = '0';
279 var $MetaDesc = 'Joomla! - the dynamic portal engine and content management system';
280 var $MetaKeys = 'joomla, Joomla';
281 var $MetaTitle = '1';
282 var $MetaAuthor = '1';
286 var $sef_rewrite = '0';
287 var $sef_suffix = '';
290 var $feed_limit = 10;
291 var $feed_email = 'author';
296 function __construct()
300 $this->sitename = $gEnvManager->getSiteName();// サイト名称
301 $this->tmp_path = $gEnvManager->getWorkDirPath(); // 一時ディレクトリ
305 * Version information class for the Joomla CMS.
306 * テンプレートからは、RELEASE値以外はまず使用されない
308 * @package Joomla.Site
313 /** @var string Product name. */
314 public $PRODUCT = 'Joomla!';
316 /** @var string Release version. */
317 // public $RELEASE = '1.7';
318 // public $RELEASE = '1.5';
319 public $RELEASE = '3.0';
321 /** @var string Maintenance version. */
322 public $DEV_LEVEL = '1';
324 /** @var string Development STATUS. */
325 public $DEV_STATUS = 'Stable';
327 /** @var string Build number. */
330 /** @var string Code name. */
331 public $CODENAME = 'Ember';
333 /** @var string Release date. */
334 public $RELDATE = '26-Sep-2011';
336 /** @var string Release time. */
337 public $RELTIME = '14:00';
339 /** @var string Release timezone. */
340 public $RELTZ = 'GMT';
342 /** @var string Copyright Notice. */
343 public $COPYRIGHT = 'Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.';
345 /** @var string Link text. */
346 public $URL = '<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.';
349 * Compares two a "PHP standardized" version number against the current Joomla version.
351 * @param string $minimum The minimum version of the Joomla which is compatible.
353 * @return bool True if the version is compatible.
355 * @see http://www.php.net/version_compare
358 public function isCompatible($minimum)
360 return version_compare(JVERSION, $minimum, 'ge');
364 * Method to get the help file version.
366 * @return string Version suffix for help files.
370 public function getHelpVersion()
372 if ($this->RELEASE > '1.0') {
373 return '.' . str_replace('.', '', $this->RELEASE);
381 * Gets a "PHP standardized" version string for the current Joomla.
383 * @return string Version string.
387 public function getShortVersion()
389 return $this->RELEASE.'.'.$this->DEV_LEVEL;
393 * Gets a version string for the current Joomla with all release information.
395 * @return string Complete version string.
399 public function getLongVersion()
401 return $this->PRODUCT.' '. $this->RELEASE.'.'.$this->DEV_LEVEL.' '
402 . $this->DEV_STATUS.' [ '.$this->CODENAME.' ] '.$this->RELDATE.' '
403 .$this->RELTIME.' '.$this->RELTZ;
407 * Returns the user agent.
409 * @param string $component Name of the component.
410 * @param bool $mask Mask as Mozilla/5.0 or not.
411 * @param bool $add_version Add version afterwards to component.
413 * @return string User Agent.
417 public function getUserAgent($component = null, $mask = false, $add_version = true)
419 if ($component === null) {
420 $component = 'Framework';
424 $component .= '/'.$this->RELEASE;
427 // If masked pretend to look like Mozilla 5.0 but still identify ourselves.
429 return 'Mozilla/5.0 '. $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
432 return $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
437 // Define the Joomla version if not already defined.
438 if (!defined('JVERSION')) {
439 $jversion = new JVersion;
440 define('JVERSION', $jversion->getShortVersion());