Update file modification timestamps and clean up whitespace in appagebuilder module
This commit is contained in:
@@ -38,7 +38,7 @@ class APPageBuilder extends Module
|
||||
protected $product_active;
|
||||
protected $backup_dir;
|
||||
protected $header_content;
|
||||
|
||||
|
||||
protected $_confirmations = array();
|
||||
protected $_errors = array();
|
||||
protected $_warnings = array();
|
||||
@@ -56,7 +56,7 @@ class APPageBuilder extends Module
|
||||
$this->secure_key = Tools::encrypt($this->name);
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
|
||||
$this->displayName = $this->l('Apollo Page Builder');
|
||||
$this->description = $this->l('Apollo Page Builder build content for your site.');
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
@@ -66,7 +66,7 @@ class APPageBuilder extends Module
|
||||
$this->templateFile = 'module:appagebuilder/views/templates/hook/appagebuilder.tpl';
|
||||
$this->redirectFriendUrl();
|
||||
}
|
||||
|
||||
|
||||
public function redirectFriendUrl()
|
||||
{
|
||||
// if (Context::getContext()->controller === null || (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront')))) {
|
||||
@@ -80,19 +80,19 @@ class APPageBuilder extends Module
|
||||
if (isset($profile_data['friendly_url']) && !empty($profile_data['friendly_url'])) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoFriendlyUrl.php');
|
||||
$leo_friendly_url = LeoFriendlyUrl::getInstance();
|
||||
|
||||
|
||||
$link = Context::getContext()->link;
|
||||
$idLang = Context::getContext()->language->id;
|
||||
$idShop = null;
|
||||
$relativeProtocol = false;
|
||||
|
||||
|
||||
$url = $link->getBaseLink($idShop, null, $relativeProtocol).$leo_friendly_url->getLangLink($idLang, null, $idShop).$profile_data['friendly_url'].'.html';
|
||||
$leo_friendly_url->canonicalRedirection($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
static $_instance;
|
||||
@@ -105,20 +105,20 @@ class APPageBuilder extends Module
|
||||
public function install()
|
||||
{
|
||||
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
|
||||
|
||||
|
||||
//DONGND:: build shortcode, create folder for override
|
||||
apPageHelper::createShortCode();
|
||||
|
||||
|
||||
if (!parent::install() || !ApPageSetup::installConfiguration() || !ApPageSetup::createTables() || !ApPageSetup::installModuleTab() || !$this->registerLeoHook()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
# NOT LOAD DATASAMPLE AGAIN
|
||||
Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '1');
|
||||
|
||||
|
||||
# REMOVE FILE INDEX.PHP FOR TRANSLATE
|
||||
ApPageSetup::processTranslateTheme();
|
||||
|
||||
|
||||
Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 1);
|
||||
|
||||
return true;
|
||||
@@ -127,21 +127,21 @@ class APPageBuilder extends Module
|
||||
public function uninstall()
|
||||
{
|
||||
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
|
||||
|
||||
|
||||
//DONGND:: rollback default file config for tinymce
|
||||
Tools::copy(_PS_MODULE_DIR_.$this->name.'/views/js/shortcode/backup/tinymce.inc.js', _PS_ROOT_DIR_.'/js/admin/tinymce.inc.js');
|
||||
|
||||
if (!parent::uninstall()|| !ApPageSetup::uninstallModuleTab() || !ApPageSetup::deleteTables() || !ApPageSetup::uninstallConfiguration()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: remove overrider folder
|
||||
// $this->uninstallOverrides();
|
||||
Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 0);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function hookActionModuleRegisterHookAfter($params)
|
||||
{
|
||||
if (isset($params['hook_name']) && ($params['hook_name'] == 'header' || $params['hook_name']=='displayheader')) {
|
||||
@@ -150,7 +150,7 @@ class APPageBuilder extends Module
|
||||
$id_hook = Hook::getIdByName($hook_name);
|
||||
$id_module = $this->id;
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
|
||||
// Get module position in hook
|
||||
$sql = 'SELECT MAX(`position`) AS position
|
||||
FROM `'._DB_PREFIX_.'hook_module`
|
||||
@@ -167,13 +167,13 @@ class APPageBuilder extends Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('installdemo')) {
|
||||
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
|
||||
ApPageSetup::installSample();
|
||||
@@ -242,12 +242,12 @@ class APPageBuilder extends Module
|
||||
$this->errors[] = $this->trans('You do not have permission to configure this.', array(), 'Admin.Notifications.Error');
|
||||
$this->context->smarty->assign('errors', $this->errors);
|
||||
}
|
||||
|
||||
|
||||
$this->postProcess();
|
||||
|
||||
|
||||
$output = '';
|
||||
$this->backup_dir = str_replace('\\', '/', _PS_CACHE_DIR_.'backup/modules/appagebuilder/');
|
||||
|
||||
|
||||
$create_profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles').'&addappagebuilder_profiles';
|
||||
$profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles');
|
||||
$position_link = $this->context->link->getAdminLink('AdminApPageBuilderPositions');
|
||||
@@ -283,7 +283,7 @@ class APPageBuilder extends Module
|
||||
foreach ($field_text as $k => $v) {
|
||||
// validate module
|
||||
unset($k);
|
||||
|
||||
|
||||
$v = str_replace(' ', '_', trim($v));
|
||||
$v = preg_replace('/[^A-Za-z0-9\_]/', '', $v);
|
||||
if ($v && !in_array($v, $field_default)) {
|
||||
@@ -299,14 +299,14 @@ class APPageBuilder extends Module
|
||||
foreach ($field_editor as $k => $v) {
|
||||
// validate module
|
||||
unset($k);
|
||||
|
||||
|
||||
$v = str_replace(' ', '_', trim($v));
|
||||
$v = preg_replace('/[^A-Za-z0-9\_]/', '', $v);
|
||||
if ($v && !in_array($v, $field_text) && !in_array($v, $field_default)) {
|
||||
$field_editor_valid[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Configuration::updateValue($fe, implode(',', $field_editor_valid));
|
||||
$this->processExtrafield($field_editor_valid, $type, 'text');
|
||||
}
|
||||
@@ -440,7 +440,7 @@ class APPageBuilder extends Module
|
||||
public function processBackup()
|
||||
{
|
||||
$install_folder = $this->backup_dir;
|
||||
|
||||
|
||||
if (!is_dir($install_folder)) {
|
||||
mkdir($install_folder, 0755, true);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sub function of back-up database
|
||||
*/
|
||||
@@ -934,7 +934,7 @@ class APPageBuilder extends Module
|
||||
'title' => $this->l('Save'),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$form_extrafield = array(
|
||||
|
||||
'legend' => array(
|
||||
@@ -1168,7 +1168,7 @@ class APPageBuilder extends Module
|
||||
{
|
||||
$this->context->controller->addCss(apPageHelper::getCssDir().'style.css');
|
||||
$result = array();
|
||||
|
||||
|
||||
foreach ($form_general['input'] as $form) {
|
||||
//$form['name'] = isset($form['name']) ? $form['name'] : '';
|
||||
if (Configuration::hasKey($form['name'])) {
|
||||
@@ -1177,7 +1177,7 @@ class APPageBuilder extends Module
|
||||
$result[$form['name']] = Tools::getValue($form['name'], isset($form['default']) ? $form['default'] : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($form_extrafield['input'] as $form) {
|
||||
//$form['name'] = isset($form['name']) ? $form['name'] : '';
|
||||
if (Configuration::hasKey($form['name'])) {
|
||||
@@ -1239,7 +1239,7 @@ class APPageBuilder extends Module
|
||||
$assign['apLiveEdit'] .= '" target="_blank"><i class="icon-pencil"></i> <span>Edit</span></a>';
|
||||
$assign['apLiveEditEnd'] = '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($assign) {
|
||||
foreach ($assign as $key => $ass) {
|
||||
$this->smarty->assign(array($key => $ass));
|
||||
@@ -1315,12 +1315,12 @@ class APPageBuilder extends Module
|
||||
if ($value_by_categories) {
|
||||
$id_categories = isset($params['categorybox']) ? $params['categorybox'] : '';
|
||||
$id_categories = apPageHelper::addonValidInt( $id_categories ); # We validate id_categories in apPageHelper::addonValidInt function . This function is used at any where
|
||||
|
||||
|
||||
if (isset($params['category_type']) && $params['category_type'] == 'default') {
|
||||
$where .= ' AND product_shop.`id_category_default` IN ('.pSQL($id_categories).')';
|
||||
} else {
|
||||
$sql_join .= ' INNER JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product= p.`id_product` )';
|
||||
|
||||
|
||||
$where .= ' AND cp.`id_category` IN ('.pSQL($id_categories).')';
|
||||
$sql_group = ' GROUP BY p.id_product';
|
||||
}
|
||||
@@ -1384,7 +1384,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
$where .= ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')';
|
||||
}
|
||||
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, p.`reference`, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
product_attribute_shop.id_product_attribute,
|
||||
product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity,
|
||||
@@ -1402,7 +1402,7 @@ class APPageBuilder extends Module
|
||||
} else {
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'product` p';
|
||||
}
|
||||
|
||||
|
||||
$sql .= ' INNER JOIN '._DB_PREFIX_.'product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = '.(int)$context->shop->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_shop product_attribute_shop ON p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.'
|
||||
'.ProductCore::sqlStock('p', 'product_attribute_shop', false, $context->shop).'
|
||||
@@ -1452,14 +1452,14 @@ class APPageBuilder extends Module
|
||||
)
|
||||
);
|
||||
Configuration::updateValue('shortcode_url_add', $this->context->link->getAdminLink('AdminApPageBuilderShortcode'));
|
||||
|
||||
|
||||
$this->autoRestoreSampleData();
|
||||
}
|
||||
|
||||
public function hookdisplayHeader()
|
||||
{
|
||||
apPageHelper::autoUpdateModule();
|
||||
|
||||
|
||||
if ( Tools::getIsset('leo_support_team') && (int)Tools::getValue('leo_support_team') == 1) {
|
||||
Configuration::updateValue('LEO_SUPPORT_TEAM', '1');
|
||||
die('update');
|
||||
@@ -1467,7 +1467,7 @@ class APPageBuilder extends Module
|
||||
Configuration::updateValue('LEO_SUPPORT_TEAM', '0');
|
||||
die('update');
|
||||
}
|
||||
|
||||
|
||||
if (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront'))) {
|
||||
# WORK AT FRONTEND
|
||||
apPageHelper::loadShortCode(_PS_THEME_DIR_);
|
||||
@@ -1479,12 +1479,12 @@ class APPageBuilder extends Module
|
||||
# FIX 1.7
|
||||
apPageHelper::setGlobalVariable($this->context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_WAYPOINTS')) {
|
||||
$uri = apPageHelper::getCssDir().'animate.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'waypoints.min.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1501,7 +1501,7 @@ class APPageBuilder extends Module
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
$uri = apPageHelper::getCssDir().'owl.theme.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'owl.carousel.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1509,7 +1509,7 @@ class APPageBuilder extends Module
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_SWIPER')) {
|
||||
$uri = apPageHelper::getCssDir().'swiper.min.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'swiper.min.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1557,12 +1557,12 @@ class APPageBuilder extends Module
|
||||
if ($product_list_image) {
|
||||
$this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll'));
|
||||
}
|
||||
|
||||
|
||||
// add js for html5 youtube video
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_HTML5VIDEO')) {
|
||||
$uri = apPageHelper::getCssDir().'mediaelementplayer.min.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'mediaelement-and-player.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1570,7 +1570,7 @@ class APPageBuilder extends Module
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_FULLPAGEJS')) {
|
||||
$uri = apPageHelper::getCssDir().'jquery.fullPage.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'jquery.fullPage.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ class APPageBuilder extends Module
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_IMAGE360')) {
|
||||
$uri = apPageHelper::getCssDir().'ApImage360.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'ApImage360.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
$this->context->controller->addJqueryUI('ui.slider');
|
||||
@@ -1587,7 +1587,7 @@ class APPageBuilder extends Module
|
||||
if (Configuration::get('APPAGEBUILDER_LOAD_IMAGEHOTPOT')) {
|
||||
$uri = apPageHelper::getCssDir().'ApImageHotspot.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'ApImageHotspot.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -1598,20 +1598,20 @@ class APPageBuilder extends Module
|
||||
|
||||
$uri = apPageHelper::getCssDir().'styles.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
//DONGND:: add unique css file, css of module for all theme, no need override
|
||||
|
||||
//DONGND:: add unique css file, css of module for all theme, no need override
|
||||
$uri = apPageHelper::getCssDir().'unique.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'script.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
if (!$this->product_active) {
|
||||
$this->product_active = ApPageBuilderProductsModel::getActive();
|
||||
}
|
||||
$this->smarty->smarty->assign(array('productClassWidget' => $this->product_active['class']));
|
||||
|
||||
|
||||
$tpl_file = apPageHelper::getConfigDir('theme_profiles') . $this->product_active['plist_key'].'.tpl';
|
||||
|
||||
|
||||
if (is_file($tpl_file)) {
|
||||
$this->smarty->smarty->assign(array('productProfileDefault' => $this->product_active['plist_key']));
|
||||
}
|
||||
@@ -1626,7 +1626,7 @@ class APPageBuilder extends Module
|
||||
'mediumSize' => Image::getSize(ImageType::getFormattedName('medium'))
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
# LEOTEMCP
|
||||
$isRTL = $this->context->language->is_rtl;
|
||||
$leoRTL = $this->context->language->is_rtl;
|
||||
@@ -1640,7 +1640,7 @@ class APPageBuilder extends Module
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($rtl_file) {
|
||||
$leoRTL = false; // to remove class RTL
|
||||
// $this->context->controller->unregisterStylesheet('theme-rtl');
|
||||
@@ -1650,11 +1650,11 @@ class APPageBuilder extends Module
|
||||
}
|
||||
// $id_shop = $this->context->shop->id;
|
||||
// $helper = LeoFrameworkHelper::getInstance();
|
||||
|
||||
|
||||
$this->themeCookieName = $this->getConfigName('PANEL_CONFIG');
|
||||
$panelTool = $this->getConfig('PANELTOOL');
|
||||
$backGroundValue = '';
|
||||
|
||||
|
||||
//DONGND:: get product detail layout
|
||||
$list_productdetail_layout = array();
|
||||
|
||||
@@ -1664,17 +1664,17 @@ class APPageBuilder extends Module
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
$uri = apPageHelper::getCssDir().'paneltool.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'colorpicker/js/colorpicker.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
$uri = apPageHelper::getJsDir().'paneltool.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
$this->context->controller->addJqueryPlugin('cooki-plugin');
|
||||
|
||||
|
||||
$skin = $this->getPanelConfig('default_skin');
|
||||
$layout_mode = $this->getPanelConfig('layout_mode');
|
||||
$enable_fheader = (int)$this->getPanelConfig('enable_fheader');
|
||||
|
||||
|
||||
$backGroundValue = array(
|
||||
'attachment' => array('scroll', 'fixed', 'local', 'initial', 'inherit'),
|
||||
'repeat' => array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'),
|
||||
@@ -1720,7 +1720,7 @@ class APPageBuilder extends Module
|
||||
$this->context->controller->addJqueryPlugin('cooki-plugin');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if ($this->getConfig('ENABLE_CUSTOMFONT')) {
|
||||
// # CUSTOM FONT
|
||||
// $uri = apPageHelper::getCssDir().'fonts-cuttom.css';
|
||||
@@ -1731,7 +1731,7 @@ class APPageBuilder extends Module
|
||||
$uri = apPageHelper::getCssDir().'fonts-cuttom2.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
}
|
||||
|
||||
|
||||
$layout_width_val = '';
|
||||
$layout_width = $this->getConfig('layout_width');
|
||||
if (trim($layout_width) != 'auto' && trim($layout_width) != '') {
|
||||
@@ -1742,7 +1742,7 @@ class APPageBuilder extends Module
|
||||
$layout_width_val .= '<script type="text/javascript">layout_width = '.$layout_width.';</script>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$load_css_type = $this->getConfig('load_css_type');
|
||||
$css_skin = array();
|
||||
$css_custom = array();
|
||||
@@ -1752,19 +1752,19 @@ class APPageBuilder extends Module
|
||||
$uri = apPageHelper::getCssDir().'non-responsive.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
}
|
||||
|
||||
|
||||
# LOAD SKIN CSS IN MODULE
|
||||
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/custom-rtl.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
# LOAD CUSTOM CSS
|
||||
if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) {
|
||||
$uri = apPageHelper::getCssDir().'mobile.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
}
|
||||
|
||||
|
||||
# LOAD POSITIONS AND PROFILES
|
||||
$this->loadResouceForProfile();
|
||||
|
||||
@@ -1782,7 +1782,7 @@ class APPageBuilder extends Module
|
||||
$css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# LOAD SKIN CSS IN TPL
|
||||
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css';
|
||||
$skinFileUrl = apPageHelper::getFullPathCss($uri);
|
||||
@@ -1794,7 +1794,7 @@ class APPageBuilder extends Module
|
||||
if ($leoRTL && $skinFileUrl !== false) {
|
||||
$css_skin[] = '<link rel="stylesheet" id="leo-dynamic-skin-css-rtl" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
|
||||
}
|
||||
|
||||
|
||||
# LOAD CUSTOM CSS
|
||||
if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) {
|
||||
$uri = apPageHelper::getCssDir().'mobile.css';
|
||||
@@ -1803,10 +1803,10 @@ class APPageBuilder extends Module
|
||||
$css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# LOAD POSITIONS AND PROFILES
|
||||
$this->loadResouceForProfile();
|
||||
|
||||
|
||||
# LOAD PATTERN
|
||||
if ($profile = $this->getConfig('c_profile')) {
|
||||
$uri = apPageHelper::getCssDir().'patterns/'.$profile.'.css';
|
||||
@@ -1816,7 +1816,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->context->language->is_rtl) {
|
||||
# OVERRIDE CORE, LOAD RTL.CSS FILE AT BOTTOM
|
||||
$this->context->controller->registerStylesheet('theme-rtl', '/assets/css/rtl.css', ['media' => 'all', 'priority' => 9000]);
|
||||
@@ -1930,20 +1930,20 @@ class APPageBuilder extends Module
|
||||
$shortcode_obj = ApPageBuilderShortcodeModel::getShortCode($shortcode_key);
|
||||
if (isset($shortcode_obj['id_appagebuilder']) && $shortcode_obj['id_appagebuilder'] != '' && $shortcode_obj['id_appagebuilder'] != 0) {
|
||||
$shortcode_code = ApPageBuilderShortcodeModel::getAllItems($shortcode_obj['id_appagebuilder'], 1);
|
||||
|
||||
|
||||
if (!empty($shortcode_code)) {
|
||||
if (empty(ApShortCodesBuilder::$shortcode_tags)) {
|
||||
apPageHelper::loadShortCode(_PS_THEME_DIR_);
|
||||
}
|
||||
|
||||
|
||||
apPageHelper::setGlobalVariable($this->context);
|
||||
|
||||
|
||||
// ApShortCodesBuilder::$is_front_office = 1;
|
||||
// ApShortCodesBuilder::$is_gen_html = 1;
|
||||
// ApShortCodesBuilder::$profile_param = array();
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
// ApShortCodesBuilder::$hook_name = 'apshortcode';
|
||||
|
||||
|
||||
$shortcode_html = $ap_helper->parse($shortcode_code['apshortcode']);
|
||||
}
|
||||
}
|
||||
@@ -2005,7 +2005,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
return $cover_hook_live.$this->fetch( $this->templateFile, $cache_id);
|
||||
}
|
||||
|
||||
|
||||
public function hookDisplayBanner($params)
|
||||
{
|
||||
return $this->processHook('displayBanner', $params);
|
||||
@@ -2080,23 +2080,23 @@ class APPageBuilder extends Module
|
||||
{
|
||||
return $this->processHook('displayLeftColumnProduct', $params);
|
||||
}
|
||||
|
||||
|
||||
public function hookdisplayProductButtons($params)
|
||||
{
|
||||
return $this->processHook('displayProductButtons', $params);
|
||||
}
|
||||
|
||||
|
||||
public function hookDisplayReassurance($params)
|
||||
{
|
||||
return $this->processHook('displayReassurance', $params);
|
||||
}
|
||||
|
||||
|
||||
public function hookDisplayLeoProfileProduct($params)
|
||||
{
|
||||
apPageHelper::setGlobalVariable($this->context);
|
||||
$html = '';
|
||||
$tpl_file = '';
|
||||
|
||||
|
||||
if (isset($params['ony_global_variable'])) {
|
||||
# {hook h='displayLeoProfileProduct' ony_global_variable=true}
|
||||
return $html;
|
||||
@@ -2148,7 +2148,7 @@ class APPageBuilder extends Module
|
||||
// $this->unregisterExceptions((int)$row['id_hook']);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIX BUG 1.7.3.3 : install theme lose hook displayHome, displayLeoProfileProduct
|
||||
* because ajax not run hookActionAdminBefore();
|
||||
@@ -2163,7 +2163,7 @@ class APPageBuilder extends Module
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run only one when install/change Theme_of_Leo
|
||||
*/
|
||||
@@ -2176,8 +2176,8 @@ class APPageBuilder extends Module
|
||||
// Other module call this hook -> duplicate data
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# FIX : update Prestashop by 1-Click module -> NOT NEED RESTORE DATABASE
|
||||
$ap_version = Configuration::get('AP_CURRENT_VERSION');
|
||||
if ($ap_version != false) {
|
||||
@@ -2189,8 +2189,8 @@ class APPageBuilder extends Module
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# WHENE INSTALL THEME, INSERT HOOK FROM DATASAMPLE IN THEME
|
||||
$hook_from_theme = false;
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
|
||||
@@ -2200,36 +2200,36 @@ class APPageBuilder extends Module
|
||||
$hook_from_theme = true;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
# INSERT HOOK FROM MODULE_DATASAMPLE
|
||||
if ($hook_from_theme == false) {
|
||||
$this->registerLeoHook();
|
||||
}
|
||||
|
||||
|
||||
# WHEN INSTALL MODULE, NOT NEED RESTORE DATABASE IN THEME
|
||||
$install_module = (int)Configuration::get('AP_INSTALLED_APPAGEBUILDER', 0);
|
||||
if ($install_module) {
|
||||
Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '0'); // next : allow restore sample
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# INSERT DATABASE FROM THEME_DATASAMPLE
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php');
|
||||
$sample = new Datasample();
|
||||
$sample->processImport($this->name);
|
||||
}
|
||||
|
||||
|
||||
# REMOVE FILE INDEX.PHP FOR TRANSLATE
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php');
|
||||
ApPageSetup::processTranslateTheme();
|
||||
}
|
||||
|
||||
|
||||
# REMOVE SUPPORT TEAM FIX LINK CSS, JS
|
||||
Configuration::updateValue('LEO_SUPPORT_TEAM', '0');
|
||||
}
|
||||
|
||||
|
||||
protected function getCacheId($hook_name = null, $shortcode_key = null)
|
||||
{
|
||||
$cache_array = array();
|
||||
@@ -2287,12 +2287,12 @@ class APPageBuilder extends Module
|
||||
if (Tools::getValue('footer') && Tools::getIsset('leopanelchange') && (in_array($hook_name, ApPageSetting::getHook('footer')) || $hook_name == 'pagebuilderConfig|footer')) {
|
||||
$cache_array[] = 'footer_'.Tools::getValue('footer');
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: update cache for shortcode
|
||||
if ($shortcode_key) {
|
||||
$cache_array[] = 'shortcodekey_'.$shortcode_key;
|
||||
}
|
||||
|
||||
|
||||
return implode('|', $cache_array);
|
||||
}
|
||||
|
||||
@@ -2372,12 +2372,12 @@ class APPageBuilder extends Module
|
||||
// $this->_clearCache('appagebuilder.tpl', $this->name);
|
||||
$this->_clearCache($this->templateFile); # CLEAR CACHE ALL HOOKS
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: add clear cache for shortcode
|
||||
public function clearShortCodeCache($shortcode_key)
|
||||
{
|
||||
$cache_id = $this->getCacheId('apshortcode', $shortcode_key);
|
||||
|
||||
|
||||
$this->_clearCache('appagebuilder.tpl', $cache_id);
|
||||
}
|
||||
|
||||
@@ -2457,19 +2457,19 @@ class APPageBuilder extends Module
|
||||
if ($list_positions) {
|
||||
foreach ($list_positions as $item) {
|
||||
$name = $item['position'].$item['position_key'];
|
||||
|
||||
|
||||
$uri = apPageHelper::getCssDir().'positions/'.$name.'.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'positions/'.$name.'.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$uri = apPageHelper::getCssDir().'profiles/'.$profile['profile_key'].'.css';
|
||||
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
|
||||
|
||||
|
||||
$uri = apPageHelper::getJsDir().'profiles/'.$profile['profile_key'].'.js';
|
||||
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
|
||||
}
|
||||
@@ -2662,7 +2662,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
public function hookModuleRoutes($params)
|
||||
{
|
||||
$routes = array();
|
||||
@@ -2834,7 +2834,7 @@ class APPageBuilder extends Module
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* alias from apPageHelper::getConfig()
|
||||
*/
|
||||
@@ -2842,7 +2842,7 @@ class APPageBuilder extends Module
|
||||
{
|
||||
return apPageHelper::getConfigName($name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* alias from apPageHelper::getConfig()
|
||||
*/
|
||||
@@ -2850,7 +2850,7 @@ class APPageBuilder extends Module
|
||||
{
|
||||
return apPageHelper::getConfig($name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get Value of configuration based on actived theme
|
||||
*/
|
||||
@@ -2862,7 +2862,7 @@ class APPageBuilder extends Module
|
||||
}
|
||||
|
||||
$cookie = LeoFrameworkHelper::getCookie();
|
||||
|
||||
|
||||
if (isset($cookie[$this->themeCookieName.'_'.$key])) {
|
||||
return $cookie[$this->themeCookieName.'_'.$key];
|
||||
}
|
||||
@@ -2904,16 +2904,16 @@ class APPageBuilder extends Module
|
||||
}
|
||||
# register hook to show when paging
|
||||
$this->registerHook('pagebuilderConfig');
|
||||
|
||||
|
||||
# register hook to show category and tags of product
|
||||
$this->registerHook('displayProductInformation');
|
||||
|
||||
|
||||
# register hook again to after install/change theme
|
||||
$this->registerHook('actionObjectShopUpdateAfter');
|
||||
|
||||
|
||||
# Multishop create new shop
|
||||
$this->registerHook('actionAdminShopControllerSaveAfter');
|
||||
|
||||
|
||||
$this->registerHook('displayProductButtons');
|
||||
$this->registerHook('displayReassurance');
|
||||
$this->registerHook('displayLeoProfileProduct');
|
||||
@@ -2931,7 +2931,7 @@ class APPageBuilder extends Module
|
||||
$this->registerHook('actionAdminControllerSetMedia');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Action Create new shop, choose theme then auto restore datasample.
|
||||
*/
|
||||
@@ -2941,7 +2941,7 @@ class APPageBuilder extends Module
|
||||
&& Tools::getIsset('submitAddshop') !== false && Tools::getValue('submitAddshop')
|
||||
&& Tools::getIsset('theme_name') !== false && Tools::getValue('theme_name')) {
|
||||
$shop = $param['return'];
|
||||
|
||||
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php');
|
||||
$sample = new Datasample();
|
||||
@@ -2954,16 +2954,16 @@ class APPageBuilder extends Module
|
||||
|
||||
public function hookDisplayBackOfficeCategory($params)
|
||||
{
|
||||
|
||||
|
||||
if (Validate::isLoadedObject($category = new Category((int)Tools::getValue('id_category')))) {
|
||||
// validate module
|
||||
unset($category);
|
||||
|
||||
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
|
||||
$category_layouts = array();
|
||||
$id_category = Tools::getValue('id_category');
|
||||
|
||||
|
||||
if (is_dir(apPageHelper::getConfigDir('theme_profiles'))) {
|
||||
//DONGND:: fix get list product list via database
|
||||
$sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_products p
|
||||
@@ -3012,7 +3012,7 @@ class APPageBuilder extends Module
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$sql = 'SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' AND id_shop = \''.(int)$id_shop.'\'';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
if ($aplayout == 'default') {
|
||||
Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' and id_shop=\''.(int)$id_shop.'\'');
|
||||
@@ -3095,7 +3095,7 @@ class APPageBuilder extends Module
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$sql = 'SELECT * from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' AND id_shop = '.(int)$id_shop;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
if ($aplayout == 'default') {
|
||||
Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' and id_shop='.(int)$id_shop);
|
||||
@@ -3107,7 +3107,7 @@ class APPageBuilder extends Module
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'appagebuilder_page` (`id_product`,`id_category`,`page`,`id_shop`) VALUES ('.(int)$id_product.',0,\''.pSQL($aplayout).'\','.(int)$id_shop.')');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) {
|
||||
//save for extrafield
|
||||
$sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`';
|
||||
@@ -3151,7 +3151,7 @@ class APPageBuilder extends Module
|
||||
if (Validate::isLoadedObject($product = new Product((int)$params['id_product']))) {
|
||||
// validate module
|
||||
unset($product);
|
||||
|
||||
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$extrafied = array();
|
||||
$data_fields = array();
|
||||
@@ -3159,7 +3159,7 @@ class APPageBuilder extends Module
|
||||
if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) {
|
||||
$sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
|
||||
$rows = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'` WHERE id_product="'.(int)$params['id_product'].'" AND id_shop="'.(int)$id_shop.'"');
|
||||
|
||||
foreach ($result as $value) {
|
||||
@@ -3185,7 +3185,7 @@ class APPageBuilder extends Module
|
||||
'default_language' => $this->default_language,
|
||||
'current_layout' => Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_product = \''.(int)$params['id_product'].'\' AND id_shop = \''.(int)$id_shop.'\'')
|
||||
));
|
||||
|
||||
|
||||
return $this->display(__FILE__, 'productExtra.tpl');
|
||||
}
|
||||
}
|
||||
@@ -3227,7 +3227,7 @@ class APPageBuilder extends Module
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
*/
|
||||
@@ -3240,10 +3240,10 @@ class APPageBuilder extends Module
|
||||
$view = Module::getPermissionStatic($this->id, 'view', $employee);
|
||||
return ($configure || $view);
|
||||
}
|
||||
|
||||
|
||||
return Module::getPermissionStatic($this->id, $variable, $employee);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user