Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<svg width="71" height="55" viewBox="0 0 71 55" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0)">
<path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="#ffffff"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="71" height="55" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

2256
modules/ps_socialfollow/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>ps_socialfollow</name>
<displayName><![CDATA[Social media follow links]]></displayName>
<version><![CDATA[2.3.3]]></version>
<description><![CDATA[Allows you to add information about your brand&#039;s social networking accounts.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,28 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../');
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,415 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Component\Validator\Validation;
class Ps_Socialfollow extends Module implements WidgetInterface
{
const SOCIAL_NETWORKS = [
'FACEBOOK',
'TWITTER',
'RSS',
'YOUTUBE',
'PINTEREST',
'VIMEO',
'INSTAGRAM',
'LINKEDIN',
'TIKTOK',
'DISCORD',
];
private $templateFile;
public function __construct()
{
$this->name = 'ps_socialfollow';
$this->tab = 'advertising_marketing';
$this->author = 'PrestaShop';
$this->version = '2.3.3';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->trans('Social media follow links', [], 'Modules.Socialfollow.Admin');
$this->description = $this->trans('Facebook, Twitter, let your customers know where to follow you and increase your community.', [], 'Modules.Socialfollow.Admin');
$this->ps_versions_compliancy = ['min' => '1.7.4.0', 'max' => _PS_VERSION_];
$this->templateFile = 'module:ps_socialfollow/ps_socialfollow.tpl';
}
public function install()
{
return 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', '') &&
Configuration::updateValue('BLOCKSOCIAL_LINKEDIN', '') &&
Configuration::updateValue('BLOCKSOCIAL_TIKTOK', '') &&
Configuration::updateValue('BLOCKSOCIAL_DISCORD', '') &&
$this->registerHook('actionFrontControllerSetMedia') &&
$this->registerHook('displayFooter');
}
public function uninstall()
{
return 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') &&
Configuration::deleteByName('BLOCKSOCIAL_LINKEDIN') &&
Configuration::deleteByName('BLOCKSOCIAL_TIKTOK') &&
Configuration::deleteByName('BLOCKSOCIAL_DISCORD') &&
parent::uninstall();
}
public function getContent()
{
$html = '';
if (Tools::isSubmit('submitModule')) {
$result = $this->updateFields();
if ($result === true) {
$this->_clearCache('*');
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true, [], [
'configure' => $this->name,
'conf' => 4,
]));
} else {
$html .= $this->displayError(implode('<br />', $result));
}
}
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
$html .= '<p class="alert alert-warning">' .
$this->trans('Please choose a shop to edit the social media links.', [], 'Modules.Socialfollow.Admin') .
'</p>';
} else {
$html .= $this->renderForm();
}
return $html;
}
public function _clearCache($template, $cache_id = null, $compile_id = null)
{
parent::_clearCache($this->templateFile);
}
public function renderForm()
{
$fields_form = [
'form' => [
'legend' => [
'title' => $this->trans('Settings', [], 'Admin.Global'),
'icon' => 'icon-cogs',
],
'input' => [
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Facebook URL', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_FACEBOOK',
'desc' => $this->trans('Your Facebook fan page.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Twitter URL', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_TWITTER',
'desc' => $this->trans('Your official Twitter account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('RSS URL', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_RSS',
'desc' => $this->trans('The RSS feed of your choice (your blog, your store, etc.).', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('YouTube URL', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_YOUTUBE',
'desc' => $this->trans('Your official YouTube account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Pinterest URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_PINTEREST',
'desc' => $this->trans('Your official Pinterest account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Vimeo URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_VIMEO',
'desc' => $this->trans('Your official Vimeo account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Instagram URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_INSTAGRAM',
'desc' => $this->trans('Your official Instagram account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('LinkedIn URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_LINKEDIN',
'desc' => $this->trans('Your official LinkedIn account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('TikTok URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_TIKTOK',
'desc' => $this->trans('Your official TikTok account.', [], 'Modules.Socialfollow.Admin'),
],
[
'type' => 'text',
'lang' => true,
'label' => $this->trans('Discord URL:', [], 'Modules.Socialfollow.Admin'),
'name' => 'BLOCKSOCIAL_DISCORD',
'desc' => $this->trans('Your official Discord account.', [], 'Modules.Socialfollow.Admin'),
],
],
'submit' => [
'title' => $this->trans('Save', [], 'Admin.Global'),
],
],
];
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$helper->submit_action = 'submitModule';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', true, [], ['configure' => $this->name]);
$helper->tpl_vars = [
'fields_value' => $this->getConfigFieldsValues(),
];
$helper->languages = $this->context->controller->getLanguages();
$helper->default_form_language = (int) $this->context->language->id;
return $helper->generateForm([$fields_form]);
}
public function getConfigFieldsValues()
{
$result = [];
foreach (static::SOCIAL_NETWORKS as $social) {
$configuration_name = "BLOCKSOCIAL_$social";
if (!empty(Configuration::get($configuration_name))) {
$this->upgradeConfiguration($configuration_name);
}
foreach (Language::getIDs() as $id_lang) {
$conf = Configuration::get($configuration_name, $id_lang);
$result[$configuration_name][$id_lang] = $conf;
}
}
return $result;
}
/**
* This upgrades the configuration of the module from simple values to localized values. This assures that the
* upgrade of the module keeps the old configurations, and that the change is transparent to the user.
*
* This function is only run once during upgrade, i.e. the first time the user accesses the configuration in the BO
* after an upgrade of the module to the localized version.
*
* @param string $name Name of the configuration setting
*
* @return array Configuration value, now localized
*/
protected function upgradeConfiguration($name)
{
/** @var string|array $value */
$value = Configuration::get($name);
if (!empty($value) && !is_array($value)) {
$value_localized = [];
foreach (Language::getIDs() as $id_lang) {
$value_localized[$id_lang] = $value;
}
Configuration::updateValue($name, $value_localized);
$value = $value_localized;
}
return $value;
}
public function renderWidget($hookName = null, array $configuration = [])
{
if (!$this->isCached($this->templateFile, $this->getCacheId('ps_socialfollow'))) {
$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
}
return $this->fetch($this->templateFile, $this->getCacheId('ps_socialfollow'));
}
public function getWidgetVariables($hookName = null, array $configuration = [])
{
$social_links = [];
$id_lang = (int) $this->context->language->id;
if ($sf_facebook = Configuration::get('BLOCKSOCIAL_FACEBOOK', $id_lang)) {
$social_links['facebook'] = [
'label' => $this->trans('Facebook', [], 'Modules.Socialfollow.Shop'),
'class' => 'facebook',
'url' => $sf_facebook,
];
}
if ($sf_twitter = Configuration::get('BLOCKSOCIAL_TWITTER', $id_lang)) {
$social_links['twitter'] = [
'label' => $this->trans('Twitter', [], 'Modules.Socialfollow.Shop'),
'class' => 'twitter',
'url' => $sf_twitter,
];
}
if ($sf_rss = Configuration::get('BLOCKSOCIAL_RSS', $id_lang)) {
$social_links['rss'] = [
'label' => $this->trans('Rss', [], 'Modules.Socialfollow.Shop'),
'class' => 'rss',
'url' => $sf_rss,
];
}
if ($sf_youtube = Configuration::get('BLOCKSOCIAL_YOUTUBE', $id_lang)) {
$social_links['youtube'] = [
'label' => $this->trans('YouTube', [], 'Modules.Socialfollow.Shop'),
'class' => 'youtube',
'url' => $sf_youtube,
];
}
if ($sf_pinterest = Configuration::get('BLOCKSOCIAL_PINTEREST', $id_lang)) {
$social_links['pinterest'] = [
'label' => $this->trans('Pinterest', [], 'Modules.Socialfollow.Shop'),
'class' => 'pinterest',
'url' => $sf_pinterest,
];
}
if ($sf_vimeo = Configuration::get('BLOCKSOCIAL_VIMEO', $id_lang)) {
$social_links['vimeo'] = [
'label' => $this->trans('Vimeo', [], 'Modules.Socialfollow.Shop'),
'class' => 'vimeo',
'url' => $sf_vimeo,
];
}
if ($sf_instagram = Configuration::get('BLOCKSOCIAL_INSTAGRAM', $id_lang)) {
$social_links['instagram'] = [
'label' => $this->trans('Instagram', [], 'Modules.Socialfollow.Shop'),
'class' => 'instagram',
'url' => $sf_instagram,
];
}
if ($sf_linkedin = Configuration::get('BLOCKSOCIAL_LINKEDIN', $id_lang)) {
$social_links['linkedin'] = [
'label' => $this->trans('LinkedIn', [], 'Modules.Socialfollow.Shop'),
'class' => 'linkedin',
'url' => $sf_linkedin,
];
}
if ($sf_tiktok = Configuration::get('BLOCKSOCIAL_TIKTOK', $id_lang)) {
$social_links['tiktok'] = [
'label' => $this->trans('TikTok', [], 'Modules.Socialfollow.Shop'),
'class' => 'tiktok',
'url' => $sf_tiktok,
];
}
if ($sf_discord = Configuration::get('BLOCKSOCIAL_DISCORD', $id_lang)) {
$social_links['discord'] = [
'label' => $this->trans('Discord', [], 'Modules.Socialfollow.Shop'),
'class' => 'ps-socialfollow-discord',
'url' => $sf_discord,
];
}
return [
'social_links' => $social_links,
];
}
public function hookActionFrontControllerSetMedia()
{
$this->context->controller->registerStylesheet(
'ps_socialfollow_icons',
'/modules/' . $this->name . '/views/css/ps_socialfollow.css'
);
}
/**
* Update form fields.
* Check all social networks form value and verify the URL is valid.
* Do nothing if a violation is spotted.
*
* @return array|bool true on success, errors on failure
*/
protected function updateFields()
{
$defaultLanguageId = (int) Configuration::get('PS_LANG_DEFAULT');
$validator = Validation::createValidator();
$constraints = [new Url()];
$values = [];
$errors = [];
foreach (static::SOCIAL_NETWORKS as $social) {
$defaultValue = trim(Tools::getValue("BLOCKSOCIAL_{$social}_{$defaultLanguageId}", ''));
foreach (Language::getIDs() as $id_lang) {
$value = trim(Tools::getValue("BLOCKSOCIAL_{$social}_{$id_lang}", ''));
$values[$social][$id_lang] = $value ? $value : $defaultValue;
$violations = $validator->validate($values[$social][$id_lang], $constraints);
if (count($violations)) {
$errors[] = $this->trans('Invalid URL', [], 'Admin.Notifications.Error') . ': ' . $values[$social][$id_lang];
}
}
}
if (empty($errors)) {
foreach (static::SOCIAL_NETWORKS as $social) {
Configuration::updateValue("BLOCKSOCIAL_$social", $values[$social]);
}
return true;
}
return $errors;
}
}

View File

@@ -0,0 +1,29 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*}
{block name='ps_social_follow'}
<div class="ps-social-follow">
<h4>{l s='Follow us' d='Modules.Socialfollow.Shop'}</h4>
<ul>
{foreach from=$social_links item='social_link'}
<li class="{$social_link.class}"><a href="{$social_link.url}">{$social_link.label}</a></li>
{/foreach}
</ul>
</div>
{/block}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,33 @@
<?php
/**
* 2007-2022 PrestaShop.
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2022 PrestaShop SA
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_2_3_0($object)
{
return (bool) $object->registerHook('actionFrontControllerSetMedia') && Configuration::updateValue('BLOCKSOCIAL_DISCORD', '');
}

View File

@@ -0,0 +1,5 @@
.ps-socialfollow-discord {
background-image: url('../../assets/icon/discord.svg');
background-position: 50%;
background-size: 2rem auto;
}