first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
/**
* 2007-2020 PayPal
*
* 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 2007-2020 PayPal
* @author 202 ecommerce <tech@202-ecommerce.com>
* @copyright PayPal
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace PaypalAddons\classes\Shortcut\Form\Field;
interface FieldInteface
{
public function render();
}

View File

@@ -0,0 +1,107 @@
<?php
/**
* 2007-2020 PayPal
*
* 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 2007-2020 PayPal
* @author 202 ecommerce <tech@202-ecommerce.com>
* @copyright PayPal
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace PaypalAddons\classes\Shortcut\Form\Field;
use Context;
use PayPalHttp\Serializer\Text;
class InputChain implements FieldInteface
{
/** @var TextInput[]*/
protected $inputs;
/** @var string*/
protected $label;
public function __construct($inputs)
{
$this->setInputs($inputs);
}
public function render()
{
return Context::getContext()->smarty
->assign('inputs', $this->getInputs())
->assign('label', $this->getLabel())
->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/form/fields/inputChain.tpl');
}
/**
* @param TextInput[] $inputs
* @return InputChain
*/
public function setInputs($inputs)
{
$this->inputs = [];
if (empty($inputs)) {
return $this;
}
foreach ($inputs as $input) {
$this->addInput($input);
}
return $this;
}
/**
* @param TextInput $input
* @return InputChain
*/
public function addInput(TextInput $input)
{
$this->inputs[] = $input;
return $this;
}
/**
* @return TextInput[]
*/
public function getInputs()
{
return $this->inputs;
}
/**
* @return string
*/
public function getLabel()
{
return (string) $this->label;
}
/**
* @param string $label
* @return InputChain
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
}

View File

@@ -0,0 +1,249 @@
<?php
/**
* 2007-2020 PayPal
*
* 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 2007-2020 PayPal
* @author 202 ecommerce <tech@202-ecommerce.com>
* @copyright PayPal
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace PaypalAddons\classes\Shortcut\Form\Field;
use Context;
class Select implements FieldInteface
{
/** @var string*/
protected $name;
/** @var array*/
protected $options;
/** @var string*/
protected $label;
/** @var mixed*/
protected $value;
/** @var string*/
protected $type;
/** @var string*/
protected $afterSelectContent;
/** @var string*/
protected $css;
/** @var string*/
protected $hint;
public function __construct($name, $options, $label = null, $value = null, $type = null, $hint = null, $css = null)
{
$this->setName($name);
$this->setOptions($options);
$this->setLabel($label);
$this->setValue($value);
$this->setType($type);
$this->setHint($hint);
}
public function render()
{
if (false === empty($this->options)) {
foreach ($this->options as $key => $option) {
if ($this->getValue() == $option->getValue()) {
$option->setIsSelected(true);
}
}
}
return Context::getContext()->smarty
->assign('name', $this->getName())
->assign('options', $this->getOptions())
->assign('label', $this->getLabel())
->assign('configType', $this->getType())
->assign('afterSelectContent', $this->getAfterSelectContent())
->assign('css', $this->getCss())
->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/form/fields/select.tpl');
}
/**
* @return string
*/
public function getName()
{
return (string) $this->name;
}
/**
* @param string $name
* @return Select
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return SelectOption[]
*/
public function getOptions()
{
return $this->options;
}
/**
* @param array $options
* @return Select
*/
public function setOptions($options)
{
$this->options = [];
if (empty($options)) {
return $this;
}
foreach ($options as $option) {
$this->addOption($option);
}
return $this;
}
/**
* @param SelectOption $option
* @return Select
*/
public function addOption(SelectOption $option)
{
$this->options[] = $option;
return $this;
}
/**
* @return string
*/
public function getLabel()
{
return (string) $this->label;
}
/**
* @param string $label
* @return Select
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* @return mixed
*/
public function getValue()
{
return $this->value;
}
/**
* @param mixed $value
* @return Select
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* @return string
*/
public function getType()
{
return (string) $this->type;
}
/**
* @param string $type
* @return Select
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* @return string
*/
public function getAfterSelectContent()
{
return (string) $this->afterSelectContent;
}
/**
* @param string $afterSelectContent
* @return Select
*/
public function setAfterSelectContent($afterSelectContent)
{
$this->afterSelectContent = (string) $afterSelectContent;
return $this;
}
/**
* @return string
*/
public function getCss()
{
return (string) $this->css;
}
/**
* @param string $css
* @return Select
*/
public function setCss($css)
{
$this->css = $css;
return $this;
}
/**
* @return string
*/
public function getHint()
{
return (string) $this->hint;
}
/**
* @param string $hint
* @return Select
*/
public function setHint($hint)
{
$this->hint = $hint;
return $this;
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* 2007-2020 PayPal
*
* 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 2007-2020 PayPal
* @author 202 ecommerce <tech@202-ecommerce.com>
* @copyright PayPal
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace PaypalAddons\classes\Shortcut\Form\Field;
use Context;
class SelectOption implements FieldInteface
{
/** @var string*/
protected $description;
/** @var string*/
protected $value;
/** @var bool*/
protected $isSelected;
public function __construct($value, $description)
{
$this->setDescription($description);
$this->setValue($value);
}
public function render()
{
return Context::getContext()->smarty
->assign('value', $this->getValue())
->assign('description', $this->getDescription())
->assign('isSelected', $this->isSelected())
->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/form/fields/selectOption.tpl');
}
/**
* @return string
*/
public function getDescription()
{
return (string) $this->description;
}
/**
* @param string $description
* @return SelectOption
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getValue()
{
return (string) $this->value;
}
/**
* @param string $value
* @return SelectOption
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* @return bool
*/
public function isSelected()
{
return (bool) $this->isSelected;
}
/**
* @param bool $isSelected
* @return SelectOption
*/
public function setIsSelected($isSelected)
{
$this->isSelected = (bool) $isSelected;
return $this;
}
}

View File

@@ -0,0 +1,162 @@
<?php
/**
* 2007-2020 PayPal
*
* 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 2007-2020 PayPal
* @author 202 ecommerce <tech@202-ecommerce.com>
* @copyright PayPal
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace PaypalAddons\classes\Shortcut\Form\Field;
use Context;
class TextInput implements FieldInteface
{
/** @var string*/
protected $name;
/** @var string*/
protected $value;
/** @var string*/
protected $label;
/** @var string*/
protected $type;
/** @var array*/
protected $attributes;
public function __construct($name, $value, $label, $type = null, $attributes = null)
{
$this->setName($name);
$this->setValue($value);
$this->setLabel($label);
$this->setType($type);
$this->setAttributes($attributes);
}
public function render()
{
return Context::getContext()->smarty
->assign('name', $this->getName())
->assign('value', $this->getValue())
->assign('label', $this->getLabel())
->assign('configType', $this->getType())
->assign('attributes', $this->getAttributes())
->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/form/fields/textInput.tpl');
}
/**
* @return string
*/
public function getName()
{
return (string) $this->name;
}
/**
* @param string $name
* @return TextInput
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getValue()
{
return (string) $this->value;
}
/**
* @param string $value
* @return TextInput
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* @return string
*/
public function getLabel()
{
return (string) $this->label;
}
/**
* @param string $label
* @return TextInput
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* @return string
*/
public function getType()
{
return (string) $this->type;
}
/**
* @param string $type
* @return TextInput
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* @return array
*/
public function getAttributes()
{
return (array) $this->attributes;
}
/**
* @param array $attributes
* @return TextInput
*/
public function setAttributes($attributes)
{
if (false === is_array($attributes)) {
return $this;
}
$this->attributes = $attributes;
return $this;
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to a commercial license from SARL 202 ecommence
* Use, copy, modification or distribution of this source file without written
* license agreement from the SARL 202 ecommence is strictly forbidden.
* In order to obtain a license, please contact us: tech@202-ecommerce.com
* ...........................................................................
* INFORMATION SUR LA LICENCE D'UTILISATION
*
* L'utilisation de ce fichier source est soumise a une licence commerciale
* concedee par la societe 202 ecommence
* Toute utilisation, reproduction, modification ou distribution du present
* fichier source sans contrat de licence ecrit de la part de la SARL 202 ecommence est
* expressement interdite.
* Pour obtenir une licence, veuillez contacter 202-ecommerce <tech@202-ecommerce.com>
* ...........................................................................
*
* @author 202-ecommerce <tech@202-ecommerce.com>
* @copyright Copyright (c) 202-ecommerce
* @license Commercial license
*/
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;