first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
<?php
if (!class_exists('Przelewy24Installer', false)) {
class Przelewy24Installer implements Przelewy24Interface
{
private $translations;
private $sliderEnabled = true;
private $pages = array();
public function __construct($sliderEnabled = true, array $translations = array())
{
$this->sliderEnabled = $sliderEnabled;
$this->setTranslations($translations);
}
public function setTranslations(array $translations = array())
{
$this->translations = $translations;
// set default values
if (empty($this->translations['php_version'])) {
$this->translations['php_version'] = 'Wersja PHP min. 5.2';
}
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';
}
if (empty($this->translations['shop_id'])) {
$this->translations['shop_id'] = 'ID sklepu';
}
if (empty($this->translations['crc_key'])) {
$this->translations['crc_key'] = 'Klucz CRC';
}
if (empty($this->translations['api_key'])) {
$this->translations['api_key'] = 'Klucz API';
}
}
public function addPages(array $pages = array())
{
$this->pages = array_values($pages);
}
public function renderInstallerSteps()
{
if (!$this->sliderEnabled || empty($this->pages) || !is_array($this->pages)) {
return '';
}
$requirements = $this->checkRequirements();
$params = array(
'requirements' => $requirements,
'translations' => $this->translations
);
$maxSteps = 0;
$data = array(
'steps' => array()
);
foreach ($this->pages as $page) {
$page = (int)$page;
if ($page > 0) {
$step = $this->loadStep($page, $params);
$data['steps'][$page] = $step;
$maxSteps++;
}
}
if ($maxSteps === 0) {
return '';
}
$data['maxSteps'] = $maxSteps;
return $this->loadTemplate('installer', $data);
}
private function loadStep($number, $params = null)
{
$step = $this->loadTemplate('step' . $number, $params);
$step = $this->removeNewLines($step);
return $step;
}
private function removeNewLines($string)
{
return trim(str_replace(PHP_EOL, ' ', $string));
}
private function loadTemplate($view, $data = null)
{
extract(array("content" => $data));
ob_start();
$viewFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . "$view.tpl.php";
if (file_exists($viewFile)) {
include $viewFile;
} else {
throw new Exception('View not exist in ' . get_class($this));
}
$content = ob_get_clean();
return $content;
}
private function checkRequirements()
{
$data = array(
'php' => array(
'test' => (version_compare(PHP_VERSION, '5.2.0') > 0),
'label' => $this->translations['php_version']
),
'curl' => array(
'test' => function_exists('curl_version'),
'label' => $this->translations['curl_enabled']
),
);
return $data;
}
}
}

View File

@@ -0,0 +1,181 @@
<style type="text/css">
.p24-admin-main-config {
display: none;
}
.p24-step {
height: 300px;
background: #eee;
}
.p24-step-1 {
}
.p24-inputs-group p {
display: inline-block;
width: 100%;
}
.p24-installer-container label.p24-required span::after {
color: red;
content: "*";
}
.p24-installer-container label.p24-required.p24-error input {
border: 1px solid red;
}
</style>
<script type="text/javascript">
(function ($) {
/**
* Global settings.
*/
var currentStep = 1;
var sliderSpeed = 300;
var stepsDiv = '.p24-installer-steps';
var maxSteps = <?php print $content['maxSteps']; ?>;
function contentStep(number) {
if (number == undefined || number < 1) {
number = 1
}
var html = '';
switch (number) {
<?php $i = 0; ?>
<?php foreach ($content['steps'] as $step): ?>
case <?php print ++$i; ?>:
html = '<?php print $step; ?>';
break;
<?php endforeach; ?>
}
return html;
}
function loadStep(step) {
var content = contentStep(step);
jQuery(stepsDiv).fadeOut(sliderSpeed, function () {
jQuery(this).html(content);
jQuery(this).fadeIn(sliderSpeed);
updateStepCounter();
});
}
function skip() {
jQuery('.p24-installer-container').fadeOut(sliderSpeed, function () {
jQuery('.p24-admin-main-config').fadeIn(sliderSpeed);
});
}
function saveInputs() {
var validInputs = true;
jQuery('.p24-inputs-group input').each(function () {
var name = jQuery(this).attr('name');
var val = jQuery(this).val();
var valid = true;
if (jQuery(this).hasClass('p24-valid-crc')) {
valid = crcValidator(val);
}
if (jQuery(this).hasClass('p24-valid-number')) {
valid = numberValidator(val);
}
if (valid) {
jQuery('.p24-admin-main-config input.' + name).val(val);
jQuery(this).parents('label').removeClass('p24-error');
} else {
validInputs = false;
jQuery(this).parents('label').addClass('p24-error');
}
});
return validInputs;
}
function numberValidator(text) {
if (text == "" || text == undefined) {
return false;
}
if (!isNumeric(text)) {
return false;
}
var length = text.trim().length;
if (length < 4 || length > 6) {
return false;
}
return true;
}
function crcValidator(text) {
if (text == "" || text == undefined) {
return false;
}
return true;
}
function isNumeric(input) {
var test = ((input - 0) == input && ('' + input).trim().length > 0);
return test;
}
function updateStepCounter() {
var wrapper = '.p24-step-counter';
jQuery(wrapper).find('.p24-step-current').text(currentStep);
jQuery(wrapper).find('.p24-step-all').text(maxSteps);
}
$(document).ready(function () {
loadStep(currentStep);
jQuery('.p24-installer-container a.p24-a').click(function () {
if (jQuery(this).hasClass('p24-a-next')) {
var valid = saveInputs();
if (!valid) {
return false;
}
currentStep++;
} else if (jQuery(this).hasClass('p24-a-back')) {
currentStep--;
} else {
skip();
return false;
}
if (currentStep < 1) {
currentStep = 1;
return false;
}
if (currentStep > maxSteps) {
currentStep = maxSteps;
skip();
return false;
}
loadStep(currentStep);
return false;
});
});
})(jQuery);
</script>
<div class="p24-installer-container">
<div class="p24-step-counter">
<span class="p24-step-current"></span>
/
<span class="p24-step-all"></span>
</div>
<div class="p24-installer-steps">
</div>
<div class="p24-installer-nav">
<a class="p24-a p24-a-back" href="#">
Back
</a>
<a class="p24-a p24-a-next" href="#">
Next
</a>
<a class="p24-a p24-a-skip" href="#">
Skip
</a>
</div>
</div>

View File

@@ -0,0 +1,22 @@
<div class="p24-step p24-step-1">
<p>
Instalator - sprawdzenie wymagań wtyczki Przelewy24
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
</p>
<div class="">
<?php foreach ($content['requirements'] as $key => $requirement): ?>
<p>
<?php print $requirement['label']; ?>
-
<?php if ($requirement['test']): ?>
<span class="">TAK</span>
<?php else: ?>
<span class="">NIE</span>
<?php endif; ?>
</p>
<?php endforeach; ?>
</div>
</div>

View File

@@ -0,0 +1,38 @@
<div class="p24-step p24-step-2">
<p>
Autoryzacja
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper
justo at risus. Donec venenatis, turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero
dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est.
Etiam sit amet lectus quis est congue mollis.
</p>
<div class="p24-inputs-group">
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['merchant_id']; ?>
</span>
<input name="p24_merchant_id" value="12345" class="p24-valid-number" type="text"/>
</label>
</p>
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['shop_id']; ?>
</span>
<input name="p24_shop_id" value="12345" class="p24-valid-number" type="text"/>
</label>
</p>
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['crc_key']; ?>
</span>
<input name="p24_crc_key" value="testtest" class="p24-valid-crc" type="text"/>
</label>
</p>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<div class="p24-step p24-step-3">
<p>
Klucz API - dodatkowe funkcje
</p>
<p>
Jakie dodatkowe funkcje i korzyści daje nam wtyczka Przelewy24 po wprowadzeniu klucza API?
</p>
<b>Oneclick</b>
<p>
Najwygodniejszy dla klienta sposób zakupu produktów, usług lub subskrypcji w Internecie za pomocą jednego
kliknięcia, bez konieczności zakładania konta w systemie operatora i każdorazowego uzupełniania danych karty.
</p>
<b>
Wybór metody płatności w sklepie
</b>
<p>
Możliwość personalizacji procesu płatności, dowolność ingerencji w kwestie graficzne i funkcjonalne modułu.
Wybór płatności bezpośrednio na stronie partnera.
</p>
<b>
IVR
</b>
<p>
Obsługa płatności przez telefon za pośrednictwem automatycznego operatora. Usługa ma zastosowanie m.in w
serwisach, które posiadają własne CallCenter sprzedażowe lub doradcze. Klient w procesie płatności bezpiecznie
uzupełnia dane swojej karty przy pomocy klawiatury własnego urządzenia.
</p>
<div class="p24-inputs-group">
<p>
<label class="">
<span>
<?php print $content['translations']['api_key']; ?>
</span>
<input name="p24_api_key" value="" class="" type="text"/>
</label>
</p>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<div class="p24-step p24-step-4">
<p>
Dodatkowe informacje
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
</p>
</div>

View File

@@ -0,0 +1,19 @@
<div class="p24-step p24-step-5">
<p>
Podsumowanie
</p>
<p>
To już wszystko!
</p>
<p>
Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in
interdum massa nibh nec erat.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet
lectus quis est congue mollis. Phasellus congue lacus eget neque.
</p>
</div>