first commit

This commit is contained in:
2024-10-28 22:14:22 +01:00
commit b65352c452
40581 changed files with 5712079 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 .
drwxr-xr-x 115 30094 users 117 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 201 Oct 3 06:58 CONTRIBUTORS.md
-rw-r--r-- 1 30094 users 10329 Oct 3 06:58 LICENSE.md
-rw-r--r-- 1 30094 users 2175 Oct 3 06:58 README.md
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 _dev
-rw-r--r-- 1 30094 users 19625 Oct 3 06:58 blockreassurance.php
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 classes
-rw-r--r-- 1 30094 users 946 Oct 3 06:58 composer.json
-rw-r--r-- 1 30094 users 60428 Oct 3 06:58 composer.lock
-rw-r--r-- 1 30094 users 528 Oct 3 06:58 config.xml
-rw-rw-r-- 1 30094 users 633 Oct 3 06:59 config_pl.xml
drwxr-xr-x 3 30094 users 4 Oct 6 10:16 controllers
drwxr-xr-x 2 30094 users 7 Oct 6 10:16 img
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php
drwxr-xr-x 2 30094 users 3 Oct 6 10:16 lang
-rw-r--r-- 1 30094 users 3213 Oct 3 06:58 logo.png
-rw-r--r-- 1 30094 users 423093 Oct 3 06:58 package-lock.json
-rw-r--r-- 1 30094 users 1235 Oct 3 06:58 package.json
-rw-r--r-- 1 30094 users 2664 Aug 31 2021 reassuranceClass.php
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 src
-rw-r--r-- 1 30094 users 717 Aug 31 2021 style.css
drwxr-xr-x 4 30094 users 6 Oct 6 10:16 tests
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 translations
drwxr-xr-x 2 30094 users 5 Oct 6 10:16 upgrade
drwxr-xr-x 8 30094 users 10 Oct 6 10:16 vendor
drwxr-xr-x 8 30094 users 9 Oct 6 10:16 views
-rw-r--r-- 1 30094 users 2214 Oct 3 06:58 webpack.config.js

View File

@@ -0,0 +1,11 @@
GitHub contributors:
--------------------------------
- Alex Sampaio
- AlexEven
- Franck Lefebvre
- Julien Bourdeau
- Martin Fojtík
- Mathieu Ferment
- Mickaël Andrieu
- Maxime Biloé
- Pablo Polyte

View File

@@ -0,0 +1,47 @@
Academic Free License ("AFL") v. 3.0
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
Licensed under the Academic Free License version 3.0
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
a) to reproduce the Original Work in copies, either alone or as part of a collective work;
b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.

View File

@@ -0,0 +1,58 @@
# Customer reassurance block
[![PHP tests](https://github.com/PrestaShop/blockreassurance/actions/workflows/php.yml/badge.svg)](https://github.com/PrestaShop/blockreassurance/actions/workflows/php.yml)
[![JS tests](https://github.com/PrestaShop/blockreassurance/actions/workflows/js.yml/badge.svg)](https://github.com/PrestaShop/blockreassurance/actions/workflows/js.yml)
[![Latest Stable Version](https://poser.pugx.org/PrestaShop/blockreassurance/v)](//packagist.org/packages/PrestaShop/blockreassurance)
[![Total Downloads](https://poser.pugx.org/PrestaShop/blockreassurance/downloads)](//packagist.org/packages/PrestaShop/blockreassurance)
[![GitHub license](https://img.shields.io/github/license/PrestaShop/blockreassurance)](https://github.com/PrestaShop/blockreassurance/LICENSE.md)
## About
Connect with your visitors and reassure them about secure payment, free shipping or returns.
## Multistore compatibility
This module is compatible with the multistore :heavy_check_mark: <br/>
The module can only specify if block reasassurance is displayed from one shop to another but the configuration is common to all shops.
## Reporting issues
You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue].
## Requirements
Required only for development:
- npm
- composer
## Installation
Install all dependencies.
```
npm install
composer install
```
## Usage
```
npm run dev # Watch js/css files for changes
npm run build # Build for production
```
## Contributing
PrestaShop modules are open source extensions to the [PrestaShop e-commerce platform][prestashop]. Everyone is welcome and even encouraged to contribute with their own improvements!
Just make sure to follow our [contribution guidelines][contribution-guidelines].
## License
This module is released under the [Academic Free License 3.0][AFL-3.0]
[report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose
[prestashop]: https://www.prestashop.com/
[contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/
[AFL-3.0]: https://opensource.org/licenses/AFL-3.0

View File

@@ -0,0 +1,5 @@
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 8 Oct 6 10:16 back
drwxr-xr-x 2 30094 users 7 Oct 6 10:16 front
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

View File

@@ -0,0 +1,8 @@
drwxr-xr-x 2 30094 users 8 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 5687 Oct 3 06:58 additional_module.png
-rw----r-- 1 30094 users 12439 Sep 5 07:45 back.css
-rw----r-- 1 30094 users 4891 Sep 5 07:45 back.css.map
-rw-r--r-- 1 30094 users 12984 Oct 3 06:58 back.scss
-rw-r--r-- 1 30094 users 17594 Oct 3 06:58 index.js
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,594 @@
/* Tab */
.first-body {
padding-bottom: 50px !important;
}
.bootstrap .page-head .page-head-tabs ul {
border-bottom: 0;
}
.bootstrap .page-head .page-head-tabs li a:hover {
color: #25b9d7;
}
.bootstrap .page-head .page-head-tabs ul.nav li.active {
border-bottom: 3px solid #25b9d7;
border-bottom: .1875rem solid #25b9d7;
background: #f3f9fb;
color: #000000;
}
/* Tab : Alert */
.bootstrap .alert {
clear: both;
}
.bootstrap .alert p {
margin: 0;
}
.bootstrap .alert.alert-warning {
background-color: #fff;
border: 2px solid #cd9321;
color: #363a41;
padding: 3.221rem 0 .75rem 2.875rem;
position: relative;
}
.bootstrap .alert.alert-warning:before {
color: #d29500;
background: #fce6bb;
font-weight: 400;
font-style: normal;
font-size: 1.563rem;
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
vertical-align: middle;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-moz-osx-font-smoothing: grayscale;
-webkit-font-feature-settings: "liga";
font-feature-settings: "liga";
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 2.875rem;
height: 100%;
text-align: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
/* Tab : Helpers */
.help-block {
font-style: normal !important;
}
.bootstrap .form-control,
.bootstrap input[type=password],
.bootstrap input[type=search],
.bootstrap input[type=text],
.bootstrap input[type=number],
.bootstrap select,
.bootstrap textarea {
display: block;
width: 100%;
font-size: .875rem;
line-height: 1.5;
color: #363a41;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #bbcdd2;
border-radius: 0;
box-shadow: none;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
height: 31px;
padding: 0 8px;
}
.customradiodesign {
cursor: pointer;
}
.customradiodesign > div {
display: inline-block;
}
.customradiodesign input[type=checkbox]:not(old),
.customradiodesign input[type=radio]:not(old) {
width: 20px;
margin: 0;
margin-left: -20px;
padding: 0;
font-size: 1em;
opacity: 0;
}
.customradiodesign input[type=checkbox]:not(old) + label,
.customradiodesign input[type=radio]:not(old) + label {
display: inline-block;
line-height: 1.5em;
}
.customradiodesign input[type=radio]:not(old) + label > span {
border: 0.0625em solid #6C868E;
display: inline-block;
width: 18px;
height: 18px;
margin: 1px 5px 0 1px;
background: #ffffff;
vertical-align: bottom;
border-radius: 50%;
}
.customradiodesign input[type=radio]:not(old):checked + label > span {
border: 0.0625em solid rgb(37, 185, 215);
}
.customradiodesign input[type=radio]:not(old):checked + label > span > span {
display: block;
width: 10px;
height: 10px;
margin: 3px 3px;
border: 0;
border-radius: 50%;
background: rgb(90, 199, 215);
}
.customradiodesign input[type=checkbox]:not(old) + label > span {
display: inline-block;
width: 18px;
height: 18px;
margin: 1px 5px 0px 1px;
border: 1px solid rgb(37, 185, 215);
background: #ffffff;
vertical-align: bottom;
border-radius: 0;
}
.customradiodesign input[type=checkbox]:not(old):checked + label > span > span {
display: block;
width: 10px;
height: 10px;
margin: 3px 3px;
border: 0;
border-radius: 0;
background: rgb(90, 199, 215);
}
.customradiodesign label {
cursor: pointer;
font-weight: normal;
}
/* Tab Content */
#content.bootstrap {
padding-top: 160px;
}
#content.bootstrap .page-head.custom-tab {
height: auto !important;
top: 8rem !important;
}
@media screen and (max-width: 1039px) {
#content.bootstrap {
padding-top: 175px !important;
}
#content.bootstrap .page-head.custom-tab {
top: 9rem !important;
}
}
#content.bootstrap .panel-heading {
background-color: #f5f5f5;
border-bottom: 1px solid #e5e5e5;
color: #363a41 !important;
font-family: Open Sans, Helvetica, Arial, sans-serif !important;
font-size: 16px !important;
font-weight: 600 !important;
height: 49px !important;
line-height: 1.2;
margin: 0;
padding: 12px 20px !important;
}
#content.bootstrap .panel-blockreassurance {
border-radius: 0;
padding: 0;
}
#content.bootstrap .panel .panel-footer {
background-color: #f5f5f5;
border-top: 1px solid #e5e5e5;
padding: .75rem 1.25rem;
margin: 0;
}
#content.bootstrap .panel .panel-footer .btn,
#content.bootstrap .panel .btn {
display: inline-block;
text-align: center;
text-transform: initial;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
padding: .375rem .838rem;
font-size: .875rem;
line-height: 1.5;
border-radius: 0;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
#content.bootstrap .btn.btn-primary {
background-color: #00b9d9;
color: #fff;
}
#content.bootstrap .btn.btn-primary.refreshPage {
background-color: transparent;
border-color: #6C868E;
color: #6C868E;
}
/* Tab Content : Listing */
.listing-table .block-title {
width: 198px !important;
}
.listing-head {
border-bottom: 2px #00b9d9 solid;
font-weight: bold;
padding-bottom: 9px;
padding-top: 15px;
}
.listing-general-rol:hover, .listing-general-rol.active {
background-color: #FAFBFC;
transition: background .3s;
}
.listing-body {
&.ui-sortable {
padding: 0;
}
.btn-group {
padding: 0;
.dropdown-toggle {
&:hover, &:focus {
text-decoration: none;
&:after {
color: #00aff0;
}
}
&:after {
color: #6c868e;
content: "more_vert";
font-family: "Material Icons";
font-weight: 400;
font-style: normal;
font-size: 1.5rem;
text-transform: none;
}
}
.dropdown-item {
color: #6c868e;
display: block;
padding: .375rem 1.5rem .375rem .938rem;
font-size: .875rem;
&:hover {
color: #fff !important;
background: #25b9d7 !important;
text-decoration: none !important;
}
.material-icons {
font-size: 1.125rem;
vertical-align: text-bottom;
padding-right: .5rem;
}
}
}
.status-toggle {
padding: .6rem 0;
}
}
.listing-row.row {
border-bottom: #BBCDD2 solid 1px;
margin: 0;
padding-bottom: 9px;
padding-top: 15px;
}
.listing-row div {
padding: 18px 0;
line-height: 30px;
}
.listing-row div:first-child {
cursor: grab;
}
.listing-row:hover div:first-child i {
color: #00b9d9;
}
.listing-row div img {
width: 35px;
}
.inline-flex {
display: inline-flex;
}
.psrea-flex {
display: flex !important;
}
.psre-add {
color: #B1C0C4;
cursor: pointer;
float: right;
}
.psre-add i {
font-size: 1.5em !important;
}
/* Tab Content : Listing : Switch */
.switch-input {
background: #DA6E6E;
height: 20px;
width: 50px;
padding: 10px 0;
position: relative;
cursor: pointer;
display: inline-block;
vertical-align: middle;
margin: -2px 5px 0 0;
}
.switch-input, .switch-input:after {
background: #D96D6E;
border: 2px solid #BBCDD2;
border-radius: 30px;
box-sizing: border-box;
color: #6C868E;
transition: all 0.5s;
}
.switch-input:after {
background: #FFFFFF;
color: #D96D6E;
display: block;
content: 'close';
height: 30px;
width: 30px;
position: absolute;
top: -5px;
left: -3px;
transform: rotate(-180deg);
vertical-align: middle;
text-align: center;
font-family: 'Material Icons';
font-size: 18px;
line-height: 26px;
}
.switch-input > input {
display: none;
}
.switch-input.-checked {
background: #25B9D7;
}
.switch-input.-checked:after {
content: 'done';
left: 20px;
color: #25B9D7;
line-height: 28px;
transform: rotate(0deg);
}
.switch_text {
font-weight: normal;
}
.msgRecommendation {
color: #6C868E;
margin-top: 20px;
}
/* Tab Content : Edit */
.inactive {
display: none;
}
.active {
display: block;
}
#reassurance_block {
position: absolute;
width: 300px;
border: 1px solid #abcbd2;
background: #ffffff;
z-index: 3;
text-align: center;
display: none;
}
#reassurance_block .row {
margin-left: 0;
margin-right: 0;
}
#reassurance_block .category_select {
margin-bottom: 10px;
border-bottom: 1px solid #a3cbd2;
}
#reassurance_block .category_select div.active {
border-bottom: 2px solid #00b8df;
background: #f2f9fb;
}
#reassurance_block .category_select div img {
cursor: pointer;
height: 38px;
padding: 7px;
width: 38px;
}
#reassurance_block .category_select div img:hover {
opacity: .5;
}
#reassurance_block .category_reassurance {
display: none;
}
#reassurance_block .category_reassurance.active {
display: block;
}
#reassurance_block .category_reassurance .row {
padding: 12px;
}
#reassurance_block .category_reassurance i {
font-size: 48px;
cursor: pointer;
border: 2px solid #fff;
}
#reassurance_block .category_reassurance img {
max-width: 100%;
border: 2px solid #fff;
cursor: pointer;
}
#reassurance_block .category_reassurance i.selected,
#reassurance_block .category_reassurance img.selected {
border: 2px solid #00b9d9;
}
#reassurance_block .category_reassurance i:hover,
#reassurance_block .category_reassurance img:hover {
opacity: .5;
}
#blockDisplay label {
font-weight: bold;
}
#blockDisplay .form-group {
margin-bottom: 25px;
}
#blockDisplay textarea {
height: 70px;
}
#blockDisplay .text-right {
color: #4b4b4b;
padding-right: 25px;
padding-top: 6px;
}
#blockDisplay .panel-footer .text-left,
#blockDisplay .panel-footer .text-right {
color: inherit;
padding-right: inherit;
padding-top: 6px;
}
#blockDisplay .customradiodesign label {
font-weight: normal;
}
#blockDisplay .picto-url {
padding-right: 5px !important;
}
#blockDisplay .first-block {
padding-top: 20px;
}
#blockDisplay .input-redirection {
padding-right: 40px;
}
/* Tab Content : Edit : Select Icon */
.select_none {
cursor: pointer;
color: #59858f;
font-size: 12px;
font-weight: bold;
padding: 20px;
background: whitesmoke;
border-top: 1px solid #e4e4e4;
}
.select_none:hover {
color: #000;
transition: .2s color ease;
}
.psr_picto_showing {
margin-bottom: 20px;
}
.psr_picto_showing .landscape {
border: dotted;
font-size:70px;
}
.modify_icon {
cursor: pointer;
}
.modify_icon:hover {
color: #25b9d7
}
.image-preview-lang, .picto_by_module {
width: 100%;
max-width: 75px;
height: auto;
}
.upload_file_button {
border: 1px solid #b6ccd2;
padding-right: 11px;
}
.upload_file_button .slide_image {
display: none !important;
}
.upload_file_button .file_label {
font-weight: normal !important;
line-height: 10px;
width: 100%;
padding: 11px 11px 6px 11px;
font-size: 14px;
color: #9a9a9a;
}
/* Tab Display */
#display img {
max-width: 200px;
width: 100%;
height: auto;
}
.position-hook {
margin-top: 20px;
margin-bottom: 20px;
}
.addons-hide {
display: none;
}
.psr-footer-color,
.psr-footer-grey,
.psr-header-color,
.psr-header-grey,
.psr-product-color,
.psr-product-grey,
.psr-checkout-color,
.psr-checkout-grey {
display: none;
}
.psr-footer-color.active,
.psr-footer-grey.active,
.psr-header-color.active,
.psr-header-grey.active,
.psr-product-color.active,
.psr-product-grey.active,
.psr-checkout-color.active,
.psr-checkout-grey.active {
display: block;
}
#display label > div > .input_img:not(:checked) ~ img {
border: 1px solid #d3d8db;
}
#display label > div > .input_img:checked ~ img {
border: 2px solid #00b9d9;
}
/* Tab Appearance */
#appearance .panel-body {
margin-top: 20px;
}
/* Pickr Override */
.pickr {
z-index: initial !important;
button.pcr-button {
width: 70%;
border: 1px solid #BBB;
height: 30px;
border-radius: 5px;
}
}
.pcr-app .pcr-interaction {
input {
font-size: 12px !important;
width: 26% !important;
}
.pcr-save {
background-color: #3bb7d7 !important;
height: 31px !important;
font-family: "Open Sans", Helvetica, Arial, sans-serif !important;
}
}

View File

@@ -0,0 +1,568 @@
/**
* 2007-2019 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-2019 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
*/
import Pickr from '@simonwep/pickr';
import Vue from 'vue/dist/vue.min';
import 'material-design-icons/iconfont/material-icons.css';
import '@simonwep/pickr/dist/themes/classic.min.css';
import './back.scss';
window.Vue = Vue;
$(window).ready(() => {
// Tab Content
let imgSelected;
// Tab Content : Change position
$('.listing-body').sortable({
update() {
const blocks = [];
$('.listing-general-rol').each(function () {
blocks.push($(this).attr('data-block'));
});
$.ajax({
type: 'POST',
dataType: 'JSON',
url: window.psr_controller_block_url,
data: {
ajax: true,
action: 'UpdatePosition',
blocks,
},
success(data) {
if (data === 'success') {
window.showSuccessMessage(window.successPosition);
} else {
window.showErrorMessage(window.errorPosition);
}
},
});
},
});
// Tab Content : Set active/inactive
$(document).on('click', '.listing-row .switch-input', (e) => {
const switchIsOn = $(e.target).hasClass('-checked');
const status = switchIsOn ? 1 : 0;
$(e.target).parent().find('.switch_text').hide();
if (switchIsOn) {
$('input', e.target).attr('checked', false);
$(e.target).removeClass('-checked');
$(e.target).parent().find('.switch-off').show();
} else {
$('input', e.target).attr('checked', true);
$(e.target).addClass('-checked');
$(e.target).parent().find('.switch-on').show();
}
$.ajax({
url: window.psr_controller_block_url,
type: 'POST',
dataType: 'JSON',
async: false,
data: {
controller: window.psr_controller_block,
action: 'changeBlockStatus',
idpsr: $(e.target).parent().attr('data-cart_psreassurance_id'),
status,
ajax: true,
},
success: (data) => {
if (data === 'success') {
window.showNoticeMessage(window.block_updated);
} else {
window.showErrorMessage(window.active_error);
}
},
});
});
// Tab Content : Add
$(document).on('click', '.psre-add', () => {
$('.landscape').show();
$('#reminder_listing').removeClass('active').addClass('inactive');
$('#blockDisplay').removeClass('inactive').addClass('active');
$('.show-rea-block').removeClass('active').addClass('inactive');
$('.panel-body-0').removeClass('inactive').addClass('active');
$('#saveContentConfiguration').attr('data-id', '');
$('.limit_text:visible').text($('.show-rea-block.active .content_by_lang:visible input[type="text"]').val().length);
$('.limit_description:visible').text($('.show-rea-block.active .content_by_lang:visible textarea').val().length);
const landscape = $('.panel-body-0 .psr-picto').attr('src');
if (typeof landscape === 'undefined') {
$('.psr-picto:visible').hide();
$('.svg_chosed_here:visible').hide();
$('.landscape').show();
}
});
// Tab Content : Delete
$(document).on('click', '.psre-delete', function deleteTabContent() {
const idBlock = $(this).data('id');
if (!window.confirm(window.txtConfirmRemoveBlock)) {
return;
}
$.ajax({
type: 'POST',
dataType: 'JSON',
url: window.psr_controller_block_url,
data: {
ajax: true,
action: 'DeleteBlock',
idBlock,
},
success(data) {
if (data === 'success') {
// Remove line
$(`div[data-block="${idBlock}"]`).remove();
} else {
window.showErrorMessage(window.errorRemove);
}
},
error(err) {
console.log(err);
},
});
});
// Tab Content : Edit
$(document).on('click', '.psre-edit', function editTabContent() {
$('.landscape').hide();
$('#reminder_listing').removeClass('active').addClass('inactive');
$('#blockDisplay').removeClass('inactive').addClass('active');
$('.show-rea-block').removeClass('active').addClass('inactive');
const id = $(this).data('id');
$(`.panel-body-${id}`).removeClass('inactive').addClass('active');
$('#saveContentConfiguration').attr('data-id', id);
$('.limit_text:visible').text($('.show-rea-block.active .content_by_lang:visible input[type="text"]').val().length);
$('.limit_description:visible').text($('.show-rea-block.active .content_by_lang:visible textarea').val().length);
const landscape = $(`.panel-body-${id} .psr-picto`).attr('src');
if (typeof landscape === 'undefined' || landscape === 'undefined') {
$('.psr-picto:visible').hide();
$('.svg_chosed_here:visible').hide();
$('.landscape').show();
}
});
// Tab Content : Edit : Language
$(document).on('change', 'select[name="psr-language"]', (e) => {
const lang = $(e.target).val();
$('.content_by_lang').removeClass('active').addClass('inactive');
$(`.content_by_lang.lang-${lang}`).addClass('active');
$('.limit_text:visible').text($('.show-rea-block.active .content_by_lang:visible input[type="text"]').val().length);
$('.limit_description:visible').text($('.show-rea-block.active .content_by_lang:visible textarea').val().length);
});
// Tab Content : Edit : Modify icon
$(document).on('click', '.modify_icon', (e) => {
const position = $(e.target).offset();
const offset = $(e.target).width();
const top = position.top / 2;
const left = position.left / 2 - offset;
$('#reassurance_block')
.show().css('top', `${top}px`).css('left', `${left}px`);
});
// Tab Content : Edit : Modify icon : Click outside
$(document).on('click', 'body', (e) => {
const isInside = $(e.target).closest('.modify_icon').length;
const isPopin = $(e.target).closest('#reassurance_block').length;
if (!isInside && !isPopin) {
$('#reassurance_block').fadeOut(300);
}
});
// Tab Content : Edit : Modify icon : Tabs
$(document).on('click', '#reassurance_block .category_select div img', (e) => {
const category = $(e.target).attr('data-id');
// Change the tab
$('#reassurance_block .category_select div').removeClass('active');
$(e.target).parent().addClass('active');
// Change the tab content
$('#reassurance_block .category_reassurance').removeClass('active');
$(`#reassurance_block .cat_${category}`).addClass('active');
});
// Tab Content : Edit : Select icon
$(document).on('click', '#reassurance_block .category_reassurance .svg', (e) => {
const svg = $(e.target)[0].outerHTML;
// Popin : select the icon
$('#reassurance_block .category_reassurance img.svg.selected').removeClass('selected');
$(e.target).addClass('selected');
// Hide the initial icon
$('.landscape').hide();
$('.psr-picto').hide();
// Show the image
$('.svg_chosed_here').show();
$('.svg_chosed_here:visible').html(svg);
// Popin : hide it
$('#reassurance_block').fadeOut(300);
});
// Tab Content : Edit : Select none
$(document).on('click', '#reassurance_block .select_none', () => {
const psrPicto = $('.psr-picto:visible');
psrPicto.attr('src', 'undefined').hide();
// Un-select icon in the popin
$('#reassurance_block .category_reassurance img.svg').removeClass('selected');
// Hide the icon seected
$('.svg_chosed_here:visible').hide();
// Display the landscape icon
$('.landscape').show();
// Hide the popin
$('#reassurance_block').fadeOut(300);
});
// Tab Content : Edit : Custom Icon
$(document).on('change', '.show-rea-block.active input[type="file"]', function editTabContentCustomIcon() {
const {files} = $(this)[0];
// Change the label
const jqLabel = $(this).parents('.input-group').find('label.file_label');
let label = jqLabel.attr('data-label');
if (files.length === 1) {
label = `${files.length} file selected`;
}
jqLabel.html(label);
// Preview the image
const idPreview = $(this).attr('data-preview');
if (files && files[0]) {
const reader = new FileReader();
reader.onload = (e) => {
const jqPreview = $(`.${idPreview}`);
if (jqPreview.hasClass('hide')) {
jqPreview.removeClass('hide');
}
jqPreview.attr('src', e.target.result);
};
reader.readAsDataURL(files[0]);
[imgSelected] = files;
// Hide the initial icon
$('.landscape').hide();
$('.psr-picto').hide();
$('.picto_by_module').hide();
// Show the image
$('.svg_chosed_here').show();
}
});
// Tab Content : Edit : MaxLength
$(document).on('keyup keydown', '.show-rea-block.active .content_by_lang input[type="text"], .show-rea-block.active .content_by_lang textarea', function editTabContentMaxLength() {
const maxLength = 100;
const val = $(this).val();
let valLength = val.length;
if (val.length > maxLength) {
$(this).val(val.substring(0, maxLength - 1));
valLength = $(this).val().length;
}
if ($(this).is('input:text')) {
$('.limit_text:visible').text(valLength);
} else {
$('.limit_description:visible').text(valLength);
}
});
// Tab Content : Edit : Return
$(document).on('click', '#blockDisplay .refreshPage', () => {
window.location.reload();
});
// Tab Content : Edit : Redirect
$(document).on('change', 'input[name^="PSR_REDIRECTION_"]', (e) => {
function setEnabledPSR(psr, state) {
if (state) {
$(`.psr-${psr}`).removeClass('inactive').addClass('active');
} else {
$(`.psr-${psr}`).removeClass('active').addClass('inactive');
}
}
switch ($(e.target).val()) {
case '0':
setEnabledPSR('cms', false);
setEnabledPSR('url', false);
break;
case '1':
setEnabledPSR('cms', true);
setEnabledPSR('url', false);
break;
case '2':
setEnabledPSR('cms', false);
setEnabledPSR('url', true);
break;
default:
break;
}
});
// Tab Content : Edit : Redirect : URL
$(document).on('keyup', '.block_url:visible', (e) => {
const url = $(e.target).val();
const patternForUrl = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;
const patternForHttp = /(http(s)?:\/\/)/g;
// If it is a real URL :
if (patternForUrl.test(url)) {
$(e.target).css('background', '#fff');
if (!patternForHttp.test(url)) {
$(e.target).val(`http://${url}`);
}
} else {
$(e.target).css('background', '#ffecec');
}
});
// Tab Content : Edit : Save
$(document).on('click', '#saveContentConfiguration', function editTabContentSave() {
const dataToSave = {};
const blockId = $(this).attr('data-id');
const imgIcon = $('.psr_picto_showing:visible img.psr-picto');
let iconSrc = imgIcon.attr('src');
const iconReplaced = $('.svg_chosed_here img.svg').attr('src');
if (typeof iconReplaced !== 'undefined') {
iconSrc = iconReplaced;
}
let minimalData = false;
$('.show-rea-block.active .content_by_lang').each((index, elem) => {
const lang = parseInt($(elem).attr('data-lang'), 10);
const dataType = $(elem).attr('data-type');
if (!Object.prototype.hasOwnProperty.call(dataToSave, lang)) {
dataToSave[lang] = {};
}
if (!Object.prototype.hasOwnProperty.call(dataToSave[lang], dataType)) {
dataToSave[lang][dataType] = '';
}
if (dataType === 'description') {
dataToSave[lang][dataType] = $('textarea', elem).val();
} else if (typeof ($('input', elem).val()) !== 'undefined') {
dataToSave[lang][dataType] = $('input', elem).val();
}
if (!minimalData && lang === window.psr_lang && dataType === 'title' && dataToSave[lang][dataType].length > 0) {
minimalData = true;
}
});
if (!minimalData) {
window.showErrorMessage(window.min_field_error);
return;
}
const formData = new FormData();
formData.append('ajax', true);
formData.append('action', 'SaveBlockContent');
formData.append('file', imgSelected);
formData.append('id_block', blockId);
formData.append('lang_values', JSON.stringify(dataToSave));
formData.append('picto', iconSrc);
formData.append('typelink', $(`input[name="PSR_REDIRECTION_${blockId}"]:checked`).val());
formData.append('id_cms', $(`select[name="ID_CMS_${blockId}"]`).val());
$.ajax({
type: 'POST',
dataType: 'JSON',
url: window.psr_controller_block_url,
contentType: false,
processData: false,
data: formData,
success() {
window.showSuccessMessage(window.psre_success);
setTimeout(window.location.reload(), 1800);
},
});
});
// Tab Display
new Vue({
el: '#menu',
data: {
selectedTabName: window.currentPage,
},
methods: {
makeActive(item) {
this.selectedTabName = item;
window.history.pushState({}, '', `${window.moduleAdminLink.replace(/amp;/g, '')}&page=${item}`);
},
isActive(item) {
if (this.selectedTabName !== item) {
return false;
}
$('.psr_menu').addClass('addons-hide');
$(`.psr_menu#${item}`).removeClass('addons-hide');
return true;
},
},
});
// Tab Display : Save Position
$(document).on(
'change',
'input[name="PSR_HOOK_CHECKOUT"],input[name="PSR_HOOK_HEADER"],input[name="PSR_HOOK_FOOTER"],input[name="PSR_HOOK_PRODUCT"]',
function updatePosition() {
let selector;
switch ($(this).attr('name')) {
case 'PSR_HOOK_CHECKOUT':
selector = 'checkout';
break;
case 'PSR_HOOK_HEADER':
selector = 'header';
break;
case 'PSR_HOOK_FOOTER':
selector = 'footer';
break;
case 'PSR_HOOK_PRODUCT':
selector = 'product';
break;
default:
selector = '';
}
$(`.psr-${selector}-grey`).addClass('active');
$(`.psr-${selector}-color`).removeClass('active');
$(this).nextAll(`.psr-${selector}-grey`).removeClass('active');
$(this).nextAll(`.psr-${selector}-color`).addClass('active');
savePositionByHook($(this).attr('name'), $(this).val());
},
);
function savePositionByHook(hook, value) {
$.ajax({
type: 'POST',
dataType: 'JSON',
url: window.psr_controller_block_url,
data: {
ajax: true,
action: 'SavePositionByHook',
hook,
value,
},
success(data) {
if (data === 'success') {
window.showSuccessMessage(window.successPosition);
} else {
window.showErrorMessage(window.errorPosition);
}
},
});
}
// Tab Appearance
const pickrComponents = {
// Main components
preview: true,
opacity: false,
hue: true,
// Input / output Options
interaction: {
hex: false,
rgba: false,
hsla: false,
hsva: false,
cmyk: false,
input: true,
clear: false,
save: true,
},
};
const pickr1 = Pickr.create({
el: '.ps_colorpicker1',
default: window.psr_icon_color,
defaultRepresentation: 'HEX',
closeWithKey: 'Escape',
adjustableNumbers: true,
components: pickrComponents,
});
pickr1.on('change', () => {
const pickrColor = pickr1.getColor();
const hexaColor = pickrColor.toHEXA().toString();
$('.psr_icon_color').val(hexaColor);
});
const pickr2 = Pickr.create({
el: '.ps_colorpicker2',
default: window.psr_text_color,
defaultRepresentation: 'HEX',
closeWithKey: 'Escape',
adjustableNumbers: true,
components: pickrComponents,
});
pickr2.on('change', () => {
const pickrColor = pickr2.getColor();
const hexaColor = pickrColor.toHEXA().toString();
$('.psr_text_color').val(hexaColor);
});
// Tab Appearance : Save Color
$(document).on('click', '#saveConfiguration', () => {
const color1 = $('#color_1').val();
const color2 = $('#color_2').val();
$.ajax({
type: 'POST',
dataType: 'JSON',
url: window.psr_controller_block_url,
data: {
ajax: true,
action: 'SaveColor',
color1,
color2,
},
success(data) {
if (data === 'success') {
window.showSuccessMessage(window.psre_success);
} else {
window.showErrorMessage(window.active_error);
}
},
});
});
});

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,7 @@
drwxr-xr-x 2 30094 users 7 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 5 Oct 6 10:16 ..
-rw----r-- 1 30094 users 1351 Sep 5 07:45 front.css
-rw----r-- 1 30094 users 579 Sep 5 07:45 front.css.map
-rw-r--r-- 1 30094 users 1322 Oct 3 06:58 front.scss
-rw-r--r-- 1 30094 users 2900 Oct 3 06:58 index.js
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

View File

@@ -0,0 +1,2 @@
.blockreassurance{padding-top:10px;text-align:center;width:100%}.blockreassurance .reass-item{display:inline-block;text-align:center;vertical-align:top}.blockreassurance .block-title{font-weight:bold}.blockreassurance .block-icon,.blockreassurance .block-icon img,.blockreassurance .block-icon svg{height:70px}@media (max-width: 575px){.blockreassurance{text-align:left}.blockreassurance .block-icon{display:inline-block;height:35px;float:left;margin:10px;width:35px}.blockreassurance .block-icon img,.blockreassurance .block-icon svg{height:35px;width:35px}.blockreassurance .block-title{display:inline-block;height:35px;max-width:calc(100% - 55px);padding-top:10px}}.blockreassurance_product{margin-top:25px}.blockreassurance_product .item-product{display:inline-block;height:35px;float:left;margin-right:5px;padding-top:5px;width:35px}.blockreassurance_product .item-product img,.blockreassurance_product .item-product svg{height:35px;width:35px}.blockreassurance_product p.block-title{line-height:40px}body#checkout .container-blockreassurance{min-height:auto}
/*# sourceMappingURL=front.css.map */

View File

@@ -0,0 +1,9 @@
{
"version": 3,
"mappings": "AAAA,AAAA,iBAAiB,AAAC,CACd,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,IAAI,CAcd,AAjBD,AAIE,iBAJe,CAIf,WAAW,AAAC,CACV,OAAO,CAAE,YAAY,CACrB,UAAU,CAAE,MAAM,CAClB,cAAc,CAAE,GAAG,CACpB,AARH,AASE,iBATe,CASf,YAAY,AAAC,CACX,WAAW,CAAE,IAAI,CAClB,AAXH,AAYE,iBAZe,CAYf,WAAW,CAZb,iBAAiB,CAaf,WAAW,CAAC,GAAG,CAbjB,iBAAiB,CAcf,WAAW,CAAC,GAAG,AAAC,CACd,MAAM,CAAE,IAAI,CACb,AAGH,MAAM,EAAE,SAAS,EAAE,KAAK,EACpB,AAAA,iBAAiB,AAAC,CACd,UAAU,CAAC,IAAI,CAClB,AACD,AAAA,iBAAiB,CAAC,WAAW,AAAC,CAC1B,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACd,AACD,AAAA,iBAAiB,CAAC,WAAW,CAAC,GAAG,CACjC,iBAAiB,CAAC,WAAW,CAAC,GAAG,AAAC,CAC9B,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACd,AACD,AAAA,iBAAiB,CAAC,YAAY,AAAC,CAC3B,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,IAAI,CACZ,SAAS,CAAE,iBAAiB,CAC5B,WAAW,CAAE,IAAI,CACpB,CAGL,AAAA,yBAAyB,AAAC,CACxB,UAAU,CAAE,IAAI,CASjB,AAVD,AAEE,yBAFuB,CAEvB,aAAa,AAAC,CACZ,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACX,YAAY,CAAE,GAAG,CACjB,WAAW,CAAE,GAAG,CAChB,KAAK,CAAE,IAAI,CACZ,AAGH,AAAA,yBAAyB,CAAC,aAAa,CAAC,GAAG,CAC3C,yBAAyB,CAAC,aAAa,CAAC,GAAG,AAAC,CACxC,MAAM,CAAE,IAAI,CACZ,KAAK,CAAE,IAAI,CACd,AAED,AAAA,yBAAyB,CAAC,CAAC,AAAA,YAAY,AAAC,CACpC,WAAW,CAAE,IAAI,CACpB,AAGD,AAAA,IAAI,AAAA,SAAS,CAAC,2BAA2B,AAAC,CACtC,UAAU,CAAE,IAAI,CACnB",
"sources": [
"front.scss"
],
"names": [],
"file": "front.css"
}

View File

@@ -0,0 +1,69 @@
.blockreassurance {
padding-top: 10px;
text-align: center;
width: 100%;
.reass-item {
display: inline-block;
text-align: center;
vertical-align: top;
}
.block-title {
font-weight: bold;
}
.block-icon,
.block-icon img,
.block-icon svg {
height: 70px;
}
}
@media (max-width:575px) {
.blockreassurance {
text-align:left;
}
.blockreassurance .block-icon {
display: inline-block;
height: 35px;
float: left;
margin: 10px;
width: 35px;
}
.blockreassurance .block-icon img,
.blockreassurance .block-icon svg {
height: 35px;
width: 35px;
}
.blockreassurance .block-title {
display: inline-block;
height: 35px;
max-width: calc(100% - 55px);
padding-top: 10px;
}
}
.blockreassurance_product {
margin-top: 25px;
.item-product {
display: inline-block;
height: 35px;
float: left;
margin-right: 5px;
padding-top: 5px;
width: 35px;
}
}
.blockreassurance_product .item-product img,
.blockreassurance_product .item-product svg {
height: 35px;
width: 35px;
}
.blockreassurance_product p.block-title {
line-height: 40px;
}
/* Specific Checkout */
body#checkout .container-blockreassurance {
min-height: auto;
}

View File

@@ -0,0 +1,77 @@
/**
* 2007-2019 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-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import './front.scss';
$(window).ready(() => {
/**
* @param {String} imgSrc
*/
function styleSVG(imgSrc) {
const imgTarget = $(`.blockreassurance_product img.svg.invisible[src="${imgSrc}"], .blockreassurance img.svg.invisible[src="${imgSrc}"]`);
if (imgTarget.length === 0) {
return;
}
// Fetch the image
$.ajax({
url: imgSrc,
type: 'GET',
success(data) {
if ($.isXMLDoc(data)) {
// Get the SVG tag, ignore the rest
let $svg = $(data).find('svg');
// Add URL in data
$svg = $svg.attr('data-img-url', imgSrc);
// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');
// Set color defined in backoffice
$svg.find('path[fill]').attr('fill', window.psr_icon_color);
$svg.find('path:not([fill])').css('fill', window.psr_icon_color);
// For each element, replace the svg with specific ID & CSS class
imgTarget.each(function () {
const imgID = $(this).attr('id');
const imgClass = $(this).attr('class');
let $imgSvg = $svg.clone();
// Add replaced image's ID to the new SVG
$imgSvg = typeof imgID !== 'undefined' ? $imgSvg.attr('id', imgID) : $imgSvg;
// Add replaced image's classes to the new SVG
$imgSvg = typeof imgClass !== 'undefined' ? $imgSvg.attr('class', `${imgClass} replaced-svg`) : $imgSvg.attr('class', ' replaced-svg');
$imgSvg.removeClass('invisible');
$(this).replaceWith($imgSvg);
});
}
},
});
}
const imgSrcSvg = $('.blockreassurance_product img.svg, .blockreassurance img.svg').map(function () {
return $(this).attr('src');
}).toArray();
imgSrcSvg
.filter((el, pos) => imgSrcSvg.indexOf(el) === pos)
.forEach(styleSVG);
});

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,34 @@
<?php
/**
* 2007-2019 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-2019 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,522 @@
<?php
/**
* 2007-2019 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-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
$autoloadPath = __DIR__ . '/vendor/autoload.php';
if (file_exists($autoloadPath)) {
require_once $autoloadPath;
}
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
class blockreassurance extends Module implements WidgetInterface
{
const ALLOWED_CONTROLLERS_CHECKOUT = [
'cart',
'order',
];
const ALLOWED_CONTROLLERS_PRODUCT = [
'product',
];
const POSITION_NONE = 0;
const POSITION_BELOW_HEADER = 1;
const POSITION_ABOVE_HEADER = 2;
/** @var string */
public $name;
/** @var string */
public $version;
/** @var string */
public $author;
/** @var bool */
public $need_instance;
/** @var string */
public $controller_name;
/** @var bool */
public $bootstrap;
/** @var string */
public $displayName;
/** @var string */
public $description;
/** @var string */
public $js_path;
/** @var string */
public $css_path;
/** @var string */
public $img_path;
/** @var string */
public $old_path_img;
/** @var string */
public $img_path_perso;
/** @var string */
public $lib_path;
/** @var string */
public $docs_path;
/** @var string */
public $logo_path;
/** @var string */
public $module_path;
/** @var string Text to display when ask for confirmation on uninstall action */
public $confirmUninstall;
/** @var string */
public $ps_url;
/** @var string */
public $folder_file_upload;
/** @var string */
private $templateFile;
public function __construct()
{
// Settings
$this->name = 'blockreassurance';
$this->tab = 'seo';
$this->version = '5.1.1';
$this->author = 'PrestaShop';
$this->need_instance = false;
$this->bootstrap = true;
parent::__construct();
if ($this->context->link == null) {
$protocolPrefix = Tools::getCurrentUrlProtocolPrefix();
$this->context->link = new Link($protocolPrefix, $protocolPrefix);
}
$this->displayName = $this->trans('Customer Reassurance', [], 'Modules.Blockreassurance.Admin');
$this->description = $this->trans('Connect with your visitors and reassure them about secure payment, free shipping or returns.', [], 'Modules.Blockreassurance.Admin');
// Settings paths
if (!$this->_path) {
$this->_path = __PS_BASE_URI__ . 'modules/' . $this->name . '/';
}
$this->js_path = $this->_path . 'views/js/';
$this->css_path = $this->_path . 'views/css/';
$this->img_path = $this->_path . 'views/img/';
$this->old_path_img = $this->_path . 'img/';
$this->img_path_perso = $this->img_path . 'img_perso';
$this->lib_path = $this->_path . 'views/lib/';
$this->docs_path = $this->_path . 'docs/';
$this->logo_path = $this->_path . 'logo.png';
$this->module_path = $this->_path;
$this->folder_file_upload = _PS_MODULE_DIR_ . $this->name . '/views/img/img_perso/';
// Confirm uninstall
$this->confirmUninstall = $this->trans('Are you sure you want to uninstall this module?', [], 'Modules.Blockreassurance.Admin');
$this->ps_url = $this->context->link->getBaseLink();
$this->ps_versions_compliancy = ['min' => '1.7', 'max' => _PS_VERSION_];
$this->templateFile = 'module:blockreassurance/views/templates/hook/blockreassurance.tpl';
}
/**
* install pre-config
*
* @return bool
*/
public function install()
{
// SQL
$sqlQueries = [];
$sqlQueries[] = ' CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'psreassurance` (
`id_psreassurance` int(10) unsigned NOT NULL AUTO_INCREMENT,
`icon` varchar(255) NULL,
`custom_icon` varchar(255) NULL,
`status` int(10) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL,
`type_link` int(10) unsigned NULL,
`id_cms` int(10) unsigned NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NULL,
PRIMARY KEY (`id_psreassurance`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;';
$sqlQueries[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'psreassurance_lang` (
`id_psreassurance` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`link` varchar(255) NOT NULL,
PRIMARY KEY (`id_psreassurance`,`id_lang`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;';
$sqlQueries[] = 'INSERT INTO ' . _DB_PREFIX_ . 'psreassurance (icon, custom_icon, status, position, type_link, id_cms, date_add) VALUES '
. "('" . $this->img_path . "reassurance/pack2/security.svg', null, 1, 1, null, null, now()),"
. "('" . $this->img_path . "reassurance/pack2/carrier.svg', null, 1, 2, null, null, now()),"
. "('" . $this->img_path . "reassurance/pack2/parcel.svg', null, 1, 3, null, null, now())";
foreach (Language::getLanguages(false) as $lang) {
$sqlQueries[] = 'INSERT INTO ' . _DB_PREFIX_ . 'psreassurance_lang (id_psreassurance, id_lang, title, description, link) VALUES '
. '(1, ' . $lang['id_lang'] . ", '" . $this->trans('Security policy', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', '" . $this->trans('(edit with the Customer Reassurance module)', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', ''),"
. '(2, ' . $lang['id_lang'] . ", '" . $this->trans('Delivery policy', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', '" . $this->trans('(edit with the Customer Reassurance module)', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', ''),"
. '(3, ' . $lang['id_lang'] . ", '" . $this->trans('Return policy', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', '" . $this->trans('(edit with the Customer Reassurance module)', [], 'Modules.Blockreassurance.Shop', $lang['locale']) . "', '')";
}
foreach ($sqlQueries as $query) {
if (Db::getInstance()->execute($query) == false) {
return false;
}
}
// Configuration
Configuration::updateValue('PSR_HOOK_HEADER', self::POSITION_NONE);
Configuration::updateValue('PSR_HOOK_FOOTER', self::POSITION_NONE);
Configuration::updateValue('PSR_HOOK_PRODUCT', self::POSITION_BELOW_HEADER);
Configuration::updateValue('PSR_HOOK_CHECKOUT', self::POSITION_BELOW_HEADER);
Configuration::updateValue('PSR_ICON_COLOR', '#F19D76');
Configuration::updateValue('PSR_TEXT_COLOR', '#000000');
// Hooks
if (parent::install() &&
$this->registerHook('displayAfterBodyOpeningTag') &&
$this->registerHook('displayNavFullWidth') &&
$this->registerHook('displayFooterAfter') &&
$this->registerHook('displayFooterBefore') &&
$this->registerHook('displayReassurance') &&
$this->registerHook('actionFrontControllerSetMedia')
) {
return true;
}
$this->_errors[] = $this->trans('There was an error during the installation. Please <a href="https://github.com/PrestaShop/PrestaShop/issues">open an issue</a> on the PrestaShop project.', [], 'Modules.Blockreassurance.Admin');
return false;
}
/**
* Uninstall module configuration
*
* @return bool
*/
public function uninstall()
{
// SQL
$sql = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'psreassurance`, `' . _DB_PREFIX_ . 'psreassurance_lang`';
if (Db::getInstance()->execute($sql) == false) {
return false;
}
// Configuration
Configuration::deleteByName('PSR_HOOK_HEADER');
Configuration::deleteByName('PSR_HOOK_FOOTER');
Configuration::deleteByName('PSR_HOOK_PRODUCT');
Configuration::deleteByName('PSR_HOOK_CHECKOUT');
Configuration::deleteByName('PSR_ICON_COLOR');
Configuration::deleteByName('PSR_TEXT_COLOR');
if (parent::uninstall()) {
return true;
}
$this->_errors[] = $this->trans('There was an error during the uninstallation. Please <a href="https://github.com/PrestaShop/PrestaShop/issues">open an issue</a> on the PrestaShop project.', [], 'Modules.Blockreassurance.Admin');
return false;
}
/**
* load dependencies
*/
public function loadAsset()
{
$this->addJsDefList();
$this->context->controller->addCSS($this->_path . 'views/dist/back.css', 'all');
$this->context->controller->addJS($this->_path . 'views/dist/back.js');
$this->context->controller->addJqueryPlugin('colorpicker');
$this->context->controller->addJqueryUI('ui.sortable');
}
/**
* Check if folder img_perso is writable and executable
*
* @return bool
*/
private function folderUploadFilesHasGoodRights()
{
return is_writable($this->folder_file_upload)
&& is_executable($this->folder_file_upload);
}
/**
* @return string
*
* @throws PrestaShopException
*/
public function getContent()
{
$this->loadAsset();
$id_lang = $this->context->language->id;
$currentPage = 'global';
$getPage = Tools::getValue('page');
if (!empty($getPage)) {
$currentPage = $getPage;
}
$moduleAdminLink = Context::getContext()->link->getAdminLink('AdminModules', true) . '&configure=' . $this->name . '&module_name=' . $this->name;
$allCms = CMS::listCms($id_lang);
$this->context->smarty->assign([
'psr_hook_header' => (int) Configuration::get('PSR_HOOK_HEADER'),
'psr_hook_footer' => (int) Configuration::get('PSR_HOOK_FOOTER'),
'psr_hook_product' => (int) Configuration::get('PSR_HOOK_PRODUCT'),
'psr_hook_checkout' => (int) Configuration::get('PSR_HOOK_CHECKOUT'),
'psr_text_color' => Configuration::get('PSR_TEXT_COLOR'),
'psr_icon_color' => Configuration::get('PSR_ICON_COLOR'),
'logo_path' => $this->logo_path,
'languages' => Language::getLanguages(false),
'allblock' => ReassuranceActivity::getAllBlock(),
'currentPage' => $currentPage,
'moduleAdminLink' => $moduleAdminLink,
'img_path' => $this->img_path,
'allCms' => $allCms,
'defaultFormLanguage' => (int) $this->context->employee->id_lang,
'img_url' => $this->img_path,
'old_img_url' => $this->old_path_img,
'folderIsWritable' => $this->folderUploadFilesHasGoodRights(),
'folderPath' => $this->img_path_perso,
// constants
'LINK_TYPE_NONE' => ReassuranceActivity::TYPE_LINK_NONE,
'LINK_TYPE_CMS' => ReassuranceActivity::TYPE_LINK_CMS_PAGE,
'LINK_TYPE_URL' => ReassuranceActivity::TYPE_LINK_URL,
]);
return $this->display(__FILE__, 'views/templates/admin/configure.tpl');
}
/**
* @param array $params
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function hookdisplayAfterBodyOpeningTag($params)
{
$position = (int) Configuration::get('PSR_HOOK_HEADER');
return $position === self::POSITION_ABOVE_HEADER ? $this->renderTemplateInHook('displayBlock.tpl') : '';
}
/**
* @param array $params
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function hookdisplayNavFullWidth($params)
{
$position = (int) Configuration::get('PSR_HOOK_HEADER');
return $position === self::POSITION_BELOW_HEADER ? $this->renderTemplateInHook('displayBlock.tpl') : '';
}
/**
* @param array $params
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function hookdisplayFooterAfter($params)
{
$position = (int) Configuration::get('PSR_HOOK_FOOTER');
return $position === self::POSITION_BELOW_HEADER ? $this->renderTemplateInHook('displayBlockWhite.tpl') : '';
}
/**
* @param array $params
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function hookdisplayFooterBefore($params)
{
$position = (int) Configuration::get('PSR_HOOK_FOOTER');
return $position === self::POSITION_ABOVE_HEADER ? $this->renderTemplateInHook('displayBlockWhite.tpl') : '';
}
/**
* @param array $params
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function hookdisplayReassurance($params)
{
$enableCheckout = (int) Configuration::get('PSR_HOOK_CHECKOUT');
$enableProduct = (int) Configuration::get('PSR_HOOK_PRODUCT');
$controller = Tools::getValue('controller');
if (!$this->shouldWeDisplayOnBlockProduct($enableCheckout, $enableProduct, $controller)) {
return '';
}
return $this->renderTemplateInHook('displayBlockProduct.tpl');
}
public function hookActionFrontControllerSetMedia()
{
Media::addJsDef([
'psr_icon_color' => Configuration::get('PSR_ICON_COLOR'),
]);
$this->context->controller->registerStylesheet(
'front-css',
'modules/' . $this->name . '/views/dist/front.css'
);
$this->context->controller->registerJavascript(
'front-js',
'modules/' . $this->name . '/views/dist/front.js'
);
}
/**
* @param string $hookName
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
public function renderWidget($hookName = null, array $configuration = [])
{
if ($hookName === 'displayFooter') {
return '';
}
if (!$this->isCached($this->templateFile, $this->getCacheId('blockreassurance'))) {
$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
}
return $this->fetch($this->templateFile, $this->getCacheId('blockreassurance'));
}
/**
* @param string $hookName
*
* @return array
*
* @throws PrestaShopDatabaseException
*/
public function getWidgetVariables($hookName = null, array $configuration = [])
{
$blocks = ReassuranceActivity::getAllBlockByStatus(
$this->context->language->id
);
$elements = [];
foreach ($blocks as $key => $value) {
if (!empty($value['icon'])) {
$elements[$key]['image'] = $value['icon'];
} elseif (!empty($value['custom_icon'])) {
$elements[$key]['image'] = $value['custom_icon'];
} else {
$elements[$key]['image'] = '';
}
$elements[$key]['text'] = $value['title'] . ' ' . $value['description'];
$elements[$key]['title'] = $value['title'];
$elements[$key]['description'] = $value['description'];
}
return [
'elements' => $elements,
];
}
/**
* Check if we can display the hook on product page or cart page.
* The HOOK must be active
*
* @param int $enableCheckout
* @param int $enableProduct
* @param string $controller
*
* @return bool
*/
private function shouldWeDisplayOnBlockProduct($enableCheckout, $enableProduct, $controller)
{
if ($enableCheckout === self::POSITION_BELOW_HEADER && in_array($controller, self::ALLOWED_CONTROLLERS_CHECKOUT)) {
return true;
}
if ($enableProduct === self::POSITION_BELOW_HEADER && in_array($controller, self::ALLOWED_CONTROLLERS_PRODUCT)) {
return true;
}
return false;
}
/**
* Assign smarty variables and display the hook
*
* @param string $template
*
* @return string
*
* @throws PrestaShopDatabaseException
*/
private function renderTemplateInHook($template)
{
$id_lang = $this->context->language->id;
$this->context->smarty->assign([
'blocks' => ReassuranceActivity::getAllBlockByStatus($id_lang),
'iconColor' => Configuration::get('PSR_ICON_COLOR'),
'textColor' => Configuration::get('PSR_TEXT_COLOR'),
// constants
'LINK_TYPE_NONE' => ReassuranceActivity::TYPE_LINK_NONE,
'LINK_TYPE_CMS' => ReassuranceActivity::TYPE_LINK_CMS_PAGE,
'LINK_TYPE_URL' => ReassuranceActivity::TYPE_LINK_URL,
]);
return $this->display(__FILE__, 'views/templates/hook/' . $template);
}
/**
* @throws PrestaShopException
*/
protected function addJsDefList()
{
Media::addJsDef([
'psr_icon_color' => Configuration::get('PSR_ICON_COLOR'),
'psr_text_color' => Configuration::get('PSR_TEXT_COLOR'),
'psr_controller_block_url' => $this->context->link->getAdminLink('AdminBlockListing'),
'psr_controller_block' => 'AdminBlockListing',
'psr_lang' => (int) Configuration::get('PS_LANG_DEFAULT'),
'block_updated' => $this->trans('Block updated', [], 'Modules.Blockreassurance.Admin'),
'active_error' => $this->trans('Oops... looks like an error occurred', [], 'Modules.Blockreassurance.Admin'),
'min_field_error' => $this->trans('The field %field_name% is required at least in your default language.', ['%field_name%' => sprintf('"%s"', $this->trans('Title', [], 'Admin.Global'))], 'Admin.Notifications.Error'),
'psre_success' => $this->trans('Configuration updated successfully!', [], 'Modules.Blockreassurance.Admin'),
'successPosition' => $this->trans('Position changed successfully!', [], 'Modules.Blockreassurance.Admin'),
'errorPosition' => $this->trans('An error occurred when switching position', [], 'Modules.Blockreassurance.Admin'),
'txtConfirmRemoveBlock' => $this->trans('Are you sure?', [], 'Admin.Notifications.Warning'),
'errorRemove' => $this->trans('An error occurred when removing block', [], 'Modules.Blockreassurance.Admin'),
]);
}
}

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 7777 Oct 3 06:58 ReassuranceActivity.php
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

View File

@@ -0,0 +1,213 @@
<?php
/**
* 2007-2019 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-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class ReassuranceActivity extends ObjectModel
{
const TYPE_LINK_NONE = 0;
const TYPE_LINK_CMS_PAGE = 1;
const TYPE_LINK_URL = 2;
public $id;
public $icon;
public $custom_icon;
public $title;
public $description;
public $status;
public $position;
public $type_link;
public $link;
public $id_cms;
public $date_add;
public $date_upd;
/**
* @see ObjectModel::$definition
*/
public static $definition = [
'table' => 'psreassurance',
'primary' => 'id_psreassurance',
'multilang' => true,
'fields' => [
'icon' => ['type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 255],
'custom_icon' => ['type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 255],
'status' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true],
'position' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => false],
'type_link' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => false],
'id_cms' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => false],
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
// lang fields
'title' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255],
'description' => ['type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 2000],
'link' => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isUrl', 'required' => false, 'size' => 255],
],
];
/**
* @param array $psr_languages
* @param int $type_link
* @param int $id_cms
*/
public function handleBlockValues($psr_languages, $type_link, $id_cms)
{
$languages = Language::getLanguages();
$newValues = [];
foreach ($psr_languages as $key => $value) {
$newValues[$key] = [
'title' => $value->title,
'description' => $value->description,
'url' => $value->url,
];
}
foreach ($languages as $language) {
if (false === array_key_exists($language['id_lang'], $newValues)) {
continue;
}
$this->title[$language['id_lang']] = $newValues[$language['id_lang']]['title'];
$this->description[$language['id_lang']] = $newValues[$language['id_lang']]['description'];
$this->link[$language['id_lang']] = '';
if ($type_link === self::TYPE_LINK_URL) {
$this->link[$language['id_lang']] = $newValues[$language['id_lang']]['url'];
}
}
if (!empty($id_cms) && $type_link === self::TYPE_LINK_CMS_PAGE) {
$this->id_cms = $id_cms;
$link = Context::getContext()->link;
foreach ($languages as $language) {
$this->link[$language['id_lang']] = $link->getCMSLink(
$id_cms,
null,
null,
$language['id_lang']
);
}
}
if ($type_link == 'undefined') {
$type_link = self::TYPE_LINK_NONE;
}
$this->type_link = $type_link;
}
/**
* @return array
*
* @throws PrestaShopDatabaseException
*/
public static function getAllBlock()
{
$result = [];
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'psreassurance` pr
LEFT JOIN ' . _DB_PREFIX_ . 'psreassurance_lang prl ON (pr.id_psreassurance = prl.id_psreassurance)
ORDER BY pr.position';
$dbResult = Db::getInstance()->executeS($sql);
foreach ($dbResult as $key => $value) {
if (!isset($result[$value['id_psreassurance']])) {
$result[$value['id_psreassurance']] = $value;
$result[$value['id_psreassurance']]['title'] = [];
$result[$value['id_psreassurance']]['description'] = [];
$result[$value['id_psreassurance']]['url'] = [];
}
$result[$value['id_psreassurance']]['title'][$value['id_lang']] = $value['title'];
$result[$value['id_psreassurance']]['description'][$value['id_lang']] = $value['description'];
$result[$value['id_psreassurance']]['url'][$value['id_lang']] = $value['link'];
}
return $result;
}
/**
* @param int $id_lang
*
* @return array
*
* @throws PrestaShopDatabaseException
*/
public static function getAllBlockByStatus($id_lang = 1)
{
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'psreassurance` pr
LEFT JOIN ' . _DB_PREFIX_ . 'psreassurance_lang prl ON (pr.id_psreassurance = prl.id_psreassurance)
WHERE prl.id_lang = "' . (int) $id_lang . '"
AND pr.status = 1
ORDER BY pr.position';
$result = Db::getInstance()->executeS($sql);
$xmlMimes = ['image/svg', 'image/svg+xml'];
foreach ($result as &$item) {
$item['is_svg'] = !empty($item['custom_icon'])
&& (in_array(self::getMimeType(_PS_ROOT_DIR_ . $item['custom_icon']), $xmlMimes));
}
return $result;
}
/**
* @return string|bool
*/
public static function getMimeType(string $filename)
{
$mimeType = false;
// Try with GD
if (function_exists('getimagesize')) {
$imageInfo = @getimagesize($filename);
if ($imageInfo) {
$mimeType = $imageInfo['mime'];
}
}
// Try with FileInfo
if (!$mimeType && function_exists('finfo_open')) {
$const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
$finfo = finfo_open($const);
$mimeType = finfo_file($finfo, $filename);
finfo_close($finfo);
}
// Try with Mime
if (!$mimeType && function_exists('mime_content_type')) {
$mimeType = mime_content_type($filename);
}
// Try with exec command and file binary
if (!$mimeType && function_exists('exec')) {
$mimeType = trim(exec('file -b --mime-type ' . escapeshellarg($filename)));
if (!$mimeType) {
$mimeType = trim(exec('file --mime ' . escapeshellarg($filename)));
}
if (!$mimeType) {
$mimeType = trim(exec('file -bi ' . escapeshellarg($filename)));
}
}
return $mimeType;
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,43 @@
{
"name": "prestashop/blockreassurance",
"description": "PrestaShop module blockreassurance",
"homepage": "https://github.com/PrestaShop/blockreassurance",
"license": "AFL-3.0",
"authors": [
{
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
}
],
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"prestashop/php-dev-tools": "^3.4"
},
"autoload": {
"psr-4": {
"PrestaShop\\Module\\BlockReassurance\\": "src/"
},
"classmap": [
"blockreassurance.php",
"classes/ReassuranceActivity.php"
],
"exclude-from-classmap": []
},
"config": {
"preferred-install": "dist",
"classmap-authoritative": true,
"optimize-autoloader": true,
"prepend-autoloader": false,
"platform": {
"php": "5.6"
}
},
"scripts": {
"lint": [
"php-cs-fixer fix --no-interaction --dry-run --diff"
]
},
"type": "prestashop-module"
}

1680
modules/blockreassurance/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockreassurance</name>
<displayName><![CDATA[Customer reassurance block]]></displayName>
<version><![CDATA[5.1.1]]></version>
<description><![CDATA[Adds an information block aimed at offering helpful information to reassure customers that your store is trustworthy.]]></description>
<author><![CDATA[PrestaShop]]></author>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockreassurance</name>
<displayName><![CDATA[Bezpieczeństwo Klienta]]></displayName>
<version><![CDATA[5.1.1]]></version>
<description><![CDATA[Connect with your visitors and reassure them about secure payment, free shipping or returns.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[seo]]></tab>
<confirmUninstall><![CDATA[Czy na pewno chcesz odinstalować ten moduł?]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 3 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 admin
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 4 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 9165 Oct 3 06:58 AdminBlockListingController.php
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php

View File

@@ -0,0 +1,255 @@
<?php
/**
* 2007-2019 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-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminBlockListingController extends ModuleAdminController
{
/** @var blockreassurance */
public $module;
/**
* @param string $content
*
* @throws PrestaShopException
*/
protected function ajaxRenderJson($content)
{
header('Content-Type: application/json');
$this->ajaxRender(json_encode($content));
}
/**
* Enable or disable a block
*
* @throws PrestaShopException
*/
public function displayAjaxChangeBlockStatus()
{
$now = new DateTime();
$psreassuranceId = (int) Tools::getValue('idpsr');
$newStatus = ((int) Tools::getValue('status') == 1) ? 0 : 1;
$dataToUpdate = [
'status' => $newStatus,
'date_upd' => $now->format('Y-m-d H:i:s'),
];
$whereCondition = 'id_psreassurance = ' . $psreassuranceId;
$updateResult = Db::getInstance()->update('psreassurance', $dataToUpdate, $whereCondition);
// Response
$this->ajaxRenderJson($updateResult ? 'success' : 'error');
}
/**
* Delete a block
*
* @throws PrestaShopException
*/
public function displayAjaxDeleteBlock()
{
$result = false;
$idPSR = (int) Tools::getValue('idBlock');
$blockPSR = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'psreassurance WHERE `id_psreassurance` = ' . (int) $idPSR);
if (!empty($blockPSR)) {
$result = true;
// Remove Custom icon
if (!empty($blockPSR['custom_icon'])) {
$filePath = _PS_ROOT_DIR_ . $blockPSR['custom_icon'];
if (file_exists($filePath)) {
$result = unlink($filePath);
}
}
// Remove Block Translations
if ($result) {
$result = Db::getInstance()->delete('psreassurance_lang', 'id_psreassurance = ' . (int) $idPSR);
}
// Remove Block
if ($result) {
$result = Db::getInstance()->delete('psreassurance', 'id_psreassurance = ' . (int) $idPSR);
}
}
// Response
$this->ajaxRenderJson($result ? 'success' : 'error');
}
/**
* Update how the blocks are displayed in the front-office
*
* @throws PrestaShopException
*/
public function displayAjaxSavePositionByHook()
{
$hook = Tools::getValue('hook');
$value = Tools::getValue('value');
$result = false;
if (!empty($hook) && in_array($value, [
blockreassurance::POSITION_NONE,
blockreassurance::POSITION_BELOW_HEADER,
blockreassurance::POSITION_ABOVE_HEADER,
])
) {
$result = Configuration::updateValue($hook, $value);
}
// Response
$this->ajaxRenderJson($result ? 'success' : 'error');
}
/**
* Update color settings to be used in front-office display
*
* @throws PrestaShopException
*/
public function displayAjaxSaveColor()
{
$color1 = Tools::getValue('color1');
$color2 = Tools::getValue('color2');
$result = false;
if (!empty($color1) && !empty($color2)) {
$result = Configuration::updateValue('PSR_ICON_COLOR', $color1)
&& Configuration::updateValue('PSR_TEXT_COLOR', $color2);
}
// Response
$this->ajaxRenderJson($result ? 'success' : 'error');
}
/**
* Modify the settings of one block from BO "configure" page
*
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function displayAjaxSaveBlockContent()
{
$errors = [];
$picto = Tools::getValue('picto');
$id_block = empty(Tools::getValue('id_block')) ? null : Tools::getValue('id_block');
$type_link = (int) Tools::getValue('typelink');
$id_cms = Tools::getValue('id_cms');
$psr_languages = (array) json_decode(Tools::getValue('lang_values'));
$blockPsr = new ReassuranceActivity($id_block);
if (!$id_block) {
// Last position
$blockPsr->position = (int) Db::getInstance()->getValue('SELECT MAX(position) AS max FROM ' . _DB_PREFIX_ . 'psreassurance');
$blockPsr->position = $blockPsr->position ? $blockPsr->position + 1 : 1;
$blockPsr->status = false;
}
$blockPsr->handleBlockValues($psr_languages, $type_link, $id_cms);
$blockPsr->icon = $picto;
if (!empty($picto)) {
$blockPsr->custom_icon = '';
}
$blockPsr->date_add = date('Y-m-d H:i:s');
$blockPsr->date_upd = date('Y-m-d H:i:s');
if (!empty($_FILES)) {
$customImage = $_FILES['file'];
$fileTmpName = $customImage['tmp_name'];
$filename = $customImage['name'];
// validateUpload return false if no error (false -> OK)
$authExtensions = ['gif', 'jpg', 'jpeg', 'jpe', 'png', 'svg'];
$authMimeType = ['image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/svg', 'image/svg+xml'];
if (version_compare(_PS_VERSION_, '1.7.7.0', '>=')) {
// PrestaShop 1.7.7.0+
$validUpload = ImageManager::validateUpload(
$customImage,
0,
$authExtensions,
$authMimeType
);
} else {
// PrestaShop < 1.7.7
$validUpload = false;
$mimeType = ReassuranceActivity::getMimeType($customImage['tmp_name']);
if ($mimeType && (
!in_array($mimeType, $authMimeType)
|| !ImageManager::isCorrectImageFileExt($customImage['name'], $authExtensions)
|| preg_match('/\%00/', $customImage['name'])
)) {
$validUpload = Context::getContext()->getTranslator()->trans('Image format not recognized, allowed formats are: .gif, .jpg, .png', [], 'Admin.Notifications.Error');
}
if ($customImage['error']) {
$validUpload = Context::getContext()->getTranslator()->trans('Error while uploading image; please change your server\'s settings. (Error code: %s)', [$customImage['error']], 'Admin.Notifications.Error');
}
}
if (is_bool($validUpload) && $validUpload === false) {
move_uploaded_file($fileTmpName, $this->module->folder_file_upload . $filename);
$blockPsr->custom_icon = $this->module->img_path_perso . '/' . $filename;
$blockPsr->icon = '';
} else {
$errors[] = $validUpload;
}
}
if (empty($errors)) {
if ($id_block) {
$blockPsr->update();
} else {
$blockPsr->add();
}
}
// Response
$this->ajaxRenderJson(empty($errors) ? 'success' : 'error');
}
/**
* Reorder the blocks positions
*
* @throws PrestaShopException
*/
public function displayAjaxUpdatePosition()
{
$blocks = Tools::getValue('blocks');
$result = false;
if (!empty($blocks) && is_array($blocks)) {
$updateResult = true;
foreach ($blocks as $key => $id_block) {
// Set the position of the Reassurance block
$position = $key + 1;
$dataToUpdate = ['position' => (int) $position];
$whereCondition = 'id_psreassurance = ' . (int) $id_block;
$updateResult = (bool) Db::getInstance()->update('psreassurance', $dataToUpdate, $whereCondition);
// If the update can't be done, we return false
if (!$updateResult) {
break;
}
}
$result = $updateResult ? true : false;
}
// Response
$this->ajaxRenderJson($result ? 'success' : 'error');
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,34 @@
<?php
/**
* 2007-2019 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-2019 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,7 @@
drwxr-xr-x 2 30094 users 7 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 299 Aug 31 2021 bg_reassurance_block.gif
-rw-r--r-- 1 30094 users 545 Aug 31 2021 ic_local_shipping_black_36dp_1x.png
-rw-r--r-- 1 30094 users 432 Aug 31 2021 ic_swap_horiz_black_36dp_1x.png
-rw-r--r-- 1 30094 users 671 Aug 31 2021 ic_verified_user_black_36dp_1x.png
-rw-r--r-- 1 30094 users 1287 Aug 31 2021 index.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2015 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-2015 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,34 @@
<?php
/**
* 2007-2019 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-2019 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,3 @@
drwxr-xr-x 2 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 2147 Aug 31 2021 ReassuranceLang.php

View File

@@ -0,0 +1,52 @@
<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class ReassuranceLang extends DataLangCore
{
// Don't replace domain in init() with $this->domain for translation parsing
protected $domain = 'Modules.Blockreassurance.Shop ';
protected $keys = array('id_reassurance');
protected $fieldsToUpdate = array('text');
protected function init()
{
$this->fieldNames = array(
'text' => array(
md5('Security policy (edit with module Customer reassurance)') =>
$this->translator->trans('Security policy (edit with Customer reassurance module)', array(), 'Modules.Blockreassurance.Shop', $this->locale),
md5('Delivery policy (edit with module Customer reassurance)') =>
$this->translator->trans('Delivery policy (edit with Customer reassurance module)', array(), 'Modules.Blockreassurance.Shop', $this->locale),
md5('Return policy (edit with module Customer reassurance)') =>
$this->translator->trans('Return policy (edit with Customer reassurance module)', array(), 'Modules.Blockreassurance.Shop', $this->locale),
),
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

11288
modules/blockreassurance/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
{
"name": "blockreassurance",
"description": "Customer reassurance block",
"keywords": [],
"author": {
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
},
"license": "AFL-3.0",
"bugs": {
"url": "https://github.com/PrestaShop/PrestaShop/issues"
},
"homepage": "https://github.com/PrestaShop/blockreassurance#readme",
"scripts": {
"lint": "eslint --ext .js,.vue .",
"lint-fix": "eslint --fix --ext .js,.vue .",
"build": "webpack-cli --mode production",
"dev": "webpack-cli --mode development --watch"
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/core": "^7.17.9",
"babel-loader": "^8.2.4",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.7.1",
"eslint": "^8.12.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prestashop": "^0.2.1",
"eslint-plugin-import": "^2.26.0",
"file-loader": "^6.2.0",
"mini-css-extract-plugin": "^2.6.0",
"node-sass": "^7.0.1",
"sass-loader": "^12.6.0",
"style-loader": "^3.3.1",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
},
"dependencies": {
"material-design-icons": "^3.0.1",
"@simonwep/pickr": "^1.8.2",
"vue": "^2.6.14"
}
}

View File

@@ -0,0 +1,78 @@
<?php
/*
* 2007-2015 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-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class reassuranceClass extends ObjectModel
{
/** @var integer reassurance id*/
public $id;
/** @var integer reassurance id shop*/
public $id_shop;
/** @var string reassurance file name icon*/
public $file_name;
/** @var string reassurance text*/
public $text;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'reassurance',
'primary' => 'id_reassurance',
'multilang' => true,
'fields' => array(
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true),
'file_name' => array('type' => self::TYPE_STRING, 'validate' => 'isFileName'),
// Lang fields
'text' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true),
)
);
public function copyFromPost()
{
/* Classical fields */
foreach ($_POST as $key => $value) {
if (array_key_exists($key, $this) and $key != 'id_'.$this->table) {
$this->{$key} = $value;
}
}
/* Multilingual fields */
if (sizeof($this->fieldsValidateLang)) {
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
foreach ($this->fieldsValidateLang as $field => $validation) {
if (isset($_POST[$field.'_'.(int)($language['id_lang'])])) {
$this->{$field}[(int)($language['id_lang'])] = $_POST[$field.'_'.(int)($language['id_lang'])];
}
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 3 Oct 6 10:16 Addons

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 2 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 9166 Aug 31 2021 CategoryFetcher.php

View File

@@ -0,0 +1,267 @@
<?php
/**
* 2007-2019 PrestaShop SA and Contributors
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/OSL-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-2019 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
namespace PrestaShop\Module\BlockReassurance\Addons;
use Doctrine\Common\Cache\FilesystemCache;
use DOMDocument;
use DOMNode;
use DOMXPath;
use GuzzleHttp\Message\Request;
use GuzzleHttp\Subscriber\Cache\CacheStorage;
use GuzzleHttp\Subscriber\Cache\CacheSubscriber;
use PrestaShop\CircuitBreaker\AdvancedCircuitBreakerFactory;
use PrestaShop\CircuitBreaker\Contract\FactoryInterface;
use PrestaShop\CircuitBreaker\Contract\FactorySettingsInterface;
use PrestaShop\CircuitBreaker\FactorySettings;
use PrestaShop\CircuitBreaker\Storage\DoctrineCache;
use Symfony\Component\CssSelector\CssSelectorConverter;
/**
* Class CategoryFetcher helps you to fetch an Addon category data. It calls the Addons
* API for name and link, and scrap the Addons platform to get its description.
* Every call is protected by a CircuitBreaker to avoid blocking the back-office.
*
* This is a copy from https://github.com/PrestaShop/productcomments/
*/
class CategoryFetcher
{
const CACHE_DURATION = 86400; // 24 hours
const ADDONS_BASE_URL = 'https://addons.prestashop.com';
const ADDONS_API_URL = 'https://api-addons.prestashop.com';
const CLOSED_ALLOWED_FAILURES = 2;
const API_TIMEOUT_SECONDS = 0.6;
/**
* The timeout is longer for Addons platform as the content is bigger (HTML content)
*/
const PLATFORM_TIMEOUT_SECONDS = 2;
const OPEN_ALLOWED_FAILURES = 1;
const OPEN_TIMEOUT_SECONDS = 1.2;
const OPEN_THRESHOLD_SECONDS = 60;
/** @var int */
private $categoryId;
/** @var array */
private $defaultData;
/** @var FactoryInterface */
private $factory;
/** @var FactorySettingsInterface */
private $apiSettings;
/** @var FactorySettingsInterface */
private $platformSettings;
/**
* @param int $categoryId
* @param array $defaultData
*/
public function __construct(
$categoryId,
array $defaultData
) {
$this->categoryId = $categoryId;
$this->defaultData = array_merge([
'id_category' => (int) $categoryId,
], $defaultData);
//Doctrine cache used for Guzzle and CircuitBreaker storage
$doctrineCache = new FilesystemCache(_PS_CACHE_DIR_ . '/addons_category');
//Init Guzzle cache
$cacheStorage = new CacheStorage($doctrineCache, null, self::CACHE_DURATION);
$cacheSubscriber = new CacheSubscriber($cacheStorage, function (Request $request) { return true; });
//Init circuit breaker factory
$storage = new DoctrineCache($doctrineCache);
$this->apiSettings = new FactorySettings(self::CLOSED_ALLOWED_FAILURES, self::API_TIMEOUT_SECONDS, 0);
$this->apiSettings
->setThreshold(self::OPEN_THRESHOLD_SECONDS)
->setStrippedFailures(self::OPEN_ALLOWED_FAILURES)
->setStrippedTimeout(self::OPEN_TIMEOUT_SECONDS)
->setStorage($storage)
->setClientOptions([
'subscribers' => [$cacheSubscriber],
'method' => 'POST',
])
;
$this->platformSettings = new FactorySettings(self::CLOSED_ALLOWED_FAILURES, self::PLATFORM_TIMEOUT_SECONDS, 0);
$this->platformSettings
->setThreshold(self::OPEN_THRESHOLD_SECONDS)
->setStrippedFailures(self::OPEN_ALLOWED_FAILURES)
->setStrippedTimeout(self::OPEN_TIMEOUT_SECONDS)
->setStorage($storage)
->setClientOptions([
'subscribers' => [$cacheSubscriber],
'method' => 'GET',
])
;
$this->factory = new AdvancedCircuitBreakerFactory();
}
/**
* @param string $isoCode Two letters iso code to identify the country (ex: en, fr, es, ...)
*
* @return array
*/
public function getData($isoCode)
{
$category = $this->getCategoryFromApi($isoCode);
$category = $this->addTracking($category, $isoCode);
$category['description'] = $this->getDescription($category);
return $category;
}
/**
* @param string $isoCode
*
* @return array
*/
private function getCategoryFromApi($isoCode)
{
$circuitBreaker = $this->factory->create($this->apiSettings);
$apiJsonResponse = $circuitBreaker->call(
self::ADDONS_API_URL . '?iso_lang=' . $isoCode, //Include language in url to correctly cache results
[
'body' => [
'method' => 'listing',
'action' => 'categories',
'version' => '1.7',
'iso_lang' => $isoCode,
],
]
);
$apiResponse = !empty($apiJsonResponse) ? json_decode($apiJsonResponse, true) : false;
$category = null;
if (false !== $apiResponse && !empty($apiResponse['module']) && empty($apiResponse['errors'])) {
$category = $this->searchCategory($apiResponse['module'], $this->categoryId);
}
return null !== $category ? $category : $this->defaultData;
}
/**
* @param array $categories
* @param int $searchedCategoryId
*
* @return array|null
*/
private function searchCategory(array $categories, $searchedCategoryId)
{
foreach ($categories as $category) {
if (!empty($category['id_category']) && $searchedCategoryId == $category['id_category']) {
return $category;
}
if (!empty($category['categories'])) {
$subCategory = $this->searchCategory($category['categories'], $searchedCategoryId);
if (null !== $subCategory) {
return $subCategory;
}
}
}
return null;
}
/**
* @param array $category
*
* @return string
*/
private function getDescription(array $category)
{
$defaultDescription = !empty($this->defaultData['description']) ? $this->defaultData['description'] : '';
//Clean link used to fetch description (no need for tracking then)
if (empty($category['clean_link'])) {
return $defaultDescription;
}
$circuitBreaker = $this->factory->create($this->platformSettings);
$categoryResponse = $circuitBreaker->call($category['clean_link']);
if (empty($categoryResponse)) {
return $defaultDescription;
}
$cssSelector = new CssSelectorConverter();
$document = new DOMDocument();
$document->loadHTML($categoryResponse);
$xpath = new DOMXPath($document);
$descriptionNode = $xpath->query($cssSelector->toXPath('#category_description'))->item(0);
$categoryDescription = '';
/** @var DOMNode $childNode */
foreach ($descriptionNode->childNodes as $childNode) {
$categoryDescription .= $childNode->ownerDocument->saveHTML($childNode);
}
return !empty($categoryDescription) ? $categoryDescription : $defaultDescription;
}
/**
* Updates link property with a correctly formatted url with tracking parameters
*
* @param array $category
* @param string $isoCode
*
* @return array
*/
private function addTracking(array $category, $isoCode)
{
if (empty($category['link'])) {
return $category;
}
$parsedUrl = parse_url($category['link']);
if (false === $parsedUrl) {
return $category;
}
$parameters = [];
if (!empty($parsedUrl['query'])) {
parse_str($parsedUrl['query'], $parameters);
}
$parameters['utm_source'] = 'back-office';
$parameters['utm_medium'] = 'modules';
$parameters['utm_campaign'] = 'back-office-' . strtoupper($isoCode);
//Clean link used to fetch description (no need for tracking then)
$category['clean_link'] = self::ADDONS_BASE_URL . $parsedUrl['path'];
$category['link'] = self::ADDONS_BASE_URL . $parsedUrl['path'] . '?' . http_build_query($parameters);
return $category;
}
}

View File

@@ -0,0 +1,24 @@
/* BLOCK #reassurance_block ******************************************************************** */
#reassurance_block {background:url(../blockreassurance/img/bg_reassurance_block.gif) repeat-x 0 0 #c3c7cb}
#reassurance_block li {
float:left;
padding:15px 10px !important;
font-size:13px;
color:#333;
text-transform:uppercase;
text-shadow:0 1px 0 #fff
}
#reassurance_block .width1 li {width:960px}
#reassurance_block .width2 li {width:470px}
#reassurance_block .width3 li {width:305px}
#reassurance_block .width4 li {width:224px}
#reassurance_block .width5 li {width:175px}
#reassurance_block li img{
float:left;
margin-right:10px;
}
#reassurance_block li span {
float:left;
padding-top:12px;
width:65%;
}

View File

@@ -0,0 +1,6 @@
drwxr-xr-x 4 30094 users 6 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1380 Oct 3 06:58 index.php
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 php
drwxr-xr-x 2 30094 users 13 Oct 6 10:16 phpstan
-rw-r--r-- 1 30094 users 1070 Oct 3 06:58 phpstan.sh

View File

@@ -0,0 +1,34 @@
<?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.
*
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <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,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 6 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 phpstan

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1832 Aug 31 2021 bootstrap.php
-rw-r--r-- 1 30094 users 220 Aug 31 2021 phpstan.neon

View File

@@ -0,0 +1,56 @@
<?php
if (!(php_sapi_name() === 'cli-server')) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}
$rootDir = getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
echo '[ERROR] Define _PS_ROOT_DIR_ with the path to PrestaShop folder' . PHP_EOL;
exit(1);
}
// Add module composer autoloader
require_once dirname(__DIR__) . '/../../vendor/autoload.php';
// Add PrestaShop composer autoload
define('_PS_ADMIN_DIR_', $rootDir . '/admin-dev/');
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_);
require_once $rootDir . '/config/defines.inc.php';
require_once $rootDir . '/config/autoload.php';
require_once $rootDir . '/config/bootstrap.php';
// Make sure loader php-parser is coming from php stan composer
$loader = new \Composer\Autoload\ClassLoader();
$loader->setPsr4('PhpParser\\', array('/composer/vendor/nikic/php-parser/lib/PhpParser'));
$loader->register(true);
// We must declare these constant in this boostrap script.
// Ignoring the error partern with this value will throw another error if not found
// during the checks.
$constantsToDefine = [
'_DB_PREFIX_',
'_PS_SSL_PORT_',
'_THEME_NAME_',
'_PARENT_THEME_NAME_',
'__PS_BASE_URI__',
'_PS_PRICE_DISPLAY_PRECISION_',
'_PS_PRICE_COMPUTE_PRECISION_',
'_PS_OS_CHEQUE_',
'_PS_OS_PAYMENT_',
'_PS_OS_PREPARATION_',
'_PS_OS_SHIPPING_',
'_PS_OS_DELIVERED_',
'_PS_OS_CANCELED_',
'_PS_OS_REFUND_',
'_PS_OS_ERROR_',
'_PS_OS_OUTOFSTOCK_',
'_PS_OS_OUTOFSTOCK_PAID_',
'_PS_OS_OUTOFSTOCK_UNPAID_',
'_PS_OS_BANKWIRE_',
'_PS_OS_PAYPAL_',
'_PS_OS_WS_PAYMENT_',
'_PS_OS_COD_VALIDATION_',
];
foreach ($constantsToDefine as $constant) {
if (!defined($constant)) {
define($constant, 'DUMMY_VALUE');
}
}

View File

@@ -0,0 +1,8 @@
parameters:
reportUnmatchedIgnoredErrors: false
bootstrap: /var/www/html/modules/blockreassurance/tests/php/phpstan/bootstrap.php
paths:
- /var/www/html/modules/blockreassurance/src
ignoreErrors:
level: 5

View File

@@ -0,0 +1,28 @@
#!/bin/bash
PS_VERSION=$1
set -e
# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
echo "Pull PrestaShop files (Tag ${PS_VERSION})"
docker rm -f temp-ps || true
docker volume rm -f ps-volume || true
docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION
# Clear previous instance of the module in the PrestaShop volume
echo "Clear previous module"
docker exec -t temp-ps rm -rf /var/www/html/modules/blockreassurance
# Run a container for PHPStan, having access to the module content and PrestaShop sources.
# This tool is outside the composer.json because of the compatibility with PHP 5.6
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
docker run --rm --volumes-from temp-ps \
-v $PWD:/var/www/html/modules/blockreassurance \
-e _PS_ROOT_DIR_=/var/www/html \
--workdir=/var/www/html/modules/blockreassurance phpstan/phpstan:0.12 \
analyse \
--configuration=/var/www/html/modules/blockreassurance/tests/phpstan/phpstan-$PS_VERSION.neon

View File

@@ -0,0 +1,13 @@
drwxr-xr-x 2 30094 users 13 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 6 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1380 Oct 3 06:58 index.php
-rw-r--r-- 1 30094 users 369 Oct 3 06:58 phpstan-1.7.1.2.neon
-rw-r--r-- 1 30094 users 280 Oct 3 06:58 phpstan-1.7.2.5.neon
-rw-r--r-- 1 30094 users 280 Oct 3 06:58 phpstan-1.7.3.4.neon
-rw-r--r-- 1 30094 users 280 Oct 3 06:58 phpstan-1.7.4.4.neon
-rw-r--r-- 1 30094 users 304 Oct 3 06:58 phpstan-1.7.5.1.neon
-rw-r--r-- 1 30094 users 304 Oct 3 06:58 phpstan-1.7.6.neon
-rw-r--r-- 1 30094 users 202 Oct 3 06:58 phpstan-1.7.7.neon
-rw-r--r-- 1 30094 users 66 Oct 3 06:58 phpstan-1.7.8.neon
-rw-r--r-- 1 30094 users 66 Oct 3 06:58 phpstan-latest.neon
-rw-r--r-- 1 30094 users 332 Oct 3 06:58 phpstan.neon

View File

@@ -0,0 +1,34 @@
<?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.
*
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <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,8 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Call to an undefined method AdminBlockListingController::ajaxRender\(\).#'
- '#Parameter \#1 \$cms of method LinkCore::getCMSLink\(\) expects CMS, int given.#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Call to an undefined method AdminBlockListingController::ajaxRender\(\).#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Call to an undefined method AdminBlockListingController::ajaxRender\(\).#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Call to an undefined method AdminBlockListingController::ajaxRender\(\).#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string|false given.#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string|false given.#'
- '#Static method ImageManagerCore::validateUpload\(\) invoked with 4 parameters, 1-3 required.#'

View File

@@ -0,0 +1,6 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
parameters:
ignoreErrors:
- '#Parameter \#1 \$value of method ControllerCore::ajaxRender\(\) expects null, string|false given.#'

View File

@@ -0,0 +1,2 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon

View File

@@ -0,0 +1,2 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon

View File

@@ -0,0 +1,11 @@
includes:
- %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
parameters:
paths:
# From PHPStan 0.12, paths to check are relative to the neon file
- ../../blockreassurance.php
- ../../classes/
- ../../controllers/
- ../../translations/
- ../../upgrade/
level: 5

View File

@@ -0,0 +1,4 @@
drwxr-xr-x 2 30094 users 4 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php
-rw-r--r-- 1 30094 users 0 Sep 2 2021 pl.php

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,5 @@
drwxr-xr-x 2 30094 users 5 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1291 Oct 3 06:58 index.php
-rw-r--r-- 1 30094 users 5656 Oct 3 06:58 upgrade-4.0.0.php
-rw-r--r-- 1 30094 users 1667 Oct 3 06:58 upgrade-5.1.0.php

View File

@@ -0,0 +1,34 @@
<?php
/**
* 2007-2019 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-2019 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,155 @@
<?php
/**
* 2007-2019 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-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param blockreassurance $module
*
* @return bool|string
*
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
function upgrade_module_4_0_0($module)
{
$tab = new Tab();
$tab->active = true;
$tab->class_name = 'AdminBlockListing';
foreach (Language::getLanguages(true) as $lang) {
$tab->name[$lang['id_lang']] = 'blockreassurance';
}
$tab->id_parent = -1;
$tab->module = 'blockreassurance';
$tab->add();
/*
** Select the reassurance_lang table values
** ps_reassurance_lang => id_reassurance, id_lang, text
*/
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'reassurance_lang`';
$reassurance_langs = Db::getInstance()->ExecuteS($sql);
/*
** Select the reassurance table values
** ps_reassurance => id_reassurance, id_shop, filename
*/
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'reassurance`';
$reassurances = Db::getInstance()->ExecuteS($sql);
$sql = [];
$sql[] = ' CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'psreassurance` (
`id_psreassurance` int(10) unsigned NOT NULL AUTO_INCREMENT,
`icon` varchar(255) NULL,
`custom_icon` varchar(255) NULL,
`status` int(10) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
`type_link` int(10) unsigned NULL,
`id_cms` int(10) unsigned NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NULL,
PRIMARY KEY (`id_psreassurance`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;';
$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'psreassurance_lang` (
`id_psreassurance` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`link` varchar(255) NOT NULL,
PRIMARY KEY (`id_psreassurance`,`id_shop`,`id_lang`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=UTF8;';
/*
** First we make a verification that the new tables are empty
*/
$sql[] = 'TRUNCATE TABLE `' . _DB_PREFIX_ . 'psreassurance`';
$sql[] = 'TRUNCATE TABLE `' . _DB_PREFIX_ . 'psreassurance_lang`';
/* This path : /modules/blockreassurance/img/".$reassurance['file_name']
** is used with the real path in the module
**
** We do the INSERT INTO to get the old module values
*/
if (!empty($reassurances)) {
foreach ($reassurances as $reassurance) {
$sql[] = 'INSERT INTO ' . _DB_PREFIX_ . 'psreassurance (id_psreassurance, icon, custom_icon, status, position, id_shop, type_link, id_cms, date_add)
VALUES (' . $reassurance['id_reassurance'] . ", '" . $module->old_path_img . $reassurance['file_name'] . "', null, 1, " . $reassurance['id_reassurance'] . ', ' . $reassurance['id_shop'] . ', null, null, now())';
}
}
if (!empty($reassurance_langs)) {
foreach ($reassurance_langs as $reassurance_lang) {
$sql[] = 'INSERT INTO ' . _DB_PREFIX_ . 'psreassurance_lang (id_psreassurance, id_lang, id_shop, title, description, link)
VALUES (' . $reassurance_lang['id_reassurance'] . ', ' . $reassurance_lang['id_lang'] . ", 1, '" . $reassurance_lang['text'] . "', '', '')";
}
}
/*
** Here we execute the SQL
*/
foreach ($sql as $query) {
if (Db::getInstance()->execute($query) == false) {
return Db::getInstance()->getMsgError();
}
}
/*
** Verification if the hooks are already registered
*/
$result = true;
foreach ([
'displayAfterBodyOpeningTag',
'displayNavFullWidth',
'displayFooterAfter',
'displayFooterBefore',
'displayReassurance',
'actionFrontControllerSetMedia',
] as $hookName) {
if (!$module->isRegisteredInHook($hookName)) {
$result &= $module->registerHook($hookName);
}
}
/*
** We set the new configuration values
*/
Configuration::updateValue('PSR_HOOK_HEADER', '0');
Configuration::updateValue('PSR_HOOK_FOOTER', '0');
Configuration::updateValue('PSR_HOOK_PRODUCT', '1');
Configuration::updateValue('PSR_HOOK_CHECKOUT', '1');
Configuration::updateValue('PSR_ICON_COLOR', '#F19D76');
Configuration::updateValue('PSR_TEXT_COLOR', '#000000');
unset($module);
return $result;
}

View File

@@ -0,0 +1,51 @@
<?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;
}
/**
* @param blockreassurance $module
*
* @return bool|string
*/
function upgrade_module_5_1_0($module)
{
$sql = [];
$sql[] = sprintf(
'DELETE FROM `%spsreassurance_lang` WHERE `id_shop` != %d',
_DB_PREFIX_,
Configuration::get('PS_SHOP_DEFAULT')
);
$sql[] = sprintf(
'ALTER TABLE `%spsreassurance_lang` DROP PRIMARY KEY, ADD PRIMARY KEY(`id_psreassurance`,`id_lang`);',
_DB_PREFIX_
);
$sql[] = sprintf('ALTER TABLE `%spsreassurance` DROP `id_shop`;', _DB_PREFIX_);
$sql[] = sprintf('ALTER TABLE `%spsreassurance_lang` DROP `id_shop`;', _DB_PREFIX_);
foreach ($sql as $query) {
if (Db::getInstance()->execute($query) === false) {
return Db::getInstance()->getMsgError();
}
}
return true;
}

View File

@@ -0,0 +1,10 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

View File

@@ -0,0 +1,10 @@
drwxr-xr-x 8 30094 users 10 Oct 6 10:16 .
drwxr-xr-x 13 30094 users 28 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 170 Aug 31 2021 .htaccess
-rw-r--r-- 1 30094 users 178 Oct 3 06:58 autoload.php
drwxr-xr-x 2 30094 users 11 Oct 6 10:16 composer
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 doctrine
drwxr-xr-x 6 30094 users 6 Oct 6 10:16 guzzlehttp
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 prestashop
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 react
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 symfony

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit9ae5bc6126673394e04fe6b9071c1662::getLoader();

View File

@@ -0,0 +1,11 @@
drwxr-xr-x 2 30094 users 11 Oct 6 10:16 .
drwxr-xr-x 8 30094 users 10 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 13420 Oct 3 06:58 ClassLoader.php
-rw-r--r-- 1 30094 users 1070 Oct 3 06:58 LICENSE
-rw-r--r-- 1 30094 users 285 Oct 3 06:58 autoload_classmap.php
-rw-r--r-- 1 30094 users 243 Apr 5 2022 autoload_files.php
-rw-r--r-- 1 30094 users 149 Oct 3 06:58 autoload_namespaces.php
-rw-r--r-- 1 30094 users 217 Oct 3 06:58 autoload_psr4.php
-rw-r--r-- 1 30094 users 1453 Oct 3 06:58 autoload_real.php
-rw-r--r-- 1 30094 users 1180 Oct 3 06:58 autoload_static.php
-rw-r--r-- 1 30094 users 3 Oct 3 06:58 installed.json

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,11 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ReassuranceActivity' => $baseDir . '/classes/ReassuranceActivity.php',
'blockreassurance' => $baseDir . '/blockreassurance.php',
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'PrestaShop\\Module\\BlockReassurance\\' => array($baseDir . '/src'),
);

View File

@@ -0,0 +1,43 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9ae5bc6126673394e04fe6b9071c1662
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9ae5bc6126673394e04fe6b9071c1662', 'loadClassLoader'), true, false);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit9ae5bc6126673394e04fe6b9071c1662', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9ae5bc6126673394e04fe6b9071c1662::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->setClassMapAuthoritative(true);
$loader->register(false);
return $loader;
}
}

View File

@@ -0,0 +1,37 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit9ae5bc6126673394e04fe6b9071c1662
{
public static $prefixLengthsPsr4 = array (
'P' =>
array (
'PrestaShop\\Module\\BlockReassurance\\' => 35,
),
);
public static $prefixDirsPsr4 = array (
'PrestaShop\\Module\\BlockReassurance\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
);
public static $classMap = array (
'ReassuranceActivity' => __DIR__ . '/../..' . '/classes/ReassuranceActivity.php',
'blockreassurance' => __DIR__ . '/../..' . '/blockreassurance.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9ae5bc6126673394e04fe6b9071c1662::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9ae5bc6126673394e04fe6b9071c1662::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9ae5bc6126673394e04fe6b9071c1662::$classMap;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 8 30094 users 10 Oct 6 10:16 ..
drwxr-xr-x 4 30094 users 11 Oct 6 10:16 cache

View File

@@ -0,0 +1,11 @@
drwxr-xr-x 4 30094 users 11 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 ..
-rw-r--r-- 1 30094 users 1065 Apr 5 2022 LICENSE
-rw-r--r-- 1 30094 users 695 Apr 5 2022 README.md
-rw-r--r-- 1 30094 users 726 Apr 5 2022 UPGRADE.md
-rw-r--r-- 1 30094 users 143 Apr 5 2022 build.properties
-rw-r--r-- 1 30094 users 4132 Apr 5 2022 build.xml
-rw-r--r-- 1 30094 users 1206 Apr 5 2022 composer.json
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 lib
-rw-r--r-- 1 30094 users 631 Apr 5 2022 phpunit.xml.dist
drwxr-xr-x 4 30094 users 4 Oct 6 10:16 tests

View File

@@ -0,0 +1,19 @@
Copyright (c) 2006-2015 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,14 @@
# Doctrine Cache
Master: [![Build Status](https://secure.travis-ci.org/doctrine/cache.png?branch=master)](http://travis-ci.org/doctrine/cache) [![Coverage Status](https://coveralls.io/repos/doctrine/cache/badge.png?branch=master)](https://coveralls.io/r/doctrine/cache?branch=master)
[![Latest Stable Version](https://poser.pugx.org/doctrine/cache/v/stable.png)](https://packagist.org/packages/doctrine/cache) [![Total Downloads](https://poser.pugx.org/doctrine/cache/downloads.png)](https://packagist.org/packages/doctrine/cache)
Cache component extracted from the Doctrine Common project.
## Changelog
### v1.2
* Added support for MongoDB as Cache Provider
* Fix namespace version reset

View File

@@ -0,0 +1,16 @@
# Upgrade to 1.4
## Minor BC Break: `Doctrine\Common\Cache\FileCache#$extension` is now `private`.
If you need to override the value of `Doctrine\Common\Cache\FileCache#$extension`, then use the
second parameter of `Doctrine\Common\Cache\FileCache#__construct()` instead of overriding
the property in your own implementation.
## Minor BC Break: file based caches paths changed
`Doctrine\Common\Cache\FileCache`, `Doctrine\Common\Cache\PhpFileCache` and
`Doctrine\Common\Cache\FilesystemCache` are using a different cache paths structure.
If you rely on warmed up caches for deployments, consider that caches generated
with `doctrine/cache` `<1.4` are not compatible with the new directory structure,
and will be ignored.

View File

@@ -0,0 +1,3 @@
# Version class and file
project.version_class = Doctrine\\Common\\Cache\\Version
project.version_file = lib/Doctrine/Common/Cache/Version.php

View File

@@ -0,0 +1,110 @@
<?xml version="1.0"?>
<project name="DoctrineCommonCache" default="build" basedir=".">
<property file="build.properties" />
<target name="php">
<exec executable="which" outputproperty="php_executable">
<arg value="php" />
</exec>
</target>
<target name="prepare">
<mkdir dir="build" />
</target>
<target name="build" depends="check-git-checkout-clean,prepare,php,composer">
<exec executable="${php_executable}">
<arg value="build/composer.phar" />
<arg value="archive" />
<arg value="--dir=build" />
</exec>
</target>
<target name="composer" depends="php,composer-check,composer-download">
<exec executable="${php_executable}">
<arg value="build/composer.phar" />
<arg value="install" />
</exec>
</target>
<target name="composer-check" depends="prepare">
<available file="build/composer.phar" property="composer.present"/>
</target>
<target name="composer-download" unless="composer.present">
<exec executable="wget">
<arg value="-Obuild/composer.phar" />
<arg value="http://getcomposer.org/composer.phar" />
</exec>
</target>
<target name="make-release" depends="check-git-checkout-clean,prepare,php">
<replace file="${project.version_file}" token="-DEV" value="" failOnNoReplacements="true" />
<exec executable="git" failonerror="true" outputproperty="current_git_branch">
<arg value="rev-parse" />
<arg value="--abbrev-ref" />
<arg value="HEAD" />
</exec>
<exec executable="${php_executable}" outputproperty="doctrine.current_version" failonerror="true">
<arg value="-r" />
<arg value="require_once '${project.version_file}';echo ${project.version_class}::VERSION;" />
</exec>
<exec executable="${php_executable}" outputproperty="doctrine.next_version" failonerror="true">
<arg value="-r" />
<arg value="$parts = explode('.', str_ireplace(array('-DEV', '-ALPHA', '-BETA'), '', '${doctrine.current_version}'));
if (count($parts) != 3) {
throw new \InvalidArgumentException('Version is assumed in format x.y.z, ${doctrine.current_version} given');
}
if ('${current_git_branch}' === 'master') {
$parts[1]++;
} else {
$parts[2]++;
}
echo implode('.', $parts);
" />
</exec>
<git-commit file="${project.version_file}" message="Release ${doctrine.current_version}" />
<git-tag version="${doctrine.current_version}" />
<replace file="${project.version_file}" token="${doctrine.current_version}" value="${doctrine.next_version}-DEV" />
<git-commit file="${project.version_file}" message="Bump version to ${doctrine.next_version}" />
</target>
<target name="check-git-checkout-clean">
<exec executable="git" failonerror="true">
<arg value="diff-index" />
<arg value="--quiet" />
<arg value="HEAD" />
</exec>
</target>
<macrodef name="git-commit">
<attribute name="file" default="NOT SET"/>
<attribute name="message" default="NOT SET"/>
<sequential>
<exec executable="git">
<arg value="add" />
<arg value="@{file}" />
</exec>
<exec executable="git">
<arg value="commit" />
<arg value="-m" />
<arg value="@{message}" />
</exec>
</sequential>
</macrodef>
<macrodef name="git-tag">
<attribute name="version" default="NOT SET" />
<sequential>
<exec executable="git">
<arg value="tag" />
<arg value="-m" />
<arg value="v@{version}" />
<arg value="v@{version}" />
</exec>
</sequential>
</macrodef>
</project>

View File

@@ -0,0 +1,37 @@
{
"name": "doctrine/cache",
"type": "library",
"description": "Caching library offering an object-oriented API for many cache backends",
"keywords": ["cache", "caching"],
"homepage": "http://www.doctrine-project.org",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
{"name": "Roman Borschel", "email": "roman@code-factory.org"},
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": "~5.5|~7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8|~5.0",
"satooshi/php-coveralls": "~0.6",
"predis/predis": "~1.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"autoload": {
"psr-4": { "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Tests\\": "tests/Doctrine/Tests" }
},
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
}
}

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 4 30094 users 11 Oct 6 10:16 ..
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 Doctrine

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 ..
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 Common

View File

@@ -0,0 +1,3 @@
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 .
drwxr-xr-x 3 30094 users 3 Oct 6 10:16 ..
drwxr-xr-x 2 30094 users 28 Oct 6 10:16 Cache

Some files were not shown because too many files have changed in this diff Show More