From 55a81b68e4f142b44b3d3ec813c242c3cae3ed9a Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 30 Sep 2022 20:24:25 +0530 Subject: [PATCH 1/2] Replace Google+ url with Medium url in blocksocial module --- install/data/theme.sql | 2 +- modules/blocksocial/blocksocial.php | 161 ++++++++---------- modules/blocksocial/blocksocial.tpl | 87 ++++++++-- themes/hotel-reservation-theme/css/global.css | 2 + .../modules/blocksocial/blocksocial.tpl | 9 +- 5 files changed, 159 insertions(+), 102 deletions(-) diff --git a/install/data/theme.sql b/install/data/theme.sql index 9785d6955..304baf0db 100644 --- a/install/data/theme.sql +++ b/install/data/theme.sql @@ -53,7 +53,7 @@ UPDATE `PREFIX_configuration` SET value = 'CAT3,CAT8,CAT5,LNK1' WHERE name = 'MO UPDATE `PREFIX_configuration` SET value = '0' WHERE name = 'MOD_BLOCKTOPMENU_SEARCH'; UPDATE `PREFIX_configuration` SET value = 'https://www.facebook.com/qloapps' WHERE name = 'BLOCKSOCIAL_FACEBOOK'; UPDATE `PREFIX_configuration` SET value = 'https://twitter.com/qloapps' WHERE name = 'BLOCKSOCIAL_TWITTER'; -UPDATE `PREFIX_configuration` SET value = 'https://plus.google.com/110221570427070809661' WHERE name = 'BLOCKSOCIAL_GOOGLE_PLUS'; +UPDATE `PREFIX_configuration` SET value = 'https://medium.com/@qloapps' WHERE name = 'BLOCKSOCIAL_MEDIUM'; UPDATE `PREFIX_configuration` SET value = 'My Company' WHERE name = 'BLOCKCONTACTINFOS_COMPANY'; UPDATE `PREFIX_configuration` SET value = '42 Puffin street\n12345 Puffinville\nFrance' WHERE name = 'BLOCKCONTACTINFOS_ADDRESS'; UPDATE `PREFIX_configuration` SET value = '0123-456-789' WHERE name = 'BLOCKCONTACTINFOS_PHONE'; diff --git a/modules/blocksocial/blocksocial.php b/modules/blocksocial/blocksocial.php index 5ebb5991f..05b67238c 100644 --- a/modules/blocksocial/blocksocial.php +++ b/modules/blocksocial/blocksocial.php @@ -24,10 +24,11 @@ * International Registered Trademark & Property of PrestaShop SA */ -if (!defined('_CAN_LOAD_FILES_')) +if (!defined('_PS_VERSION_')) { exit; - -class blocksocial extends Module +} + +class BlockSocial extends Module { public function __construct() { @@ -37,102 +38,87 @@ class blocksocial extends Module $this->author = 'PrestaShop'; $this->bootstrap = true; - parent::__construct(); + parent::__construct(); $this->displayName = $this->l('Social networking block'); $this->description = $this->l('Allows you to add information about your brand\'s social networking accounts.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } - + public function install() { - return (parent::install() AND Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', '') && - Configuration::updateValue('BLOCKSOCIAL_TWITTER', '') && - Configuration::updateValue('BLOCKSOCIAL_RSS', '') && - Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', '') && - Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', '') && - Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') && - Configuration::updateValue('BLOCKSOCIAL_VIMEO', '') && - Configuration::updateValue('BLOCKSOCIAL_INSTAGRAM', '') && - $this->registerHook('displayHeader') && - $this->registerHook('displayFooterNotificationHook') - ); + if (!parent::install() + || !Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', '') + || !Configuration::updateValue('BLOCKSOCIAL_TWITTER', '') + || !Configuration::updateValue('BLOCKSOCIAL_MEDIUM', '') + || !Configuration::updateValue('BLOCKSOCIAL_RSS', '') + || !Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', '') + || !Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') + || !Configuration::updateValue('BLOCKSOCIAL_VIMEO', '') + || !Configuration::updateValue('BLOCKSOCIAL_INSTAGRAM', '') + || !$this->registerHook('displayFooterNotificationHook') + ) { + return false; + } + + return true; } - + public function uninstall() { - //Delete configuration - return (Configuration::deleteByName('BLOCKSOCIAL_FACEBOOK') AND - Configuration::deleteByName('BLOCKSOCIAL_TWITTER') AND - Configuration::deleteByName('BLOCKSOCIAL_RSS') AND - Configuration::deleteByName('BLOCKSOCIAL_YOUTUBE') AND - Configuration::deleteByName('BLOCKSOCIAL_GOOGLE_PLUS') AND - Configuration::deleteByName('BLOCKSOCIAL_PINTEREST') AND - Configuration::deleteByName('BLOCKSOCIAL_VIMEO') AND - Configuration::deleteByName('BLOCKSOCIAL_INSTAGRAM') AND - parent::uninstall()); + // Delete configuration + if (!parent::uninstall() + || !Configuration::deleteByName('BLOCKSOCIAL_FACEBOOK') + || !Configuration::deleteByName('BLOCKSOCIAL_TWITTER') + || !Configuration::deleteByName('BLOCKSOCIAL_MEDIUM') + || !Configuration::deleteByName('BLOCKSOCIAL_RSS') + || !Configuration::deleteByName('BLOCKSOCIAL_YOUTUBE') + || !Configuration::deleteByName('BLOCKSOCIAL_PINTEREST') + || !Configuration::deleteByName('BLOCKSOCIAL_VIMEO') + || !Configuration::deleteByName('BLOCKSOCIAL_INSTAGRAM') + ) { + return false; + } + + return true; } - + public function getContent() { // If we try to update the settings $output = ''; - if (Tools::isSubmit('submitModule')) - { + if (Tools::isSubmit('submitModule')) { Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', Tools::getValue('blocksocial_facebook', '')); Configuration::updateValue('BLOCKSOCIAL_TWITTER', Tools::getValue('blocksocial_twitter', '')); + Configuration::updateValue('BLOCKSOCIAL_MEDIUM', Tools::getValue('blocksocial_medium', '')); Configuration::updateValue('BLOCKSOCIAL_RSS', Tools::getValue('blocksocial_rss', '')); Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', Tools::getValue('blocksocial_youtube', '')); - Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', Tools::getValue('blocksocial_google_plus', '')); Configuration::updateValue('BLOCKSOCIAL_PINTEREST', Tools::getValue('blocksocial_pinterest', '')); Configuration::updateValue('BLOCKSOCIAL_VIMEO', Tools::getValue('blocksocial_vimeo', '')); Configuration::updateValue('BLOCKSOCIAL_INSTAGRAM', Tools::getValue('blocksocial_instagram', '')); - $this->_clearCache('blocksocial.tpl'); - Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.'&conf=4&module_name='.$this->name); + + Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&conf=4'); } - + return $output.$this->renderForm(); } - - public function hookDisplayHeader() - { - $this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all'); - } public function hookDisplayFooterNotificationHook() { - if (!$this->isCached('blocksocial.tpl', $this->getCacheId())) - $this->smarty->assign(array( - 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), - 'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'), - 'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'), - 'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'), - 'google_plus_url' => Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS'), - 'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'), - 'vimeo_url' => Configuration::get('BLOCKSOCIAL_VIMEO'), - 'instagram_url' => Configuration::get('BLOCKSOCIAL_INSTAGRAM'), - )); + $this->smarty->assign(array( + 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), + 'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'), + 'medium_url' => Configuration::get('BLOCKSOCIAL_MEDIUM'), + 'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'), + 'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'), + 'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'), + 'vimeo_url' => Configuration::get('BLOCKSOCIAL_VIMEO'), + 'instagram_url' => Configuration::get('BLOCKSOCIAL_INSTAGRAM'), + )); - return $this->display(__FILE__, 'blocksocial.tpl', $this->getCacheId()); + return $this->display(__FILE__, 'blocksocial.tpl'); } - /*public function hookDisplayFooter() - { - if (!$this->isCached('blocksocial.tpl', $this->getCacheId())) - $this->smarty->assign(array( - 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), - 'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'), - 'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'), - 'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'), - 'google_plus_url' => Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS'), - 'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'), - 'vimeo_url' => Configuration::get('BLOCKSOCIAL_VIMEO'), - 'instagram_url' => Configuration::get('BLOCKSOCIAL_INSTAGRAM'), - )); - - return $this->display(__FILE__, 'blocksocial.tpl', $this->getCacheId()); - }*/ - public function renderForm() { $fields_form = array( @@ -154,6 +140,12 @@ class blocksocial extends Module 'name' => 'blocksocial_twitter', 'desc' => $this->l('Your official Twitter account.'), ), + array( + 'type' => 'text', + 'label' => $this->l('Medium URL'), + 'name' => 'blocksocial_medium', + 'desc' => $this->l('Your official Medium account.'), + ), array( 'type' => 'text', 'label' => $this->l('RSS URL'), @@ -166,29 +158,23 @@ class blocksocial extends Module 'name' => 'blocksocial_youtube', 'desc' => $this->l('Your official YouTube account.'), ), - array( - 'type' => 'text', - 'label' => $this->l('Google+ URL:'), - 'name' => 'blocksocial_google_plus', - 'desc' => $this->l('Your official Google+ page.'), - ), array( 'type' => 'text', 'label' => $this->l('Pinterest URL:'), 'name' => 'blocksocial_pinterest', 'desc' => $this->l('Your official Pinterest account.'), ), - array( - 'type' => 'text', - 'label' => $this->l('Vimeo URL:'), - 'name' => 'blocksocial_vimeo', - 'desc' => $this->l('Your official Vimeo account.'), + array( + 'type' => 'text', + 'label' => $this->l('Vimeo URL:'), + 'name' => 'blocksocial_vimeo', + 'desc' => $this->l('Your official Vimeo account.'), ), - array( - 'type' => 'text', - 'label' => $this->l('Instagram URL:'), - 'name' => 'blocksocial_instagram', - 'desc' => $this->l('Your official Instagram account.'), + array( + 'type' => 'text', + 'label' => $this->l('Instagram URL:'), + 'name' => 'blocksocial_instagram', + 'desc' => $this->l('Your official Instagram account.'), ), ), 'submit' => array( @@ -196,7 +182,7 @@ class blocksocial extends Module ) ), ); - + $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; @@ -215,19 +201,18 @@ class blocksocial extends Module return $helper->generateForm(array($fields_form)); } - + public function getConfigFieldsValues() { return array( 'blocksocial_facebook' => Tools::getValue('blocksocial_facebook', Configuration::get('BLOCKSOCIAL_FACEBOOK')), 'blocksocial_twitter' => Tools::getValue('blocksocial_twitter', Configuration::get('BLOCKSOCIAL_TWITTER')), + 'blocksocial_medium' => Tools::getValue('blocksocial_medium', Configuration::get('BLOCKSOCIAL_MEDIUM')), 'blocksocial_rss' => Tools::getValue('blocksocial_rss', Configuration::get('BLOCKSOCIAL_RSS')), 'blocksocial_youtube' => Tools::getValue('blocksocial_youtube', Configuration::get('BLOCKSOCIAL_YOUTUBE')), - 'blocksocial_google_plus' => Tools::getValue('blocksocial_google_plus', Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS')), 'blocksocial_pinterest' => Tools::getValue('blocksocial_pinterest', Configuration::get('BLOCKSOCIAL_PINTEREST')), 'blocksocial_vimeo' => Tools::getValue('blocksocial_vimeo', Configuration::get('BLOCKSOCIAL_VIMEO')), 'blocksocial_instagram' => Tools::getValue('blocksocial_instagram', Configuration::get('BLOCKSOCIAL_INSTAGRAM')), ); } - } diff --git a/modules/blocksocial/blocksocial.tpl b/modules/blocksocial/blocksocial.tpl index 28da35841..4564f1182 100644 --- a/modules/blocksocial/blocksocial.tpl +++ b/modules/blocksocial/blocksocial.tpl @@ -24,16 +24,79 @@ * International Registered Trademark & Property of PrestaShop SA *} -
-

{l s='Follow us' mod='blocksocial'}

- +
+
+ +
+ +
+
+
diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index a13cb81e4..a91870056 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -7449,6 +7449,8 @@ div.star a:hover { content: "\f09a"; } .footer-container #footer #social_block ul li.twitter a:before { content: "\f099"; } + .footer-container #footer #social_block ul li.medium a:before { + content: "\f23a"; } .footer-container #footer #social_block ul li.rss a:before { content: "\f09e"; } .footer-container #footer #social_block ul li.youtube a:before { diff --git a/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl b/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl index f036c9453..c23d417f2 100644 --- a/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl +++ b/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl @@ -46,6 +46,13 @@ {/if} + {if isset($medium_url) && $medium_url != ''} +
  • + + {l s='Medium' mod='blocksocial'} + +
  • + {/if} {if isset($rss_url) && $rss_url != ''}
  • @@ -92,4 +99,4 @@
  • - \ No newline at end of file + From b43f6db9f8df809e98e29cb019324dd1e15b5c94 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 30 Nov 2022 16:53:39 +0530 Subject: [PATCH 2/2] Remove Medium URL --- install/data/theme.sql | 1 - modules/blocksocial/blocksocial.php | 11 ----------- modules/blocksocial/blocksocial.tpl | 7 ------- themes/hotel-reservation-theme/css/global.css | 2 -- .../modules/blocksocial/blocksocial.tpl | 7 ------- 5 files changed, 28 deletions(-) diff --git a/install/data/theme.sql b/install/data/theme.sql index 304baf0db..3f9fb22c2 100644 --- a/install/data/theme.sql +++ b/install/data/theme.sql @@ -53,7 +53,6 @@ UPDATE `PREFIX_configuration` SET value = 'CAT3,CAT8,CAT5,LNK1' WHERE name = 'MO UPDATE `PREFIX_configuration` SET value = '0' WHERE name = 'MOD_BLOCKTOPMENU_SEARCH'; UPDATE `PREFIX_configuration` SET value = 'https://www.facebook.com/qloapps' WHERE name = 'BLOCKSOCIAL_FACEBOOK'; UPDATE `PREFIX_configuration` SET value = 'https://twitter.com/qloapps' WHERE name = 'BLOCKSOCIAL_TWITTER'; -UPDATE `PREFIX_configuration` SET value = 'https://medium.com/@qloapps' WHERE name = 'BLOCKSOCIAL_MEDIUM'; UPDATE `PREFIX_configuration` SET value = 'My Company' WHERE name = 'BLOCKCONTACTINFOS_COMPANY'; UPDATE `PREFIX_configuration` SET value = '42 Puffin street\n12345 Puffinville\nFrance' WHERE name = 'BLOCKCONTACTINFOS_ADDRESS'; UPDATE `PREFIX_configuration` SET value = '0123-456-789' WHERE name = 'BLOCKCONTACTINFOS_PHONE'; diff --git a/modules/blocksocial/blocksocial.php b/modules/blocksocial/blocksocial.php index 05b67238c..ad61f6b8c 100644 --- a/modules/blocksocial/blocksocial.php +++ b/modules/blocksocial/blocksocial.php @@ -50,7 +50,6 @@ class BlockSocial extends Module if (!parent::install() || !Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', '') || !Configuration::updateValue('BLOCKSOCIAL_TWITTER', '') - || !Configuration::updateValue('BLOCKSOCIAL_MEDIUM', '') || !Configuration::updateValue('BLOCKSOCIAL_RSS', '') || !Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', '') || !Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') @@ -70,7 +69,6 @@ class BlockSocial extends Module if (!parent::uninstall() || !Configuration::deleteByName('BLOCKSOCIAL_FACEBOOK') || !Configuration::deleteByName('BLOCKSOCIAL_TWITTER') - || !Configuration::deleteByName('BLOCKSOCIAL_MEDIUM') || !Configuration::deleteByName('BLOCKSOCIAL_RSS') || !Configuration::deleteByName('BLOCKSOCIAL_YOUTUBE') || !Configuration::deleteByName('BLOCKSOCIAL_PINTEREST') @@ -90,7 +88,6 @@ class BlockSocial extends Module if (Tools::isSubmit('submitModule')) { Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', Tools::getValue('blocksocial_facebook', '')); Configuration::updateValue('BLOCKSOCIAL_TWITTER', Tools::getValue('blocksocial_twitter', '')); - Configuration::updateValue('BLOCKSOCIAL_MEDIUM', Tools::getValue('blocksocial_medium', '')); Configuration::updateValue('BLOCKSOCIAL_RSS', Tools::getValue('blocksocial_rss', '')); Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', Tools::getValue('blocksocial_youtube', '')); Configuration::updateValue('BLOCKSOCIAL_PINTEREST', Tools::getValue('blocksocial_pinterest', '')); @@ -108,7 +105,6 @@ class BlockSocial extends Module $this->smarty->assign(array( 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), 'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'), - 'medium_url' => Configuration::get('BLOCKSOCIAL_MEDIUM'), 'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'), 'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'), 'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'), @@ -140,12 +136,6 @@ class BlockSocial extends Module 'name' => 'blocksocial_twitter', 'desc' => $this->l('Your official Twitter account.'), ), - array( - 'type' => 'text', - 'label' => $this->l('Medium URL'), - 'name' => 'blocksocial_medium', - 'desc' => $this->l('Your official Medium account.'), - ), array( 'type' => 'text', 'label' => $this->l('RSS URL'), @@ -207,7 +197,6 @@ class BlockSocial extends Module return array( 'blocksocial_facebook' => Tools::getValue('blocksocial_facebook', Configuration::get('BLOCKSOCIAL_FACEBOOK')), 'blocksocial_twitter' => Tools::getValue('blocksocial_twitter', Configuration::get('BLOCKSOCIAL_TWITTER')), - 'blocksocial_medium' => Tools::getValue('blocksocial_medium', Configuration::get('BLOCKSOCIAL_MEDIUM')), 'blocksocial_rss' => Tools::getValue('blocksocial_rss', Configuration::get('BLOCKSOCIAL_RSS')), 'blocksocial_youtube' => Tools::getValue('blocksocial_youtube', Configuration::get('BLOCKSOCIAL_YOUTUBE')), 'blocksocial_pinterest' => Tools::getValue('blocksocial_pinterest', Configuration::get('BLOCKSOCIAL_PINTEREST')), diff --git a/modules/blocksocial/blocksocial.tpl b/modules/blocksocial/blocksocial.tpl index 4564f1182..08c703dee 100644 --- a/modules/blocksocial/blocksocial.tpl +++ b/modules/blocksocial/blocksocial.tpl @@ -46,13 +46,6 @@ {/if} - {if isset($medium_url) && $medium_url != ''} -
  • - - {l s='Medium' mod='blocksocial'} - -
  • - {/if} {if isset($rss_url) && $rss_url != ''}
  • diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index a91870056..a13cb81e4 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -7449,8 +7449,6 @@ div.star a:hover { content: "\f09a"; } .footer-container #footer #social_block ul li.twitter a:before { content: "\f099"; } - .footer-container #footer #social_block ul li.medium a:before { - content: "\f23a"; } .footer-container #footer #social_block ul li.rss a:before { content: "\f09e"; } .footer-container #footer #social_block ul li.youtube a:before { diff --git a/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl b/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl index c23d417f2..b355dc40f 100644 --- a/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl +++ b/themes/hotel-reservation-theme/modules/blocksocial/blocksocial.tpl @@ -46,13 +46,6 @@
  • {/if} - {if isset($medium_url) && $medium_url != ''} -
  • - - {l s='Medium' mod='blocksocial'} - -
  • - {/if} {if isset($rss_url) && $rss_url != ''}