[TEP-COMMIT] [CVS catalog] new method to include language definitions
hpdl-OfajU3CKLf1/[email protected] 28 Apr 2005 07:39:32 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes/classes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">language.php</a></tt></td><td align="right" id="added">+38</td><td align="right" id="removed">-14</td><td nowrap="nowrap" align="center"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.10&content-type=text/vnd.viewcvs-markup">1.10</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php.diff?r1=1.10&r2=1.11">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.11&content-type=text/vnd.viewcvs-markup">1.11</a></td></tr>
</table>
<pre class="comment">
new method to include language definitions
new methods to return selected language information
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes">classes</a><br /></span>
<div class="fileheader"><big><b>language.php</b></big> <small id="info"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.10&content-type=text/vnd.viewcvs-markup">1.10</a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php.diff?r1=1.10&r2=1.11">-></a> <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/classes/language.php?rev=1.11&content-type=text/vnd.viewcvs-markup">1.11</a></small></div>
<pre class="diff"><small id="info">diff -u -r1.10 -r1.11
--- language.php 2004/11/29 00:07:49 1.10
+++ language.php 2005/04/28 07:39:30 1.11
@@ -5,7 +5,7 @@
</small></pre><pre class="diff" id="context"> osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
</pre><pre class="diff" id="removed">- Copyright (c) 200<span id="removedchars">4</span> osCommerce
</pre><pre class="diff" id="added">+ Copyright (c) 200<span id="addedchars">5</span> osCommerce
</pre><pre class="diff" id="context">
Released under the GNU General Public License
*/
</pre><pre class="diff"><small id="info">@@ -48,27 +48,27 @@
</small></pre><pre class="diff" id="context">
/* Public methods */
</pre><pre class="diff" id="removed">- function set($lang<span id="removedchars">uage</span> = '') {
</pre><pre class="diff" id="added">+ function set($lang = '') {
</pre><pre class="diff" id="context"> if (PHP_VERSION < 4.1) {
global $_COOKIE;
}
global $osC_Session;
</pre><pre class="diff" id="removed">- if (empty($lang<span id="removedchars">uage</span>) && $osC_Session->exists('language')) {
</pre><pre class="diff" id="added">+ if (empty($lang) && $osC_Session->exists('language')) {
</pre><pre class="diff" id="context"> foreach ($this->_languages as $l) {
if ($l['directory'] == $osC_Session->value('language')) {
</pre><pre class="diff" id="removed">- $lang<span id="removedchars">uage</span> = $l['code'];
</pre><pre class="diff" id="added">+ $lang = $l['code'];
</pre><pre class="diff" id="context"> break;
}
}
}
</pre><pre class="diff" id="removed">- if (empty($language) || ($this->exists($language) === false)) {
- $language = DEFAULT_LANGUAGE;
</pre><pre class="diff" id="added">+ if (empty($lang) || ($this->exists($lang) === false)) {
+ $lang = DEFAULT_LANGUAGE;
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- $this->language = $this->get($lang<span id="removedchars">uage</span>);
</pre><pre class="diff" id="added">+ $this->language = $this->get($lang);
</pre><pre class="diff" id="context">
if (!isset($_COOKIE['language']) || (isset($_COOKIE['language']) && ($_COOKIE['language'] != $this->language['code']))) {
tep_setcookie('language', $this->language['code'], time()+60*60*24*90);
</pre><pre class="diff"><small id="info">@@ -146,20 +146,44 @@
</small></pre><pre class="diff" id="context"> $this->set(DEFAULT_LANGUAGE);
}
</pre><pre class="diff" id="removed">- function get($language) {
- return $this->_languages[$language];
</pre><pre class="diff" id="added">+ function get($lang) {
+ return $this->_languages[$lang];
</pre><pre class="diff" id="context"> }
function getAll() {
return $this->_languages;
}
</pre><pre class="diff" id="removed">- function exists($language) {
- if (isset($this->_languages[$language])) {
- return true;
- }
</pre><pre class="diff" id="added">+ function exists($lang) {
+ return array_key_exists($lang, $this->_languages);
+ }
+
+ function getID() {
+ return $this->language['id'];
+ }
+
+ function getName() {
+ return $this->language['name'];
+ }
+
+ function getCode() {
+ return $this->language['code'];
+ }
+
+ function getImage() {
+ return $this->language['image'];
+ }
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- return false;
</pre><pre class="diff" id="added">+ function getDirectory() {
+ return $this->language['directory'];
+ }
+
+ function load($definition = false) {
+ if (is_string($definition)) {
+ include('includes/languages/' . $this->getDirectory() . '/' . $definition);
+ } else {
+ include('includes/languages/' . $this->getDirectory() . '.php');
+ }
</pre><pre class="diff" id="context"> }
}
?>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix