Esempio n. 1
0
 public static function execute($data)
 {
     $language = Languages::get($data['id']);
     $export_array = array();
     if ($data['include_data'] === true) {
         $export_array['language']['data'] = array('title-CDATA' => $language['name'], 'code-CDATA' => $language['code'], 'locale-CDATA' => $language['locale'], 'character_set-CDATA' => $language['charset'], 'text_direction-CDATA' => $language['text_direction'], 'date_format_short-CDATA' => $language['date_format_short'], 'date_format_long-CDATA' => $language['date_format_long'], 'time_format-CDATA' => $language['time_format'], 'default_currency-CDATA' => Currencies::get($language['currencies_id'], 'code'), 'numerical_decimal_separator-CDATA' => $language['numeric_separator_decimal'], 'numerical_thousands_separator-CDATA' => $language['numeric_separator_thousands']);
         if ($language['parent_id'] > 0) {
             $export_array['language']['data']['parent_language_code'] = Languages::get($language['parent_id'], 'code');
         }
     }
     $definitions = Languages::getDefinitions($data['id'], $data['groups']);
     $definitions = $definitions['entries'];
     foreach ($definitions as $def) {
         $export_array['language']['definitions']['definition'][] = array('key' => $def['definition_key'], 'value-CDATA' => $def['definition_value'], 'group' => $def['content_group']);
     }
     $xml = XML::fromArray($export_array, $language['charset']);
     header('Content-disposition: attachment; filename=' . $language['code'] . '.xml');
     header('Content-Type: application/force-download');
     header('Content-Transfer-Encoding: binary');
     header('Content-Length: ' . strlen($xml));
     header('Pragma: no-cache');
     header('Expires: 0');
     echo $xml;
     exit;
 }
Esempio n. 2
0
 public static function execute($id)
 {
     $data = array('id' => $id);
     if (Languages::get($id, 'code') != DEFAULT_LANGUAGE && OSCOM::callDB('Admin\\Languages\\Delete', $data)) {
         Cache::clear('languages');
         return true;
     }
     return false;
 }
Esempio n. 3
0
 public static function execute($id)
 {
     $def = Languages::getDefinition($id);
     $data = array('id' => $id);
     if (OSCOM::callDB('Admin\\Languages\\DeleteDefinition', $data)) {
         Cache::clear('languages-' . Languages::get($def['languages_id'], 'code') . '-' . $def['content_group']);
         return true;
     }
     return false;
 }
 public static function execute($data)
 {
     $definitions = $data['definitions'];
     unset($data['definitions']);
     foreach ($definitions as $key => $value) {
         $data['key'] = $key;
         $data['value'] = $value;
         OSCOM::callDB('Admin\\Languages\\UpdateDefinition', $data);
         Cache::clear('languages-' . Languages::get($data['language_id'], 'code') . '-' . $data['group']);
     }
     return true;
 }
 protected function process()
 {
     $this->_page_title = OSCOM::getDef('heading_title');
     if (isset($_GET['id']) && is_numeric($_GET['id']) && Languages::exists($_GET['id'])) {
         $this->_page_contents = 'groups.php';
         $this->_page_title .= ': ' . Languages::get($_GET['id'], 'name');
         if (isset($_GET['group']) && Languages::isGroup($_GET['id'], $_GET['group'])) {
             $this->_page_contents = 'definitions.php';
             $this->_page_title .= ': ' . $_GET['group'];
         }
     }
 }
Esempio n. 6
0
 public static function execute($data)
 {
     $source = array('language' => XML::toArray(simplexml_load_file(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/Languages/' . $data['code'] . '.xml')));
     $language = array('name' => $source['language']['data']['title'], 'code' => $source['language']['data']['code'], 'locale' => $source['language']['data']['locale'], 'charset' => $source['language']['data']['character_set'], 'date_format_short' => $source['language']['data']['date_format_short'], 'date_format_long' => $source['language']['data']['date_format_long'], 'time_format' => $source['language']['data']['time_format'], 'text_direction' => $source['language']['data']['text_direction'], 'currency' => $source['language']['data']['default_currency'], 'numeric_separator_decimal' => $source['language']['data']['numerical_decimal_separator'], 'numeric_separator_thousands' => $source['language']['data']['numerical_thousands_separator'], 'parent_language_code' => isset($source['language']['data']['parent_language_code']) ? $source['language']['data']['parent_language_code'] : '', 'parent_id' => 0);
     if (!Currencies::exists($language['currency'])) {
         $language['currency'] = DEFAULT_CURRENCY;
     }
     $language['currencies_id'] = Currencies::get($language['currency'], 'currencies_id');
     if (!empty($language['parent_language_code']) && Languages::exists($language['parent_language_code'])) {
         $language['parent_id'] = Languages::get($language['parent_language_code'], 'languages_id');
     }
     $language['id'] = Languages::get($language['code'], 'languages_id');
     $language['default_language_id'] = Languages::get(DEFAULT_LANGUAGE, 'languages_id');
     $language['import_type'] = $data['type'];
     $definitions = array();
     if (isset($source['language']['definitions']['definition'])) {
         $definitions = $source['language']['definitions']['definition'];
         if (isset($definitions['key']) && isset($definitions['value']) && isset($definitions['group'])) {
             $definitions = array(array('key' => $definitions['key'], 'value' => $definitions['value'], 'group' => $definitions['group']));
         }
     }
     unset($source);
     $OSCOM_DirectoryListing = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/Shop/Languages/' . $data['code']);
     $OSCOM_DirectoryListing->setRecursive(true);
     $OSCOM_DirectoryListing->setIncludeDirectories(false);
     $OSCOM_DirectoryListing->setAddDirectoryToFilename(true);
     $OSCOM_DirectoryListing->setCheckExtension('xml');
     foreach ($OSCOM_DirectoryListing->getFiles() as $files) {
         $definitions = array_merge($definitions, Language::extractDefinitions($data['code'] . '/' . $files['name']));
     }
     $language['definitions'] = $definitions;
     if (OSCOM::callDB('Admin\\Languages\\Import', $language)) {
         Cache::clear('languages');
         return true;
     }
     return false;
 }
Esempio n. 7
0
 public static function execute($id)
 {
     return Languages::get($id) !== false;
 }
Esempio n. 8
0
<?php

/**
 * osCommerce Online Merchant
 * 
 * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
 * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
 */
use osCommerce\OM\Core\HTML;
use osCommerce\OM\Core\ObjectInfo;
use osCommerce\OM\Core\OSCOM;
use osCommerce\OM\Core\Site\Admin\Application\Languages\Languages;
$OSCOM_ObjectInfo = new ObjectInfo(Languages::get($_GET['id']));
?>

<h1><?php 
echo $OSCOM_Template->getIcon(32) . HTML::link(OSCOM::getLink(), $OSCOM_Template->getPageTitle());
?>
</h1>

<?php 
if ($OSCOM_MessageStack->exists()) {
    echo $OSCOM_MessageStack->get();
}
?>

<div class="infoBox">
  <h3><?php 
echo HTML::icon('trash.png') . ' ' . $OSCOM_ObjectInfo->getProtected('name');
?>
</h3>
Esempio n. 9
0
?>
" method="post">

  <p><?php 
echo OSCOM::getDef('introduction_delete_definition_group');
?>
</p>

  <p><?php 
echo '<b>' . osc_output_string_protected($_GET['group']) . '</b>';
?>
</p>

  <p>

<?php 
foreach ($OSCOM_ObjectInfo->get('entries') as $l) {
    echo Languages::get($l['languages_id'], 'name') . ': ' . (int) $l['total_entries'] . '<br />';
}
?>

  </p>

  <p><?php 
echo osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_delete'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(null, null, 'id=' . $_GET['id']), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel')));
?>
</p>

  </form>
</div>