Merge pull request #443 from abhishek-webkul/gli-967

Remove Google+ URL from blocksocial module
This commit is contained in:
Rohit Jain
2022-12-12 17:51:18 +05:30
committed by GitHub
4 changed files with 131 additions and 102 deletions

View File

@@ -52,7 +52,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://plus.google.com/110221570427070809661' WHERE name = 'BLOCKSOCIAL_GOOGLE_PLUS';
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';

View File

@@ -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,83 @@ 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_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_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_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'),
'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(
@@ -166,29 +148,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 +172,7 @@ class blocksocial extends Module
)
),
);
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
@@ -215,7 +191,7 @@ class blocksocial extends Module
return $helper->generateForm(array($fields_form));
}
public function getConfigFieldsValues()
{
return array(
@@ -223,11 +199,9 @@ class blocksocial extends Module
'blocksocial_twitter' => Tools::getValue('blocksocial_twitter', Configuration::get('BLOCKSOCIAL_TWITTER')),
'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')),
);
}
}

View File

@@ -24,16 +24,72 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<div id="social_block">
<h4 class="title_block">{l s='Follow us' mod='blocksocial'}</h4>
<ul>
{if $facebook_url != ''}<li class="facebook"><a class="_blank" href="{$facebook_url|escape:html:'UTF-8'}">{l s='Facebook' mod='blocksocial'}</a></li>{/if}
{if $twitter_url != ''}<li class="twitter"><a class="_blank" href="{$twitter_url|escape:html:'UTF-8'}">{l s='Twitter' mod='blocksocial'}</a></li>{/if}
{if $rss_url != ''}<li class="rss"><a class="_blank" href="{$rss_url|escape:html:'UTF-8'}">{l s='RSS' mod='blocksocial'}</a></li>{/if}
{if $youtube_url != ''}<li class="youtube"><a class="_blank" href="{$youtube_url|escape:html:'UTF-8'}">{l s='YouTube' mod='blocksocial'}</a></li>{/if}
{if $google_plus_url != ''}<li class="google_plus"><a class="_blank" href="{$google_plus_url|escape:html:'UTF-8'}">{l s='Google+' mod='blocksocial'}</a></li>{/if}
{if $pinterest_url != ''}<li class="pinterest"><a class="_blank" href="{$pinterest_url|escape:html:'UTF-8'}">{l s='Pinterest' mod='blocksocial'}</a></li>{/if}
{if $vimeo_url != ''}<li class="vimeo"><a href="{$vimeo_url|escape:html:'UTF-8'}">{l s='Vimeo' mod='blocksocial'}</a></li>{/if}
{if $instagram_url != ''}<li class="instagram"><a class="_blank" href="{$instagram_url|escape:html:'UTF-8'}">{l s='Instagram' mod='blocksocial'}</a></li>{/if}
</ul>
<div class="row">
<section class="col-xs-12 col-sm-12">
<div class="row margin-lr-0 footer-section-heading">
<p>{l s='Follow us on' mod='blocksocial'}</p>
<hr/>
</div>
<div class="row margin-lr-0" id="social_block">
<ul>
{if isset($facebook_url) && $facebook_url != ''}
<li class="facebook">
<a class="_blank" href="{$facebook_url|escape:html:'UTF-8'}">
<span>{l s='Facebook' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($twitter_url) && $twitter_url != ''}
<li class="twitter">
<a class="_blank" href="{$twitter_url|escape:html:'UTF-8'}">
<span>{l s='Twitter' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($rss_url) && $rss_url != ''}
<li class="rss">
<a class="_blank" href="{$rss_url|escape:html:'UTF-8'}">
<span>{l s='RSS' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($youtube_url) && $youtube_url != ''}
<li class="youtube">
<a class="_blank" href="{$youtube_url|escape:html:'UTF-8'}">
<span>{l s='Youtube' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($google_plus_url) && $google_plus_url != ''}
<li class="google-plus">
<a class="_blank" href="{$google_plus_url|escape:html:'UTF-8'}">
<span>{l s='Google Plus' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($pinterest_url) && $pinterest_url != ''}
<li class="pinterest">
<a class="_blank" href="{$pinterest_url|escape:html:'UTF-8'}">
<span>{l s='Pinterest' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($vimeo_url) && $vimeo_url != ''}
<li class="vimeo">
<a class="_blank" href="{$vimeo_url|escape:html:'UTF-8'}">
<span>{l s='Vimeo' mod='blocksocial'}</span>
</a>
</li>
{/if}
{if isset($instagram_url) && $instagram_url != ''}
<li class="instagram">
<a class="_blank" href="{$instagram_url|escape:html:'UTF-8'}">
<span>{l s='Instagram' mod='blocksocial'}</span>
</a>
</li>
{/if}
</ul>
<div class="clearfix"></div>
</div>
</section>
</div>

View File

@@ -92,4 +92,4 @@
<div class="clearfix"></div>
</div>
</section>
</div>
</div>