This commit is contained in:
2025-03-21 20:24:43 +01:00
parent 224398df90
commit f34c9162d4
12427 changed files with 5329941 additions and 373384 deletions

View File

@@ -3,8 +3,10 @@
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
if (!defined('_PS_VERSION_')) {
exit;
}
if (!class_exists('Przelewy24Installer', false)) {
/**
@@ -31,7 +33,7 @@ if (!class_exists('Przelewy24Installer', false)) {
*
* @var array
*/
private $pages = array();
private $pages = [];
/**
* Przelewy24Installer constructor.
@@ -39,7 +41,7 @@ if (!class_exists('Przelewy24Installer', false)) {
* @param bool $sliderEnabled
* @param array $translations
*/
public function __construct($sliderEnabled = true, array $translations = array())
public function __construct($sliderEnabled = true, array $translations = [])
{
$this->sliderEnabled = $sliderEnabled;
$this->setTranslations($translations);
@@ -50,7 +52,7 @@ if (!class_exists('Przelewy24Installer', false)) {
*
* @param array $translations
*/
public function setTranslations(array $translations = array())
public function setTranslations(array $translations = [])
{
$this->translations = $translations;
@@ -61,9 +63,6 @@ if (!class_exists('Przelewy24Installer', false)) {
if (empty($this->translations['curl_version'])) {
$this->translations['curl_enabled'] = 'Włączone rozszerzenie PHP cURL (php_curl.dll)';
}
if (empty($this->translations['soap_enabled'])) {
$this->translations['soap_enabled'] = 'Włączone rozszerzenie PHP SOAP (php_soap.dll)';
}
if (empty($this->translations['merchant_id'])) {
$this->translations['merchant_id'] = 'ID sprzedawcy';
@@ -84,7 +83,7 @@ if (!class_exists('Przelewy24Installer', false)) {
*
* @param array $pages
*/
public function addPages(array $pages = array())
public function addPages(array $pages = [])
{
$this->pages = array_values($pages);
}
@@ -103,20 +102,20 @@ if (!class_exists('Przelewy24Installer', false)) {
}
$requirements = $this->checkRequirements();
$params = array(
$params = [
'requirements' => $requirements,
'translations' => $this->translations
);
'translations' => $this->translations,
];
$maxSteps = 0;
$data = array(
'steps' => array()
);
$data = [
'steps' => [],
];
foreach ($this->pages as $page) {
$page = (int)$page;
$page = (int) $page;
if ($page > 0) {
$step = $this->loadStep($page, $params);
$data['steps'][$page] = $step;
$maxSteps++;
++$maxSteps;
}
}
@@ -131,7 +130,7 @@ if (!class_exists('Przelewy24Installer', false)) {
/**
* Load step.
*
* @param int $number Step number.
* @param int $number step number
* @param array|null $params
*
* @return string
@@ -142,6 +141,7 @@ if (!class_exists('Przelewy24Installer', false)) {
{
$step = $this->loadTemplate('step' . $number, $params);
$step = $this->removeNewLines($step);
return $step;
}
@@ -169,7 +169,7 @@ if (!class_exists('Przelewy24Installer', false)) {
*/
private function loadTemplate($view, $data = null)
{
extract(array("content" => $data));
extract(['content' => $data]);
ob_start();
$viewFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . "$view.tpl.php";
@@ -179,6 +179,7 @@ if (!class_exists('Przelewy24Installer', false)) {
throw new Exception('View not exist in ' . get_class($this));
}
$content = ob_get_clean();
return $content;
}
@@ -189,20 +190,17 @@ if (!class_exists('Przelewy24Installer', false)) {
*/
private function checkRequirements()
{
$data = array(
'php' => array(
$data = [
'php' => [
'test' => (version_compare(PHP_VERSION, '5.2.0') > 0),
'label' => $this->translations['php_version']
),
'curl' => array(
'label' => $this->translations['php_version'],
],
'curl' => [
'test' => function_exists('curl_version'),
'label' => $this->translations['curl_enabled']
),
'soap' => array(
'test' => class_exists('SoapClient'),
'label' => $this->translations['soap_enabled']
)
);
'label' => $this->translations['curl_enabled'],
],
];
return $data;
}
}