예제 #1
0
 public static function getValue($key, $shop_group_id = NULL, $shop_id = NULL)
 {
     /** If setting is not initialized, try manual query **/
     if (!self::$_SETTINGS) {
         JeproshopSettingModelSetting::loadSettings();
         if (!self::$_SETTINGS) {
             $db = JFactory::getDBO();
             $query = "SELECT " . $db->quoteName('value') . " FROM " . $db->quoteName('#__jeproshop_setting');
             $query .= " WHERE " . $db->quoteName('name') . " = " . $db->quote($db->escape($key));
             $db->setQuery($query);
             $settingValue = $db->loadResult();
             return $settingValue ? $settingValue : $key;
         }
     }
     if ($shop_id && JeproshopSettingModelSetting::hasKey($key, NULL, $shop_id)) {
         return self::$_SETTINGS['shop'][$shop_id][$key];
     } elseif ($shop_group_id && JeproshopSettingModelSetting::hasKey($key)) {
         return self::$_SETTINGS['group'][$shop_group_id][$key];
     } elseif (JeproshopSettingModelSetting::hasKey($key)) {
         return self::$_SETTINGS['global'][$key];
     } else {
         echo $key;
         exit;
     }
     return FALSE;
 }
예제 #2
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php')) {
    JError::raiseError(500, JText::_(''));
}
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php';
$context = JeproshopContext::getContext();
/** initialize the shop **/
$context->shop = JeproshopShopModelShop::initialize();
/** load configuration  */
JeproshopSettingModelSetting::loadSettings();
/** load languages  */
JeproshopLanguageModelLanguage::loadLanguages();
/** set context cookie */
$life_time = time() + max(JeproshopSettingModelSetting::getValue('bo_life_time'), 1) * 3600;
$context->cookie = new JeproshopCookie('jeproshop_site', '', $life_time);
/** @var  employee */
$context->employee = new JeproshopEmployeeModelEmployee(JFactory::getUser()->id);
$context->cookie->employee_id = $context->employee->employee_id;
/** Loading default country */
$context->country = new JeproshopCountryModelCountry(JeproshopSettingModelSetting::getValue('default_country'), JeproshopSettingModelSetting::getValue('default_lang'));
/** if the cookie stored language is not an available language, use default language */
if (isset($context->cookie->lang_id) && $context->cookie->lang_id) {
    $language = new JeproshopLanguageModelLanguage($context->cookie->lang_id);
}
if (!isset($language) || !JeproshopTools::isLoadedObject($language, 'lang_id')) {