first commit

This commit is contained in:
2024-12-17 13:43:22 +01:00
commit 8e6cd8b410
21292 changed files with 3514826 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<?php
/**
* 2019-2020 MDWeb
*
* @author MDWeb
* @copyright 2019-2020 MDWeb
* @license Commercial
*/
class APIWeglot
{
/**
* Array of Weglot URL
*
* @var array
*/
private static $urls = [
'CDN' => 'https://cdn.weglot.com/weglot.min.js',
'ENDPOINT' => 'https://api.weglot.com/translate?api_key='
];
/**
* @var string
*/
private $apiKey;
/**
* Current API URL
*
* @var string
*/
private $url;
public function __construct($api = null)
{
if ($api) {
$this->apiKey = $api;
} else {
$this->apiKey = Configuration::get('MD_WEGLOT_API_KEY');
}
$this->url = self::$urls['ENDPOINT'] . $this->apiKey;
}
/**
* Call Weglot API to check API Key
*
* @param string $type
* @return boolean
*/
public function run()
{
$opts = array(
CURLOPT_POST => true,
CURLOPTurls => $this->url,
CURLOPT_HEADER => "Content-Type: application/json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode([])
);
$returnAPI = $this->callAPI($opts);
if ($returnAPI != "API Key {$this->apiKey} does not exist.") {
return true;
}
return false;
}
/**
* Call Weglot API
*
* @param array $opts cURL Options
* @return array
*/
private function callAPI($opts)
{
try {
$ch = curl_init();
curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
curl_close($ch);
return $result;
} catch (Exception $e) {
die($e->getMessage());
}
}
/**
* Retun URL of the Weglot Script
*
* @return string
*/
public static function getWeglotCDNScript()
{
return self::$urls['CDN'];
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>weglot</name>
<displayName><![CDATA[Translate Your Store - Weglot]]></displayName>
<version><![CDATA[1.0.0]]></version>
<description><![CDATA[Translate your PrestaShop store into multiple languages in minutes with Weglot.]]></description>
<author><![CDATA[Weglot]]></author>
<tab><![CDATA[front_office_features]]></tab>
<confirmUninstall><![CDATA[This action deletes the JavaScript script inserted by Weglot. Attention: If you want to stop your Weglot subscription, go to your Weglot dashboard. If you have any questions, please contact our team: support@weglot.com]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

35
modules/weglot/index.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

BIN
modules/weglot/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -0,0 +1,14 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{weglot}prestashop>weglot_e06ecfbf25649c54e7ef70b7c12100f6'] = ' Traduisez Votre Boutique - Weglot ';
$_MODULE['<{weglot}prestashop>weglot_910e8e97a79014700891e182576cd61a'] = ' Traduisez votre boutique PrestaShop en plusieurs langues en quelques minutes avec Weglot.';
$_MODULE['<{weglot}prestashop>weglot_01f7154f547060cd35913b0c562fa8b5'] = 'Cette action supprime le script JavaScript inséré par Weglot. Attention : Si vous souhaitez arrêter votre abonnement Weglot, rendez-vous sur votre dashboard Weglot. Si vous avez la moindre question, contactez notre équipe : support@weglot.com';
$_MODULE['<{weglot}prestashop>weglot_750ea708c11ddfb2534ff115274be95b'] = 'Clé API enregistrée';
$_MODULE['<{weglot}prestashop>weglot_e48735431da6e1316ae7f5921f189314'] = 'Clé API incorrecte';
$_MODULE['<{weglot}prestashop>configure_6c3a7805e1a034d5484279443d059c92'] = 'Inscrivez-vous sur [1]Weglot[/1] pour obtenir votre clé API';
$_MODULE['<{weglot}prestashop>configure_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
$_MODULE['<{weglot}prestashop>configure_45ce3a1cd3a4eba67e52308a2415d39d'] = 'Gérer mes traductions';
$_MODULE['<{weglot}prestashop>configure_7318bc860cce0d82316badc3f4cbce71'] = 'Pour modifier vos traductions et gérer votre compte Weglot, rendez-vous sur votre tableau de bord Weglot.';
$_MODULE['<{weglot}prestashop>configure_1d4b3007ba4916c7d507e87b953f1f50'] = 'Modifier mes traductions';

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,13 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{weglot}prestashop>weglot_e06ecfbf25649c54e7ef70b7c12100f6'] = ' Przetłumacz swój sklep - Weglot';
$_MODULE['<{weglot}prestashop>weglot_910e8e97a79014700891e182576cd61a'] = 'Przetłumacz swój sklep PrestaShop na wiele języków w ciągu kilku minut dzięki Weglot.';
$_MODULE['<{weglot}prestashop>weglot_750ea708c11ddfb2534ff115274be95b'] = 'Zapisano klucz API';
$_MODULE['<{weglot}prestashop>weglot_e48735431da6e1316ae7f5921f189314'] = 'Nieprawidłowy klucz API';
$_MODULE['<{weglot}prestashop>configure_6c3a7805e1a034d5484279443d059c92'] = 'Zarejestruj się w [1]Weglot[/1], aby otrzymać klucz API';
$_MODULE['<{weglot}prestashop>configure_c9cc8cce247e49bae79f15173ce97354'] = 'Zapisz';
$_MODULE['<{weglot}prestashop>configure_45ce3a1cd3a4eba67e52308a2415d39d'] = 'Zarządzaj moimi tłumaczeniami';
$_MODULE['<{weglot}prestashop>configure_7318bc860cce0d82316badc3f4cbce71'] = 'Aby edytować tłumaczenia i integrację Weglota, przejdź do pulpitu nawigacyjnego Weglot';
$_MODULE['<{weglot}prestashop>configure_1d4b3007ba4916c7d507e87b953f1f50'] = 'Edytuj moje tłumaczenia';

View File

@@ -0,0 +1,121 @@
.mdc_container {
display: flex;
align-items: center;
}
.mdc_container a {
color: #3a4cf2;
}
.mdc_left_block {
width: 65%;
display: flex;
align-items: flex-start;
}
.mdc_left_block .control-label.mdc_label {
font-weight: bold;
color: black;
padding: 7px 5px;
}
.mdc_left_block .mdc_outline_button {
padding: 10px 25px;
border-radius: 15px;
box-shadow: none;
border: 1px solid #3a4cf2;
background-color: white;
color: #3a4cf2;
}
.mdc_left_block .mdc_outline_button:hover,
.mdc_left_block .mdc_outline_button:focus {
color: white;
background-color: #3a4cf2;
}
.form-group.mdc_form_group {
margin: 0;
}
.mdc_right_block {
width: 35%;
display: flex;
flex-direction: column;
border: 1px solid #bdc3c7;
box-shadow: 5px 3px 6px #ecf0f1;
border-radius: 10px;
padding: 20px;
}
.mdc_title {
font-size: 20px;
color: black;
margin: 0;
}
.mdc_text {
margin: 10px 0;
color: black;
}
.mdc_right_block .mdc_button {
text-decoration: none;
background-color: #3a4cf2;
border: 1px solid #3a4cf2;
color: white;
padding: 15px 25px;
border-radius: 25px;
width: 60%;
text-align: center;
}
.mdc_right_block .mdc_button:focus,
.mdc_right_block .mdc_button:hover {
text-decoration: none;
background-color: white;
color: #3a4cf2;
}
.mdc_button_position {
position: relative;
top: -4px;
}
@media screen and (max-width: 768px) {
.mdc_container {
flex-direction: column;
}
.mdc_left_block,
.mdc_right_block {
width: 100%;
}
.mdc_left_block {
flex-direction: column;
align-items: initial;
}
.mdc_right_block {
margin-top: 20px;
}
.mdc_title {
font-size: 18px;
}
.mdc_text {
text-align: justify;
}
.mdc_right_block .mdc_button {
width: 100%;
}
}
@media screen and (min-width: 1025px) and (max-width: 1200px) {
.mdc_button_position {
top: 0;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,13 @@
/*
* 2019-2020 MDWeb
*
* @author MDWeb
* @copyright 22019-2020 MDWeb
* @license Commercial
*/
$(document).ready(function (){
Weglot.initialize({
api_key: weglotKey
});
});

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,40 @@
{**
* 2019-2020 MDWeb
*
* @author MDWeb
* @copyright 2019-2020 MDWeb
* @license Commercial
*}
<div class="content-wrap panel">
<form id="configuration_form" class="defaultForm form-horizontal weglot" method="post" enctype="multipart/form-data" novalidate="">
<div class="form-group mdc_form_group">
<div class='mdc_container'>
<div class='mdc_left_block'>
<label class="control-label col-lg-1 mdc_label">
{l s="Clé API" mod="weglot"}
</label>
<div class="col-sm-7 col-md-5 col-lg-5">
<div class="form-group mdc_form_group">
<div class='col-sm-11'>
<input type="text" name="api_key" value="{$api_key|escape:'html_all':'utf-8'}">
<p>{l s='Sign up to [1]Weglot[/1] to get your API key' tags=['<a href="https://dashboard.weglot.com/register-prestashop" target="_blank">'] mod='weglot'}</p>
</div>
</div>
</div>
<div class="mdc_button_position">
<button type="submit" value="1" id="configuration_form_submit_btn" name="submitWeglotConfigure" class="button mdc_outline_button">
{l s='Save' mod='weglot'}
</button>
</div>
</div>
<div class='mdc_right_block'>
<span class='mdc_title'>{l s='Manage my translations' mod='weglot'}</span>
<span class='mdc_text'>{l s='To edit your translations and your integration of Weglot, go to your Weglot dashboard' mod='weglot'}</span>
<a href="https://dashboard.weglot.com" target="_blank" class="mdc_button">
{l s='Edit my translations' mod='weglot'}
</a>
</div>
</div>
</div>
</form>
</div>

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,35 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (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:
* http://opensource.org/licenses/afl-3.0.php
* 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

133
modules/weglot/weglot.php Normal file
View File

@@ -0,0 +1,133 @@
<?php
/**
* 2019-2020 MDWeb
*
* @author MDWeb
* @copyright 2019-2020 MDWeb
* @license Commercial
*/
if (!defined('_PS_VERSION_')) {
exit;
}
require_once(_PS_MODULE_DIR_ . 'weglot/classes/APIWeglot.php');
class Weglot extends Module
{
/**
* List of hookss
*
* @var array
*/
private $hooks = [
'header',
'actionAdminControllerSetMedia'
];
/**
* @inheritDoc
*/
public function __construct()
{
$this->name = 'weglot';
$this->tab = 'front_office_features';
$this->version = '1.0.0';
$this->author = 'Weglot';
$this->need_instance = 0;
$this->bootstrap = true;
$this->module_key = '13b1e60a5855cd454b70be977a5d8a20';
parent::__construct();
$this->displayName = $this->l('Translate Your Store - Weglot');
$this->description = $this->l(
'Translate your PrestaShop store into multiple languages in minutes with Weglot.'
);
$unstallContent = 'This action deletes the JavaScript script inserted by Weglot.';
$unstallContent .= ' Attention: If you want to stop your Weglot subscription, go to your Weglot dashboard.';
$unstallContent .= ' If you have any questions, please contact our team: support@weglot.com';
$this->confirmUninstall = $this->l($unstallContent);
}
/**
* @inheritDoc
*/
public function install()
{
if (parent::install() && $this->registerHook($this->hooks)) {
return true;
}
return false;
}
/**
* @inheritDoc
*/
public function getContent()
{
$msg = null;
if (Tools::getValue('submitWeglotConfigure')) {
$APIKey = Tools::getValue('api_key');
$api = new APIWeglot($APIKey);
if ($api->run('ENDPOINT')) {
Configuration::updateValue('MD_WEGLOT_API_KEY', $APIKey);
$msg = $this->displayConfirmation($this->l('API key saved'));
} else {
$msg = $this->displayError($this->l('Incorrect API key'));
}
}
$this->context->smarty->assign(
[
'api_key' => Configuration::get('MD_WEGLOT_API_KEY')
]
);
$template = _PS_MODULE_DIR_ . $this->name . '/views/templates/admin/configure.tpl';
return $msg . $this->context->smarty->fetch($template);
}
/**
* @inheritDoc
*/
public function hookHeader($params)
{
Media::addJsDef(
[
'weglotKey' => Configuration::get('MD_WEGLOT_API_KEY')
]
);
if (version_compare(_PS_VERSION_, '1.7', '>=')) {
$this->context->controller->registerJavascript(
$this->name . '-weglot',
APIWeglot::getWeglotCDNScript(),
[
'server' => 'remote'
]
);
} else {
$this->context->controller->addJS(APIWeglot::getWeglotCDNScript());
}
$this->context->controller->addJS(
dirname(__FILE__) . '/views/js/front-weglot.js'
);
}
/**
* @inheritDoc
*/
public function hookActionAdminControllerSetMedia($params)
{
if (Tools::getIsset('controller') && Tools::getValue('controller') == 'AdminModules') {
if (Tools::getIsset('configure') && Tools::getValue('configure') == 'weglot') {
$this->context->controller->addCSS($this->_path . 'views/css/back.css');
}
}
}
}