* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7756 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
class AdminThemes extends AdminPreferences
{
/** This value is used in isThemeCompatible method. only version node with an
* higher version number will be used in [theme]/config.xml
* @since 1.4.0.11, check theme compatibility 1.4
* @static
*/
public static $check_features_version = '1.4';
/** $check_features is a multidimensional array used to check [theme]/config.xml values,
* and also checks prestashop current configuration if not match.
* @static
*/
public static $check_features = array(
'ccc' => array( // feature key name
'attributes' => array(
'available' => array(
'value' => 'true', // accepted attribute value
// if value doesnt match,
// prestashop configuration value must have thoses values
'check_if_not_valid' => array(
'PS_CSS_THEME_CACHE' => 0,
'PS_JS_THEME_CACHE' => 0,
'PS_HTML_THEME_COMPRESSION' => 0,
'PS_JS_HTML_THEME_COMPRESSION' => 0,
'PS_HIGH_HTML_THEME_COMPRESSION' => 0,
),
),
),
'error' => 'This theme may not correctly use "combine, compress and cache"',
'tab' => 'AdminPerformance',
),
'guest_checkout' => array(
'attributes' => array(
'available' => array(
'value' => 'true',
'check_if_not_valid' => array('PS_GUEST_CHECKOUT_ENABLED' => 0)
),
),
'error' => 'This theme may not correctly use "guest checkout"',
'tab' => 'AdminPreferences',
),
'one_page_checkout' => array(
'attributes' => array(
'available' => array(
'value' => 'true',
'check_if_not_valid' => array('PS_ORDER_PROCESS_TYPE' => 0),
),
),
'error' => 'This theme may not correctly use "one page checkout"',
'tab' => 'AdminPreferences',
),
'store_locator' => array(
'attributes' => array(
'available' => array(
'value' => 'true',
'check_if_not_valid' => array('PS_STORES_SIMPLIFIED' => 0,'PS_STORES_DISPLAY_FOOTER' => 0),
)
),
'error' => 'This theme may not correctly use "display store location"',
'tab' => 'AdminStores',
)
);
public function __construct()
{
$this->className = 'Configuration';
$this->table = 'configuration';
$this->_fieldsAppearance = array(
'PS_LOGO' => array('title' => $this->l('Header logo:'), 'desc' => $this->l('Will appear on main page'), 'type' => 'file', 'thumb' => array('file' => _PS_IMG_.'logo.jpg?date='.time(), 'pos' => 'before')),
'PS_LOGO_MAIL' => array('title' => $this->l('Mail logo:'), 'desc' => $this->l('Will appear on e-mail headers, if undefined the Header logo will be used'), 'type' => 'file', 'thumb' => array('file' => ((file_exists(_PS_IMG_DIR_.'logo_mail.jpg')) ? _PS_IMG_.'logo_mail.jpg?date='.time() : _PS_IMG_.'logo.jpg?date='.time()), 'pos' => 'before')),
'PS_LOGO_INVOICE' => array('title' => $this->l('Invoice logo:'), 'desc' => $this->l('Will appear on invoices headers, if undefined the Header logo will be used'), 'type' => 'file', 'thumb' => array('file' => (file_exists(_PS_IMG_DIR_.'logo_invoice.jpg') ? _PS_IMG_.'logo_invoice.jpg?date='.time() : _PS_IMG_.'logo.jpg?date='.time()), 'pos' => 'before')),
'PS_FAVICON' => array('title' => $this->l('Favicon:'), 'desc' => $this->l('Will appear in the address bar of your web browser'), 'type' => 'file', 'thumb' => array('file' => _PS_IMG_.'favicon.ico?date='.time(), 'pos' => 'after')),
'PS_STORES_ICON' => array('title' => $this->l('Store icon:'), 'desc' => $this->l('Will appear on the store locator (inside Google Maps)').'
'.$this->l('Suggested size: 30x30, Transparent GIF'), 'type' => 'file', 'thumb' => array('file' => _PS_IMG_.'logo_stores.gif?date='.time(), 'pos' => 'before')),
'PS_NAVIGATION_PIPE' => array('title' => $this->l('Navigation pipe:'), 'desc' => $this->l('Used for navigation path inside categories/product'), 'cast' => 'strval', 'type' => 'text', 'size' => 20),
);
$this->_fieldsTheme = array(
'PS_THEME' => array('title' => $this->l('Theme'), 'validation' => 'isGenericName', 'type' => 'image', 'list' => $this->_getThemesList(), 'max' => 3)
);
parent::__construct();
}
public function display()
{
global $currentIndex;
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
{
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_.'logo.jpg');
Configuration::updateValue('SHOP_LOGO_WIDTH', (int)round($width));
Configuration::updateValue('SHOP_LOGO_HEIGHT', (int)round($height));
}
// No cache for auto-refresh uploaded logo
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$this->_displayForm('appearance', $this->_fieldsAppearance, $this->l('Appearance'), 'width3', 'appearance');
echo '
';
$this->_displayForm('themes', $this->_fieldsTheme, $this->l('Themes'), 'width3', 'themes');
echo '
';
if (@ini_get('allow_url_fopen') AND @fsockopen('addons.prestashop.com', 80, $errno, $errst, 3))
echo '