Adapta RGPD - Version 1.0.0

Version Description

Download this release

Release Info

Developer cesarmaeso
Plugin Icon 128x128 Adapta RGPD
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

Files changed (81) hide show
  1. adapta-rgpd.php +431 -0
  2. assets/README.md +6 -0
  3. assets/css/cookies-banner-classic-top.css +65 -0
  4. assets/css/cookies-banner-classic.css +67 -0
  5. assets/css/cookies-banner-modern-dark.css +65 -0
  6. assets/css/cookies-banner-modern-light.css +86 -0
  7. assets/css/cookies-banner.css +33 -0
  8. assets/css/inform-box-border-number.css +19 -0
  9. assets/css/inform-box-border.css +17 -0
  10. assets/css/inform-box-simple.css +6 -0
  11. assets/images/1.png +0 -0
  12. assets/images/2.png +0 -0
  13. assets/js/cookies-banner.js +42 -0
  14. assets/json/ar.json +98 -0
  15. assets/json/cl.json +62 -0
  16. assets/json/co.json +134 -0
  17. assets/json/ec.json +98 -0
  18. assets/json/es.json +252 -0
  19. assets/json/mx.json +162 -0
  20. assets/json/pe.json +106 -0
  21. assets/json/ve.json +102 -0
  22. assets/repo/README.md +6 -0
  23. includes/README.md +6 -0
  24. includes/class-admin.php +247 -0
  25. includes/class-integration.php +179 -0
  26. includes/class-pages.php +266 -0
  27. includes/class-settings.php +364 -0
  28. includes/class-ui.php +1079 -0
  29. lib/vendor/Mustache/Autoloader.php +88 -0
  30. lib/vendor/Mustache/Cache.php +36 -0
  31. lib/vendor/Mustache/Cache/AbstractCache.php +60 -0
  32. lib/vendor/Mustache/Cache/FilesystemCache.php +161 -0
  33. lib/vendor/Mustache/Cache/NoopCache.php +47 -0
  34. lib/vendor/Mustache/Compiler.php +692 -0
  35. lib/vendor/Mustache/Context.php +242 -0
  36. lib/vendor/Mustache/Engine.php +829 -0
  37. lib/vendor/Mustache/Exception.php +18 -0
  38. lib/vendor/Mustache/Exception/InvalidArgumentException.php +18 -0
  39. lib/vendor/Mustache/Exception/LogicException.php +18 -0
  40. lib/vendor/Mustache/Exception/RuntimeException.php +18 -0
  41. lib/vendor/Mustache/Exception/SyntaxException.php +41 -0
  42. lib/vendor/Mustache/Exception/UnknownFilterException.php +38 -0
  43. lib/vendor/Mustache/Exception/UnknownHelperException.php +38 -0
  44. lib/vendor/Mustache/Exception/UnknownTemplateException.php +38 -0
  45. lib/vendor/Mustache/HelperCollection.php +172 -0
  46. lib/vendor/Mustache/LICENSE +21 -0
  47. lib/vendor/Mustache/LambdaHelper.php +76 -0
  48. lib/vendor/Mustache/Loader.php +27 -0
  49. lib/vendor/Mustache/Loader/ArrayLoader.php +79 -0
  50. lib/vendor/Mustache/Loader/CascadingLoader.php +69 -0
  51. lib/vendor/Mustache/Loader/FilesystemLoader.php +135 -0
  52. lib/vendor/Mustache/Loader/InlineLoader.php +123 -0
  53. lib/vendor/Mustache/Loader/MutableLoader.php +31 -0
  54. lib/vendor/Mustache/Loader/ProductionFilesystemLoader.php +86 -0
  55. lib/vendor/Mustache/Loader/StringLoader.php +39 -0
  56. lib/vendor/Mustache/Logger.php +126 -0
  57. lib/vendor/Mustache/Logger/AbstractLogger.php +121 -0
  58. lib/vendor/Mustache/Logger/StreamLogger.php +194 -0
  59. lib/vendor/Mustache/Parser.php +317 -0
  60. lib/vendor/Mustache/Source.php +40 -0
  61. lib/vendor/Mustache/Source/FilesystemSource.php +77 -0
  62. lib/vendor/Mustache/Template.php +180 -0
  63. lib/vendor/Mustache/Tokenizer.php +327 -0
  64. license.txt +674 -0
  65. readme.txt +41 -0
  66. tests/bootstrap.php +35 -0
  67. tests/test-admin.php +36 -0
  68. tests/test-base.php +36 -0
  69. tests/test-integration.php +36 -0
  70. tests/test-pages.php +36 -0
  71. tests/test-settings.php +36 -0
  72. tests/test-shortcodes.php +36 -0
  73. views/aviso-legal.mustache +191 -0
  74. views/ayuda.mustache +59 -0
  75. views/consentimiento.mustache +43 -0
  76. views/cookies-banner.mustache +36 -0
  77. views/deber-de-informar.mustache +29 -0
  78. views/disclaimer.mustache +44 -0
  79. views/pie-de-pagina-legal.mustache +27 -0
  80. views/politica-cookies.mustache +120 -0
  81. views/politica-privacidad.mustache +320 -0
adapta-rgpd.php ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Adapta RGPD
4
+ * Plugin URI: https://superadmin.es/adapta-rgpd
5
+ * Description: Te sirve para crear tus textos legales adecuados a las regulaciones europeas de privacidad RGPD y la LOPD de España.
6
+ * Version: 1.0.0
7
+ * Author: SuperAdmin
8
+ * Author URI: https://superadmin.es
9
+ * Donate link: https://superadmin.es
10
+ * License: GPLv2
11
+ * Text Domain: argpd
12
+ * Domain Path: /languages
13
+ *
14
+ * @link https://superadmin.es
15
+ *
16
+ * @package ARGPD
17
+ * @version 1.0.0
18
+ *
19
+ */
20
+
21
+ /**
22
+ * Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
23
+ *
24
+ * This program is free software; you can redistribute it and/or modify
25
+ * it under the terms of the GNU General Public License, version 2 or, at
26
+ * your discretion, any later version, as published by the Free
27
+ * Software Foundation.
28
+ *
29
+ * This program is distributed in the hope that it will be useful,
30
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32
+ * GNU General Public License for more details.
33
+ *
34
+ * You should have received a copy of the GNU General Public License
35
+ * along with this program; if not, write to the Free Software
36
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
+ */
38
+
39
+
40
+ /**
41
+ * Autoloads files with classes when needed.
42
+ *
43
+ * @since 0.0.0
44
+ * @param string $class_name Name of the class being requested.
45
+ */
46
+ function adaptargpd_autoload_classes( $class_name ) {
47
+
48
+ // If our class doesn't have our prefix, don't load it.
49
+ if ( 0 !== strpos( $class_name, 'ARGPD_' ) ) {
50
+ return;
51
+ }
52
+
53
+ // Set up our filename.
54
+ $filename = strtolower( str_replace( '_', '-', substr( $class_name, strlen( 'ARGPD_' ) ) ) );
55
+
56
+ // Include our file.
57
+ Adapta_RGPD::include_file( 'includes/class-' . $filename );
58
+ }
59
+ spl_autoload_register( 'adaptargpd_autoload_classes' );
60
+
61
+ /**
62
+ * Main initiation class.
63
+ *
64
+ * @since 0.0.0
65
+ */
66
+ final class Adapta_RGPD {
67
+
68
+ /**
69
+ * Current version.
70
+ *
71
+ * @var string
72
+ * @since 0.0.0
73
+ */
74
+ const VERSION = '1.0.0';
75
+
76
+ /**
77
+ * URL of plugin directory.
78
+ *
79
+ * @var string
80
+ * @since 0.0.0
81
+ */
82
+ protected $url = '';
83
+
84
+ /**
85
+ * Path of plugin directory.
86
+ *
87
+ * @var string
88
+ * @since 0.0.0
89
+ */
90
+ protected $path = '';
91
+
92
+ /**
93
+ * Plugin basename.
94
+ *
95
+ * @var string
96
+ * @since 0.0.0
97
+ */
98
+ protected $basename = '';
99
+
100
+ /**
101
+ * Detailed activation error messages.
102
+ *
103
+ * @var array
104
+ * @since 0.0.0
105
+ */
106
+ protected $activation_errors = array();
107
+
108
+ /**
109
+ * Singleton instance of plugin.
110
+ *
111
+ * @var Adapta_RGPD
112
+ * @since 0.0.0
113
+ */
114
+ protected static $single_instance = null;
115
+
116
+ /**
117
+ * Instance of ARGPD_Admin
118
+ *
119
+ * @since 0.0.0
120
+ * @var ARGPD_Admin
121
+ */
122
+ protected $admin;
123
+
124
+ /**
125
+ * Instance of ARGPD_Ui
126
+ *
127
+ * @since 0.0.0
128
+ * @var ARGPD_Ui
129
+ */
130
+ protected $argpd_ui;
131
+
132
+ /**
133
+ * Instance of ARGPD_Settings
134
+ *
135
+ * @since 0.0.0
136
+ * @var ARGPD_Settings
137
+ */
138
+ protected $argpd_settings;
139
+
140
+ /**
141
+ * Instance of ARGPD_Pages
142
+ *
143
+ * @since 0.0.0
144
+ * @var ARGPD_Pages
145
+ */
146
+ protected $pages;
147
+
148
+ /**
149
+ * Instance of ARGPD_Integration
150
+ *
151
+ * @since 0.0.0
152
+ * @var ARGPD_Integration
153
+ */
154
+ protected $integration;
155
+
156
+ /**
157
+ * Creates or returns an instance of this class.
158
+ *
159
+ * @since 0.0.0
160
+ * @return Adapta_RGPD A single instance of this class.
161
+ */
162
+ public static function get_instance() {
163
+ if ( null === self::$single_instance ) {
164
+ self::$single_instance = new self();
165
+ }
166
+
167
+ return self::$single_instance;
168
+ }
169
+
170
+ /**
171
+ * Sets up our plugin.
172
+ *
173
+ * @since 0.0.0
174
+ */
175
+ protected function __construct() {
176
+ $this->basename = plugin_basename( __FILE__ );
177
+ $this->url = plugin_dir_url( __FILE__ );
178
+ $this->path = plugin_dir_path( __FILE__ );
179
+ }
180
+
181
+ /**
182
+ * Attach other plugin classes to the base plugin class.
183
+ *
184
+ * @since 0.0.0
185
+ */
186
+ public function plugin_classes() {
187
+
188
+ $this->admin = new ARGPD_Admin( $this );
189
+
190
+ $this->argpd_ui= new ARGPD_Ui($this);
191
+
192
+ $this->argpd_settings = new ARGPD_Settings( $this );
193
+
194
+ $this->pages = new ARGPD_Pages( $this );
195
+
196
+ $this->integration = new ARGPD_Integration( $this );
197
+ } // END OF PLUGIN CLASSES FUNCTION
198
+
199
+ /**
200
+ * Add hooks and filters.
201
+ * Priority needs to be
202
+ * < 10 for CPT_Core,
203
+ * < 5 for Taxonomy_Core,
204
+ * and 0 for Widgets because widgets_init runs at init priority 1.
205
+ *
206
+ * @since 0.0.0
207
+ */
208
+ public function hooks() {
209
+ add_action( 'init', array( $this, 'init' ), 0 );
210
+ }
211
+
212
+ /**
213
+ * Activate the plugin.
214
+ *
215
+ * @since 0.0.0
216
+ */
217
+ public function _activate() {
218
+
219
+ // Bail early if requirements aren't met.
220
+ if ( ! $this->check_requirements() ) {
221
+ return;
222
+ }
223
+
224
+ // Make sure any rewrite functionality has been loaded.
225
+ flush_rewrite_rules();
226
+ }
227
+
228
+
229
+
230
+ /**
231
+ * Deactivate the plugin.
232
+ * Uninstall routines should be in uninstall.php.
233
+ *
234
+ * @since 0.0.0
235
+ */
236
+ public function _deactivate() {
237
+
238
+ // Add deactivation cleanup functionality here.
239
+ // $this->argpd_settings->update_setting("renuncia", 0);
240
+ }
241
+
242
+ /**
243
+ * Init hooks
244
+ *
245
+ * @since 0.0.0
246
+ */
247
+ public function init() {
248
+
249
+ // Bail early if requirements aren't met.
250
+ if ( ! $this->check_requirements() ) {
251
+ return;
252
+ }
253
+
254
+ // Load translated strings for plugin.
255
+ load_plugin_textdomain( 'adaptargpd', false, dirname( $this->basename ) . '/languages/' );
256
+
257
+ // Initialize plugin classes.
258
+ $this->plugin_classes();
259
+ }
260
+
261
+
262
+ /**
263
+ * Check if the plugin meets requirements and
264
+ * disable it if they are not present.
265
+ *
266
+ * @since 0.0.0
267
+ *
268
+ * @return boolean True if requirements met, false if not.
269
+ */
270
+ public function check_requirements() {
271
+
272
+ // Bail early if plugin meets requirements.
273
+ if ( $this->meets_requirements() ) {
274
+ return true;
275
+ }
276
+
277
+ // Add a dashboard notice.
278
+ add_action( 'all_admin_notices', array( $this, 'requirements_not_met_notice' ) );
279
+
280
+ // Deactivate our plugin.
281
+ add_action( 'admin_init', array( $this, 'deactivate_me' ) );
282
+
283
+ // Didn't meet the requirements.
284
+ return false;
285
+ }
286
+
287
+ /**
288
+ * Deactivates this plugin, hook this function on admin_init.
289
+ *
290
+ * @since 0.0.0
291
+ */
292
+ public function deactivate_me() {
293
+
294
+ // We do a check for deactivate_plugins before calling it, to protect
295
+ // any developers from accidentally calling it too early and breaking things.
296
+ if ( function_exists( 'deactivate_plugins' ) ) {
297
+ deactivate_plugins( $this->basename );
298
+ }
299
+ }
300
+
301
+ /**
302
+ * Check that all plugin requirements are met.
303
+ *
304
+ * @since 0.0.0
305
+ *
306
+ * @return boolean True if requirements are met.
307
+ */
308
+ public function meets_requirements() {
309
+
310
+ // Do checks for required classes / functions or similar.
311
+ // Add detailed messages to $this->activation_errors array.
312
+ return true;
313
+ }
314
+
315
+ /**
316
+ * Adds a notice to the dashboard if the plugin requirements are not met.
317
+ *
318
+ * @since 0.0.0
319
+ */
320
+ public function requirements_not_met_notice() {
321
+
322
+ // Compile default message.
323
+ $default_message = sprintf( __( 'Nos Adaptamos RGPD is missing requirements and has been <a href="%s">deactivated</a>. Please make sure all requirements are available.', 'adaptargpd' ), admin_url( 'plugins.php' ) );
324
+
325
+ // Default details to null.
326
+ $details = null;
327
+
328
+ // Add details if any exist.
329
+ if ( $this->activation_errors && is_array( $this->activation_errors ) ) {
330
+ $details = '<small>' . implode( '</small><br /><small>', $this->activation_errors ) . '</small>';
331
+ }
332
+
333
+ // Output errors.
334
+ ?>
335
+ <div id="message" class="error">
336
+ <p><?php echo wp_kses_post( $default_message ); ?></p>
337
+ <?php echo wp_kses_post( $details ); ?>
338
+ </div>
339
+ <?php
340
+ }
341
+
342
+ /**
343
+ * Magic getter for our object.
344
+ *
345
+ * @since 0.0.0
346
+ *
347
+ * @param string $field Field to get.
348
+ * @throws Exception Throws an exception if the field is invalid.
349
+ * @return mixed Value of the field.
350
+ */
351
+ public function __get( $field ) {
352
+ switch ( $field ) {
353
+ case 'version':
354
+ return self::VERSION;
355
+ case 'basename':
356
+ case 'url':
357
+ case 'path':
358
+ case 'argpd_ui':
359
+ case 'argpd_settings':
360
+ case 'pages':
361
+ case 'integration':
362
+ return $this->$field;
363
+ case 'admin':
364
+ return $this->$field;
365
+ default:
366
+ throw new Exception( 'Invalid ' . __CLASS__ . ' property: ' . $field );
367
+ }
368
+ }
369
+
370
+ /**
371
+ * Include a file from the includes directory.
372
+ *
373
+ * @since 0.0.0
374
+ *
375
+ * @param string $filename Name of the file to be included.
376
+ * @return boolean Result of include call.
377
+ */
378
+ public static function include_file( $filename ) {
379
+ $file = self::dir( $filename . '.php' );
380
+ if ( file_exists( $file ) ) {
381
+ return include_once( $file );
382
+ }
383
+ return false;
384
+ }
385
+
386
+ /**
387
+ * This plugin's directory.
388
+ *
389
+ * @since 0.0.0
390
+ *
391
+ * @param string $path (optional) appended path.
392
+ * @return string Directory and path.
393
+ */
394
+ public static function dir( $path = '' ) {
395
+ static $dir;
396
+ $dir = $dir ? $dir : trailingslashit( dirname( __FILE__ ) );
397
+ return $dir . $path;
398
+ }
399
+
400
+ /**
401
+ * This plugin's url.
402
+ *
403
+ * @since 0.0.0
404
+ *
405
+ * @param string $path (optional) appended path.
406
+ * @return string URL and path.
407
+ */
408
+ public static function url( $path = '' ) {
409
+ static $url;
410
+ $url = $url ? $url : trailingslashit( plugin_dir_url( __FILE__ ) );
411
+ return $url . $path;
412
+ }
413
+ }
414
+
415
+ /**
416
+ * Grab the Adapta_RGPD object and return it.
417
+ * Wrapper for Adapta_RGPD::get_instance().
418
+ *
419
+ * @since 0.0.0
420
+ * @return Adapta_RGPD Singleton instance of plugin class.
421
+ */
422
+ function adaptargpd() {
423
+ return Adapta_RGPD::get_instance();
424
+ }
425
+
426
+ // init hooks
427
+ add_action( 'plugins_loaded', array( adaptargpd(), 'hooks' ) );
428
+
429
+ // Activation and deactivation.
430
+ register_activation_hook( __FILE__, array( adaptargpd(), '_activate' ) );
431
+ register_deactivation_hook( __FILE__, array( adaptargpd(), '_deactivate' ) );
assets/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ # Nos Adaptamos RGPD Assets #
2
+ https://superadmin.es
3
+ Copyright (c) 2018 superadmin
4
+ Licensed under the GPLv2 license.
5
+
6
+ Assets such as styles, javascript, and images.
assets/css/cookies-banner-classic-top.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .argpd-cookies{
2
+ top:0px;
3
+ position:fixed;
4
+ transition: bottom 1s;
5
+ -webkit-transition:bottom 1s; /* Safari */
6
+ z-index:999999999;
7
+ box-shadow: 0 -3px 10px rgba(0,0,0,0.1);
8
+ background-color: rgba(255,255,255,0.85);
9
+ width: 100%;
10
+ clear:both;
11
+ }
12
+
13
+ .argpd-cookies .argpd-cookies-bar{
14
+ padding: 15px;
15
+ margin-left: auto;
16
+ margin-right: auto;
17
+ max-width: 1050px;
18
+ font-family: sans-serif;
19
+ font-size: 13.5px;
20
+ }
21
+
22
+ .argpd-cookies .argpd-cookies-bar a{
23
+ color: #fff;
24
+ }
25
+
26
+ .argpd-cookies .argpd-cookies-bar a.argpd-cookies-politica {
27
+ color: #9D3D3D;
28
+ text-decoration: underline;
29
+ }
30
+
31
+ .argpd-cookies .argpd-cookies-bar button {
32
+ background-color: #9D3D3D;
33
+ color: #0080ff;
34
+ padding: 6px 18px;
35
+ float: right;
36
+ margin-left: 10px;
37
+ white-space: nowrap;
38
+ border-radius: 3px;
39
+ color: #fff;
40
+ font-weight: normal;
41
+ margin: -3px 0 0 10px;
42
+ }
43
+
44
+ /* footer */
45
+ .argpd-footer {
46
+ background-color: #333;
47
+ text-align: center;
48
+ position: absolute;
49
+ width: 100%;
50
+ }
51
+
52
+ .argpd-footer ul {
53
+ margin: 0;
54
+ padding: 10px 0;
55
+ }
56
+
57
+ .argpd-footer ul li {
58
+ display: inline-block;
59
+ list-style-type: none;
60
+ margin-right: 20px;
61
+ }
62
+
63
+ .argpd-footer ul li a {
64
+ color: #999;
65
+ }
assets/css/cookies-banner-classic.css ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .argpd-cookies{
2
+ bottom:0px;
3
+ position:fixed;
4
+ transition: bottom 1s;
5
+ -webkit-transition:bottom 1s; /* Safari */
6
+ z-index:999999999;
7
+ box-shadow: 0 -3px 10px rgba(0,0,0,0.1);
8
+ background-color: rgba(255,255,255,0.85);
9
+ width: 100%;
10
+ clear:both;
11
+ }
12
+
13
+ .argpd-cookies .argpd-cookies-bar{
14
+ padding: 15px;
15
+ margin-left: auto;
16
+ margin-right: auto;
17
+ max-width: 1050px;
18
+ font-family: sans-serif;
19
+ font-size: 13.5px;
20
+ color: #000;
21
+ }
22
+
23
+ .argpd-cookies .argpd-cookies-bar a{
24
+ color: #9D3D3D;
25
+ }
26
+
27
+ .argpd-cookies .argpd-cookies-bar a.argpd-cookies-politica {
28
+ color: #9D3D3D;
29
+ text-decoration: underline;
30
+ }
31
+
32
+ .argpd-cookies .argpd-cookies-bar button {
33
+ background-color: #9D3D3D;
34
+ color: #0080ff;
35
+ padding: 6px 18px;
36
+ float: right;
37
+ margin-left: 10px;
38
+ white-space: nowrap;
39
+ border-radius: 3px;
40
+ color: #fff;
41
+ font-weight: normal;
42
+ margin: -3px 0 0 10px;
43
+ }
44
+
45
+
46
+ /* footer */
47
+ .argpd-footer {
48
+ background-color: #333;
49
+ text-align: center;
50
+ position: absolute;
51
+ width: 100%;
52
+ }
53
+
54
+ .argpd-footer ul {
55
+ margin: 0;
56
+ padding: 10px 0;
57
+ }
58
+
59
+ .argpd-footer ul li {
60
+ display: inline-block;
61
+ list-style-type: none;
62
+ margin-right: 20px;
63
+ }
64
+
65
+ .argpd-footer ul li a {
66
+ color: #999;
67
+ }
assets/css/cookies-banner-modern-dark.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .argpd-cookies{
2
+ bottom:0px;
3
+ position:fixed;
4
+ transition: bottom 1s;
5
+ -webkit-transition:bottom 1s; /* Safari */
6
+ z-index:999999999;
7
+ background-color: rgba(0,0,0,0.85);
8
+ width: 100%;
9
+ clear:both;
10
+ }
11
+
12
+ .argpd-cookies .argpd-cookies-bar{
13
+ padding: 15px;
14
+ margin-left: auto;
15
+ margin-right: auto;
16
+ max-width: 1050px;
17
+ font-family: sans-serif;
18
+ font-size: 13.5px;
19
+ color:#fff;
20
+ }
21
+
22
+ .argpd-cookies .argpd-cookies-bar a{
23
+ color: #fff;
24
+ }
25
+
26
+ .argpd-cookies .argpd-cookies-bar a.argpd-cookies-politica {
27
+ color: #22CFBD;
28
+ text-decoration:underline;
29
+ }
30
+
31
+ .argpd-cookies .argpd-cookies-bar button {
32
+ background-color:#09BAA5;
33
+ color: #0080ff;
34
+ padding: 6px 18px;
35
+ float: right;
36
+ margin-left: 10px;
37
+ white-space: nowrap;
38
+ border-radius: 3px;
39
+ color: #fff;
40
+ font-weight: normal;
41
+ margin: -3px 0 0 10px;
42
+ }
43
+
44
+ /* footer */
45
+ .argpd-footer {
46
+ background-color: #333;
47
+ text-align: center;
48
+ position: absolute;
49
+ width: 100%;
50
+ }
51
+
52
+ .argpd-footer ul {
53
+ margin: 0;
54
+ padding: 10px 0;
55
+ }
56
+
57
+ .argpd-footer ul li {
58
+ display: inline-block;
59
+ list-style-type: none;
60
+ margin-right: 20px;
61
+ }
62
+
63
+ .argpd-footer ul li a {
64
+ color: #999;
65
+ }
assets/css/cookies-banner-modern-light.css ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .argpd-cookies{
2
+ width:100%;
3
+ min-height:43px;
4
+ margin:0 auto;
5
+ padding-left:1%;
6
+ padding-top:5px;
7
+ font-size: 1em;
8
+ clear:both;
9
+ font-weight: strong;
10
+ color: #333;
11
+ bottom:0px;
12
+ position:fixed;
13
+ left: 0px;
14
+ background-color: #FFF;
15
+ opacity:0.9;
16
+ filter:alpha(opacity=80); /* For IE8 and earlier */
17
+ transition: bottom 1s;
18
+ -webkit-transition:bottom 1s; /* Safari */
19
+ z-index:999999999;
20
+ border-top: 0.5px solid #707070;
21
+ }
22
+
23
+ .argpd-cookies .argpd-cookies-bar{
24
+ padding: 20px;
25
+ margin-left: auto;
26
+ margin-right: auto;
27
+ max-width: 1050px;
28
+ font-family: sans-serif;
29
+ font-size: 15px;
30
+ color:#707070;
31
+ }
32
+
33
+ .argpd-cookies .argpd-cookies-bar a{
34
+ color:#707070;
35
+ }
36
+
37
+ .argpd-cookies .argpd-cookies-bar a.argpd-cookies-politica {
38
+ color: #0080ff;
39
+ text-decoration:underline;
40
+ }
41
+
42
+ .argpd-cookies .argpd-cookies-bar button {
43
+ margin-left: 8px;
44
+ border: 1px solid #0080ff;
45
+ background-color: #fff;
46
+ color: #0080ff;
47
+
48
+ text-decoration: uppercase;
49
+ padding: 10px 35px;
50
+ float: right;
51
+ margin-left: 10px;
52
+ white-space: nowrap;
53
+ border-radius: 0;
54
+ font-weight: bold;
55
+ margin: -9px 0 0 0;
56
+ }
57
+
58
+ .argpd-cookies .argpd-cookies-bar button:hover,focus,active{
59
+ border: 1px solid #0080ff;
60
+ background-color: #0080ff;
61
+ color: #fff;
62
+ }
63
+
64
+
65
+ /* footer */
66
+ .argpd-footer {
67
+ background-color: #333;
68
+ text-align: center;
69
+ position: absolute;
70
+ width: 100%;
71
+ }
72
+
73
+ .argpd-footer ul {
74
+ margin: 0;
75
+ padding: 10px 0;
76
+ }
77
+
78
+ .argpd-footer ul li {
79
+ display: inline-block;
80
+ list-style-type: none;
81
+ margin-right: 20px;
82
+ }
83
+
84
+ .argpd-footer ul li a {
85
+ color: #999;
86
+ }
assets/css/cookies-banner.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .argpd-cookies{
3
+ width:100%;
4
+ min-height:43px;
5
+ margin:0 auto;
6
+ padding-left:1%;
7
+ padding-top:5px;
8
+ font-size: 1em;
9
+ clear:both;
10
+ font-weight: strong;
11
+ color: #333;
12
+ bottom:0px;
13
+ position:fixed;
14
+ left: 0px;
15
+ background-color: #FFF;
16
+ opacity:0.8;
17
+ filter:alpha(opacity=80); /* For IE8 and earlier */
18
+ transition: bottom 1s;
19
+ -webkit-transition:bottom 1s; /* Safari */
20
+ z-index:999999999;
21
+ }
22
+
23
+ .argpd-cookies:hover{
24
+ bottom:0px;
25
+ }
26
+
27
+ .argpd-cookies button {
28
+ margin-left: 8px;
29
+ border: 1px solid #0080ff;
30
+ background-color: #fff;
31
+ color: #0080ff;
32
+ text-decoration: uppercase;
33
+ }
assets/css/inform-box-border-number.css ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Background + Border + Numbers (Numeros) */
2
+
3
+
4
+ .argpd-informar {
5
+ border: 1px solid #d1d1d1;
6
+ padding: 25px 40px;
7
+ background-color: #fff;
8
+ color: #707070;
9
+ }
10
+
11
+ .argpd-informar ul {
12
+ margin-left: 1.25rem;
13
+ font-style: italic;
14
+ list-style: decimal;
15
+ color: #707070;
16
+ }
17
+
18
+
19
+
assets/css/inform-box-border.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Background + Border (Border) */
2
+
3
+ .argpd-informar {
4
+ border: 1px solid #d1d1d1;
5
+ padding: 25px 40px;
6
+ background-color: #fff;
7
+ color: #707070;
8
+ }
9
+
10
+ .argpd-informar ul {
11
+ margin-left: 1.25rem;
12
+ list-style-type: disc;
13
+ color: #707070;
14
+ }
15
+
16
+
17
+
assets/css/inform-box-simple.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+
2
+ .argpd-informar ul {
3
+ list-style-type: disc;
4
+ padding: 25px 0px;
5
+ color: #707070
6
+ }
assets/images/1.png ADDED
Binary file
assets/images/2.png ADDED
Binary file
assets/js/cookies-banner.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ jQuery(function ($) {
5
+
6
+ 'use strict';
7
+
8
+ window.Adapta_RGPD = window.Adapta_RGPD || {};
9
+
10
+
11
+ Adapta_RGPD.cookiesAceptar= () => {
12
+ localStorage.cookies_consentimiento = (localStorage.cookies_consentimiento || 0);
13
+ localStorage.cookies_consentimiento++;
14
+ $('#cookies-consentimiento').hide();
15
+ }
16
+
17
+ Adapta_RGPD.cookiesInit= () => {
18
+ if (localStorage.cookies_consentimiento>0){
19
+ $('#cookies-consentimiento').hide();
20
+ }
21
+ }
22
+
23
+ // load events
24
+ Adapta_RGPD.cargarEventos= () => {
25
+ $("#argpd-cookies-btn").click(function(){
26
+ Adapta_RGPD.cookiesAceptar();
27
+ });
28
+
29
+ }
30
+
31
+ // init
32
+ Adapta_RGPD.init = () => {
33
+
34
+ Adapta_RGPD.cargarEventos();
35
+
36
+ Adapta_RGPD.cookiesInit();
37
+ }
38
+
39
+ Adapta_RGPD.init();
40
+
41
+ });
42
+
assets/json/ar.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Buenos Aires",
4
+ "code": "AR-B"
5
+ },
6
+ {
7
+ "name": "Catamarca",
8
+ "code": "AR-K"
9
+ },
10
+ {
11
+ "name": "Chaco",
12
+ "code": "AR-H"
13
+ },
14
+ {
15
+ "name": "Chubut",
16
+ "code": "AR-U"
17
+ },
18
+ {
19
+ "name": "Ciudad Autónoma de Buenos Aires",
20
+ "code": "AR-C"
21
+ },
22
+ {
23
+ "name": "Corrientes",
24
+ "code": "AR-W"
25
+ },
26
+ {
27
+ "name": "Córdoba",
28
+ "code": "AR-X"
29
+ },
30
+ {
31
+ "name": "Entre Ríos",
32
+ "code": "AR-E"
33
+ },
34
+ {
35
+ "name": "Formosa",
36
+ "code": "AR-P"
37
+ },
38
+ {
39
+ "name": "Jujuy",
40
+ "code": "AR-Y"
41
+ },
42
+ {
43
+ "name": "La Pampa",
44
+ "code": "AR-L"
45
+ },
46
+ {
47
+ "name": "La Rioja",
48
+ "code": "AR-F"
49
+ },
50
+ {
51
+ "name": "Mendoza",
52
+ "code": "AR-M"
53
+ },
54
+ {
55
+ "name": "Misiones",
56
+ "code": "AR-N"
57
+ },
58
+ {
59
+ "name": "Neuquén",
60
+ "code": "AR-Q"
61
+ },
62
+ {
63
+ "name": "Río Negro",
64
+ "code": "AR-R"
65
+ },
66
+ {
67
+ "name": "Salta",
68
+ "code": "AR-A"
69
+ },
70
+ {
71
+ "name": "San Juan",
72
+ "code": "AR-J"
73
+ },
74
+ {
75
+ "name": "San Luis",
76
+ "code": "AR-D"
77
+ },
78
+ {
79
+ "name": "Santa Cruz",
80
+ "code": "AR-Z"
81
+ },
82
+ {
83
+ "name": "Santa Fe",
84
+ "code": "AR-S"
85
+ },
86
+ {
87
+ "name": "Santiago del Estero",
88
+ "code": "AR-G"
89
+ },
90
+ {
91
+ "name": "Tierra del Fuego",
92
+ "code": "AR-V"
93
+ },
94
+ {
95
+ "name": "Tucumán",
96
+ "code": "AR-T"
97
+ }
98
+ ]
assets/json/cl.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Aisén del General Carlos Ibañez del Campo",
4
+ "code": "CL-AI"
5
+ },
6
+ {
7
+ "name": "Antofagasta",
8
+ "code": "CL-AN"
9
+ },
10
+ {
11
+ "name": "Araucanía",
12
+ "code": "CL-AR"
13
+ },
14
+ {
15
+ "name": "Arica y Parinacota",
16
+ "code": "CL-AP"
17
+ },
18
+ {
19
+ "name": "Atacama",
20
+ "code": "CL-AT"
21
+ },
22
+ {
23
+ "name": "Bío-Bío",
24
+ "code": "CL-BI"
25
+ },
26
+ {
27
+ "name": "Coquimbo",
28
+ "code": "CL-CO"
29
+ },
30
+ {
31
+ "name": "Libertador General Bernardo O'Higgins",
32
+ "code": "CL-LI"
33
+ },
34
+ {
35
+ "name": "Los Lagos",
36
+ "code": "CL-LL"
37
+ },
38
+ {
39
+ "name": "Los Ríos",
40
+ "code": "CL-LR"
41
+ },
42
+ {
43
+ "name": "Magallanes",
44
+ "code": "CL-MA"
45
+ },
46
+ {
47
+ "name": "Maule",
48
+ "code": "CL-ML"
49
+ },
50
+ {
51
+ "name": "Región Metropolitana de Santiago",
52
+ "code": "CL-RM"
53
+ },
54
+ {
55
+ "name": "Tarapacá",
56
+ "code": "CL-TA"
57
+ },
58
+ {
59
+ "name": "Valparaíso",
60
+ "code": "CL-VS"
61
+ }
62
+ ]
assets/json/co.json ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Amazonas",
4
+ "code": "CO-AMA"
5
+ },
6
+ {
7
+ "name": "Antioquia",
8
+ "code": "CO-ANT"
9
+ },
10
+ {
11
+ "name": "Arauca",
12
+ "code": "CO-ARA"
13
+ },
14
+ {
15
+ "name": "Atlántico",
16
+ "code": "CO-ATL"
17
+ },
18
+ {
19
+ "name": "Bolívar",
20
+ "code": "CO-BOL"
21
+ },
22
+ {
23
+ "name": "Boyacá",
24
+ "code": "CO-BOY"
25
+ },
26
+ {
27
+ "name": "Caldas",
28
+ "code": "CO-CAL"
29
+ },
30
+ {
31
+ "name": "Caquetá",
32
+ "code": "CO-CAQ"
33
+ },
34
+ {
35
+ "name": "Casanare",
36
+ "code": "CO-CAS"
37
+ },
38
+ {
39
+ "name": "Cauca",
40
+ "code": "CO-CAU"
41
+ },
42
+ {
43
+ "name": "Cesar",
44
+ "code": "CO-CES"
45
+ },
46
+ {
47
+ "name": "Chocó",
48
+ "code": "CO-CHO"
49
+ },
50
+ {
51
+ "name": "Cundinamarca",
52
+ "code": "CO-CUN"
53
+ },
54
+ {
55
+ "name": "Córdoba",
56
+ "code": "CO-COR"
57
+ },
58
+ {
59
+ "name": "Distrito Capital de Bogotá",
60
+ "code": "CO-DC"
61
+ },
62
+ {
63
+ "name": "Guainía",
64
+ "code": "CO-GUA"
65
+ },
66
+ {
67
+ "name": "Guaviare",
68
+ "code": "CO-GUV"
69
+ },
70
+ {
71
+ "name": "Huila",
72
+ "code": "CO-HUI"
73
+ },
74
+ {
75
+ "name": "La Guajira",
76
+ "code": "CO-LAG"
77
+ },
78
+ {
79
+ "name": "Magdalena",
80
+ "code": "CO-MAG"
81
+ },
82
+ {
83
+ "name": "Meta",
84
+ "code": "CO-MET"
85
+ },
86
+ {
87
+ "name": "Nariño",
88
+ "code": "CO-NAR"
89
+ },
90
+ {
91
+ "name": "Norte de Santander",
92
+ "code": "CO-NSA"
93
+ },
94
+ {
95
+ "name": "Putumayo",
96
+ "code": "CO-PUT"
97
+ },
98
+ {
99
+ "name": "Quindío",
100
+ "code": "CO-QUI"
101
+ },
102
+ {
103
+ "name": "Risaralda",
104
+ "code": "CO-RIS"
105
+ },
106
+ {
107
+ "name": "San Andrés, Providencia y Santa Catalina",
108
+ "code": "CO-SAP"
109
+ },
110
+ {
111
+ "name": "Santander",
112
+ "code": "CO-SAN"
113
+ },
114
+ {
115
+ "name": "Sucre",
116
+ "code": "CO-SUC"
117
+ },
118
+ {
119
+ "name": "Tolima",
120
+ "code": "CO-TOL"
121
+ },
122
+ {
123
+ "name": "Valle del Cauca",
124
+ "code": "CO-VAC"
125
+ },
126
+ {
127
+ "name": "Vaupés",
128
+ "code": "CO-VAU"
129
+ },
130
+ {
131
+ "name": "Vichada",
132
+ "code": "CO-VID"
133
+ }
134
+ ]
assets/json/ec.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Azuay",
4
+ "code": "EC-A"
5
+ },
6
+ {
7
+ "name": "Bolívar",
8
+ "code": "EC-B"
9
+ },
10
+ {
11
+ "name": "Carchi",
12
+ "code": "EC-C"
13
+ },
14
+ {
15
+ "name": "Cañar",
16
+ "code": "EC-F"
17
+ },
18
+ {
19
+ "name": "Chimborazo",
20
+ "code": "EC-H"
21
+ },
22
+ {
23
+ "name": "Cotopaxi",
24
+ "code": "EC-X"
25
+ },
26
+ {
27
+ "name": "El Oro",
28
+ "code": "EC-O"
29
+ },
30
+ {
31
+ "name": "Esmeraldas",
32
+ "code": "EC-E"
33
+ },
34
+ {
35
+ "name": "Galápagos",
36
+ "code": "EC-W"
37
+ },
38
+ {
39
+ "name": "Guayas",
40
+ "code": "EC-G"
41
+ },
42
+ {
43
+ "name": "Imbabura",
44
+ "code": "EC-I"
45
+ },
46
+ {
47
+ "name": "Loja",
48
+ "code": "EC-L"
49
+ },
50
+ {
51
+ "name": "Los Ríos",
52
+ "code": "EC-R"
53
+ },
54
+ {
55
+ "name": "Manabí",
56
+ "code": "EC-M"
57
+ },
58
+ {
59
+ "name": "Morona-Santiago",
60
+ "code": "EC-S"
61
+ },
62
+ {
63
+ "name": "Napo",
64
+ "code": "EC-N"
65
+ },
66
+ {
67
+ "name": "Orellana",
68
+ "code": "EC-D"
69
+ },
70
+ {
71
+ "name": "Pastaza",
72
+ "code": "EC-Y"
73
+ },
74
+ {
75
+ "name": "Pichincha",
76
+ "code": "EC-P"
77
+ },
78
+ {
79
+ "name": "Santa Elena",
80
+ "code": "EC-SE"
81
+ },
82
+ {
83
+ "name": "Santo Domingo de los Tsáchilas",
84
+ "code": "EC-SD"
85
+ },
86
+ {
87
+ "name": "Sucumbíos",
88
+ "code": "EC-U"
89
+ },
90
+ {
91
+ "name": "Tungurahua",
92
+ "code": "EC-T"
93
+ },
94
+ {
95
+ "name": "Zamora-Chinchipe",
96
+ "code": "EC-Z"
97
+ }
98
+ ]
assets/json/es.json ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "A Coruña",
4
+ "code": "ES-C",
5
+ "subdivision": "Province"
6
+ },
7
+ {
8
+ "name": "Albacete",
9
+ "code": "ES-AB",
10
+ "subdivision": "Province"
11
+ },
12
+ {
13
+ "name": "Alicante",
14
+ "code": "ES-A",
15
+ "subdivision": "Province"
16
+ },
17
+ {
18
+ "name": "Almería",
19
+ "code": "ES-AL",
20
+ "subdivision": "Province"
21
+ },
22
+ {
23
+ "name": "Asturias",
24
+ "code": "ES-O",
25
+ "subdivision": "Province"
26
+ },
27
+ {
28
+ "name": "Badajoz",
29
+ "code": "ES-BA",
30
+ "subdivision": "Province"
31
+ },
32
+ {
33
+ "name": "Balears",
34
+ "code": "ES-PM",
35
+ "subdivision": "Province"
36
+ },
37
+ {
38
+ "name": "Barcelona",
39
+ "code": "ES-B",
40
+ "subdivision": "Province"
41
+ },
42
+ {
43
+ "name": "Burgos",
44
+ "code": "ES-BU",
45
+ "subdivision": "Province"
46
+ },
47
+ {
48
+ "name": "Cantabria",
49
+ "code": "ES-S",
50
+ "subdivision": "Province"
51
+ },
52
+ {
53
+ "name": "Castellón",
54
+ "code": "ES-CS",
55
+ "subdivision": "Province"
56
+ },
57
+ {
58
+ "name": "Ciudad Real",
59
+ "code": "ES-CR",
60
+ "subdivision": "Province"
61
+ },
62
+ {
63
+ "name": "Cuenca",
64
+ "code": "ES-CU",
65
+ "subdivision": "Province"
66
+ },
67
+ {
68
+ "name": "Cáceres",
69
+ "code": "ES-CC",
70
+ "subdivision": "Province"
71
+ },
72
+ {
73
+ "name": "Cádiz",
74
+ "code": "ES-CA",
75
+ "subdivision": "Province"
76
+ },
77
+ {
78
+ "name": "Córdoba",
79
+ "code": "ES-CO",
80
+ "subdivision": "Province"
81
+ },
82
+ {
83
+ "name": "Girona",
84
+ "code": "ES-GI",
85
+ "subdivision": "Province"
86
+ },
87
+ {
88
+ "name": "Granada",
89
+ "code": "ES-GR",
90
+ "subdivision": "Province"
91
+ },
92
+ {
93
+ "name": "Guadalajara",
94
+ "code": "ES-GU",
95
+ "subdivision": "Province"
96
+ },
97
+ {
98
+ "name": "Guipúzcoa",
99
+ "code": "ES-SS",
100
+ "subdivision": "Province"
101
+ },
102
+ {
103
+ "name": "Huelva",
104
+ "code": "ES-H",
105
+ "subdivision": "Province"
106
+ },
107
+ {
108
+ "name": "Huesca",
109
+ "code": "ES-HU",
110
+ "subdivision": "Province"
111
+ },
112
+ {
113
+ "name": "Jaén",
114
+ "code": "ES-J",
115
+ "subdivision": "Province"
116
+ },
117
+ {
118
+ "name": "La Rioja",
119
+ "code": "ES-LO",
120
+ "subdivision": "Province"
121
+ },
122
+ {
123
+ "name": "Las Palmas",
124
+ "code": "ES-GC",
125
+ "subdivision": "Province"
126
+ },
127
+ {
128
+ "name": "León",
129
+ "code": "ES-LE",
130
+ "subdivision": "Province"
131
+ },
132
+ {
133
+ "name": "Lleida",
134
+ "code": "ES-L",
135
+ "subdivision": "Province"
136
+ },
137
+ {
138
+ "name": "Lugo",
139
+ "code": "ES-LU",
140
+ "subdivision": "Province"
141
+ },
142
+ {
143
+ "name": "Madrid",
144
+ "code": "ES-M",
145
+ "subdivision": "Province"
146
+ },
147
+ {
148
+ "name": "Murcia",
149
+ "code": "ES-MU",
150
+ "subdivision": "Province"
151
+ },
152
+ {
153
+ "name": "Málaga",
154
+ "code": "ES-MA",
155
+ "subdivision": "Province"
156
+ },
157
+ {
158
+ "name": "Navarra",
159
+ "code": "ES-NA",
160
+ "subdivision": "Province"
161
+ },
162
+ {
163
+ "name": "Ourense",
164
+ "code": "ES-OR",
165
+ "subdivision": "Province"
166
+ },
167
+ {
168
+ "name": "Palencia",
169
+ "code": "ES-P",
170
+ "subdivision": "Province"
171
+ },
172
+ {
173
+ "name": "Pontevedra",
174
+ "code": "ES-PO",
175
+ "subdivision": "Province"
176
+ },
177
+ {
178
+ "name": "Salamanca",
179
+ "code": "ES-SA",
180
+ "subdivision": "Province"
181
+ },
182
+ {
183
+ "name": "Santa Cruz de Tenerife",
184
+ "code": "ES-TF",
185
+ "subdivision": "Province"
186
+ },
187
+ {
188
+ "name": "Segovia",
189
+ "code": "ES-SG",
190
+ "subdivision": "Province"
191
+ },
192
+ {
193
+ "name": "Sevilla",
194
+ "code": "ES-SE",
195
+ "subdivision": "Province"
196
+ },
197
+ {
198
+ "name": "Soria",
199
+ "code": "ES-SO",
200
+ "subdivision": "Province"
201
+ },
202
+ {
203
+ "name": "Tarragona",
204
+ "code": "ES-T",
205
+ "subdivision": "Province"
206
+ },
207
+ {
208
+ "name": "Teruel",
209
+ "code": "ES-TE",
210
+ "subdivision": "Province"
211
+ },
212
+ {
213
+ "name": "Toledo",
214
+ "code": "ES-TO",
215
+ "subdivision": "Province"
216
+ },
217
+ {
218
+ "name": "Valencia",
219
+ "code": "ES-V",
220
+ "subdivision": "Province"
221
+ },
222
+ {
223
+ "name": "Valladolid",
224
+ "code": "ES-VA",
225
+ "subdivision": "Province"
226
+ },
227
+ {
228
+ "name": "Vizcaya",
229
+ "code": "ES-BI",
230
+ "subdivision": "Province"
231
+ },
232
+ {
233
+ "name": "Zamora",
234
+ "code": "ES-ZA",
235
+ "subdivision": "Province"
236
+ },
237
+ {
238
+ "name": "Zaragoza",
239
+ "code": "ES-Z",
240
+ "subdivision": "Province"
241
+ },
242
+ {
243
+ "name": "Álava",
244
+ "code": "ES-VI",
245
+ "subdivision": "Province"
246
+ },
247
+ {
248
+ "name": "Ávila",
249
+ "code": "ES-AV",
250
+ "subdivision": "Province"
251
+ }
252
+ ]
assets/json/mx.json ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Distrito Federal",
4
+ "code": "MX-DIF",
5
+ "subdivision": "federal district"
6
+ },
7
+ {
8
+ "name": "Aguascalientes",
9
+ "code": "MX-AGU",
10
+ "subdivision": "state"
11
+ },
12
+ {
13
+ "name": "Baja California",
14
+ "code": "MX-BCN",
15
+ "subdivision": "state"
16
+ },
17
+ {
18
+ "name": "Baja California Sur",
19
+ "code": "MX-BCS",
20
+ "subdivision": "state"
21
+ },
22
+ {
23
+ "name": "Campeche",
24
+ "code": "MX-CAM",
25
+ "subdivision": "state"
26
+ },
27
+ {
28
+ "name": "Chiapas",
29
+ "code": "MX-CHP",
30
+ "subdivision": "state"
31
+ },
32
+ {
33
+ "name": "Chihuahua",
34
+ "code": "MX-CHH",
35
+ "subdivision": "state"
36
+ },
37
+ {
38
+ "name": "Coahuila",
39
+ "code": "MX-COA",
40
+ "subdivision": "state"
41
+ },
42
+ {
43
+ "name": "Colima",
44
+ "code": "MX-COL",
45
+ "subdivision": "state"
46
+ },
47
+ {
48
+ "name": "Durango",
49
+ "code": "MX-DUR",
50
+ "subdivision": "state"
51
+ },
52
+ {
53
+ "name": "Guanajuato",
54
+ "code": "MX-GUA",
55
+ "subdivision": "state"
56
+ },
57
+ {
58
+ "name": "Guerrero",
59
+ "code": "MX-GRO",
60
+ "subdivision": "state"
61
+ },
62
+ {
63
+ "name": "Hidalgo",
64
+ "code": "MX-HID",
65
+ "subdivision": "state"
66
+ },
67
+ {
68
+ "name": "Jalisco",
69
+ "code": "MX-JAL",
70
+ "subdivision": "state"
71
+ },
72
+ {
73
+ "name": "Michoacán",
74
+ "code": "MX-MIC",
75
+ "subdivision": "state"
76
+ },
77
+ {
78
+ "name": "Morelos",
79
+ "code": "MX-MOR",
80
+ "subdivision": "state"
81
+ },
82
+ {
83
+ "name": "México",
84
+ "code": "MX-MEX",
85
+ "subdivision": "state"
86
+ },
87
+ {
88
+ "name": "Nayarit",
89
+ "code": "MX-NAY",
90
+ "subdivision": "state"
91
+ },
92
+ {
93
+ "name": "Nuevo León",
94
+ "code": "MX-NLE",
95
+ "subdivision": "state"
96
+ },
97
+ {
98
+ "name": "Oaxaca",
99
+ "code": "MX-OAX",
100
+ "subdivision": "state"
101
+ },
102
+ {
103
+ "name": "Puebla",
104
+ "code": "MX-PUE",
105
+ "subdivision": "state"
106
+ },
107
+ {
108
+ "name": "Querétaro",
109
+ "code": "MX-QUE",
110
+ "subdivision": "state"
111
+ },
112
+ {
113
+ "name": "Quintana Roo",
114
+ "code": "MX-ROO",
115
+ "subdivision": "state"
116
+ },
117
+ {
118
+ "name": "San Luis Potosí",
119
+ "code": "MX-SLP",
120
+ "subdivision": "state"
121
+ },
122
+ {
123
+ "name": "Sinaloa",
124
+ "code": "MX-SIN",
125
+ "subdivision": "state"
126
+ },
127
+ {
128
+ "name": "Sonora",
129
+ "code": "MX-SON",
130
+ "subdivision": "state"
131
+ },
132
+ {
133
+ "name": "Tabasco",
134
+ "code": "MX-TAB",
135
+ "subdivision": "state"
136
+ },
137
+ {
138
+ "name": "Tamaulipas",
139
+ "code": "MX-TAM",
140
+ "subdivision": "state"
141
+ },
142
+ {
143
+ "name": "Tlaxcala",
144
+ "code": "MX-TLA",
145
+ "subdivision": "state"
146
+ },
147
+ {
148
+ "name": "Veracruz",
149
+ "code": "MX-VER",
150
+ "subdivision": "state"
151
+ },
152
+ {
153
+ "name": "Yucatán",
154
+ "code": "MX-YUC",
155
+ "subdivision": "state"
156
+ },
157
+ {
158
+ "name": "Zacatecas",
159
+ "code": "MX-ZAC",
160
+ "subdivision": "state"
161
+ }
162
+ ]
assets/json/pe.json ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Amazonas",
4
+ "code": "PE-AMA"
5
+ },
6
+ {
7
+ "name": "Ancash",
8
+ "code": "PE-ANC"
9
+ },
10
+ {
11
+ "name": "Apurímac",
12
+ "code": "PE-APU"
13
+ },
14
+ {
15
+ "name": "Arequipa",
16
+ "code": "PE-ARE"
17
+ },
18
+ {
19
+ "name": "Ayacucho",
20
+ "code": "PE-AYA"
21
+ },
22
+ {
23
+ "name": "Cajamarca",
24
+ "code": "PE-CAJ"
25
+ },
26
+ {
27
+ "name": "Cusco",
28
+ "code": "PE-CUS"
29
+ },
30
+ {
31
+ "name": "El Callao",
32
+ "code": "PE-CAL"
33
+ },
34
+ {
35
+ "name": "Huancavelica",
36
+ "code": "PE-HUV"
37
+ },
38
+ {
39
+ "name": "Huánuco",
40
+ "code": "PE-HUC"
41
+ },
42
+ {
43
+ "name": "Ica",
44
+ "code": "PE-ICA"
45
+ },
46
+ {
47
+ "name": "Junín",
48
+ "code": "PE-JUN"
49
+ },
50
+ {
51
+ "name": "La Libertad",
52
+ "code": "PE-LAL"
53
+ },
54
+ {
55
+ "name": "Lambayeque",
56
+ "code": "PE-LAM"
57
+ },
58
+ {
59
+ "name": "Lima",
60
+ "code": "PE-LIM"
61
+ },
62
+ {
63
+ "name": "Loreto",
64
+ "code": "PE-LOR"
65
+ },
66
+ {
67
+ "name": "Madre de Dios",
68
+ "code": "PE-MDD"
69
+ },
70
+ {
71
+ "name": "Moquegua",
72
+ "code": "PE-MOQ"
73
+ },
74
+ {
75
+ "name": "Municipalidad Metropolitana de Lima",
76
+ "code": "PE-LMA"
77
+ },
78
+ {
79
+ "name": "Pasco",
80
+ "code": "PE-PAS"
81
+ },
82
+ {
83
+ "name": "Piura",
84
+ "code": "PE-PIU"
85
+ },
86
+ {
87
+ "name": "Puno",
88
+ "code": "PE-PUN"
89
+ },
90
+ {
91
+ "name": "San Martín",
92
+ "code": "PE-SAM"
93
+ },
94
+ {
95
+ "name": "Tacna",
96
+ "code": "PE-TAC"
97
+ },
98
+ {
99
+ "name": "Tumbes",
100
+ "code": "PE-TUM"
101
+ },
102
+ {
103
+ "name": "Ucayali",
104
+ "code": "PE-UCA"
105
+ }
106
+ ]
assets/json/ve.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "Amazonas",
4
+ "code": "VE-Z"
5
+ },
6
+ {
7
+ "name": "Anzoátegui",
8
+ "code": "VE-B"
9
+ },
10
+ {
11
+ "name": "Apure",
12
+ "code": "VE-C"
13
+ },
14
+ {
15
+ "name": "Aragua",
16
+ "code": "VE-D"
17
+ },
18
+ {
19
+ "name": "Barinas",
20
+ "code": "VE-E"
21
+ },
22
+ {
23
+ "name": "Bolívar",
24
+ "code": "VE-F"
25
+ },
26
+ {
27
+ "name": "Carabobo",
28
+ "code": "VE-G"
29
+ },
30
+ {
31
+ "name": "Cojedes",
32
+ "code": "VE-H"
33
+ },
34
+ {
35
+ "name": "Delta Amacuro",
36
+ "code": "VE-Y"
37
+ },
38
+ {
39
+ "name": "Dependencias Federales",
40
+ "code": "VE-W"
41
+ },
42
+ {
43
+ "name": "Distrito Capital",
44
+ "code": "VE-A"
45
+ },
46
+ {
47
+ "name": "Falcón",
48
+ "code": "VE-I"
49
+ },
50
+ {
51
+ "name": "Guárico",
52
+ "code": "VE-J"
53
+ },
54
+ {
55
+ "name": "Lara",
56
+ "code": "VE-K"
57
+ },
58
+ {
59
+ "name": "Miranda",
60
+ "code": "VE-M"
61
+ },
62
+ {
63
+ "name": "Monagas",
64
+ "code": "VE-N"
65
+ },
66
+ {
67
+ "name": "Mérida",
68
+ "code": "VE-L"
69
+ },
70
+ {
71
+ "name": "Nueva Esparta",
72
+ "code": "VE-O"
73
+ },
74
+ {
75
+ "name": "Portuguesa",
76
+ "code": "VE-P"
77
+ },
78
+ {
79
+ "name": "Sucre",
80
+ "code": "VE-R"
81
+ },
82
+ {
83
+ "name": "Trujillo",
84
+ "code": "VE-T"
85
+ },
86
+ {
87
+ "name": "Táchira",
88
+ "code": "VE-S"
89
+ },
90
+ {
91
+ "name": "Vargas",
92
+ "code": "VE-X"
93
+ },
94
+ {
95
+ "name": "Yaracuy",
96
+ "code": "VE-U"
97
+ },
98
+ {
99
+ "name": "Zulia",
100
+ "code": "VE-V"
101
+ }
102
+ ]
assets/repo/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ # Nos Adaptamos RGPD Repo Assets #
2
+ https://superadmin.es
3
+ Copyright (c) 2018 superadmin
4
+ Licensed under the GPLv2 license.
5
+
6
+ Assets such as screenshots and banner for WordPress.org plugin repository listing.
includes/README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ # Nos Adaptamos RGPD Includes #
2
+ https://superadmin.es
3
+ Copyright (c) 2018 superadmin
4
+ Licensed under the GPLv2 license.
5
+
6
+ Additional PHP functionality goes here.
includes/class-admin.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ARGPD
4
+ * @subpackage Admin
5
+ * @since 0.0.0
6
+ *
7
+ * @author César Maeso <superadmin@superadmin.es>
8
+ *
9
+ * @copyright (c) 2018, César Maeso (https://superadmin.es)
10
+ */
11
+
12
+ /**
13
+ * Admin class.
14
+ *
15
+ * @since 0.0.0
16
+ */
17
+ class ARGPD_Admin {
18
+
19
+ /**
20
+ * Parent plugin class.
21
+ *
22
+ * @var string
23
+ * @since 0.0.0
24
+ */
25
+ protected $plugin = null;
26
+
27
+ /**
28
+ * plugin title
29
+ *
30
+ * @var string
31
+ * @since 0.0.0
32
+ */
33
+ protected $title = "Adapta RGPD";
34
+
35
+ /**
36
+ * plugin menu title
37
+ *
38
+ * @var string
39
+ * @since 0.0.0
40
+ */
41
+ protected $menu_title = "Adapta RGPD";
42
+
43
+ /**
44
+ * key
45
+ *
46
+ * @var string
47
+ * @since 0.0.0
48
+ */
49
+ protected $key= 'argpd';
50
+
51
+ /**
52
+ * Constructor.
53
+ *
54
+ * @since 0.0.0
55
+ *
56
+ * @param Main plugin object.
57
+ */
58
+ public function __construct( $plugin ) {
59
+ $this->plugin = $plugin;
60
+ $this->hooks();
61
+ }
62
+
63
+ /**
64
+ * Initiate our hooks.
65
+ *
66
+ * @since 0.0.0
67
+ */
68
+ public function hooks() {
69
+
70
+ if ( is_admin()){
71
+ // add menu page
72
+ add_action( 'admin_menu', array($this, 'add_menu_page'));
73
+
74
+ // action to save settings from setup
75
+ add_action( 'admin_post_argpd_setup', array($this, 'setup'));
76
+
77
+ // action to save settings from pages setup
78
+ add_action( 'admin_post_argpd_pages_setup', array($this, 'pages_setup'));
79
+
80
+ // accept disclaimer
81
+ add_action( 'admin_post_argpd_disclaimer', array($this, 'accept_disclaimer'));
82
+
83
+ // add settings to plugin menu
84
+ add_filter( 'plugin_action_links_' . $this->plugin->basename, array($this, 'plugin_add_settings_link'));
85
+ }
86
+ }
87
+
88
+
89
+ /**
90
+ * Add main menu
91
+ *
92
+ * @since 0.0.0
93
+ */
94
+ public function add_menu_page() {
95
+
96
+ add_menu_page(
97
+ $this->title,
98
+ $this->menu_title,
99
+ 'manage_options',
100
+ $this->key,
101
+ array($this, 'admin_page_display'),
102
+ 'dashicons-welcome-write-blog'
103
+ );
104
+ }
105
+
106
+
107
+ /**
108
+ * Add admin user interface
109
+ *
110
+ * @since 0.0.0
111
+ */
112
+ public function admin_page_display(){
113
+
114
+ if ( !current_user_can( 'manage_options' ) ) {
115
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
116
+ }
117
+
118
+ $this->plugin->argpd_ui->options_ui();
119
+ }
120
+
121
+
122
+ /**
123
+ * Accept Disclaimer
124
+ *
125
+ * @since 0.0.0
126
+ */
127
+ public function accept_disclaimer(){
128
+
129
+ if (!current_user_can('manage_options') || !check_admin_referer('argpd')){
130
+ wp_die( __( 'No tienes permisos.' ) );
131
+ }
132
+
133
+ // update disclaimer setting
134
+ $this->plugin->argpd_settings->update_setting("renuncia", 1);
135
+
136
+ // create default pages
137
+ $this->plugin->pages->create_all();
138
+
139
+ // redirect
140
+ wp_redirect(add_query_arg(
141
+ array ( 'page' => 'argpd',
142
+ 'message' => null),
143
+ admin_url('admin.php?page=argpd')
144
+ ));
145
+ }
146
+
147
+
148
+ /**
149
+ *
150
+ * Save settings from pages setup
151
+ *
152
+ * @since 0.0.0
153
+ */
154
+ public function pages_setup(){
155
+
156
+ if (!current_user_can('manage_options') || !check_admin_referer('argpd')){
157
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
158
+ }
159
+
160
+
161
+ $this->plugin->argpd_settings->update_setting("avisolegalID", $_POST['avisolegal']);
162
+ $this->plugin->argpd_settings->update_setting("privacidadID", $_POST['privacidad']);
163
+ $this->plugin->argpd_settings->update_setting("cookiesID", $_POST['cookies']);
164
+
165
+ $option_comments= isset($_POST['option-comments'])?1:0;
166
+ $this->plugin->argpd_settings->update_setting("option-comments", $option_comments);
167
+
168
+ $option_cookies= isset($_POST['option-cookies'])?1:0;
169
+ $this->plugin->argpd_settings->update_setting("option-cookies", $option_cookies);
170
+
171
+ $option_forms= isset($_POST['option-forms'])?1:0;
172
+ $this->plugin->argpd_settings->update_setting("option-forms", $option_forms);
173
+
174
+ $option_footer= isset($_POST['option-footer'])?1:0;
175
+ $this->plugin->argpd_settings->update_setting("option-footer", $option_footer);
176
+
177
+ // labels
178
+ $this->plugin->argpd_settings->update_setting("cookies-label", $_POST['cookies-label']);
179
+ $this->plugin->argpd_settings->update_setting("consentimiento-label", $_POST['consentimiento-label']);
180
+
181
+ // themes
182
+ $this->plugin->argpd_settings->update_setting("cookies-theme", $_POST['cookies-theme']);
183
+ $this->plugin->argpd_settings->update_setting("informbox-theme", $_POST['informbox-theme']);
184
+
185
+
186
+ // set message and redirect
187
+ $message= "saved";
188
+ wp_redirect(add_query_arg(
189
+ array ( 'page' => 'argpd',
190
+ 'message' => $message),
191
+ admin_url('admin.php?page=argpd&tab=paginas')
192
+ ));
193
+ }
194
+
195
+
196
+ /**
197
+ *
198
+ * Save settings from setup
199
+ *
200
+ * @since 0.0.0
201
+ */
202
+ public function setup(){
203
+
204
+ if (!current_user_can('manage_options') || !check_admin_referer('argpd')){
205
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
206
+ }
207
+
208
+ // reset settings
209
+ $settings= $this->plugin->argpd_settings->reset();
210
+ $settings= $this->plugin->argpd_settings->get_settings();
211
+
212
+ // save every setting
213
+ foreach ($settings as $name => $text) {
214
+ if ( isset( $_POST[$name] )){
215
+ $this->plugin->argpd_settings->update_setting($name, $_POST[$name]);
216
+ }
217
+ }
218
+
219
+ // set message and redirect
220
+ $message= "saved";
221
+ wp_redirect(add_query_arg(
222
+ array ( 'page' => 'argpd',
223
+ 'message' => $message),
224
+ admin_url('admin.php?page=argpd&tab=ajustes')
225
+ ));
226
+ }
227
+
228
+
229
+ /**
230
+ *
231
+ * Add settings to plugin menu
232
+ *
233
+ * @since 0.0.0
234
+ */
235
+ public function plugin_add_settings_link($links){
236
+ $settings = '<a href="admin.php?page=argpd">' . __( 'Settings' ) . '</a>';
237
+
238
+ if ( ! empty( $links ) ) {
239
+ array_unshift( $links, $settings );
240
+ } else {
241
+ $links = array( $settings );
242
+ }
243
+
244
+ return $links;
245
+ }
246
+
247
+ }
includes/class-integration.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ARGPD
4
+ * @subpackage Integration
5
+ * @since 0.0.0
6
+ *
7
+ * @author César Maeso <superadmin@superadmin.es>
8
+ *
9
+ * @copyright (c) 2018, César Maeso (https://superadmin.es)
10
+ */
11
+
12
+ /**
13
+ * Integration class.
14
+ *
15
+ * @since 0.0.0
16
+ */
17
+ class ARGPD_Integration {
18
+
19
+ /**
20
+ * Parent plugin class.
21
+ *
22
+ * @var string
23
+ * @since 0.0.0
24
+ */
25
+ protected $plugin = null;
26
+
27
+
28
+ /**
29
+ * Constructor.
30
+ *
31
+ * @since 0.0.0
32
+ *
33
+ * @param Main plugin object.
34
+ */
35
+ public function __construct( $plugin ) {
36
+
37
+ // set parent plugin
38
+ $this->plugin = $plugin;
39
+
40
+ // register scripts and styles
41
+ $this->register();
42
+
43
+ // initiate our hooks
44
+ $this->hooks();
45
+ }
46
+
47
+
48
+ /**
49
+ * Register scripts and Styles for cookies banner
50
+ *
51
+ * @since 0.0.0
52
+ */
53
+ public function register(){
54
+
55
+ /* Register JavaScript */
56
+ wp_register_script( 'argpd-cookies-banner', $this->plugin->url . 'assets/js/cookies-banner.js', array(
57
+ 'jquery'
58
+ ), $this->plugin->version );
59
+
60
+ /* Register Style */
61
+ $settings= $this->plugin->argpd_settings->get_settings();
62
+ wp_register_style( 'argpd-cookies-banner',
63
+ //$this->plugin->url . 'assets/css/cookies-banner.css',
64
+ sprintf("%sassets/css/cookies-banner-%s.css", $this->plugin->url, $settings['cookies-theme']),
65
+ array(),
66
+ $this->plugin->version );
67
+
68
+ /* Register Style duty to inform */
69
+ wp_register_style( 'argpd-informbox',
70
+ sprintf("%sassets/css/inform-box-%s.css", $this->plugin->url, $settings['informbox-theme']),
71
+ array(),
72
+ $this->plugin->version );
73
+ }
74
+
75
+
76
+ /**
77
+ * Initiate our hooks.
78
+ *
79
+ * @since 0.0.0
80
+ */
81
+ public function hooks() {
82
+
83
+ $settings= $this->plugin->argpd_settings->get_settings();
84
+
85
+ if ($settings['option-footer']){
86
+ add_action('wp_footer', array($this, 'show_footer_links'));
87
+ }
88
+
89
+ // enque theme styles
90
+ wp_enqueue_style( 'argpd-cookies-banner' );
91
+
92
+ // add hooks if option-comments option is checked
93
+ if ($settings['option-comments']) while(true){
94
+
95
+ // disable if jetpack-comments is active
96
+ if (class_exists('Jetpack') && Jetpack::is_module_active( 'comments')) break;
97
+
98
+ add_action('pre_comment_on_post', array($this, 'check_consentimiento'));
99
+ add_filter('comment_form_submit_field', array($this, 'addField'));
100
+ break;
101
+ }
102
+
103
+ // add hooks if option-cookies option is checked
104
+ if ($settings['option-cookies']){
105
+ add_action('wp_enqueue_scripts', array($this, 'enqueue'));
106
+ add_action('wp_footer', array($this, 'cookiesbanner_footer'));
107
+ }
108
+
109
+ // add hooks if have a duty to inform
110
+ if ($settings['option-cookies'] || $settings['option-forms']){
111
+ // add css styles
112
+ wp_enqueue_style( 'argpd-informbox' );
113
+ }
114
+ }
115
+
116
+
117
+ /**
118
+ * Engueue scripts and styles
119
+ *
120
+ * @since 0.0.0
121
+ */
122
+ public function enqueue(){
123
+
124
+ /**
125
+ * Allows to disable enqueuing files on a particular page
126
+ */
127
+ $enqueue_agrpd = apply_filters( 'wp_agrpd_enqueue', true );
128
+
129
+ // Enqueue Scripts
130
+ wp_enqueue_script( 'argpd-cookies-banner' );
131
+
132
+ // Enqueue Styles
133
+ //wp_enqueue_style( 'argpd-cookies-banner' );
134
+ }
135
+
136
+
137
+ /**
138
+ * Add view for comment form submit
139
+ *
140
+ * @since 0.0.0
141
+ */
142
+ public function addField($submitField = '') {
143
+ $consentimiento_view= $this->plugin->pages->consentimiento_view();
144
+ $deber_de_informar_view= $this->plugin->pages->deber_de_informar_view();
145
+ return $consentimiento_view . $deber_de_informar_view . $submitField;
146
+ }
147
+
148
+
149
+ /**
150
+ * Test if privacy is checked in comments
151
+ *
152
+ * @since 0.0.0
153
+ */
154
+ public function check_consentimiento() {
155
+ if (!isset($_POST['agdpr-consentimiento'])) {
156
+ wp_die( __( 'Para poder comentar debes aceptar la política de privacidad.' ) );
157
+ }
158
+ }
159
+
160
+
161
+ /**
162
+ * Echo cookies banner
163
+ *
164
+ * @since 0.0.0
165
+ */
166
+ public function cookiesbanner_footer() {
167
+ echo $this->plugin->pages->cookiesbanner_view();
168
+ }
169
+
170
+ /**
171
+ * Echo cookies banner
172
+ *
173
+ * @since 1.0.0
174
+ */
175
+ public function show_footer_links() {
176
+ echo $this->plugin->pages->footer_links_view();
177
+ }
178
+
179
+ }
includes/class-pages.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ARGPD
4
+ * @subpackage Pages
5
+ * @since 0.0.0
6
+ *
7
+ * @author César Maeso <superadmin@superadmin.es>
8
+ *
9
+ * @copyright (c) 2018, César Maeso (https://superadmin.es)
10
+ */
11
+
12
+ /**
13
+ * Pages class.
14
+ *
15
+ * @since 0.0.0
16
+ */
17
+ class ARGPD_Pages {
18
+
19
+ /**
20
+ * Parent plugin class.
21
+ *
22
+ * @var string
23
+ * @since 0.0.0
24
+ */
25
+ protected $plugin = null;
26
+
27
+ /**
28
+ * Parent plugin class.
29
+ *
30
+ * @var class
31
+ * @since 0.0.0
32
+ */
33
+ protected $compiler = null;
34
+
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @since 0.0.0
39
+ *
40
+ * @param Main plugin object.
41
+ */
42
+ public function __construct( $plugin ) {
43
+
44
+ // set parent plugin
45
+ $this->plugin = $plugin;
46
+
47
+ // Init mustache
48
+ if (!class_exists('Mustache_Autoloader')) {
49
+ require_once(dirname(__FILE__)."/../lib/vendor/Mustache/Autoloader.php");
50
+ Mustache_autoloader::register();
51
+ }
52
+
53
+ // Init template engine
54
+ $this->compiler= new Mustache_Engine(
55
+ array(
56
+ 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__)."/../views")
57
+ ));
58
+
59
+ // initiate our hooks
60
+ $this->hooks();
61
+ }
62
+
63
+
64
+ /**
65
+ * Initiate our hooks.
66
+ *
67
+ * @since 0.0.0
68
+ */
69
+ public function hooks(){
70
+
71
+ // create shortcodes for main views
72
+ add_shortcode('argpd_aviso-legal', function(){
73
+ return $this->aviso_legal();
74
+ });
75
+
76
+ add_shortcode('argpd_politica-cookies', function(){
77
+ return $this->politica_cookies();
78
+ });
79
+
80
+ add_shortcode('argpd_politica-privacidad', function(){
81
+ return $this->politica_privacidad();
82
+ });
83
+
84
+ add_shortcode('argpd_consentimiento', function(){
85
+ return $this->consentimiento_view();
86
+ });
87
+
88
+ add_shortcode('argpd_deber_de_informar', function(){
89
+ return $this->deber_de_informar_view();
90
+ });
91
+
92
+
93
+ // filter legal pages
94
+ add_filter('the_content', function($content){
95
+
96
+ $page_id= get_the_ID();
97
+ $settings= $this->plugin->argpd_settings->get_settings();
98
+ switch (get_the_ID()){
99
+ case $settings['avisolegalID']:
100
+ $content= $this->aviso_legal().$content;
101
+ break;
102
+ case $settings['privacidadID']:
103
+ $content= $this->politica_privacidad().$content;
104
+ break;
105
+ case $settings['cookiesID']:
106
+ $content= $this->politica_cookies().$content;
107
+ break;
108
+ default:
109
+ break;
110
+ }
111
+ return $content;
112
+ });
113
+ }
114
+
115
+
116
+ /**
117
+ * Create Legal Pages
118
+ *
119
+ * @since 0.0.0
120
+ */
121
+ public function create_all(){
122
+
123
+ $id= $this->create_page("Aviso Legal");
124
+ ($id != 0) && $this->plugin->argpd_settings->update_setting('avisolegalID', $id);
125
+
126
+ $id= $this->create_page("Política de Privacidad");
127
+ ($id != 0) && $this->plugin->argpd_settings->update_setting('privacidadID', $id);
128
+
129
+ $id= $this->create_page("Política de Cookies");
130
+ ($id != 0) && $this->plugin->argpd_settings->update_setting('cookiesID', $id);
131
+ }
132
+
133
+
134
+ /**
135
+ * Create Page by Name
136
+ *
137
+ * @param string $name page title
138
+ *
139
+ * @return int the page_id if created else 0
140
+ */
141
+ public function create_page($name){
142
+
143
+ if (!get_page_by_title($name)){
144
+ $page = array(
145
+ 'post_content' => '',
146
+ 'post_title' => $name,
147
+ 'post_status' => 'publish',
148
+ 'post_parent' => 0,
149
+ 'post_type' => 'page'
150
+ );
151
+
152
+ return wp_insert_post( $page );
153
+ }
154
+ return 0;
155
+ }
156
+
157
+
158
+ /**
159
+ * Render "Aviso Legal" Page
160
+ *
161
+ * @since 0.0.0
162
+ * @return string
163
+ */
164
+ public function aviso_legal(){
165
+ $settings= $this->plugin->argpd_settings->get_settings();
166
+ return $this->compiler->render('aviso-legal', $settings );
167
+ }
168
+
169
+
170
+ /**
171
+ * Render Disclaimer Page
172
+ *
173
+ * @since 0.0.0
174
+ * @return string
175
+ */
176
+ public function disclaimer(){
177
+ return $this->compiler->render('disclaimer', null );
178
+ }
179
+
180
+
181
+ /**
182
+ * Render "Politica de cookies" Page
183
+ *
184
+ * @since 0.0.0
185
+ * @return string
186
+ */
187
+ public function politica_cookies(){
188
+ $settings= $this->plugin->argpd_settings->get_settings();
189
+ return $this->compiler->render('politica-cookies', $settings );
190
+ }
191
+
192
+
193
+ /**
194
+ * Render "Politica de privacidad" Page
195
+ *
196
+ * @since 0.0.0
197
+ * @return string
198
+ */
199
+ public function politica_privacidad(){
200
+ $settings= $this->plugin->argpd_settings->get_settings();
201
+ return $this->compiler->render('politica-privacidad', $settings );
202
+ }
203
+
204
+
205
+ /**
206
+ * Render "consentimiento" View
207
+ *
208
+ * @since 0.0.0
209
+ * @return string
210
+ */
211
+ public function consentimiento_view(){
212
+ $settings= $this->plugin->argpd_settings->get_settings();
213
+ return $this->compiler->render('consentimiento', $settings );
214
+ }
215
+
216
+
217
+ /**
218
+ * Render "Deber de informar" View
219
+ *
220
+ * @since 0.0.0
221
+ * @return string
222
+ */
223
+ public function deber_de_informar_view(){
224
+ $settings= $this->plugin->argpd_settings->get_settings();
225
+ return $this->compiler->render('deber-de-informar', $settings );
226
+ }
227
+
228
+
229
+ /**
230
+ * Render Help Page
231
+ *
232
+ * @since 0.0.0
233
+ * @return string
234
+ */
235
+ public function ayuda_view(){
236
+ $settings= array(
237
+ 'url' => $this->plugin->url,
238
+ );
239
+ return $this->compiler->render('ayuda', $settings );
240
+ }
241
+
242
+ /**
243
+ * Render cookies banner
244
+ *
245
+ * @since 0.0.0
246
+ * @return string
247
+ */
248
+ public function cookiesbanner_view(){
249
+ $settings= $this->plugin->argpd_settings->get_settings();
250
+ return $this->compiler->render('cookies-banner', $settings );
251
+ }
252
+
253
+
254
+
255
+ /**
256
+ * Render footer links
257
+ *
258
+ * @since 1.0.0
259
+ * @return string
260
+ */
261
+ public function footer_links_view(){
262
+ $settings= $this->plugin->argpd_settings->get_settings();
263
+ return $this->compiler->render('pie-de-pagina-legal', $settings );
264
+ }
265
+
266
+ }
includes/class-settings.php ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ARGPD
4
+ * @subpackage Settings
5
+ * @since 0.0.0
6
+ *
7
+ * @author César Maeso <superadmin@superadmin.es>
8
+ *
9
+ * @copyright (c) 2018, César Maeso (https://superadmin.es)
10
+ */
11
+
12
+ /**
13
+ * Settings class.
14
+ *
15
+ * @since 0.0.0
16
+ */
17
+ class ARGPD_Settings {
18
+
19
+ /**
20
+ * Parent plugin class.
21
+ *
22
+ * @var string
23
+ * @since 0.0.0
24
+ */
25
+ protected $plugin = null;
26
+
27
+ /**
28
+ * key
29
+ *
30
+ * @var string
31
+ * @since 0.0.0
32
+ */
33
+ protected $key= 'argpd';
34
+
35
+ /**
36
+ * themes
37
+ *
38
+ * @var string
39
+ * @since 0.0.0
40
+ */
41
+ protected $informbox_themes= null;
42
+
43
+ /**
44
+ * themes
45
+ *
46
+ * @var string
47
+ * @since 0.0.0
48
+ */
49
+ protected $cookie_themes= null;
50
+
51
+ /**
52
+ * countries
53
+ *
54
+ * @var string
55
+ * @since 0.0.0
56
+ */
57
+ protected $countries= null;
58
+
59
+ /**
60
+ * states
61
+ *
62
+ * @var string
63
+ * @since 0.0.0
64
+ */
65
+ protected $states= null;
66
+
67
+
68
+ /**
69
+ * settings array
70
+ *
71
+ * @var string
72
+ * @since 0.0.0
73
+ */
74
+ protected $settings = array(
75
+ 'renuncia' => 0,
76
+ // pages
77
+ 'avisolegalID' => 0,
78
+ 'privacidadID' => 0,
79
+ 'cookiesID' => 0,
80
+ 'avisolegalURL' => '',
81
+ 'privacidadURL' => '',
82
+ 'cookiesURL' => '',
83
+ 'cookies-label' => '',
84
+ 'cookies-theme' => 'modern-light',
85
+ 'consentimiento-label' => '',
86
+ 'informbox-theme' => 'simple',
87
+ // owner
88
+ 'dominio' => '',
89
+ 'titular' => '',
90
+ 'id-fiscal' => '',
91
+ 'domicilio' => '',
92
+ 'provincia' => '',
93
+ 'provincia-code' => '',
94
+ 'pais' => 'ES',
95
+ 'pais-nombre' => '',
96
+ 'pais-ue' => 1,
97
+ 'correo' => '',
98
+ // settings
99
+ 'finalidad' => '',
100
+ 'hosting-info' => '',
101
+ // options
102
+ 'option-comments' => 0,
103
+ 'option-cookies' => 0,
104
+ 'option-forms' => 0,
105
+ 'option-footer' => 0,
106
+ // clauses
107
+ 'clause-exclusion' => 0,
108
+ 'clause-thirdparty' => 0,
109
+ 'clause-edad' => 0,
110
+ 'clause-terceros' => 0,
111
+ 'clause-protegidos' => 0,
112
+ 'clause-portabilidad' => 0,
113
+ // thirdparty
114
+ 'thirdparty-dclick' => 0,
115
+ 'thirdparty-ganalytics' => 0,
116
+ 'thirdparty-social' => 0,
117
+ 'thirdparty-mailchimp' => 0,
118
+ );
119
+
120
+
121
+ /**
122
+ * Constructor.
123
+ *
124
+ * @since 0.0.0
125
+ *
126
+ * @param Main plugin object.
127
+ */
128
+ public function __construct( $plugin ) {
129
+
130
+ $this->informbox_themes= [
131
+ 'simple' => __('Simple', 'argpd'),
132
+ 'border' => __('Con borde', 'argpd'),
133
+ 'border-number' => __('Borde + Números', 'argpd'),
134
+ ];
135
+
136
+ $this->cookie_themes= [
137
+ 'classic' => __('Clásico', 'argpd'),
138
+ 'classic-top' => __('Clásico en parte superior', 'argpd'),
139
+ 'modern-light' => __('Moderno Claro', 'argpd'),
140
+ 'modern-dark' => __('Moderno Oscuro', 'argpd'),
141
+ ];
142
+
143
+ $this->countries= [
144
+ 'AR' => __('Argentina', 'argpd'),
145
+ 'CO' => __('Colombia', 'argpd'),
146
+ 'CL' => __('Chile', 'argpd'),
147
+ 'EC' => __('Ecuador', 'argpd'),
148
+ 'ES' => __('España', 'argpd'),
149
+ 'MX' => __('Méjico', 'argpd'),
150
+ 'PE' => __('Perú', 'argpd'),
151
+ 'VE' => __('Venezuela', 'argpd'),
152
+ ];
153
+
154
+
155
+ $this->plugin = $plugin;
156
+
157
+ $this->init_settings();
158
+ }
159
+
160
+
161
+ /**
162
+ * Init settings.
163
+ *
164
+ * @since 0.0.0
165
+ */
166
+ function init_settings() {
167
+
168
+ // get all settings
169
+ foreach ($this->settings as $name => $text) {
170
+ $value= get_option(sprintf("%s_%s", $this->key, $name));
171
+ if ($value){
172
+ $this->settings[$name]= $value;
173
+ }
174
+ }
175
+
176
+ // set domain value
177
+ $this->settings['dominio']= get_site_url();
178
+
179
+ // get legal pages permalinks
180
+ $cookiesID= intval($this->settings['cookiesID']);
181
+ if (is_int($cookiesID) && $cookiesID >0) {
182
+ $this->settings['cookiesURL']= get_permalink($cookiesID);
183
+ }
184
+
185
+ $avisolegalID= intval($this->settings['avisolegalID']);
186
+ if (is_int($avisolegalID) && $avisolegalID >0) {
187
+ $this->settings['avisolegalURL']= get_permalink($avisolegalID);
188
+ }
189
+
190
+ $privacidadID= intval($this->settings['privacidadID']);
191
+ if (is_int($privacidadID) && $privacidadID >0) {
192
+ $this->settings['privacidadURL']= get_permalink($privacidadID);
193
+ }
194
+
195
+
196
+ $this->convert_regional_codes();
197
+ }
198
+
199
+
200
+ private function convert_regional_codes(){
201
+
202
+ // convert cc2 to string
203
+ $cc2= $this->settings['pais'];
204
+ foreach ($this->countries as $key => $value) {
205
+ if ($key == $cc2){
206
+ $this->settings['pais-nombre']= $value;
207
+ }
208
+ }
209
+
210
+ // is ue country
211
+ $this->settings['pais-ue']= ($cc2 == 'ES')?1:0;
212
+
213
+
214
+ // convert state-cc2 to string
215
+ $state_code= $this->settings['provincia-code'];
216
+ $states= $this->get_states($cc2);
217
+ foreach ($states as $i) {
218
+ if ($i['code'] == $state_code){
219
+ $this->settings['provincia']= $i['name'];
220
+ }
221
+ }
222
+ }
223
+
224
+
225
+
226
+
227
+ /**
228
+ * Reset settings.
229
+ *
230
+ * @since 0.0.0
231
+ */
232
+ public function reset(){
233
+
234
+ $this->update_setting('clause-exclusion', 0);
235
+ $this->update_setting('clause-terceros', 0);
236
+ $this->update_setting('clause-edad', 0);
237
+ $this->update_setting('clause-protegidos', 0);
238
+ $this->update_setting('clause-portabilidad', 0);
239
+
240
+ $this->update_setting('thirdparty-dclick', 0);
241
+ $this->update_setting('thirdparty-ganalytics', 0);
242
+ $this->update_setting('thirdparty-social', 0);
243
+ $this->update_setting('thirdparty-mailchimp', 0);
244
+ }
245
+
246
+
247
+ /**
248
+ * Returns all settings
249
+ *
250
+ * @return array
251
+ *
252
+ */
253
+ function get_settings(){
254
+ return $this->settings;
255
+ }
256
+
257
+ /**
258
+ * Returns themes
259
+ *
260
+ * @return array
261
+ *
262
+ */
263
+ function get_cookie_themes(){
264
+ return $this->cookie_themes;
265
+ }
266
+
267
+ /**
268
+ * Returns themes
269
+ *
270
+ * @return array
271
+ *
272
+ */
273
+ function get_informbox_themes(){
274
+ return $this->informbox_themes;
275
+ }
276
+
277
+ /**
278
+ * Returns countries
279
+ *
280
+ * @return array
281
+ *
282
+ */
283
+ function get_countries(){
284
+ return $this->countries;
285
+ }
286
+
287
+
288
+ /**
289
+ * Returns states
290
+ *
291
+ * @return array
292
+ *
293
+ */
294
+ function get_states($country){
295
+
296
+ $fn= sprintf("%s/../assets/json/%s.json", dirname(__FILE__), strtolower($country));
297
+ if (file_exists($fn)){
298
+ $str= file_get_contents($fn);
299
+ $json = json_decode($str, true);
300
+
301
+ // catch error
302
+ if ($json === null && json_last_error() !== JSON_ERROR_NONE) {
303
+ return array();
304
+ }
305
+
306
+ $states= array();
307
+ foreach($json as $state){
308
+ //array_push($states, $state['name']);
309
+ array_push($states, array('name' => $state['name'], 'code' => $state['code']));
310
+ }
311
+ return $states;
312
+ }
313
+
314
+ return array();
315
+ }
316
+
317
+
318
+ /**
319
+ * Returns the value of given setting key, based on if network settings are enabled or not
320
+ *
321
+ * @param string $name Setting to fetch
322
+ * @param string $default Default Value
323
+ *
324
+ * @return bool|mixed|void
325
+ *
326
+ */
327
+ function get_setting( $name = '', $default = false ) {
328
+
329
+ //return "prueba";
330
+ if( empty( $name ) ) {
331
+ return false;
332
+ }
333
+
334
+ return $this->settings[$name];
335
+ }
336
+
337
+
338
+ /**
339
+ * Update value for given setting key
340
+ *
341
+ * @param string $name Key
342
+ * @param string $value Value
343
+ *
344
+ * @return bool If the setting was updated or not
345
+ */
346
+ function update_setting( $name = '', $value = '' ) {
347
+
348
+ if( empty( $name ) ) {
349
+ return false;
350
+ }
351
+
352
+ $value= trim(sanitize_text_field($value));
353
+
354
+ if (update_site_option(sprintf("%s_%s", $this->key, $name), $value)){
355
+ $this->settings[$name]= $value;
356
+ //
357
+ ($name == 'provincia-code' || $name == 'pais') && $this->convert_regional_codes();
358
+ //
359
+ return true;
360
+ }
361
+ return false;
362
+ }
363
+
364
+ }
includes/class-ui.php ADDED
@@ -0,0 +1,1079 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ARGPD
4
+ * @subpackage Ui
5
+ * @since 0.0.0
6
+ *
7
+ * @author César Maeso <superadmin@superadmin.es>
8
+ *
9
+ * @copyright (c) 2018, César Maeso (https://superadmin.es)
10
+ */
11
+
12
+ /**
13
+ * Ui class.
14
+ *
15
+ * @since 0.0.0
16
+ */
17
+ class ARGPD_Ui {
18
+
19
+ /**
20
+ * Parent plugin class.
21
+ *
22
+ * @var string
23
+ * @since 0.0.0
24
+ */
25
+ protected $plugin = null;
26
+
27
+
28
+ /**
29
+ * Constructor.
30
+ *
31
+ * @since 0.0.0
32
+ *
33
+ * @param Main plugin object.
34
+ */
35
+ public function __construct( $plugin ) {
36
+
37
+ // set parent plugin
38
+ $this->plugin = $plugin;
39
+
40
+ // initiate our hooks
41
+ $this->hooks();
42
+ }
43
+
44
+ /**
45
+ * Initiate our hooks.
46
+ *
47
+ * @since 0.0.0
48
+ */
49
+ public function hooks() {
50
+
51
+ // config tab
52
+ add_action('argpd_settings_tab', array($this, 'argpd_ajustes_tab'), 1);
53
+ add_action('argpd_settings_content', array($this, 'argpd_ajustes_content'));
54
+
55
+
56
+ // pages tab
57
+ add_action('argpd_settings_tab', array($this, 'argpd_paginas_tab'), 1);
58
+ add_action('argpd_settings_content', array($this, 'argpd_paginas_content'));
59
+
60
+ // ayuda
61
+ add_action('argpd_settings_tab', array($this, 'argpd_ayuda_tab'), 1);
62
+ add_action('argpd_settings_content', array($this, 'argpd_ayuda_content'));
63
+
64
+ // ajax scripts
65
+ add_action( 'admin_footer', array($this, 'argpd_change_country' ));
66
+ add_action( 'wp_ajax_argpd_get_states', array($this, 'argpd_get_states' ));
67
+ }
68
+
69
+
70
+
71
+
72
+
73
+ function argpd_change_country() { ?>
74
+
75
+ <script type="text/javascript" >
76
+
77
+ var ajaxurl = '<?php echo admin_url("admin-ajax.php"); ?>';
78
+
79
+ jQuery(document).ready(function($) {
80
+
81
+ $('body').on('change', '.countries', function() {
82
+ var countryid = $(this).val();
83
+ if(countryid != '') {
84
+ var data = {
85
+ action: 'argpd_get_states',
86
+ country: countryid,
87
+ 'security': '<?php echo wp_create_nonce("load_states"); ?>'
88
+ }
89
+
90
+ $('.load-state').html("<span><?php _e('cargando...','argpd');?></span>");
91
+ $.post(ajaxurl, data, function(response) {
92
+ $('.load-state').html(response);
93
+ });
94
+ }
95
+ });
96
+ });
97
+ </script>
98
+ <?php }
99
+
100
+
101
+
102
+ function argpd_get_states(){
103
+ check_ajax_referer('load_states', 'security');
104
+ $country = $_POST['country'];
105
+
106
+ $settings= $this->plugin->argpd_settings;
107
+ $states= $settings->get_states($country);
108
+ ?>
109
+ <select name="provincia-code" id="provincia-code">
110
+ <option value="" selected="selected">Selecciona</option>
111
+ <?php
112
+ foreach ($states as $i) {
113
+ printf("<option value=\"%s\" %s>%s</option>",
114
+ $i['code'],
115
+ ($i['code'] == $settings->get_setting('provincia-code'))?("selected=\"selected\""):"",
116
+ $i['name']);
117
+ }
118
+ ?>
119
+ </select>
120
+
121
+ <?php
122
+ wp_die();
123
+ }
124
+
125
+
126
+
127
+ /**
128
+ * Echo 'Titular' tab of plugin settings
129
+ *
130
+ * @since 0.0.0
131
+ */
132
+ public function argpd_ajustes_tab(){
133
+ global $argpd_active_tab;
134
+ ?>
135
+ <a class="nav-tab <?php echo $argpd_active_tab == 'ajustes' || '' ? 'nav-tab-active' : ''; ?>"
136
+ href="<?php echo admin_url( 'admin.php?page=argpd&tab=ajustes' ); ?>">
137
+ <?php _e( 'Titular', 'argpd' ); ?>
138
+ </a>
139
+ <?php
140
+ }
141
+
142
+
143
+ /**
144
+ * Echo 'Titular' content of plugin settings
145
+ *
146
+ * @since 0.0.0
147
+ */
148
+ public function argpd_ajustes_content(){
149
+ global $argpd_active_tab;
150
+ if ( '' || 'ajustes' != $argpd_active_tab )
151
+ return;
152
+
153
+ $settings= $this->plugin->argpd_settings;
154
+ ?>
155
+
156
+
157
+ <form method="post" action="admin-post.php" style="padding-top: 20px">
158
+ <?php wp_nonce_field( 'argpd' ); ?>
159
+ <input type="hidden" value="argpd_setup" name="action"/>
160
+
161
+ <div>
162
+ <h2 class="title"><?php _e( 'Sobre el Titular', 'argpd' ); ?></h2>
163
+ <p>
164
+ Aquí añades información sobre el titular (Persona física o empresa) y sobre la Web.
165
+ </p>
166
+
167
+ <p>
168
+ Pulsa <b>Guardar cambios</b> para actualizar el contenido de las páginas de <i>Aviso Legal</i>, <i>Política de Privacidad</i> y <i>Política de Cookies</i>.
169
+ </p>
170
+ </div>
171
+
172
+
173
+ <table class="form-table">
174
+ <tbody>
175
+
176
+ <?php /* Titular */ ?>
177
+ <tr>
178
+ <th scope="row">
179
+ <label for="titular"><?php _e('Nombre del Titular', 'argpd');?></label>
180
+ </th>
181
+ <td>
182
+
183
+ <input type="text"
184
+ name="titular"
185
+ value="<?php echo $settings->get_setting('titular'); ?>"
186
+ />
187
+ <p class="description">
188
+ Nombre del titular o denominación social si es una empresa
189
+ </p>
190
+ </td>
191
+ </tr>
192
+
193
+ <?php /* Identificador fiscal */?>
194
+ <tr>
195
+ <th scope="row">
196
+ <label for="id-fiscal"><?php _e('Identificador Fiscal', 'argpd');?></label>
197
+ </th>
198
+ <td>
199
+
200
+ <input type="text"
201
+ name="id-fiscal"
202
+ value="<?php echo $settings->get_setting('id-fiscal'); ?>"
203
+ />
204
+ <p class="description">
205
+ NIF o CIF del titular
206
+ </p>
207
+ </td>
208
+ </tr>
209
+
210
+ <?php /* Domicilio */?>
211
+ <tr>
212
+ <th scope="row">
213
+ <label for="domicilio"><?php _e('Domicilio', 'argpd');?></label>
214
+ </th>
215
+ <td>
216
+
217
+ <input type="text"
218
+ name="domicilio"
219
+ value="<?php echo $settings->get_setting('domicilio'); ?>"
220
+ />
221
+ <p>
222
+
223
+ <span class="load-state">
224
+ <select name="provincia-code" id="provincia-code">
225
+ <option value="" selected="selected">Selecciona</option>
226
+ <?php
227
+ //$provincias= $settings->get_states();
228
+ $country= $settings->get_setting('pais');
229
+ $states= $settings->get_states($country);
230
+ foreach ($states as $i) {
231
+ printf("<option value=\"%s\" %s>%s</option>",
232
+ $i['code'],
233
+ ($i['code'] == $settings->get_setting('provincia-code'))?("selected=\"selected\""):"",
234
+ $i['name']);
235
+ }
236
+ ?>
237
+ </select>
238
+
239
+ </span>
240
+
241
+ <select name="pais" id="pais" class="countries">
242
+ <?php
243
+ $countries= $settings->get_countries();
244
+ foreach ($countries as $key => $value) {
245
+ printf("<option value=\"%s\" %s>%s</option>",
246
+ $key,
247
+ ($key == $settings->get_setting('pais'))?("selected=\"selected\""):"",
248
+ $value);
249
+ }
250
+ ?>
251
+ </select>
252
+ </p>
253
+
254
+ <p class="description">
255
+ Domicilio del titular o Domicilio Fiscal
256
+ </p>
257
+ </td>
258
+ </tr>
259
+
260
+
261
+ <?php /* correo electrónico */?>
262
+ <tr>
263
+ <th scope="row">
264
+ <label for="correo"><?php _e('Correo electrónico', 'argpd');?></label>
265
+ </th>
266
+ <td>
267
+
268
+ <input type="text"
269
+ name="correo"
270
+ value="<?php echo $settings->get_setting('correo'); ?>"
271
+ />
272
+ <p class="description">
273
+ Es la dirección de correo para contactar y dónde los usuarios van a poder ejercer sus derechos.
274
+ </p>
275
+ </td>
276
+ </tr>
277
+ </tbody>
278
+ </table>
279
+ <?php submit_button(); ?>
280
+
281
+ <?php /* Sobre el sitio web */ ?>
282
+ <div>
283
+ <h2 class="title"><?php _e( 'Sobre el sitio Web', 'argpd' ); ?></h2>
284
+ <p>
285
+ En este apartado configurás datos de tu sitio web.
286
+ </p>
287
+ </div>
288
+ <table class="form-table">
289
+ <tbody>
290
+ <tr>
291
+ <th scope="row">
292
+ <?php _e('URL del sitio', 'argpd');?>
293
+ </th>
294
+ <td>
295
+ <?php echo $settings->get_setting('dominio'); ?>
296
+ </td>
297
+ </tr>
298
+ <tr>
299
+ <th scope="row">
300
+ <label for="finalidad"><?php _e('Finalidad', 'argpd');?></label>
301
+ </th>
302
+ <td>
303
+ <textarea
304
+ name="finalidad"
305
+ id="finalidad"
306
+ cols="40"
307
+ rows="3"
308
+ ><?php echo $settings->get_setting('finalidad'); ?></textarea>
309
+ <p class="description">
310
+ Añade una descripción de la finalidad de este sitio web.
311
+ </p>
312
+ <p class="description">
313
+ Por ejemplo: Informar sobre Tecnología o vender zapatos.
314
+ </p>
315
+ <br/>
316
+ </td>
317
+ </tr>
318
+ <tr>
319
+ <th scope="row">
320
+ <label for="hosting-info"><?php _e('Alojamiento', 'argpd');?></label>
321
+ </th>
322
+ <td>
323
+
324
+ <input type="text"
325
+ name="hosting-info"
326
+ value="<?php echo $settings->get_setting('hosting-info'); ?>"
327
+ />
328
+ <p class="description">
329
+ Indica tu proveedor de alojamiento o hosting y un enlace a su política de privacidad.
330
+ </p>
331
+ </td>
332
+ </tr>
333
+ <tr>
334
+ <th scope="row">
335
+ <label for="pais"><?php _e('Servicios de Terceros', 'argpd');?></label>
336
+ </th>
337
+ <td>
338
+ <label for="thirdparty-dclick">
339
+ <input name="thirdparty-dclick"
340
+ type="checkbox"
341
+ id="thirdparty-dclick"
342
+ value="1"
343
+ <?php ($settings->get_setting('thirdparty-dclick') == 1) && printf("checked"); ?>
344
+ >
345
+ <?php _e('DoubleClick', 'argpd'); ?>
346
+ </label>
347
+ <p class="description">
348
+ Marcar si el sitio usa DoubleClick.
349
+ </p>
350
+ <br/>
351
+ <label for="thirdparty-ganalytics">
352
+ <input name="thirdparty-ganalytics"
353
+ type="checkbox"
354
+ id="thirdparty-ganalytics"
355
+ value="1"
356
+ <?php ($settings->get_setting('thirdparty-ganalytics') == 1) && printf("checked"); ?>
357
+ >
358
+ <?php _e('Google Analytics', 'argpd'); ?>
359
+ </label>
360
+ <p class="description">
361
+ Marcar si el sitio utiliza Google Analytics
362
+ <?php echo $settings->get_setting('thirdparty-ganalytics'); ?>
363
+ </p>
364
+ <br/>
365
+
366
+ <?php /* thidparte social */ ?>
367
+ <label for="thirdparty-social">
368
+ <input name="thirdparty-social"
369
+ type="checkbox"
370
+ id="thirdparty-social"
371
+ value="1"
372
+ <?php ($settings->get_setting('thirdparty-social') == 1) && printf("checked"); ?>
373
+ >
374
+ <?php _e('Redes Sociales', 'argpd');?>
375
+ </label>
376
+ <p class="description">
377
+ Marcar si el sitio utiliza redes sociales para publicar, likes, comentarios,...
378
+ </p>
379
+ <br/>
380
+
381
+ <?php /* thirdparty mailchimp */ ?>
382
+ <label for="thirdparty-mailchimp">
383
+ <input name="thirdparty-mailchimp"
384
+ type="checkbox"
385
+ id="thirdparty-mailchimp"
386
+ value="1"
387
+ <?php ($settings->get_setting('thirdparty-mailchimp') == 1) && printf("checked"); ?>
388
+ >
389
+ <?php _e('Mailchimp', 'argpd');?>
390
+ </label>
391
+ <p class="description">
392
+ Marcar si el sitio utiliza Mailchimp.
393
+ </p>
394
+ <br/>
395
+
396
+ </td>
397
+ </tr>
398
+ </tbody>
399
+ </table>
400
+ <?php submit_button(); ?>
401
+
402
+ <?php /* Más ajustes */?>
403
+ <div>
404
+ <h2 class="title"><?php _e( 'Más Ajustes', 'argpd' ); ?></h2>
405
+ <p>
406
+ Algunos ajustes más del sitio.
407
+ </p>
408
+ </div>
409
+ <table class="form-table">
410
+ <tbody>
411
+ <tr>
412
+ <th scope="row">
413
+ <label for="pais"><?php _e('Cláusulas', 'argpd');?></label>
414
+ </th>
415
+ <td>
416
+ <label for="clause-exclusion">
417
+ <input name="clause-exclusion"
418
+ type="checkbox"
419
+ id="clause-exclusion"
420
+ value="1"
421
+ <?php ($settings->get_setting('clause-exclusion') == 1) && printf("checked"); ?>
422
+ >
423
+ <?php _e('Cláusula de exclusión', 'argpd'); ?>
424
+ </label>
425
+ <p class="description">
426
+ Añadir una cláusula para reservar el Derecho de exclusión.
427
+ </p>
428
+ <br/>
429
+ <label for="clause-terceros">
430
+ <input name="clause-terceros"
431
+ type="checkbox"
432
+ id="clause-terceros"
433
+ value="1"
434
+ <?php ($settings->get_setting('clause-terceros') == 1) && printf("checked"); ?>
435
+ >
436
+ <?php _e('Cesión de datos a terceros', 'argpd'); ?>
437
+ </label>
438
+ <p class="description">
439
+ Añádir una cláusula para permitir la cesión a terceros.
440
+ </p>
441
+ <br/>
442
+
443
+ <?php /* clausula mayoría edad */ ?>
444
+ <label for="clause-edad">
445
+ <input name="clause-edad"
446
+ type="checkbox"
447
+ id="clause-edad"
448
+ value="1"
449
+ <?php ($settings->get_setting('clause-edad') == 1) && printf("checked"); ?>
450
+ >
451
+ <?php _e('Requisito mayoría edad', 'argpd');?>
452
+ </label>
453
+ <p class="description">
454
+ Añádir una cláusula para requerir una edad mínima.
455
+ </p>
456
+ <p class="description">
457
+ Marca esta opción si página web esta destianada sólo a mayores de edad.
458
+ </p>
459
+ <br/>
460
+
461
+ <?php /* clausula protected data */ ?>
462
+ <label for="clause-protegidos">
463
+ <input name="clause-protegidos"
464
+ type="checkbox"
465
+ id="clause-protegidos"
466
+ value="1"
467
+ <?php ($settings->get_setting('clause-protegidos') == 1) && printf("checked"); ?>
468
+ >
469
+ <?php _e('Datos especialmente protegidos', 'argpd');?>
470
+ </label>
471
+ <p class="description">
472
+ Marcar si se recogen datos especialmento protegidos (médicos, religión, orientación sexual,...)
473
+ </p>
474
+ <br/>
475
+
476
+ <?php /* clausula portabilidad */ ?>
477
+ <label for="clause-portabilidad">
478
+ <input name="clause-portabilidad"
479
+ type="checkbox"
480
+ id="clause-portabilidad"
481
+ value="1"
482
+ <?php ($settings->get_setting('clause-portabilidad') == 1) && printf("checked"); ?>
483
+ >
484
+ <?php _e('Portabilidad de datos', 'argpd');?>
485
+ </label>
486
+ <p class="description">
487
+ Marcar para permitir la portabilidad de datos.
488
+ </p>
489
+ <br/>
490
+ </td>
491
+ </tr>
492
+ </tbody>
493
+ </table>
494
+
495
+
496
+ <?php submit_button(); ?>
497
+ </form>
498
+ <?php
499
+ }
500
+
501
+
502
+ /**
503
+ * Echo 'Integracion' tab of plugin settings
504
+ *
505
+ * @since 0.0.0
506
+ */
507
+ public function argpd_paginas_tab(){
508
+ global $argpd_active_tab;
509
+ ?>
510
+ <a class="nav-tab <?php echo $argpd_active_tab == 'paginas' || '' ? 'nav-tab-active' : ''; ?>"
511
+ href="<?php echo admin_url( 'admin.php?page=argpd&tab=paginas' ); ?>">
512
+ <?php _e( 'Integración', 'argpd' ); ?>
513
+ </a>
514
+ <?php
515
+ }
516
+
517
+
518
+ /**
519
+ * Echo 'Integracion' content of plugin settings
520
+ *
521
+ * @since 0.0.0
522
+ */
523
+ public function argpd_paginas_content(){
524
+ global $argpd_active_tab;
525
+ if ( 'paginas' != $argpd_active_tab )
526
+ return;
527
+
528
+ $settings= $this->plugin->argpd_settings;
529
+ ?>
530
+
531
+ <div>
532
+ <h2 class="title"><?php _e( 'Páginas Legales', 'argpd' ); ?></h2>
533
+ <p>
534
+ El plugin ya ha creado las páginas legales al activarse.
535
+ </p>
536
+ <p>
537
+ Desde este apartado puedes activar, desactivar o cambiar
538
+ la página dónde quieres que aparezca cada texto legal.
539
+ </p>
540
+ <p>
541
+ Para desactivar un texto legal selecciona "Ninguna" en la columna <i>Página</i> y guarda los cambios.
542
+ </p>
543
+ </div>
544
+
545
+ <form method="post" action="admin-post.php" style="padding-top: 20px">
546
+ <div>
547
+
548
+ <?php wp_nonce_field( 'argpd' ); ?>
549
+ <input type="hidden" value="argpd_pages_setup" name="action"/>
550
+
551
+ <table class="wp-list-table widefat fixed striped posts">
552
+ <thead>
553
+ <tr>
554
+ <td>Texto Legal</td>
555
+ <td>Página</td>
556
+ <td>Código Abreviado</td>
557
+ <td>Ayuda</td>
558
+ </tr>
559
+ </thead>
560
+ <tbody>
561
+
562
+ <?php /* Aviso Legal */?>
563
+ <tr>
564
+ <th scope="row">
565
+ <label for="avisolegal"><?php _e('Aviso Legal', 'argpd');?></label>
566
+ <?php if ($settings->get_setting('avisolegalID') != 0) { ?>
567
+ <div class="row-actions">
568
+ <span class="view">
569
+ <?php
570
+ printf("<a href=\"%s?page_id=%s\">%s</a>",
571
+ get_site_url(),
572
+ $settings->get_setting('avisolegalID'),
573
+ "Ver"
574
+ );
575
+ ?>
576
+ </span>
577
+ </div>
578
+ <?php } ?>
579
+ </th>
580
+ <td>
581
+ <select name="avisolegal" id="avisolegal">
582
+ <option value="0"
583
+ <?php if ($settings->get_setting('avisolegalID') == 0) printf("selected=\"selected\"");?>
584
+ >
585
+ Ninguna</option>
586
+ <?php
587
+ foreach (get_pages() as $page) {
588
+ printf("<option value=\"%s\" %s>%s</option>",
589
+ $page->ID,
590
+ ($page->ID == $settings->get_setting('avisolegalID'))?("selected=\"selected\""):"",
591
+ $page->post_title);
592
+ }
593
+ ?>
594
+ </select>
595
+
596
+ <p class="description">
597
+ <?php
598
+ if ($settings->get_setting('avisolegalID') == 0)
599
+ echo "Selecciona una página para activar";
600
+ ?>
601
+ </p>
602
+ </td>
603
+ <td>
604
+ <span class="shortcode">[argpd_aviso-legal]</span>
605
+ </td>
606
+ <td></td>
607
+ </tr>
608
+
609
+ <?php /* Política de privacidad */?>
610
+ <tr>
611
+ <th scope="row">
612
+ <label for="privacidad"><?php _e('Política de Privacidad', 'argpd');?></label>
613
+ <?php if ($settings->get_setting('privacidadID') != 0) { ?>
614
+ <div class="row-actions">
615
+ <span class="view">
616
+ <?php
617
+ printf("<a href=\"%s?page_id=%s\">%s</a>",
618
+ get_site_url(),
619
+ $settings->get_setting('privacidadID'),
620
+ "Ver"
621
+ );
622
+ ?>
623
+ </span>
624
+ </div>
625
+ <?php } ?>
626
+ </th>
627
+ <td>
628
+ <select name="privacidad" id="privacidad">
629
+ <option value="0"
630
+ <?php if ($settings->get_setting('privacidadID') == 0) printf("selected=\"selected\"");?>
631
+ >
632
+ Ninguna</option>
633
+ <?php
634
+ foreach (get_pages() as $page) {
635
+ printf("<option value=\"%s\" %s>%s</option>",
636
+ $page->ID,
637
+ ($page->ID == $settings->get_setting('privacidadID'))?("selected=\"selected\""):"",
638
+ $page->post_title);
639
+ }
640
+ ?>
641
+ </select>
642
+ <p class="description">
643
+ <?php
644
+ if ($settings->get_setting('privacidadID') == 0)
645
+ echo "Selecciona una página para activar";
646
+ ?>
647
+ </p>
648
+
649
+ </td>
650
+ <td>
651
+ <span class="shortcode">[argpd_politica-privacidad]</span>
652
+ </td>
653
+ <td>
654
+ <a href="https://superadmin.es/blog/wordpress/crear-politica-de-privacidad/"
655
+ class="button"
656
+ target="_blank"
657
+ style="background-color: #03A9F4;color: white;border-color: #03A9F4;"
658
+ >La política de privacidad</a>
659
+ </td>
660
+ </tr>
661
+
662
+ <?php /* Política de cookies */?>
663
+ <tr>
664
+ <th scope="row">
665
+ <label for="cookies"><?php _e('Política de Cookies', 'argpd');?></label>
666
+ <?php if ($settings->get_setting('cookiesID') != 0) { ?>
667
+ <div class="row-actions">
668
+ <span class="view">
669
+ <?php
670
+ printf("<a href=\"%s?page_id=%s\">%s</a>",
671
+ get_site_url(),
672
+ $settings->get_setting('cookiesID'),
673
+ "Ver"
674
+ );
675
+ ?>
676
+ </span>
677
+ </div>
678
+ <?php } ?>
679
+ </th>
680
+ <td>
681
+ <select name="cookies" id="cookies">
682
+ <option value="0"
683
+ <?php if ($settings->get_setting('cookiesID') == 0) printf("selected=\"selected\"");?>
684
+ >
685
+ Ninguna</option>
686
+ <?php
687
+ foreach (get_pages() as $page) {
688
+ printf("<option value=\"%s\" %s>%s</option>",
689
+ $page->ID,
690
+ ($page->ID == $settings->get_setting('cookiesID'))?("selected=\"selected\""):"",
691
+ $page->post_title);
692
+ }
693
+ ?>
694
+ </select>
695
+ <p class="description">
696
+ <?php
697
+ if ($settings->get_setting('cookiesID') == 0)
698
+ echo "Selecciona una página para activar";
699
+ ?>
700
+ </p>
701
+ </td>
702
+ <td>
703
+ <span class="shortcode">[argpd_politica-cookies]</span>
704
+ </td>
705
+ <td></td>
706
+ </tr>
707
+ <?php /* Información Básica */?>
708
+ <tr>
709
+ <th scope="row">
710
+ <label><?php _e('Deber de Informar', 'argpd');?></label>
711
+ <div class="row-actions">
712
+ </div>
713
+ </th>
714
+ <td>
715
+ </td>
716
+ <td>
717
+ <span class="shortcode">[argpd_deber_de_informar]</span>
718
+ </td>
719
+ <td>
720
+ <a href="https://superadmin.es/blog/emprendedor/cumplir-deber-de-informar-rgpd/"
721
+ class="button"
722
+ target="_blank"
723
+ style="background-color: #03A9F4;color: white;border-color: #03A9F4;"
724
+ >Cumplir el deber de informar</a>
725
+ </td>
726
+ </tr>
727
+ </tbody>
728
+ </table>
729
+ <?php submit_button(); ?>
730
+ </div>
731
+
732
+ <br><br>
733
+ <div>
734
+ <h2 class="title"><?php _e( 'Consentimiento y Deber de Informar', 'argpd' ); ?></h2>
735
+ <p>
736
+ <a href="https://superadmin.es/blog/emprendedor/cumplir-deber-de-informar-rgpd/"
737
+ target="_blank"
738
+ >
739
+ <span style="text-decoration: none" class="dashicons dashicons-editor-help"></span>
740
+ Guía para cumplir el deber de informar
741
+ </a>
742
+ </p>
743
+ <p>
744
+ Este apartado te sirve para dar cumplimiento al deber de informar en los formularios web.
745
+ </p>
746
+ </div>
747
+
748
+ <table class="form-table">
749
+ <tbody>
750
+ <tr>
751
+ <th scope="row">
752
+ <label><?php _e('Activar en', 'argpd');?></label>
753
+ </th>
754
+ <td>
755
+ <label for="option-comments">
756
+ <input name="option-comments"
757
+ type="checkbox"
758
+ id="option-comments"
759
+ value="1"
760
+ <?php ($settings->get_setting('option-comments') == 1) && printf("checked"); ?>
761
+ >
762
+ <?php _e('Comentarios ', 'argpd'); ?>
763
+ </label>
764
+ <p class="description">
765
+ Marca para añadir una casilla de verificación, obtener el consentimiento y satisfacer el deber de informar.
766
+ </p>
767
+ <br/>
768
+
769
+ <label for="option-forms">
770
+ <input name="option-forms"
771
+ type="checkbox"
772
+ id="option-forms"
773
+ value="1"
774
+ <?php ($settings->get_setting('option-forms') == 1) && printf("checked"); ?>
775
+ >
776
+ <?php _e('Formularios', 'argpd'); ?>
777
+ </label>
778
+ <p class="description">
779
+ Marca si en el sitio web hay formularios. <br>
780
+ Utiliza el shortcode [argpd_deber_de_informar] debajo de tu formulario para mostrar el deber de informar.
781
+ </p>
782
+ <br/>
783
+
784
+ <label for="option-footer">
785
+ <input name="option-footer"
786
+ type="checkbox"
787
+ id="option-footer"
788
+ value="1"
789
+ <?php ($settings->get_setting('option-footer') == 1) && printf("checked"); ?>
790
+ >
791
+ <?php _e('Pie de página', 'argpd'); ?>
792
+ </label>
793
+ <p class="description">
794
+ Marca para crear enlaces a las páginas legales en el pie de página.<br>
795
+ </p>
796
+ </td>
797
+ </tr>
798
+
799
+ <?php /* Diseño */?>
800
+ <tr>
801
+ <th scope="row">
802
+ <label for="consentimiento-label"><?php _e('Texto para<br>el consentimiento', 'argpd');?></label>
803
+ </th>
804
+ <td>
805
+ <textarea
806
+ name="consentimiento-label"
807
+ id="consentimiento-label"
808
+ cols="60"
809
+ rows="3"
810
+ placeholder="He leído y acepto la política de privacidad."
811
+ ><?php echo $settings->get_setting('consentimiento-label'); ?></textarea>
812
+ <br><span class="description">
813
+ Deja en blanco para mostrar el texto por defecto.</span>
814
+ </td>
815
+ </tr>
816
+ </tbody>
817
+ </table>
818
+ <?php submit_button(); ?>
819
+
820
+
821
+ <br><br>
822
+ <div>
823
+ <h2 class="title"><?php _e( 'Ley de Cookies', 'argpd' ); ?></h2>
824
+ <p>
825
+ Este apartado te sirve para dar cumplimiento a la ley de Cookies.
826
+ </p>
827
+ <div>
828
+
829
+ <table class="form-table">
830
+ <tbody>
831
+ <?php /* Activar/Desactivar cookies */?>
832
+ <tr>
833
+ <th scope="row">
834
+ <label for="option-cookies"><?php _e('Activar', 'argpd');?></label>
835
+ </th>
836
+ <td>
837
+ <label for="option-cookies">
838
+ <input name="option-cookies"
839
+ type="checkbox"
840
+ id="option-cookies"
841
+ value="1"
842
+ <?php ($settings->get_setting('option-cookies') == 1) && printf("checked"); ?>
843
+ >
844
+ <?php _e('Banner de Política de cookies ', 'argpd'); ?>
845
+ </label>
846
+ <p class="description">
847
+ Marca para activar el banner de cookies en todas las páginas.
848
+ </p>
849
+ </td>
850
+ </tr>
851
+ <?php /* Texto */?>
852
+ <tr>
853
+ <th scope="row">
854
+ <label for="cookies-label"><?php _e('Texto personalizado <br>en el banner', 'argpd');?></label>
855
+ </th>
856
+ <td>
857
+
858
+ <textarea
859
+ name="cookies-label"
860
+ id="cookies-label"
861
+ cols="60"
862
+ rows="3"
863
+ placeholder="Esta web utiliza cookies. Puedes ver aquí la política de cookies. Si continuas navegando estás aceptándola."
864
+ ><?php echo $settings->get_setting('cookies-label'); ?></textarea>
865
+ <br>
866
+ <span class="description">
867
+ Deja en blanco para mostrar el texto por defecto.
868
+ </span>
869
+ </td>
870
+ </tr>
871
+ </tbody>
872
+ </table>
873
+
874
+ </div>
875
+ </div>
876
+ <?php submit_button(); ?>
877
+
878
+ <br><br>
879
+ <div>
880
+ <h2 class="title"><?php _e( 'Estilo y diseño', 'argpd' ); ?></h2>
881
+ <div>
882
+
883
+ <table class="form-table">
884
+ <tbody>
885
+ <?php /* Theme */?>
886
+ <tr>
887
+ <th scope="row">
888
+ <label for="cookies-theme"><?php _e('Tema', 'argpd');?></label>
889
+ </th>
890
+ <td>
891
+
892
+ <select name="cookies-theme" id="cookies-theme">
893
+ <?php
894
+ $cookie_themes= $settings->get_cookie_themes();
895
+ foreach ($cookie_themes as $key => $value) {
896
+ printf("<option value=\"%s\" %s>%s</option>",
897
+ $key,
898
+ ($key == $settings->get_setting('cookies-theme'))?("selected=\"selected\""):"",
899
+ $value);
900
+ }
901
+ ?>
902
+ </select>
903
+
904
+ <a href="https://superadmin.es/adapta-rgpd/personalizar-banner-cookies/"
905
+ target="_blank"
906
+ >
907
+ <span style="text-decoration: none" class="dashicons dashicons-editor-help"></span>
908
+ Cómo personalizar con CSS
909
+ </a>
910
+
911
+ </td>
912
+ </tr>
913
+
914
+ <?php /* list style */?>
915
+ <tr>
916
+ <th scope="row">
917
+ <label><?php _e('Listas', 'argpd');?></label>
918
+ </th>
919
+ <td>
920
+ <select name="informbox-theme" id="informbox-theme">
921
+ <?php
922
+ $informbox_themes= $settings->get_informbox_themes();
923
+ foreach ($informbox_themes as $key => $value) {
924
+ printf("<option value=\"%s\" %s>%s</option>",
925
+ $key,
926
+ ($key == $settings->get_setting('informbox-theme'))?("selected=\"selected\""):"",
927
+ $value);
928
+ }
929
+ ?>
930
+ </select>
931
+ </td>
932
+ </tr>
933
+ </tbody>
934
+ </table>
935
+ </div>
936
+ </div>
937
+ <?php submit_button(); ?>
938
+ </form>
939
+
940
+ <?php
941
+ }
942
+
943
+
944
+ /**
945
+ * Echo 'Ayuda' tab of plugin settings
946
+ *
947
+ * @since 0.0.0
948
+ */
949
+ public function argpd_ayuda_tab(){
950
+ global $argpd_active_tab;
951
+ ?>
952
+ <a class="nav-tab <?php echo $argpd_active_tab == 'ayuda' || '' ? 'nav-tab-active' : ''; ?>"
953
+ href="<?php echo admin_url( 'admin.php?page=argpd&tab=ayuda' ); ?>">
954
+ <?php _e( 'Ayuda', 'argpd' ); ?>
955
+ </a>
956
+ <?php
957
+ }
958
+
959
+
960
+ /**
961
+ * Echo 'Ayuda' content of plugin settings
962
+ *
963
+ * @since 0.0.0
964
+ */
965
+ public function argpd_ayuda_content(){
966
+ global $argpd_active_tab;
967
+ if ( 'ayuda' != $argpd_active_tab )
968
+ return;
969
+ ?>
970
+
971
+ <div>
972
+ <h2 class="title"><?php _e( 'Ayuda', 'argpd' ); ?></h2>
973
+
974
+ <?php
975
+ echo $this->plugin->pages->ayuda_view();
976
+
977
+ echo $this->plugin->pages->disclaimer();
978
+ ?>
979
+
980
+ </div>
981
+ <?php
982
+ }
983
+
984
+
985
+ /**
986
+ * Echo plugin settings view
987
+ *
988
+ * @since 0.0.0
989
+ */
990
+ public function options_ui(){
991
+
992
+ global $argpd_active_tab;
993
+ $argpd_active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'ajustes';
994
+ ?>
995
+
996
+ <?php /* ARGPD messages */ ?>
997
+ <?php
998
+
999
+ $message= _('Algo fue mal.', 'argpd');
1000
+
1001
+ if ( isset($_GET['message']) ){
1002
+ switch ($_GET['message']){
1003
+ case "saved":
1004
+ $message= _('Los cambios se han guardado.', 'argpd');
1005
+ break;
1006
+ default:
1007
+ $message= _('La página ya existe.', 'argpd');
1008
+ break;
1009
+ }
1010
+ ?>
1011
+ <div id="message"
1012
+ class="notice notice-success is-dismissible"
1013
+ >
1014
+ <p><?php echo $message ?></p>
1015
+ <button type="button"
1016
+ class="notice-dismiss"
1017
+ >
1018
+ <span class="screen-reader-text">
1019
+ Descartar este aviso.
1020
+ </span>
1021
+ </button>
1022
+ </div>
1023
+ <?php } ?>
1024
+
1025
+
1026
+ <div class="wrap">
1027
+ <h1>Adaptación RGPD</h1>
1028
+
1029
+ <?php
1030
+ $settings= $this->plugin->argpd_settings;
1031
+ if ($settings->get_setting('renuncia') == 0) { ?>
1032
+ <div>
1033
+ <div>
1034
+ <?php
1035
+ echo $this->plugin->pages->disclaimer();
1036
+ ?>
1037
+
1038
+ <form method="post" action="admin-post.php">
1039
+ <?php wp_nonce_field( 'argpd' ); ?>
1040
+ <input type="hidden" value="argpd_disclaimer" name="action"/>
1041
+
1042
+ <p class="submit">
1043
+ <input type="submit"
1044
+ name="submit"
1045
+ id="submit"
1046
+ class="button button-primary"
1047
+ value="Aceptar">
1048
+ </p>
1049
+ </form>
1050
+ </div>
1051
+ </div>
1052
+
1053
+
1054
+ <?php } else { ?>
1055
+
1056
+ <div>
1057
+ <h2 class="nav-tab-wrapper">
1058
+ <?php
1059
+ // echo tabs by tab param
1060
+ do_action('argpd_settings_tab');
1061
+ ?>
1062
+ </h2>
1063
+
1064
+ <?php
1065
+ // echo content by tab param
1066
+ do_action('argpd_settings_content');
1067
+ ?>
1068
+ </div>
1069
+ <?php } ?>
1070
+ <hr>
1071
+ <p>
1072
+ <em>Adapta RGPD creado por <a href="https://superadmin.es">SuperAdmin</a>.</em>
1073
+ </p>
1074
+ </div>
1075
+ <?php
1076
+ }
1077
+ }
1078
+
1079
+
lib/vendor/Mustache/Autoloader.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache class autoloader.
14
+ */
15
+ class Mustache_Autoloader
16
+ {
17
+ private $baseDir;
18
+
19
+ /**
20
+ * An array where the key is the baseDir and the key is an instance of this
21
+ * class.
22
+ *
23
+ * @var array
24
+ */
25
+ private static $instances;
26
+
27
+ /**
28
+ * Autoloader constructor.
29
+ *
30
+ * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
31
+ */
32
+ public function __construct($baseDir = null)
33
+ {
34
+ if ($baseDir === null) {
35
+ $baseDir = dirname(__FILE__) . '/..';
36
+ }
37
+
38
+ // realpath doesn't always work, for example, with stream URIs
39
+ $realDir = realpath($baseDir);
40
+ if (is_dir($realDir)) {
41
+ $this->baseDir = $realDir;
42
+ } else {
43
+ $this->baseDir = $baseDir;
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Register a new instance as an SPL autoloader.
49
+ *
50
+ * @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..')
51
+ *
52
+ * @return Mustache_Autoloader Registered Autoloader instance
53
+ */
54
+ public static function register($baseDir = null)
55
+ {
56
+ $key = $baseDir ? $baseDir : 0;
57
+
58
+ if (!isset(self::$instances[$key])) {
59
+ self::$instances[$key] = new self($baseDir);
60
+ }
61
+
62
+ $loader = self::$instances[$key];
63
+ spl_autoload_register(array($loader, 'autoload'));
64
+
65
+ return $loader;
66
+ }
67
+
68
+ /**
69
+ * Autoload Mustache classes.
70
+ *
71
+ * @param string $class
72
+ */
73
+ public function autoload($class)
74
+ {
75
+ if ($class[0] === '\\') {
76
+ $class = substr($class, 1);
77
+ }
78
+
79
+ if (strpos($class, 'Mustache') !== 0) {
80
+ return;
81
+ }
82
+
83
+ $file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class));
84
+ if (is_file($file)) {
85
+ require $file;
86
+ }
87
+ }
88
+ }
lib/vendor/Mustache/Cache.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Cache interface.
14
+ *
15
+ * Interface for caching and loading Mustache_Template classes
16
+ * generated by the Mustache_Compiler.
17
+ */
18
+ interface Mustache_Cache
19
+ {
20
+ /**
21
+ * Load a compiled Mustache_Template class from cache.
22
+ *
23
+ * @param string $key
24
+ *
25
+ * @return bool indicates successfully class load
26
+ */
27
+ public function load($key);
28
+
29
+ /**
30
+ * Cache and load a compiled Mustache_Template class.
31
+ *
32
+ * @param string $key
33
+ * @param string $value
34
+ */
35
+ public function cache($key, $value);
36
+ }
lib/vendor/Mustache/Cache/AbstractCache.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Abstract Mustache Cache class.
14
+ *
15
+ * Provides logging support to child implementations.
16
+ *
17
+ * @abstract
18
+ */
19
+ abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
20
+ {
21
+ private $logger = null;
22
+
23
+ /**
24
+ * Get the current logger instance.
25
+ *
26
+ * @return Mustache_Logger|Psr\Log\LoggerInterface
27
+ */
28
+ public function getLogger()
29
+ {
30
+ return $this->logger;
31
+ }
32
+
33
+ /**
34
+ * Set a logger instance.
35
+ *
36
+ * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
37
+ */
38
+ public function setLogger($logger = null)
39
+ {
40
+ if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
41
+ throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
42
+ }
43
+
44
+ $this->logger = $logger;
45
+ }
46
+
47
+ /**
48
+ * Add a log record if logging is enabled.
49
+ *
50
+ * @param int $level The logging level
51
+ * @param string $message The log message
52
+ * @param array $context The log context
53
+ */
54
+ protected function log($level, $message, array $context = array())
55
+ {
56
+ if (isset($this->logger)) {
57
+ $this->logger->log($level, $message, $context);
58
+ }
59
+ }
60
+ }
lib/vendor/Mustache/Cache/FilesystemCache.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Cache filesystem implementation.
14
+ *
15
+ * A FilesystemCache instance caches Mustache Template classes from the filesystem by name:
16
+ *
17
+ * $cache = new Mustache_Cache_FilesystemCache(dirname(__FILE__).'/cache');
18
+ * $cache->cache($className, $compiledSource);
19
+ *
20
+ * The FilesystemCache benefits from any opcode caching that may be setup in your environment. So do that, k?
21
+ */
22
+ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
23
+ {
24
+ private $baseDir;
25
+ private $fileMode;
26
+
27
+ /**
28
+ * Filesystem cache constructor.
29
+ *
30
+ * @param string $baseDir Directory for compiled templates
31
+ * @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask
32
+ */
33
+ public function __construct($baseDir, $fileMode = null)
34
+ {
35
+ $this->baseDir = $baseDir;
36
+ $this->fileMode = $fileMode;
37
+ }
38
+
39
+ /**
40
+ * Load the class from cache using `require_once`.
41
+ *
42
+ * @param string $key
43
+ *
44
+ * @return bool
45
+ */
46
+ public function load($key)
47
+ {
48
+ $fileName = $this->getCacheFilename($key);
49
+ if (!is_file($fileName)) {
50
+ return false;
51
+ }
52
+
53
+ require_once $fileName;
54
+
55
+ return true;
56
+ }
57
+
58
+ /**
59
+ * Cache and load the compiled class.
60
+ *
61
+ * @param string $key
62
+ * @param string $value
63
+ */
64
+ public function cache($key, $value)
65
+ {
66
+ $fileName = $this->getCacheFilename($key);
67
+
68
+ $this->log(
69
+ Mustache_Logger::DEBUG,
70
+ 'Writing to template cache: "{fileName}"',
71
+ array('fileName' => $fileName)
72
+ );
73
+
74
+ $this->writeFile($fileName, $value);
75
+ $this->load($key);
76
+ }
77
+
78
+ /**
79
+ * Build the cache filename.
80
+ * Subclasses should override for custom cache directory structures.
81
+ *
82
+ * @param string $name
83
+ *
84
+ * @return string
85
+ */
86
+ protected function getCacheFilename($name)
87
+ {
88
+ return sprintf('%s/%s.php', $this->baseDir, $name);
89
+ }
90
+
91
+ /**
92
+ * Create cache directory.
93
+ *
94
+ * @throws Mustache_Exception_RuntimeException If unable to create directory
95
+ *
96
+ * @param string $fileName
97
+ *
98
+ * @return string
99
+ */
100
+ private function buildDirectoryForFilename($fileName)
101
+ {
102
+ $dirName = dirname($fileName);
103
+ if (!is_dir($dirName)) {
104
+ $this->log(
105
+ Mustache_Logger::INFO,
106
+ 'Creating Mustache template cache directory: "{dirName}"',
107
+ array('dirName' => $dirName)
108
+ );
109
+
110
+ @mkdir($dirName, 0777, true);
111
+ // @codeCoverageIgnoreStart
112
+ if (!is_dir($dirName)) {
113
+ throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
114
+ }
115
+ // @codeCoverageIgnoreEnd
116
+ }
117
+
118
+ return $dirName;
119
+ }
120
+
121
+ /**
122
+ * Write cache file.
123
+ *
124
+ * @throws Mustache_Exception_RuntimeException If unable to write file
125
+ *
126
+ * @param string $fileName
127
+ * @param string $value
128
+ */
129
+ private function writeFile($fileName, $value)
130
+ {
131
+ $dirName = $this->buildDirectoryForFilename($fileName);
132
+
133
+ $this->log(
134
+ Mustache_Logger::DEBUG,
135
+ 'Caching compiled template to "{fileName}"',
136
+ array('fileName' => $fileName)
137
+ );
138
+
139
+ $tempFile = tempnam($dirName, basename($fileName));
140
+ if (false !== @file_put_contents($tempFile, $value)) {
141
+ if (@rename($tempFile, $fileName)) {
142
+ $mode = isset($this->fileMode) ? $this->fileMode : (0666 & ~umask());
143
+ @chmod($fileName, $mode);
144
+
145
+ return;
146
+ }
147
+
148
+ // @codeCoverageIgnoreStart
149
+ $this->log(
150
+ Mustache_Logger::ERROR,
151
+ 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
152
+ array('tempName' => $tempFile, 'fileName' => $fileName)
153
+ );
154
+ // @codeCoverageIgnoreEnd
155
+ }
156
+
157
+ // @codeCoverageIgnoreStart
158
+ throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
159
+ // @codeCoverageIgnoreEnd
160
+ }
161
+ }
lib/vendor/Mustache/Cache/NoopCache.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Cache in-memory implementation.
14
+ *
15
+ * The in-memory cache is used for uncached lambda section templates. It's also useful during development, but is not
16
+ * recommended for production use.
17
+ */
18
+ class Mustache_Cache_NoopCache extends Mustache_Cache_AbstractCache
19
+ {
20
+ /**
21
+ * Loads nothing. Move along.
22
+ *
23
+ * @param string $key
24
+ *
25
+ * @return bool
26
+ */
27
+ public function load($key)
28
+ {
29
+ return false;
30
+ }
31
+
32
+ /**
33
+ * Loads the compiled Mustache Template class without caching.
34
+ *
35
+ * @param string $key
36
+ * @param string $value
37
+ */
38
+ public function cache($key, $value)
39
+ {
40
+ $this->log(
41
+ Mustache_Logger::WARNING,
42
+ 'Template cache disabled, evaluating "{className}" class at runtime',
43
+ array('className' => $key)
44
+ );
45
+ eval('?>' . $value);
46
+ }
47
+ }
lib/vendor/Mustache/Compiler.php ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Compiler class.
14
+ *
15
+ * This class is responsible for turning a Mustache token parse tree into normal PHP source code.
16
+ */
17
+ class Mustache_Compiler
18
+ {
19
+ private $pragmas;
20
+ private $defaultPragmas = array();
21
+ private $sections;
22
+ private $blocks;
23
+ private $source;
24
+ private $indentNextLine;
25
+ private $customEscape;
26
+ private $entityFlags;
27
+ private $charset;
28
+ private $strictCallables;
29
+
30
+ /**
31
+ * Compile a Mustache token parse tree into PHP source code.
32
+ *
33
+ * @param string $source Mustache Template source code
34
+ * @param string $tree Parse tree of Mustache tokens
35
+ * @param string $name Mustache Template class name
36
+ * @param bool $customEscape (default: false)
37
+ * @param string $charset (default: 'UTF-8')
38
+ * @param bool $strictCallables (default: false)
39
+ * @param int $entityFlags (default: ENT_COMPAT)
40
+ *
41
+ * @return string Generated PHP source code
42
+ */
43
+ public function compile($source, array $tree, $name, $customEscape = false, $charset = 'UTF-8', $strictCallables = false, $entityFlags = ENT_COMPAT)
44
+ {
45
+ $this->pragmas = $this->defaultPragmas;
46
+ $this->sections = array();
47
+ $this->blocks = array();
48
+ $this->source = $source;
49
+ $this->indentNextLine = true;
50
+ $this->customEscape = $customEscape;
51
+ $this->entityFlags = $entityFlags;
52
+ $this->charset = $charset;
53
+ $this->strictCallables = $strictCallables;
54
+
55
+ return $this->writeCode($tree, $name);
56
+ }
57
+
58
+ /**
59
+ * Enable pragmas across all templates, regardless of the presence of pragma
60
+ * tags in the individual templates.
61
+ *
62
+ * @internal Users should set global pragmas in Mustache_Engine, not here :)
63
+ *
64
+ * @param string[] $pragmas
65
+ */
66
+ public function setPragmas(array $pragmas)
67
+ {
68
+ $this->pragmas = array();
69
+ foreach ($pragmas as $pragma) {
70
+ $this->pragmas[$pragma] = true;
71
+ }
72
+ $this->defaultPragmas = $this->pragmas;
73
+ }
74
+
75
+ /**
76
+ * Helper function for walking the Mustache token parse tree.
77
+ *
78
+ * @throws Mustache_Exception_SyntaxException upon encountering unknown token types
79
+ *
80
+ * @param array $tree Parse tree of Mustache tokens
81
+ * @param int $level (default: 0)
82
+ *
83
+ * @return string Generated PHP source code
84
+ */
85
+ private function walk(array $tree, $level = 0)
86
+ {
87
+ $code = '';
88
+ $level++;
89
+ foreach ($tree as $node) {
90
+ switch ($node[Mustache_Tokenizer::TYPE]) {
91
+ case Mustache_Tokenizer::T_PRAGMA:
92
+ $this->pragmas[$node[Mustache_Tokenizer::NAME]] = true;
93
+ break;
94
+
95
+ case Mustache_Tokenizer::T_SECTION:
96
+ $code .= $this->section(
97
+ $node[Mustache_Tokenizer::NODES],
98
+ $node[Mustache_Tokenizer::NAME],
99
+ isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
100
+ $node[Mustache_Tokenizer::INDEX],
101
+ $node[Mustache_Tokenizer::END],
102
+ $node[Mustache_Tokenizer::OTAG],
103
+ $node[Mustache_Tokenizer::CTAG],
104
+ $level
105
+ );
106
+ break;
107
+
108
+ case Mustache_Tokenizer::T_INVERTED:
109
+ $code .= $this->invertedSection(
110
+ $node[Mustache_Tokenizer::NODES],
111
+ $node[Mustache_Tokenizer::NAME],
112
+ isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
113
+ $level
114
+ );
115
+ break;
116
+
117
+ case Mustache_Tokenizer::T_PARTIAL:
118
+ $code .= $this->partial(
119
+ $node[Mustache_Tokenizer::NAME],
120
+ isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
121
+ $level
122
+ );
123
+ break;
124
+
125
+ case Mustache_Tokenizer::T_PARENT:
126
+ $code .= $this->parent(
127
+ $node[Mustache_Tokenizer::NAME],
128
+ isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
129
+ $node[Mustache_Tokenizer::NODES],
130
+ $level
131
+ );
132
+ break;
133
+
134
+ case Mustache_Tokenizer::T_BLOCK_ARG:
135
+ $code .= $this->blockArg(
136
+ $node[Mustache_Tokenizer::NODES],
137
+ $node[Mustache_Tokenizer::NAME],
138
+ $node[Mustache_Tokenizer::INDEX],
139
+ $node[Mustache_Tokenizer::END],
140
+ $node[Mustache_Tokenizer::OTAG],
141
+ $node[Mustache_Tokenizer::CTAG],
142
+ $level
143
+ );
144
+ break;
145
+
146
+ case Mustache_Tokenizer::T_BLOCK_VAR:
147
+ $code .= $this->blockVar(
148
+ $node[Mustache_Tokenizer::NODES],
149
+ $node[Mustache_Tokenizer::NAME],
150
+ $node[Mustache_Tokenizer::INDEX],
151
+ $node[Mustache_Tokenizer::END],
152
+ $node[Mustache_Tokenizer::OTAG],
153
+ $node[Mustache_Tokenizer::CTAG],
154
+ $level
155
+ );
156
+ break;
157
+
158
+ case Mustache_Tokenizer::T_COMMENT:
159
+ break;
160
+
161
+ case Mustache_Tokenizer::T_ESCAPED:
162
+ case Mustache_Tokenizer::T_UNESCAPED:
163
+ case Mustache_Tokenizer::T_UNESCAPED_2:
164
+ $code .= $this->variable(
165
+ $node[Mustache_Tokenizer::NAME],
166
+ isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
167
+ $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_ESCAPED,
168
+ $level
169
+ );
170
+ break;
171
+
172
+ case Mustache_Tokenizer::T_TEXT:
173
+ $code .= $this->text($node[Mustache_Tokenizer::VALUE], $level);
174
+ break;
175
+
176
+ default:
177
+ throw new Mustache_Exception_SyntaxException(sprintf('Unknown token type: %s', $node[Mustache_Tokenizer::TYPE]), $node);
178
+ }
179
+ }
180
+
181
+ return $code;
182
+ }
183
+
184
+ const KLASS = '<?php
185
+
186
+ class %s extends Mustache_Template
187
+ {
188
+ private $lambdaHelper;%s
189
+
190
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
191
+ {
192
+ $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
193
+ $buffer = \'\';
194
+ %s
195
+
196
+ return $buffer;
197
+ }
198
+ %s
199
+ %s
200
+ }';
201
+
202
+ const KLASS_NO_LAMBDAS = '<?php
203
+
204
+ class %s extends Mustache_Template
205
+ {%s
206
+ public function renderInternal(Mustache_Context $context, $indent = \'\')
207
+ {
208
+ $buffer = \'\';
209
+ %s
210
+
211
+ return $buffer;
212
+ }
213
+ }';
214
+
215
+ const STRICT_CALLABLE = 'protected $strictCallables = true;';
216
+
217
+ /**
218
+ * Generate Mustache Template class PHP source.
219
+ *
220
+ * @param array $tree Parse tree of Mustache tokens
221
+ * @param string $name Mustache Template class name
222
+ *
223
+ * @return string Generated PHP source code
224
+ */
225
+ private function writeCode($tree, $name)
226
+ {
227
+ $code = $this->walk($tree);
228
+ $sections = implode("\n", $this->sections);
229
+ $blocks = implode("\n", $this->blocks);
230
+ $klass = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;
231
+
232
+ $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';
233
+
234
+ return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections, $blocks);
235
+ }
236
+
237
+ const BLOCK_VAR = '
238
+ $blockFunction = $context->findInBlock(%s);
239
+ if (is_callable($blockFunction)) {
240
+ $buffer .= call_user_func($blockFunction, $context);
241
+ %s}
242
+ ';
243
+
244
+ const BLOCK_VAR_ELSE = '} else {%s';
245
+
246
+ /**
247
+ * Generate Mustache Template inheritance block variable PHP source.
248
+ *
249
+ * @param array $nodes Array of child tokens
250
+ * @param string $id Section name
251
+ * @param int $start Section start offset
252
+ * @param int $end Section end offset
253
+ * @param string $otag Current Mustache opening tag
254
+ * @param string $ctag Current Mustache closing tag
255
+ * @param int $level
256
+ *
257
+ * @return string Generated PHP source code
258
+ */
259
+ private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level)
260
+ {
261
+ $id = var_export($id, true);
262
+
263
+ $else = $this->walk($nodes, $level);
264
+ if ($else !== '') {
265
+ $else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else);
266
+ }
267
+
268
+ return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $else);
269
+ }
270
+
271
+ const BLOCK_ARG = '%s => array($this, \'block%s\'),';
272
+
273
+ /**
274
+ * Generate Mustache Template inheritance block argument PHP source.
275
+ *
276
+ * @param array $nodes Array of child tokens
277
+ * @param string $id Section name
278
+ * @param int $start Section start offset
279
+ * @param int $end Section end offset
280
+ * @param string $otag Current Mustache opening tag
281
+ * @param string $ctag Current Mustache closing tag
282
+ * @param int $level
283
+ *
284
+ * @return string Generated PHP source code
285
+ */
286
+ private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
287
+ {
288
+ $key = $this->block($nodes);
289
+ $keystr = var_export($key, true);
290
+ $id = var_export($id, true);
291
+
292
+ return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key);
293
+ }
294
+
295
+ const BLOCK_FUNCTION = '
296
+ public function block%s($context)
297
+ {
298
+ $indent = $buffer = \'\';%s
299
+
300
+ return $buffer;
301
+ }
302
+ ';
303
+
304
+ /**
305
+ * Generate Mustache Template inheritance block function PHP source.
306
+ *
307
+ * @param array $nodes Array of child tokens
308
+ *
309
+ * @return string key of new block function
310
+ */
311
+ private function block($nodes)
312
+ {
313
+ $code = $this->walk($nodes, 0);
314
+ $key = ucfirst(md5($code));
315
+
316
+ if (!isset($this->blocks[$key])) {
317
+ $this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
318
+ }
319
+
320
+ return $key;
321
+ }
322
+
323
+ const SECTION_CALL = '
324
+ // %s section
325
+ $value = $context->%s(%s);%s
326
+ $buffer .= $this->section%s($context, $indent, $value);
327
+ ';
328
+
329
+ const SECTION = '
330
+ private function section%s(Mustache_Context $context, $indent, $value)
331
+ {
332
+ $buffer = \'\';
333
+
334
+ if (%s) {
335
+ $source = %s;
336
+ $result = call_user_func($value, $source, %s);
337
+ if (strpos($result, \'{{\') === false) {
338
+ $buffer .= $result;
339
+ } else {
340
+ $buffer .= $this->mustache
341
+ ->loadLambda((string) $result%s)
342
+ ->renderInternal($context);
343
+ }
344
+ } elseif (!empty($value)) {
345
+ $values = $this->isIterable($value) ? $value : array($value);
346
+ foreach ($values as $value) {
347
+ $context->push($value);
348
+ %s
349
+ $context->pop();
350
+ }
351
+ }
352
+
353
+ return $buffer;
354
+ }
355
+ ';
356
+
357
+ /**
358
+ * Generate Mustache Template section PHP source.
359
+ *
360
+ * @param array $nodes Array of child tokens
361
+ * @param string $id Section name
362
+ * @param string[] $filters Array of filters
363
+ * @param int $start Section start offset
364
+ * @param int $end Section end offset
365
+ * @param string $otag Current Mustache opening tag
366
+ * @param string $ctag Current Mustache closing tag
367
+ * @param int $level
368
+ *
369
+ * @return string Generated section PHP source code
370
+ */
371
+ private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level)
372
+ {
373
+ $source = var_export(substr($this->source, $start, $end - $start), true);
374
+ $callable = $this->getCallable();
375
+
376
+ if ($otag !== '{{' || $ctag !== '}}') {
377
+ $delimTag = var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
378
+ $helper = sprintf('$this->lambdaHelper->withDelimiters(%s)', $delimTag);
379
+ $delims = ', ' . $delimTag;
380
+ } else {
381
+ $helper = '$this->lambdaHelper';
382
+ $delims = '';
383
+ }
384
+
385
+ $key = ucfirst(md5($delims . "\n" . $source));
386
+
387
+ if (!isset($this->sections[$key])) {
388
+ $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2));
389
+ }
390
+
391
+ $method = $this->getFindMethod($id);
392
+ $id = var_export($id, true);
393
+ $filters = $this->getFilters($filters, $level);
394
+
395
+ return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key);
396
+ }
397
+
398
+ const INVERTED_SECTION = '
399
+ // %s inverted section
400
+ $value = $context->%s(%s);%s
401
+ if (empty($value)) {
402
+ %s
403
+ }
404
+ ';
405
+
406
+ /**
407
+ * Generate Mustache Template inverted section PHP source.
408
+ *
409
+ * @param array $nodes Array of child tokens
410
+ * @param string $id Section name
411
+ * @param string[] $filters Array of filters
412
+ * @param int $level
413
+ *
414
+ * @return string Generated inverted section PHP source code
415
+ */
416
+ private function invertedSection($nodes, $id, $filters, $level)
417
+ {
418
+ $method = $this->getFindMethod($id);
419
+ $id = var_export($id, true);
420
+ $filters = $this->getFilters($filters, $level);
421
+
422
+ return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level));
423
+ }
424
+
425
+ const PARTIAL_INDENT = ', $indent . %s';
426
+ const PARTIAL = '
427
+ if ($partial = $this->mustache->loadPartial(%s)) {
428
+ $buffer .= $partial->renderInternal($context%s);
429
+ }
430
+ ';
431
+
432
+ /**
433
+ * Generate Mustache Template partial call PHP source.
434
+ *
435
+ * @param string $id Partial name
436
+ * @param string $indent Whitespace indent to apply to partial
437
+ * @param int $level
438
+ *
439
+ * @return string Generated partial call PHP source code
440
+ */
441
+ private function partial($id, $indent, $level)
442
+ {
443
+ if ($indent !== '') {
444
+ $indentParam = sprintf(self::PARTIAL_INDENT, var_export($indent, true));
445
+ } else {
446
+ $indentParam = '';
447
+ }
448
+
449
+ return sprintf(
450
+ $this->prepare(self::PARTIAL, $level),
451
+ var_export($id, true),
452
+ $indentParam
453
+ );
454
+ }
455
+
456
+ const PARENT = '
457
+ if ($parent = $this->mustache->loadPartial(%s)) {
458
+ $context->pushBlockContext(array(%s
459
+ ));
460
+ $buffer .= $parent->renderInternal($context, $indent);
461
+ $context->popBlockContext();
462
+ }
463
+ ';
464
+
465
+ const PARENT_NO_CONTEXT = '
466
+ if ($parent = $this->mustache->loadPartial(%s)) {
467
+ $buffer .= $parent->renderInternal($context, $indent);
468
+ }
469
+ ';
470
+
471
+ /**
472
+ * Generate Mustache Template inheritance parent call PHP source.
473
+ *
474
+ * @param string $id Parent tag name
475
+ * @param string $indent Whitespace indent to apply to parent
476
+ * @param array $children Child nodes
477
+ * @param int $level
478
+ *
479
+ * @return string Generated PHP source code
480
+ */
481
+ private function parent($id, $indent, array $children, $level)
482
+ {
483
+ $realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
484
+
485
+ if (empty($realChildren)) {
486
+ return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true));
487
+ }
488
+
489
+ return sprintf(
490
+ $this->prepare(self::PARENT, $level),
491
+ var_export($id, true),
492
+ $this->walk($realChildren, $level + 1)
493
+ );
494
+ }
495
+
496
+ /**
497
+ * Helper method for filtering out non-block-arg tokens.
498
+ *
499
+ * @param array $node
500
+ *
501
+ * @return bool True if $node is a block arg token
502
+ */
503
+ private static function onlyBlockArgs(array $node)
504
+ {
505
+ return $node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_BLOCK_ARG;
506
+ }
507
+
508
+ const VARIABLE = '
509
+ $value = $this->resolveValue($context->%s(%s), $context);%s
510
+ $buffer .= %s%s;
511
+ ';
512
+
513
+ /**
514
+ * Generate Mustache Template variable interpolation PHP source.
515
+ *
516
+ * @param string $id Variable name
517
+ * @param string[] $filters Array of filters
518
+ * @param bool $escape Escape the variable value for output?
519
+ * @param int $level
520
+ *
521
+ * @return string Generated variable interpolation PHP source
522
+ */
523
+ private function variable($id, $filters, $escape, $level)
524
+ {
525
+ $method = $this->getFindMethod($id);
526
+ $id = ($method !== 'last') ? var_export($id, true) : '';
527
+ $filters = $this->getFilters($filters, $level);
528
+ $value = $escape ? $this->getEscape() : '$value';
529
+
530
+ return sprintf($this->prepare(self::VARIABLE, $level), $method, $id, $filters, $this->flushIndent(), $value);
531
+ }
532
+
533
+ const FILTER = '
534
+ $filter = $context->%s(%s);
535
+ if (!(%s)) {
536
+ throw new Mustache_Exception_UnknownFilterException(%s);
537
+ }
538
+ $value = call_user_func($filter, $value);%s
539
+ ';
540
+
541
+ /**
542
+ * Generate Mustache Template variable filtering PHP source.
543
+ *
544
+ * @param string[] $filters Array of filters
545
+ * @param int $level
546
+ *
547
+ * @return string Generated filter PHP source
548
+ */
549
+ private function getFilters(array $filters, $level)
550
+ {
551
+ if (empty($filters)) {
552
+ return '';
553
+ }
554
+
555
+ $name = array_shift($filters);
556
+ $method = $this->getFindMethod($name);
557
+ $filter = ($method !== 'last') ? var_export($name, true) : '';
558
+ $callable = $this->getCallable('$filter');
559
+ $msg = var_export($name, true);
560
+
561
+ return sprintf($this->prepare(self::FILTER, $level), $method, $filter, $callable, $msg, $this->getFilters($filters, $level));
562
+ }
563
+
564
+ const LINE = '$buffer .= "\n";';
565
+ const TEXT = '$buffer .= %s%s;';
566
+
567
+ /**
568
+ * Generate Mustache Template output Buffer call PHP source.
569
+ *
570
+ * @param string $text
571
+ * @param int $level
572
+ *
573
+ * @return string Generated output Buffer call PHP source
574
+ */
575
+ private function text($text, $level)
576
+ {
577
+ $indentNextLine = (substr($text, -1) === "\n");
578
+ $code = sprintf($this->prepare(self::TEXT, $level), $this->flushIndent(), var_export($text, true));
579
+ $this->indentNextLine = $indentNextLine;
580
+
581
+ return $code;
582
+ }
583
+
584
+ /**
585
+ * Prepare PHP source code snippet for output.
586
+ *
587
+ * @param string $text
588
+ * @param int $bonus Additional indent level (default: 0)
589
+ * @param bool $prependNewline Prepend a newline to the snippet? (default: true)
590
+ * @param bool $appendNewline Append a newline to the snippet? (default: false)
591
+ *
592
+ * @return string PHP source code snippet
593
+ */
594
+ private function prepare($text, $bonus = 0, $prependNewline = true, $appendNewline = false)
595
+ {
596
+ $text = ($prependNewline ? "\n" : '') . trim($text);
597
+ if ($prependNewline) {
598
+ $bonus++;
599
+ }
600
+ if ($appendNewline) {
601
+ $text .= "\n";
602
+ }
603
+
604
+ return preg_replace("/\n( {8})?/", "\n" . str_repeat(' ', $bonus * 4), $text);
605
+ }
606
+
607
+ const DEFAULT_ESCAPE = 'htmlspecialchars(%s, %s, %s)';
608
+ const CUSTOM_ESCAPE = 'call_user_func($this->mustache->getEscape(), %s)';
609
+
610
+ /**
611
+ * Get the current escaper.
612
+ *
613
+ * @param string $value (default: '$value')
614
+ *
615
+ * @return string Either a custom callback, or an inline call to `htmlspecialchars`
616
+ */
617
+ private function getEscape($value = '$value')
618
+ {
619
+ if ($this->customEscape) {
620
+ return sprintf(self::CUSTOM_ESCAPE, $value);
621
+ }
622
+
623
+ return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
624
+ }
625
+
626
+ /**
627
+ * Select the appropriate Context `find` method for a given $id.
628
+ *
629
+ * The return value will be one of `find`, `findDot`, `findAnchoredDot` or `last`.
630
+ *
631
+ * @see Mustache_Context::find
632
+ * @see Mustache_Context::findDot
633
+ * @see Mustache_Context::last
634
+ *
635
+ * @param string $id Variable name
636
+ *
637
+ * @return string `find` method name
638
+ */
639
+ private function getFindMethod($id)
640
+ {
641
+ if ($id === '.') {
642
+ return 'last';
643
+ }
644
+
645
+ if (isset($this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) && $this->pragmas[Mustache_Engine::PRAGMA_ANCHORED_DOT]) {
646
+ if (substr($id, 0, 1) === '.') {
647
+ return 'findAnchoredDot';
648
+ }
649
+ }
650
+
651
+ if (strpos($id, '.') === false) {
652
+ return 'find';
653
+ }
654
+
655
+ return 'findDot';
656
+ }
657
+
658
+ const IS_CALLABLE = '!is_string(%s) && is_callable(%s)';
659
+ const STRICT_IS_CALLABLE = 'is_object(%s) && is_callable(%s)';
660
+
661
+ /**
662
+ * Helper function to compile strict vs lax "is callable" logic.
663
+ *
664
+ * @param string $variable (default: '$value')
665
+ *
666
+ * @return string "is callable" logic
667
+ */
668
+ private function getCallable($variable = '$value')
669
+ {
670
+ $tpl = $this->strictCallables ? self::STRICT_IS_CALLABLE : self::IS_CALLABLE;
671
+
672
+ return sprintf($tpl, $variable, $variable);
673
+ }
674
+
675
+ const LINE_INDENT = '$indent . ';
676
+
677
+ /**
678
+ * Get the current $indent prefix to write to the buffer.
679
+ *
680
+ * @return string "$indent . " or ""
681
+ */
682
+ private function flushIndent()
683
+ {
684
+ if (!$this->indentNextLine) {
685
+ return '';
686
+ }
687
+
688
+ $this->indentNextLine = false;
689
+
690
+ return self::LINE_INDENT;
691
+ }
692
+ }
lib/vendor/Mustache/Context.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template rendering Context.
14
+ */
15
+ class Mustache_Context
16
+ {
17
+ private $stack = array();
18
+ private $blockStack = array();
19
+
20
+ /**
21
+ * Mustache rendering Context constructor.
22
+ *
23
+ * @param mixed $context Default rendering context (default: null)
24
+ */
25
+ public function __construct($context = null)
26
+ {
27
+ if ($context !== null) {
28
+ $this->stack = array($context);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Push a new Context frame onto the stack.
34
+ *
35
+ * @param mixed $value Object or array to use for context
36
+ */
37
+ public function push($value)
38
+ {
39
+ array_push($this->stack, $value);
40
+ }
41
+
42
+ /**
43
+ * Push a new Context frame onto the block context stack.
44
+ *
45
+ * @param mixed $value Object or array to use for block context
46
+ */
47
+ public function pushBlockContext($value)
48
+ {
49
+ array_push($this->blockStack, $value);
50
+ }
51
+
52
+ /**
53
+ * Pop the last Context frame from the stack.
54
+ *
55
+ * @return mixed Last Context frame (object or array)
56
+ */
57
+ public function pop()
58
+ {
59
+ return array_pop($this->stack);
60
+ }
61
+
62
+ /**
63
+ * Pop the last block Context frame from the stack.
64
+ *
65
+ * @return mixed Last block Context frame (object or array)
66
+ */
67
+ public function popBlockContext()
68
+ {
69
+ return array_pop($this->blockStack);
70
+ }
71
+
72
+ /**
73
+ * Get the last Context frame.
74
+ *
75
+ * @return mixed Last Context frame (object or array)
76
+ */
77
+ public function last()
78
+ {
79
+ return end($this->stack);
80
+ }
81
+
82
+ /**
83
+ * Find a variable in the Context stack.
84
+ *
85
+ * Starting with the last Context frame (the context of the innermost section), and working back to the top-level
86
+ * rendering context, look for a variable with the given name:
87
+ *
88
+ * * If the Context frame is an associative array which contains the key $id, returns the value of that element.
89
+ * * If the Context frame is an object, this will check first for a public method, then a public property named
90
+ * $id. Failing both of these, it will try `__isset` and `__get` magic methods.
91
+ * * If a value named $id is not found in any Context frame, returns an empty string.
92
+ *
93
+ * @param string $id Variable name
94
+ *
95
+ * @return mixed Variable value, or '' if not found
96
+ */
97
+ public function find($id)
98
+ {
99
+ return $this->findVariableInStack($id, $this->stack);
100
+ }
101
+
102
+ /**
103
+ * Find a 'dot notation' variable in the Context stack.
104
+ *
105
+ * Note that dot notation traversal bubbles through scope differently than the regular find method. After finding
106
+ * the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous
107
+ * result. For example, given the following context stack:
108
+ *
109
+ * $data = array(
110
+ * 'name' => 'Fred',
111
+ * 'child' => array(
112
+ * 'name' => 'Bob'
113
+ * ),
114
+ * );
115
+ *
116
+ * ... and the Mustache following template:
117
+ *
118
+ * {{ child.name }}
119
+ *
120
+ * ... the `name` value is only searched for within the `child` value of the global Context, not within parent
121
+ * Context frames.
122
+ *
123
+ * @param string $id Dotted variable selector
124
+ *
125
+ * @return mixed Variable value, or '' if not found
126
+ */
127
+ public function findDot($id)
128
+ {
129
+ $chunks = explode('.', $id);
130
+ $first = array_shift($chunks);
131
+ $value = $this->findVariableInStack($first, $this->stack);
132
+
133
+ foreach ($chunks as $chunk) {
134
+ if ($value === '') {
135
+ return $value;
136
+ }
137
+
138
+ $value = $this->findVariableInStack($chunk, array($value));
139
+ }
140
+
141
+ return $value;
142
+ }
143
+
144
+ /**
145
+ * Find an 'anchored dot notation' variable in the Context stack.
146
+ *
147
+ * This is the same as findDot(), except it looks in the top of the context
148
+ * stack for the first value, rather than searching the whole context stack
149
+ * and starting from there.
150
+ *
151
+ * @see Mustache_Context::findDot
152
+ *
153
+ * @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id
154
+ *
155
+ * @param string $id Dotted variable selector
156
+ *
157
+ * @return mixed Variable value, or '' if not found
158
+ */
159
+ public function findAnchoredDot($id)
160
+ {
161
+ $chunks = explode('.', $id);
162
+ $first = array_shift($chunks);
163
+ if ($first !== '') {
164
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected id for findAnchoredDot: %s', $id));
165
+ }
166
+
167
+ $value = $this->last();
168
+
169
+ foreach ($chunks as $chunk) {
170
+ if ($value === '') {
171
+ return $value;
172
+ }
173
+
174
+ $value = $this->findVariableInStack($chunk, array($value));
175
+ }
176
+
177
+ return $value;
178
+ }
179
+
180
+ /**
181
+ * Find an argument in the block context stack.
182
+ *
183
+ * @param string $id
184
+ *
185
+ * @return mixed Variable value, or '' if not found
186
+ */
187
+ public function findInBlock($id)
188
+ {
189
+ foreach ($this->blockStack as $context) {
190
+ if (array_key_exists($id, $context)) {
191
+ return $context[$id];
192
+ }
193
+ }
194
+
195
+ return '';
196
+ }
197
+
198
+ /**
199
+ * Helper function to find a variable in the Context stack.
200
+ *
201
+ * @see Mustache_Context::find
202
+ *
203
+ * @param string $id Variable name
204
+ * @param array $stack Context stack
205
+ *
206
+ * @return mixed Variable value, or '' if not found
207
+ */
208
+ private function findVariableInStack($id, array $stack)
209
+ {
210
+ for ($i = count($stack) - 1; $i >= 0; $i--) {
211
+ $frame = &$stack[$i];
212
+
213
+ switch (gettype($frame)) {
214
+ case 'object':
215
+ if (!($frame instanceof Closure)) {
216
+ // Note that is_callable() *will not work here*
217
+ // See https://github.com/bobthecow/mustache.php/wiki/Magic-Methods
218
+ if (method_exists($frame, $id)) {
219
+ return $frame->$id();
220
+ }
221
+
222
+ if (isset($frame->$id)) {
223
+ return $frame->$id;
224
+ }
225
+
226
+ if ($frame instanceof ArrayAccess && isset($frame[$id])) {
227
+ return $frame[$id];
228
+ }
229
+ }
230
+ break;
231
+
232
+ case 'array':
233
+ if (array_key_exists($id, $frame)) {
234
+ return $frame[$id];
235
+ }
236
+ break;
237
+ }
238
+ }
239
+
240
+ return '';
241
+ }
242
+ }
lib/vendor/Mustache/Engine.php ADDED
@@ -0,0 +1,829 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache implementation in PHP.
14
+ *
15
+ * {@link http://defunkt.github.com/mustache}
16
+ *
17
+ * Mustache is a framework-agnostic logic-less templating language. It enforces separation of view
18
+ * logic from template files. In fact, it is not even possible to embed logic in the template.
19
+ *
20
+ * This is very, very rad.
21
+ *
22
+ * @author Justin Hileman {@link http://justinhileman.com}
23
+ */
24
+ class Mustache_Engine
25
+ {
26
+ const VERSION = '2.12.0';
27
+ const SPEC_VERSION = '1.1.2';
28
+
29
+ const PRAGMA_FILTERS = 'FILTERS';
30
+ const PRAGMA_BLOCKS = 'BLOCKS';
31
+ const PRAGMA_ANCHORED_DOT = 'ANCHORED-DOT';
32
+
33
+ // Known pragmas
34
+ private static $knownPragmas = array(
35
+ self::PRAGMA_FILTERS => true,
36
+ self::PRAGMA_BLOCKS => true,
37
+ self::PRAGMA_ANCHORED_DOT => true,
38
+ );
39
+
40
+ // Template cache
41
+ private $templates = array();
42
+
43
+ // Environment
44
+ private $templateClassPrefix = '__Mustache_';
45
+ private $cache;
46
+ private $lambdaCache;
47
+ private $cacheLambdaTemplates = false;
48
+ private $loader;
49
+ private $partialsLoader;
50
+ private $helpers;
51
+ private $escape;
52
+ private $entityFlags = ENT_COMPAT;
53
+ private $charset = 'UTF-8';
54
+ private $logger;
55
+ private $strictCallables = false;
56
+ private $pragmas = array();
57
+ private $delimiters;
58
+
59
+ // Services
60
+ private $tokenizer;
61
+ private $parser;
62
+ private $compiler;
63
+
64
+ /**
65
+ * Mustache class constructor.
66
+ *
67
+ * Passing an $options array allows overriding certain Mustache options during instantiation:
68
+ *
69
+ * $options = array(
70
+ * // The class prefix for compiled templates. Defaults to '__Mustache_'.
71
+ * 'template_class_prefix' => '__MyTemplates_',
72
+ *
73
+ * // A Mustache cache instance or a cache directory string for compiled templates.
74
+ * // Mustache will not cache templates unless this is set.
75
+ * 'cache' => dirname(__FILE__).'/tmp/cache/mustache',
76
+ *
77
+ * // Override default permissions for cache files. Defaults to using the system-defined umask. It is
78
+ * // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
79
+ * 'cache_file_mode' => 0666,
80
+ *
81
+ * // Optionally, enable caching for lambda section templates. This is generally not recommended, as lambda
82
+ * // sections are often too dynamic to benefit from caching.
83
+ * 'cache_lambda_templates' => true,
84
+ *
85
+ * // Customize the tag delimiters used by this engine instance. Note that overriding here changes the
86
+ * // delimiters used to parse all templates and partials loaded by this instance. To override just for a
87
+ * // single template, use an inline "change delimiters" tag at the start of the template file:
88
+ * //
89
+ * // {{=<% %>=}}
90
+ * //
91
+ * 'delimiters' => '<% %>',
92
+ *
93
+ * // A Mustache template loader instance. Uses a StringLoader if not specified.
94
+ * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
95
+ *
96
+ * // A Mustache loader instance for partials.
97
+ * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
98
+ *
99
+ * // An array of Mustache partials. Useful for quick-and-dirty string template loading, but not as
100
+ * // efficient or lazy as a Filesystem (or database) loader.
101
+ * 'partials' => array('foo' => file_get_contents(dirname(__FILE__).'/views/partials/foo.mustache')),
102
+ *
103
+ * // An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order
104
+ * // sections), or any other valid Mustache context value. They will be prepended to the context stack,
105
+ * // so they will be available in any template loaded by this Mustache instance.
106
+ * 'helpers' => array('i18n' => function ($text) {
107
+ * // do something translatey here...
108
+ * }),
109
+ *
110
+ * // An 'escape' callback, responsible for escaping double-mustache variables.
111
+ * 'escape' => function ($value) {
112
+ * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
113
+ * },
114
+ *
115
+ * // Type argument for `htmlspecialchars`. Defaults to ENT_COMPAT. You may prefer ENT_QUOTES.
116
+ * 'entity_flags' => ENT_QUOTES,
117
+ *
118
+ * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'.
119
+ * 'charset' => 'ISO-8859-1',
120
+ *
121
+ * // A Mustache Logger instance. No logging will occur unless this is set. Using a PSR-3 compatible
122
+ * // logging library -- such as Monolog -- is highly recommended. A simple stream logger implementation is
123
+ * // available as well:
124
+ * 'logger' => new Mustache_Logger_StreamLogger('php://stderr'),
125
+ *
126
+ * // Only treat Closure instances and invokable classes as callable. If true, values like
127
+ * // `array('ClassName', 'methodName')` and `array($classInstance, 'methodName')`, which are traditionally
128
+ * // "callable" in PHP, are not called to resolve variables for interpolation or section contexts. This
129
+ * // helps protect against arbitrary code execution when user input is passed directly into the template.
130
+ * // This currently defaults to false, but will default to true in v3.0.
131
+ * 'strict_callables' => true,
132
+ *
133
+ * // Enable pragmas across all templates, regardless of the presence of pragma tags in the individual
134
+ * // templates.
135
+ * 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
136
+ * );
137
+ *
138
+ * @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable
139
+ *
140
+ * @param array $options (default: array())
141
+ */
142
+ public function __construct(array $options = array())
143
+ {
144
+ if (isset($options['template_class_prefix'])) {
145
+ if ((string) $options['template_class_prefix'] === '') {
146
+ throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "template_class_prefix" must not be empty');
147
+ }
148
+
149
+ $this->templateClassPrefix = $options['template_class_prefix'];
150
+ }
151
+
152
+ if (isset($options['cache'])) {
153
+ $cache = $options['cache'];
154
+
155
+ if (is_string($cache)) {
156
+ $mode = isset($options['cache_file_mode']) ? $options['cache_file_mode'] : null;
157
+ $cache = new Mustache_Cache_FilesystemCache($cache, $mode);
158
+ }
159
+
160
+ $this->setCache($cache);
161
+ }
162
+
163
+ if (isset($options['cache_lambda_templates'])) {
164
+ $this->cacheLambdaTemplates = (bool) $options['cache_lambda_templates'];
165
+ }
166
+
167
+ if (isset($options['loader'])) {
168
+ $this->setLoader($options['loader']);
169
+ }
170
+
171
+ if (isset($options['partials_loader'])) {
172
+ $this->setPartialsLoader($options['partials_loader']);
173
+ }
174
+
175
+ if (isset($options['partials'])) {
176
+ $this->setPartials($options['partials']);
177
+ }
178
+
179
+ if (isset($options['helpers'])) {
180
+ $this->setHelpers($options['helpers']);
181
+ }
182
+
183
+ if (isset($options['escape'])) {
184
+ if (!is_callable($options['escape'])) {
185
+ throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "escape" option must be callable');
186
+ }
187
+
188
+ $this->escape = $options['escape'];
189
+ }
190
+
191
+ if (isset($options['entity_flags'])) {
192
+ $this->entityFlags = $options['entity_flags'];
193
+ }
194
+
195
+ if (isset($options['charset'])) {
196
+ $this->charset = $options['charset'];
197
+ }
198
+
199
+ if (isset($options['logger'])) {
200
+ $this->setLogger($options['logger']);
201
+ }
202
+
203
+ if (isset($options['strict_callables'])) {
204
+ $this->strictCallables = $options['strict_callables'];
205
+ }
206
+
207
+ if (isset($options['delimiters'])) {
208
+ $this->delimiters = $options['delimiters'];
209
+ }
210
+
211
+ if (isset($options['pragmas'])) {
212
+ foreach ($options['pragmas'] as $pragma) {
213
+ if (!isset(self::$knownPragmas[$pragma])) {
214
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unknown pragma: "%s".', $pragma));
215
+ }
216
+ $this->pragmas[$pragma] = true;
217
+ }
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Shortcut 'render' invocation.
223
+ *
224
+ * Equivalent to calling `$mustache->loadTemplate($template)->render($context);`
225
+ *
226
+ * @see Mustache_Engine::loadTemplate
227
+ * @see Mustache_Template::render
228
+ *
229
+ * @param string $template
230
+ * @param mixed $context (default: array())
231
+ *
232
+ * @return string Rendered template
233
+ */
234
+ public function render($template, $context = array())
235
+ {
236
+ return $this->loadTemplate($template)->render($context);
237
+ }
238
+
239
+ /**
240
+ * Get the current Mustache escape callback.
241
+ *
242
+ * @return callable|null
243
+ */
244
+ public function getEscape()
245
+ {
246
+ return $this->escape;
247
+ }
248
+
249
+ /**
250
+ * Get the current Mustache entitity type to escape.
251
+ *
252
+ * @return int
253
+ */
254
+ public function getEntityFlags()
255
+ {
256
+ return $this->entityFlags;
257
+ }
258
+
259
+ /**
260
+ * Get the current Mustache character set.
261
+ *
262
+ * @return string
263
+ */
264
+ public function getCharset()
265
+ {
266
+ return $this->charset;
267
+ }
268
+
269
+ /**
270
+ * Get the current globally enabled pragmas.
271
+ *
272
+ * @return array
273
+ */
274
+ public function getPragmas()
275
+ {
276
+ return array_keys($this->pragmas);
277
+ }
278
+
279
+ /**
280
+ * Set the Mustache template Loader instance.
281
+ *
282
+ * @param Mustache_Loader $loader
283
+ */
284
+ public function setLoader(Mustache_Loader $loader)
285
+ {
286
+ $this->loader = $loader;
287
+ }
288
+
289
+ /**
290
+ * Get the current Mustache template Loader instance.
291
+ *
292
+ * If no Loader instance has been explicitly specified, this method will instantiate and return
293
+ * a StringLoader instance.
294
+ *
295
+ * @return Mustache_Loader
296
+ */
297
+ public function getLoader()
298
+ {
299
+ if (!isset($this->loader)) {
300
+ $this->loader = new Mustache_Loader_StringLoader();
301
+ }
302
+
303
+ return $this->loader;
304
+ }
305
+
306
+ /**
307
+ * Set the Mustache partials Loader instance.
308
+ *
309
+ * @param Mustache_Loader $partialsLoader
310
+ */
311
+ public function setPartialsLoader(Mustache_Loader $partialsLoader)
312
+ {
313
+ $this->partialsLoader = $partialsLoader;
314
+ }
315
+
316
+ /**
317
+ * Get the current Mustache partials Loader instance.
318
+ *
319
+ * If no Loader instance has been explicitly specified, this method will instantiate and return
320
+ * an ArrayLoader instance.
321
+ *
322
+ * @return Mustache_Loader
323
+ */
324
+ public function getPartialsLoader()
325
+ {
326
+ if (!isset($this->partialsLoader)) {
327
+ $this->partialsLoader = new Mustache_Loader_ArrayLoader();
328
+ }
329
+
330
+ return $this->partialsLoader;
331
+ }
332
+
333
+ /**
334
+ * Set partials for the current partials Loader instance.
335
+ *
336
+ * @throws Mustache_Exception_RuntimeException If the current Loader instance is immutable
337
+ *
338
+ * @param array $partials (default: array())
339
+ */
340
+ public function setPartials(array $partials = array())
341
+ {
342
+ if (!isset($this->partialsLoader)) {
343
+ $this->partialsLoader = new Mustache_Loader_ArrayLoader();
344
+ }
345
+
346
+ if (!$this->partialsLoader instanceof Mustache_Loader_MutableLoader) {
347
+ throw new Mustache_Exception_RuntimeException('Unable to set partials on an immutable Mustache Loader instance');
348
+ }
349
+
350
+ $this->partialsLoader->setTemplates($partials);
351
+ }
352
+
353
+ /**
354
+ * Set an array of Mustache helpers.
355
+ *
356
+ * An array of 'helpers'. Helpers can be global variables or objects, closures (e.g. for higher order sections), or
357
+ * any other valid Mustache context value. They will be prepended to the context stack, so they will be available in
358
+ * any template loaded by this Mustache instance.
359
+ *
360
+ * @throws Mustache_Exception_InvalidArgumentException if $helpers is not an array or Traversable
361
+ *
362
+ * @param array|Traversable $helpers
363
+ */
364
+ public function setHelpers($helpers)
365
+ {
366
+ if (!is_array($helpers) && !$helpers instanceof Traversable) {
367
+ throw new Mustache_Exception_InvalidArgumentException('setHelpers expects an array of helpers');
368
+ }
369
+
370
+ $this->getHelpers()->clear();
371
+
372
+ foreach ($helpers as $name => $helper) {
373
+ $this->addHelper($name, $helper);
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Get the current set of Mustache helpers.
379
+ *
380
+ * @see Mustache_Engine::setHelpers
381
+ *
382
+ * @return Mustache_HelperCollection
383
+ */
384
+ public function getHelpers()
385
+ {
386
+ if (!isset($this->helpers)) {
387
+ $this->helpers = new Mustache_HelperCollection();
388
+ }
389
+
390
+ return $this->helpers;
391
+ }
392
+
393
+ /**
394
+ * Add a new Mustache helper.
395
+ *
396
+ * @see Mustache_Engine::setHelpers
397
+ *
398
+ * @param string $name
399
+ * @param mixed $helper
400
+ */
401
+ public function addHelper($name, $helper)
402
+ {
403
+ $this->getHelpers()->add($name, $helper);
404
+ }
405
+
406
+ /**
407
+ * Get a Mustache helper by name.
408
+ *
409
+ * @see Mustache_Engine::setHelpers
410
+ *
411
+ * @param string $name
412
+ *
413
+ * @return mixed Helper
414
+ */
415
+ public function getHelper($name)
416
+ {
417
+ return $this->getHelpers()->get($name);
418
+ }
419
+
420
+ /**
421
+ * Check whether this Mustache instance has a helper.
422
+ *
423
+ * @see Mustache_Engine::setHelpers
424
+ *
425
+ * @param string $name
426
+ *
427
+ * @return bool True if the helper is present
428
+ */
429
+ public function hasHelper($name)
430
+ {
431
+ return $this->getHelpers()->has($name);
432
+ }
433
+
434
+ /**
435
+ * Remove a helper by name.
436
+ *
437
+ * @see Mustache_Engine::setHelpers
438
+ *
439
+ * @param string $name
440
+ */
441
+ public function removeHelper($name)
442
+ {
443
+ $this->getHelpers()->remove($name);
444
+ }
445
+
446
+ /**
447
+ * Set the Mustache Logger instance.
448
+ *
449
+ * @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
450
+ *
451
+ * @param Mustache_Logger|Psr\Log\LoggerInterface $logger
452
+ */
453
+ public function setLogger($logger = null)
454
+ {
455
+ if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) {
456
+ throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.');
457
+ }
458
+
459
+ if ($this->getCache()->getLogger() === null) {
460
+ $this->getCache()->setLogger($logger);
461
+ }
462
+
463
+ $this->logger = $logger;
464
+ }
465
+
466
+ /**
467
+ * Get the current Mustache Logger instance.
468
+ *
469
+ * @return Mustache_Logger|Psr\Log\LoggerInterface
470
+ */
471
+ public function getLogger()
472
+ {
473
+ return $this->logger;
474
+ }
475
+
476
+ /**
477
+ * Set the Mustache Tokenizer instance.
478
+ *
479
+ * @param Mustache_Tokenizer $tokenizer
480
+ */
481
+ public function setTokenizer(Mustache_Tokenizer $tokenizer)
482
+ {
483
+ $this->tokenizer = $tokenizer;
484
+ }
485
+
486
+ /**
487
+ * Get the current Mustache Tokenizer instance.
488
+ *
489
+ * If no Tokenizer instance has been explicitly specified, this method will instantiate and return a new one.
490
+ *
491
+ * @return Mustache_Tokenizer
492
+ */
493
+ public function getTokenizer()
494
+ {
495
+ if (!isset($this->tokenizer)) {
496
+ $this->tokenizer = new Mustache_Tokenizer();
497
+ }
498
+
499
+ return $this->tokenizer;
500
+ }
501
+
502
+ /**
503
+ * Set the Mustache Parser instance.
504
+ *
505
+ * @param Mustache_Parser $parser
506
+ */
507
+ public function setParser(Mustache_Parser $parser)
508
+ {
509
+ $this->parser = $parser;
510
+ }
511
+
512
+ /**
513
+ * Get the current Mustache Parser instance.
514
+ *
515
+ * If no Parser instance has been explicitly specified, this method will instantiate and return a new one.
516
+ *
517
+ * @return Mustache_Parser
518
+ */
519
+ public function getParser()
520
+ {
521
+ if (!isset($this->parser)) {
522
+ $this->parser = new Mustache_Parser();
523
+ }
524
+
525
+ return $this->parser;
526
+ }
527
+
528
+ /**
529
+ * Set the Mustache Compiler instance.
530
+ *
531
+ * @param Mustache_Compiler $compiler
532
+ */
533
+ public function setCompiler(Mustache_Compiler $compiler)
534
+ {
535
+ $this->compiler = $compiler;
536
+ }
537
+
538
+ /**
539
+ * Get the current Mustache Compiler instance.
540
+ *
541
+ * If no Compiler instance has been explicitly specified, this method will instantiate and return a new one.
542
+ *
543
+ * @return Mustache_Compiler
544
+ */
545
+ public function getCompiler()
546
+ {
547
+ if (!isset($this->compiler)) {
548
+ $this->compiler = new Mustache_Compiler();
549
+ }
550
+
551
+ return $this->compiler;
552
+ }
553
+
554
+ /**
555
+ * Set the Mustache Cache instance.
556
+ *
557
+ * @param Mustache_Cache $cache
558
+ */
559
+ public function setCache(Mustache_Cache $cache)
560
+ {
561
+ if (isset($this->logger) && $cache->getLogger() === null) {
562
+ $cache->setLogger($this->getLogger());
563
+ }
564
+
565
+ $this->cache = $cache;
566
+ }
567
+
568
+ /**
569
+ * Get the current Mustache Cache instance.
570
+ *
571
+ * If no Cache instance has been explicitly specified, this method will instantiate and return a new one.
572
+ *
573
+ * @return Mustache_Cache
574
+ */
575
+ public function getCache()
576
+ {
577
+ if (!isset($this->cache)) {
578
+ $this->setCache(new Mustache_Cache_NoopCache());
579
+ }
580
+
581
+ return $this->cache;
582
+ }
583
+
584
+ /**
585
+ * Get the current Lambda Cache instance.
586
+ *
587
+ * If 'cache_lambda_templates' is enabled, this is the default cache instance. Otherwise, it is a NoopCache.
588
+ *
589
+ * @see Mustache_Engine::getCache
590
+ *
591
+ * @return Mustache_Cache
592
+ */
593
+ protected function getLambdaCache()
594
+ {
595
+ if ($this->cacheLambdaTemplates) {
596
+ return $this->getCache();
597
+ }
598
+
599
+ if (!isset($this->lambdaCache)) {
600
+ $this->lambdaCache = new Mustache_Cache_NoopCache();
601
+ }
602
+
603
+ return $this->lambdaCache;
604
+ }
605
+
606
+ /**
607
+ * Helper method to generate a Mustache template class.
608
+ *
609
+ * This method must be updated any time options are added which make it so
610
+ * the same template could be parsed and compiled multiple different ways.
611
+ *
612
+ * @param string|Mustache_Source $source
613
+ *
614
+ * @return string Mustache Template class name
615
+ */
616
+ public function getTemplateClassName($source)
617
+ {
618
+ // For the most part, adding a new option here should do the trick.
619
+ //
620
+ // Pick a value here which is unique for each possible way the template
621
+ // could be compiled... but not necessarily unique per option value. See
622
+ // escape below, which only needs to differentiate between 'custom' and
623
+ // 'default' escapes.
624
+ //
625
+ // Keep this list in alphabetical order :)
626
+ $chunks = array(
627
+ 'charset' => $this->charset,
628
+ 'delimiters' => $this->delimiters ? $this->delimiters : '{{ }}',
629
+ 'entityFlags' => $this->entityFlags,
630
+ 'escape' => isset($this->escape) ? 'custom' : 'default',
631
+ 'key' => ($source instanceof Mustache_Source) ? $source->getKey() : 'source',
632
+ 'pragmas' => $this->getPragmas(),
633
+ 'strictCallables' => $this->strictCallables,
634
+ 'version' => self::VERSION,
635
+ );
636
+
637
+ $key = json_encode($chunks);
638
+
639
+ // Template Source instances have already provided their own source key. For strings, just include the whole
640
+ // source string in the md5 hash.
641
+ if (!$source instanceof Mustache_Source) {
642
+ $key .= "\n" . $source;
643
+ }
644
+
645
+ return $this->templateClassPrefix . md5($key);
646
+ }
647
+
648
+ /**
649
+ * Load a Mustache Template by name.
650
+ *
651
+ * @param string $name
652
+ *
653
+ * @return Mustache_Template
654
+ */
655
+ public function loadTemplate($name)
656
+ {
657
+ return $this->loadSource($this->getLoader()->load($name));
658
+ }
659
+
660
+ /**
661
+ * Load a Mustache partial Template by name.
662
+ *
663
+ * This is a helper method used internally by Template instances for loading partial templates. You can most likely
664
+ * ignore it completely.
665
+ *
666
+ * @param string $name
667
+ *
668
+ * @return Mustache_Template
669
+ */
670
+ public function loadPartial($name)
671
+ {
672
+ try {
673
+ if (isset($this->partialsLoader)) {
674
+ $loader = $this->partialsLoader;
675
+ } elseif (isset($this->loader) && !$this->loader instanceof Mustache_Loader_StringLoader) {
676
+ $loader = $this->loader;
677
+ } else {
678
+ throw new Mustache_Exception_UnknownTemplateException($name);
679
+ }
680
+
681
+ return $this->loadSource($loader->load($name));
682
+ } catch (Mustache_Exception_UnknownTemplateException $e) {
683
+ // If the named partial cannot be found, log then return null.
684
+ $this->log(
685
+ Mustache_Logger::WARNING,
686
+ 'Partial not found: "{name}"',
687
+ array('name' => $e->getTemplateName())
688
+ );
689
+ }
690
+ }
691
+
692
+ /**
693
+ * Load a Mustache lambda Template by source.
694
+ *
695
+ * This is a helper method used by Template instances to generate subtemplates for Lambda sections. You can most
696
+ * likely ignore it completely.
697
+ *
698
+ * @param string $source
699
+ * @param string $delims (default: null)
700
+ *
701
+ * @return Mustache_Template
702
+ */
703
+ public function loadLambda($source, $delims = null)
704
+ {
705
+ if ($delims !== null) {
706
+ $source = $delims . "\n" . $source;
707
+ }
708
+
709
+ return $this->loadSource($source, $this->getLambdaCache());
710
+ }
711
+
712
+ /**
713
+ * Instantiate and return a Mustache Template instance by source.
714
+ *
715
+ * Optionally provide a Mustache_Cache instance. This is used internally by Mustache_Engine::loadLambda to respect
716
+ * the 'cache_lambda_templates' configuration option.
717
+ *
718
+ * @see Mustache_Engine::loadTemplate
719
+ * @see Mustache_Engine::loadPartial
720
+ * @see Mustache_Engine::loadLambda
721
+ *
722
+ * @param string|Mustache_Source $source
723
+ * @param Mustache_Cache $cache (default: null)
724
+ *
725
+ * @return Mustache_Template
726
+ */
727
+ private function loadSource($source, Mustache_Cache $cache = null)
728
+ {
729
+ $className = $this->getTemplateClassName($source);
730
+
731
+ if (!isset($this->templates[$className])) {
732
+ if ($cache === null) {
733
+ $cache = $this->getCache();
734
+ }
735
+
736
+ if (!class_exists($className, false)) {
737
+ if (!$cache->load($className)) {
738
+ $compiled = $this->compile($source);
739
+ $cache->cache($className, $compiled);
740
+ }
741
+ }
742
+
743
+ $this->log(
744
+ Mustache_Logger::DEBUG,
745
+ 'Instantiating template: "{className}"',
746
+ array('className' => $className)
747
+ );
748
+
749
+ $this->templates[$className] = new $className($this);
750
+ }
751
+
752
+ return $this->templates[$className];
753
+ }
754
+
755
+ /**
756
+ * Helper method to tokenize a Mustache template.
757
+ *
758
+ * @see Mustache_Tokenizer::scan
759
+ *
760
+ * @param string $source
761
+ *
762
+ * @return array Tokens
763
+ */
764
+ private function tokenize($source)
765
+ {
766
+ return $this->getTokenizer()->scan($source, $this->delimiters);
767
+ }
768
+
769
+ /**
770
+ * Helper method to parse a Mustache template.
771
+ *
772
+ * @see Mustache_Parser::parse
773
+ *
774
+ * @param string $source
775
+ *
776
+ * @return array Token tree
777
+ */
778
+ private function parse($source)
779
+ {
780
+ $parser = $this->getParser();
781
+ $parser->setPragmas($this->getPragmas());
782
+
783
+ return $parser->parse($this->tokenize($source));
784
+ }
785
+
786
+ /**
787
+ * Helper method to compile a Mustache template.
788
+ *
789
+ * @see Mustache_Compiler::compile
790
+ *
791
+ * @param string|Mustache_Source $source
792
+ *
793
+ * @return string generated Mustache template class code
794
+ */
795
+ private function compile($source)
796
+ {
797
+ $name = $this->getTemplateClassName($source);
798
+
799
+ $this->log(
800
+ Mustache_Logger::INFO,
801
+ 'Compiling template to "{className}" class',
802
+ array('className' => $name)
803
+ );
804
+
805
+ if ($source instanceof Mustache_Source) {
806
+ $source = $source->getSource();
807
+ }
808
+ $tree = $this->parse($source);
809
+
810
+ $compiler = $this->getCompiler();
811
+ $compiler->setPragmas($this->getPragmas());
812
+
813
+ return $compiler->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags);
814
+ }
815
+
816
+ /**
817
+ * Add a log record if logging is enabled.
818
+ *
819
+ * @param int $level The logging level
820
+ * @param string $message The log message
821
+ * @param array $context The log context
822
+ */
823
+ private function log($level, $message, array $context = array())
824
+ {
825
+ if (isset($this->logger)) {
826
+ $this->logger->log($level, $message, $context);
827
+ }
828
+ }
829
+ }
lib/vendor/Mustache/Exception.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Exception interface.
14
+ */
15
+ interface Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
lib/vendor/Mustache/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Invalid argument exception.
14
+ */
15
+ class Mustache_Exception_InvalidArgumentException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
lib/vendor/Mustache/Exception/LogicException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Logic exception.
14
+ */
15
+ class Mustache_Exception_LogicException extends LogicException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
lib/vendor/Mustache/Exception/RuntimeException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Runtime exception.
14
+ */
15
+ class Mustache_Exception_RuntimeException extends RuntimeException implements Mustache_Exception
16
+ {
17
+ // This space intentionally left blank.
18
+ }
lib/vendor/Mustache/Exception/SyntaxException.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache syntax exception.
14
+ */
15
+ class Mustache_Exception_SyntaxException extends LogicException implements Mustache_Exception
16
+ {
17
+ protected $token;
18
+
19
+ /**
20
+ * @param string $msg
21
+ * @param array $token
22
+ * @param Exception $previous
23
+ */
24
+ public function __construct($msg, array $token, Exception $previous = null)
25
+ {
26
+ $this->token = $token;
27
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
28
+ parent::__construct($msg, 0, $previous);
29
+ } else {
30
+ parent::__construct($msg); // @codeCoverageIgnore
31
+ }
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ */
37
+ public function getToken()
38
+ {
39
+ return $this->token;
40
+ }
41
+ }
lib/vendor/Mustache/Exception/UnknownFilterException.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown filter exception.
14
+ */
15
+ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException implements Mustache_Exception
16
+ {
17
+ protected $filterName;
18
+
19
+ /**
20
+ * @param string $filterName
21
+ * @param Exception $previous
22
+ */
23
+ public function __construct($filterName, Exception $previous = null)
24
+ {
25
+ $this->filterName = $filterName;
26
+ $message = sprintf('Unknown filter: %s', $filterName);
27
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
28
+ parent::__construct($message, 0, $previous);
29
+ } else {
30
+ parent::__construct($message); // @codeCoverageIgnore
31
+ }
32
+ }
33
+
34
+ public function getFilterName()
35
+ {
36
+ return $this->filterName;
37
+ }
38
+ }
lib/vendor/Mustache/Exception/UnknownHelperException.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown helper exception.
14
+ */
15
+ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ protected $helperName;
18
+
19
+ /**
20
+ * @param string $helperName
21
+ * @param Exception $previous
22
+ */
23
+ public function __construct($helperName, Exception $previous = null)
24
+ {
25
+ $this->helperName = $helperName;
26
+ $message = sprintf('Unknown helper: %s', $helperName);
27
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
28
+ parent::__construct($message, 0, $previous);
29
+ } else {
30
+ parent::__construct($message); // @codeCoverageIgnore
31
+ }
32
+ }
33
+
34
+ public function getHelperName()
35
+ {
36
+ return $this->helperName;
37
+ }
38
+ }
lib/vendor/Mustache/Exception/UnknownTemplateException.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Unknown template exception.
14
+ */
15
+ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentException implements Mustache_Exception
16
+ {
17
+ protected $templateName;
18
+
19
+ /**
20
+ * @param string $templateName
21
+ * @param Exception $previous
22
+ */
23
+ public function __construct($templateName, Exception $previous = null)
24
+ {
25
+ $this->templateName = $templateName;
26
+ $message = sprintf('Unknown template: %s', $templateName);
27
+ if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
28
+ parent::__construct($message, 0, $previous);
29
+ } else {
30
+ parent::__construct($message); // @codeCoverageIgnore
31
+ }
32
+ }
33
+
34
+ public function getTemplateName()
35
+ {
36
+ return $this->templateName;
37
+ }
38
+ }
lib/vendor/Mustache/HelperCollection.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A collection of helpers for a Mustache instance.
14
+ */
15
+ class Mustache_HelperCollection
16
+ {
17
+ private $helpers = array();
18
+
19
+ /**
20
+ * Helper Collection constructor.
21
+ *
22
+ * Optionally accepts an array (or Traversable) of `$name => $helper` pairs.
23
+ *
24
+ * @throws Mustache_Exception_InvalidArgumentException if the $helpers argument isn't an array or Traversable
25
+ *
26
+ * @param array|Traversable $helpers (default: null)
27
+ */
28
+ public function __construct($helpers = null)
29
+ {
30
+ if ($helpers === null) {
31
+ return;
32
+ }
33
+
34
+ if (!is_array($helpers) && !$helpers instanceof Traversable) {
35
+ throw new Mustache_Exception_InvalidArgumentException('HelperCollection constructor expects an array of helpers');
36
+ }
37
+
38
+ foreach ($helpers as $name => $helper) {
39
+ $this->add($name, $helper);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Magic mutator.
45
+ *
46
+ * @see Mustache_HelperCollection::add
47
+ *
48
+ * @param string $name
49
+ * @param mixed $helper
50
+ */
51
+ public function __set($name, $helper)
52
+ {
53
+ $this->add($name, $helper);
54
+ }
55
+
56
+ /**
57
+ * Add a helper to this collection.
58
+ *
59
+ * @param string $name
60
+ * @param mixed $helper
61
+ */
62
+ public function add($name, $helper)
63
+ {
64
+ $this->helpers[$name] = $helper;
65
+ }
66
+
67
+ /**
68
+ * Magic accessor.
69
+ *
70
+ * @see Mustache_HelperCollection::get
71
+ *
72
+ * @param string $name
73
+ *
74
+ * @return mixed Helper
75
+ */
76
+ public function __get($name)
77
+ {
78
+ return $this->get($name);
79
+ }
80
+
81
+ /**
82
+ * Get a helper by name.
83
+ *
84
+ * @throws Mustache_Exception_UnknownHelperException If helper does not exist
85
+ *
86
+ * @param string $name
87
+ *
88
+ * @return mixed Helper
89
+ */
90
+ public function get($name)
91
+ {
92
+ if (!$this->has($name)) {
93
+ throw new Mustache_Exception_UnknownHelperException($name);
94
+ }
95
+
96
+ return $this->helpers[$name];
97
+ }
98
+
99
+ /**
100
+ * Magic isset().
101
+ *
102
+ * @see Mustache_HelperCollection::has
103
+ *
104
+ * @param string $name
105
+ *
106
+ * @return bool True if helper is present
107
+ */
108
+ public function __isset($name)
109
+ {
110
+ return $this->has($name);
111
+ }
112
+
113
+ /**
114
+ * Check whether a given helper is present in the collection.
115
+ *
116
+ * @param string $name
117
+ *
118
+ * @return bool True if helper is present
119
+ */
120
+ public function has($name)
121
+ {
122
+ return array_key_exists($name, $this->helpers);
123
+ }
124
+
125
+ /**
126
+ * Magic unset().
127
+ *
128
+ * @see Mustache_HelperCollection::remove
129
+ *
130
+ * @param string $name
131
+ */
132
+ public function __unset($name)
133
+ {
134
+ $this->remove($name);
135
+ }
136
+
137
+ /**
138
+ * Check whether a given helper is present in the collection.
139
+ *
140
+ * @throws Mustache_Exception_UnknownHelperException if the requested helper is not present
141
+ *
142
+ * @param string $name
143
+ */
144
+ public function remove($name)
145
+ {
146
+ if (!$this->has($name)) {
147
+ throw new Mustache_Exception_UnknownHelperException($name);
148
+ }
149
+
150
+ unset($this->helpers[$name]);
151
+ }
152
+
153
+ /**
154
+ * Clear the helper collection.
155
+ *
156
+ * Removes all helpers from this collection
157
+ */
158
+ public function clear()
159
+ {
160
+ $this->helpers = array();
161
+ }
162
+
163
+ /**
164
+ * Check whether the helper collection is empty.
165
+ *
166
+ * @return bool True if the collection is empty
167
+ */
168
+ public function isEmpty()
169
+ {
170
+ return empty($this->helpers);
171
+ }
172
+ }
lib/vendor/Mustache/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2010-2015 Justin Hileman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
21
+ OR OTHER DEALINGS IN THE SOFTWARE.
lib/vendor/Mustache/LambdaHelper.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Lambda Helper.
14
+ *
15
+ * Passed as the second argument to section lambdas (higher order sections),
16
+ * giving them access to a `render` method for rendering a string with the
17
+ * current context.
18
+ */
19
+ class Mustache_LambdaHelper
20
+ {
21
+ private $mustache;
22
+ private $context;
23
+ private $delims;
24
+
25
+ /**
26
+ * Mustache Lambda Helper constructor.
27
+ *
28
+ * @param Mustache_Engine $mustache Mustache engine instance
29
+ * @param Mustache_Context $context Rendering context
30
+ * @param string $delims Optional custom delimiters, in the format `{{= <% %> =}}`. (default: null)
31
+ */
32
+ public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null)
33
+ {
34
+ $this->mustache = $mustache;
35
+ $this->context = $context;
36
+ $this->delims = $delims;
37
+ }
38
+
39
+ /**
40
+ * Render a string as a Mustache template with the current rendering context.
41
+ *
42
+ * @param string $string
43
+ *
44
+ * @return string Rendered template
45
+ */
46
+ public function render($string)
47
+ {
48
+ return $this->mustache
49
+ ->loadLambda((string) $string, $this->delims)
50
+ ->renderInternal($this->context);
51
+ }
52
+
53
+ /**
54
+ * Render a string as a Mustache template with the current rendering context.
55
+ *
56
+ * @param string $string
57
+ *
58
+ * @return string Rendered template
59
+ */
60
+ public function __invoke($string)
61
+ {
62
+ return $this->render($string);
63
+ }
64
+
65
+ /**
66
+ * Get a Lambda Helper with custom delimiters.
67
+ *
68
+ * @param string $delims Custom delimiters, in the format `{{= <% %> =}}`
69
+ *
70
+ * @return Mustache_LambdaHelper
71
+ */
72
+ public function withDelimiters($delims)
73
+ {
74
+ return new self($this->mustache, $this->context, $delims);
75
+ }
76
+ }
lib/vendor/Mustache/Loader.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template Loader interface.
14
+ */
15
+ interface Mustache_Loader
16
+ {
17
+ /**
18
+ * Load a Template by name.
19
+ *
20
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found
21
+ *
22
+ * @param string $name
23
+ *
24
+ * @return string|Mustache_Source Mustache Template source
25
+ */
26
+ public function load($name);
27
+ }
lib/vendor/Mustache/Loader/ArrayLoader.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template array Loader implementation.
14
+ *
15
+ * An ArrayLoader instance loads Mustache Template source by name from an initial array:
16
+ *
17
+ * $loader = new ArrayLoader(
18
+ * 'foo' => '{{ bar }}',
19
+ * 'baz' => 'Hey {{ qux }}!'
20
+ * );
21
+ *
22
+ * $tpl = $loader->load('foo'); // '{{ bar }}'
23
+ *
24
+ * The ArrayLoader is used internally as a partials loader by Mustache_Engine instance when an array of partials
25
+ * is set. It can also be used as a quick-and-dirty Template loader.
26
+ */
27
+ class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_MutableLoader
28
+ {
29
+ private $templates;
30
+
31
+ /**
32
+ * ArrayLoader constructor.
33
+ *
34
+ * @param array $templates Associative array of Template source (default: array())
35
+ */
36
+ public function __construct(array $templates = array())
37
+ {
38
+ $this->templates = $templates;
39
+ }
40
+
41
+ /**
42
+ * Load a Template.
43
+ *
44
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found
45
+ *
46
+ * @param string $name
47
+ *
48
+ * @return string Mustache Template source
49
+ */
50
+ public function load($name)
51
+ {
52
+ if (!isset($this->templates[$name])) {
53
+ throw new Mustache_Exception_UnknownTemplateException($name);
54
+ }
55
+
56
+ return $this->templates[$name];
57
+ }
58
+
59
+ /**
60
+ * Set an associative array of Template sources for this loader.
61
+ *
62
+ * @param array $templates
63
+ */
64
+ public function setTemplates(array $templates)
65
+ {
66
+ $this->templates = $templates;
67
+ }
68
+
69
+ /**
70
+ * Set a Template source by name.
71
+ *
72
+ * @param string $name
73
+ * @param string $template Mustache Template source
74
+ */
75
+ public function setTemplate($name, $template)
76
+ {
77
+ $this->templates[$name] = $template;
78
+ }
79
+ }
lib/vendor/Mustache/Loader/CascadingLoader.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Template cascading loader implementation, which delegates to other
14
+ * Loader instances.
15
+ */
16
+ class Mustache_Loader_CascadingLoader implements Mustache_Loader
17
+ {
18
+ private $loaders;
19
+
20
+ /**
21
+ * Construct a CascadingLoader with an array of loaders.
22
+ *
23
+ * $loader = new Mustache_Loader_CascadingLoader(array(
24
+ * new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
25
+ * new Mustache_Loader_FilesystemLoader(__DIR__.'/templates')
26
+ * ));
27
+ *
28
+ * @param Mustache_Loader[] $loaders
29
+ */
30
+ public function __construct(array $loaders = array())
31
+ {
32
+ $this->loaders = array();
33
+ foreach ($loaders as $loader) {
34
+ $this->addLoader($loader);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Add a Loader instance.
40
+ *
41
+ * @param Mustache_Loader $loader
42
+ */
43
+ public function addLoader(Mustache_Loader $loader)
44
+ {
45
+ $this->loaders[] = $loader;
46
+ }
47
+
48
+ /**
49
+ * Load a Template by name.
50
+ *
51
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found
52
+ *
53
+ * @param string $name
54
+ *
55
+ * @return string Mustache Template source
56
+ */
57
+ public function load($name)
58
+ {
59
+ foreach ($this->loaders as $loader) {
60
+ try {
61
+ return $loader->load($name);
62
+ } catch (Mustache_Exception_UnknownTemplateException $e) {
63
+ // do nothing, check the next loader.
64
+ }
65
+ }
66
+
67
+ throw new Mustache_Exception_UnknownTemplateException($name);
68
+ }
69
+ }
lib/vendor/Mustache/Loader/FilesystemLoader.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template filesystem Loader implementation.
14
+ *
15
+ * A FilesystemLoader instance loads Mustache Template source from the filesystem by name:
16
+ *
17
+ * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
18
+ * $tpl = $loader->load('foo'); // equivalent to `file_get_contents(dirname(__FILE__).'/views/foo.mustache');
19
+ *
20
+ * This is probably the most useful Mustache Loader implementation. It can be used for partials and normal Templates:
21
+ *
22
+ * $m = new Mustache(array(
23
+ * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
24
+ * 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'),
25
+ * ));
26
+ */
27
+ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
28
+ {
29
+ private $baseDir;
30
+ private $extension = '.mustache';
31
+ private $templates = array();
32
+
33
+ /**
34
+ * Mustache filesystem Loader constructor.
35
+ *
36
+ * Passing an $options array allows overriding certain Loader options during instantiation:
37
+ *
38
+ * $options = array(
39
+ * // The filename extension used for Mustache templates. Defaults to '.mustache'
40
+ * 'extension' => '.ms',
41
+ * );
42
+ *
43
+ * @throws Mustache_Exception_RuntimeException if $baseDir does not exist
44
+ *
45
+ * @param string $baseDir Base directory containing Mustache template files
46
+ * @param array $options Array of Loader options (default: array())
47
+ */
48
+ public function __construct($baseDir, array $options = array())
49
+ {
50
+ $this->baseDir = $baseDir;
51
+
52
+ if (strpos($this->baseDir, '://') === false) {
53
+ $this->baseDir = realpath($this->baseDir);
54
+ }
55
+
56
+ if ($this->shouldCheckPath() && !is_dir($this->baseDir)) {
57
+ throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
58
+ }
59
+
60
+ if (array_key_exists('extension', $options)) {
61
+ if (empty($options['extension'])) {
62
+ $this->extension = '';
63
+ } else {
64
+ $this->extension = '.' . ltrim($options['extension'], '.');
65
+ }
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Load a Template by name.
71
+ *
72
+ * $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
73
+ * $loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache";
74
+ *
75
+ * @param string $name
76
+ *
77
+ * @return string Mustache Template source
78
+ */
79
+ public function load($name)
80
+ {
81
+ if (!isset($this->templates[$name])) {
82
+ $this->templates[$name] = $this->loadFile($name);
83
+ }
84
+
85
+ return $this->templates[$name];
86
+ }
87
+
88
+ /**
89
+ * Helper function for loading a Mustache file by name.
90
+ *
91
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found
92
+ *
93
+ * @param string $name
94
+ *
95
+ * @return string Mustache Template source
96
+ */
97
+ protected function loadFile($name)
98
+ {
99
+ $fileName = $this->getFileName($name);
100
+
101
+ if ($this->shouldCheckPath() && !file_exists($fileName)) {
102
+ throw new Mustache_Exception_UnknownTemplateException($name);
103
+ }
104
+
105
+ return file_get_contents($fileName);
106
+ }
107
+
108
+ /**
109
+ * Helper function for getting a Mustache template file name.
110
+ *
111
+ * @param string $name
112
+ *
113
+ * @return string Template file name
114
+ */
115
+ protected function getFileName($name)
116
+ {
117
+ $fileName = $this->baseDir . '/' . $name;
118
+ if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) {
119
+ $fileName .= $this->extension;
120
+ }
121
+
122
+ return $fileName;
123
+ }
124
+
125
+ /**
126
+ * Only check if baseDir is a directory and requested templates are files if
127
+ * baseDir is using the filesystem stream wrapper.
128
+ *
129
+ * @return bool Whether to check `is_dir` and `file_exists`
130
+ */
131
+ protected function shouldCheckPath()
132
+ {
133
+ return strpos($this->baseDir, '://') === false || strpos($this->baseDir, 'file://') === 0;
134
+ }
135
+ }
lib/vendor/Mustache/Loader/InlineLoader.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Template loader for inline templates.
14
+ *
15
+ * With the InlineLoader, templates can be defined at the end of any PHP source
16
+ * file:
17
+ *
18
+ * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
19
+ * $hello = $loader->load('hello');
20
+ * $goodbye = $loader->load('goodbye');
21
+ *
22
+ * __halt_compiler();
23
+ *
24
+ * @@ hello
25
+ * Hello, {{ planet }}!
26
+ *
27
+ * @@ goodbye
28
+ * Goodbye, cruel {{ planet }}
29
+ *
30
+ * Templates are deliniated by lines containing only `@@ name`.
31
+ *
32
+ * The InlineLoader is well-suited to micro-frameworks such as Silex:
33
+ *
34
+ * $app->register(new MustacheServiceProvider, array(
35
+ * 'mustache.loader' => new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__)
36
+ * ));
37
+ *
38
+ * $app->get('/{name}', function ($name) use ($app) {
39
+ * return $app['mustache']->render('hello', compact('name'));
40
+ * })
41
+ * ->value('name', 'world');
42
+ *
43
+ * // ...
44
+ *
45
+ * __halt_compiler();
46
+ *
47
+ * @@ hello
48
+ * Hello, {{ name }}!
49
+ */
50
+ class Mustache_Loader_InlineLoader implements Mustache_Loader
51
+ {
52
+ protected $fileName;
53
+ protected $offset;
54
+ protected $templates;
55
+
56
+ /**
57
+ * The InlineLoader requires a filename and offset to process templates.
58
+ *
59
+ * The magic constants `__FILE__` and `__COMPILER_HALT_OFFSET__` are usually
60
+ * perfectly suited to the job:
61
+ *
62
+ * $loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
63
+ *
64
+ * Note that this only works if the loader is instantiated inside the same
65
+ * file as the inline templates. If the templates are located in another
66
+ * file, it would be necessary to manually specify the filename and offset.
67
+ *
68
+ * @param string $fileName The file to parse for inline templates
69
+ * @param int $offset A string offset for the start of the templates.
70
+ * This usually coincides with the `__halt_compiler`
71
+ * call, and the `__COMPILER_HALT_OFFSET__`
72
+ */
73
+ public function __construct($fileName, $offset)
74
+ {
75
+ if (!is_file($fileName)) {
76
+ throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid filename.');
77
+ }
78
+
79
+ if (!is_int($offset) || $offset < 0) {
80
+ throw new Mustache_Exception_InvalidArgumentException('InlineLoader expects a valid file offset.');
81
+ }
82
+
83
+ $this->fileName = $fileName;
84
+ $this->offset = $offset;
85
+ }
86
+
87
+ /**
88
+ * Load a Template by name.
89
+ *
90
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found
91
+ *
92
+ * @param string $name
93
+ *
94
+ * @return string Mustache Template source
95
+ */
96
+ public function load($name)
97
+ {
98
+ $this->loadTemplates();
99
+
100
+ if (!array_key_exists($name, $this->templates)) {
101
+ throw new Mustache_Exception_UnknownTemplateException($name);
102
+ }
103
+
104
+ return $this->templates[$name];
105
+ }
106
+
107
+ /**
108
+ * Parse and load templates from the end of a source file.
109
+ */
110
+ protected function loadTemplates()
111
+ {
112
+ if ($this->templates === null) {
113
+ $this->templates = array();
114
+ $data = file_get_contents($this->fileName, false, null, $this->offset);
115
+ foreach (preg_split("/^@@(?= [\w\d\.]+$)/m", $data, -1) as $chunk) {
116
+ if (trim($chunk)) {
117
+ list($name, $content) = explode("\n", $chunk, 2);
118
+ $this->templates[trim($name)] = trim($content);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
lib/vendor/Mustache/Loader/MutableLoader.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template mutable Loader interface.
14
+ */
15
+ interface Mustache_Loader_MutableLoader
16
+ {
17
+ /**
18
+ * Set an associative array of Template sources for this loader.
19
+ *
20
+ * @param array $templates
21
+ */
22
+ public function setTemplates(array $templates);
23
+
24
+ /**
25
+ * Set a Template source by name.
26
+ *
27
+ * @param string $name
28
+ * @param string $template Mustache Template source
29
+ */
30
+ public function setTemplate($name, $template);
31
+ }
lib/vendor/Mustache/Loader/ProductionFilesystemLoader.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template production filesystem Loader implementation.
14
+ *
15
+ * A production-ready FilesystemLoader, which doesn't require reading a file if it already exists in the template cache.
16
+ *
17
+ * {@inheritdoc}
18
+ */
19
+ class Mustache_Loader_ProductionFilesystemLoader extends Mustache_Loader_FilesystemLoader
20
+ {
21
+ private $statProps;
22
+
23
+ /**
24
+ * Mustache production filesystem Loader constructor.
25
+ *
26
+ * Passing an $options array allows overriding certain Loader options during instantiation:
27
+ *
28
+ * $options = array(
29
+ * // The filename extension used for Mustache templates. Defaults to '.mustache'
30
+ * 'extension' => '.ms',
31
+ * 'stat_props' => array('size', 'mtime'),
32
+ * );
33
+ *
34
+ * Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this
35
+ * uses 'mtime' and 'size', but this can be set to any of the properties supported by stat():
36
+ *
37
+ * http://php.net/manual/en/function.stat.php
38
+ *
39
+ * You can also disable filesystem stat entirely:
40
+ *
41
+ * $options = array('stat_props' => null);
42
+ *
43
+ * But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation,
44
+ * YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy
45
+ * process so you don't forget!
46
+ *
47
+ * @throws Mustache_Exception_RuntimeException if $baseDir does not exist.
48
+ *
49
+ * @param string $baseDir Base directory containing Mustache template files.
50
+ * @param array $options Array of Loader options (default: array())
51
+ */
52
+ public function __construct($baseDir, array $options = array())
53
+ {
54
+ parent::__construct($baseDir, $options);
55
+
56
+ if (array_key_exists('stat_props', $options)) {
57
+ if (empty($options['stat_props'])) {
58
+ $this->statProps = array();
59
+ } else {
60
+ $this->statProps = $options['stat_props'];
61
+ }
62
+ } else {
63
+ $this->statProps = array('size', 'mtime');
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Helper function for loading a Mustache file by name.
69
+ *
70
+ * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
71
+ *
72
+ * @param string $name
73
+ *
74
+ * @return Mustache_Source Mustache Template source
75
+ */
76
+ protected function loadFile($name)
77
+ {
78
+ $fileName = $this->getFileName($name);
79
+
80
+ if (!file_exists($fileName)) {
81
+ throw new Mustache_Exception_UnknownTemplateException($name);
82
+ }
83
+
84
+ return new Mustache_Source_FilesystemSource($fileName, $this->statProps);
85
+ }
86
+ }
lib/vendor/Mustache/Loader/StringLoader.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Template string Loader implementation.
14
+ *
15
+ * A StringLoader instance is essentially a noop. It simply passes the 'name' argument straight through:
16
+ *
17
+ * $loader = new StringLoader;
18
+ * $tpl = $loader->load('{{ foo }}'); // '{{ foo }}'
19
+ *
20
+ * This is the default Template Loader instance used by Mustache:
21
+ *
22
+ * $m = new Mustache;
23
+ * $tpl = $m->loadTemplate('{{ foo }}');
24
+ * echo $tpl->render(array('foo' => 'bar')); // "bar"
25
+ */
26
+ class Mustache_Loader_StringLoader implements Mustache_Loader
27
+ {
28
+ /**
29
+ * Load a Template by source.
30
+ *
31
+ * @param string $name Mustache Template source
32
+ *
33
+ * @return string Mustache Template source
34
+ */
35
+ public function load($name)
36
+ {
37
+ return $name;
38
+ }
39
+ }
lib/vendor/Mustache/Logger.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Describes a Mustache logger instance.
14
+ *
15
+ * This is identical to the Psr\Log\LoggerInterface.
16
+ *
17
+ * The message MUST be a string or object implementing __toString().
18
+ *
19
+ * The message MAY contain placeholders in the form: {foo} where foo
20
+ * will be replaced by the context data in key "foo".
21
+ *
22
+ * The context array can contain arbitrary data, the only assumption that
23
+ * can be made by implementors is that if an Exception instance is given
24
+ * to produce a stack trace, it MUST be in a key named "exception".
25
+ *
26
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
27
+ * for the full interface specification.
28
+ */
29
+ interface Mustache_Logger
30
+ {
31
+ /**
32
+ * Psr\Log compatible log levels.
33
+ */
34
+ const EMERGENCY = 'emergency';
35
+ const ALERT = 'alert';
36
+ const CRITICAL = 'critical';
37
+ const ERROR = 'error';
38
+ const WARNING = 'warning';
39
+ const NOTICE = 'notice';
40
+ const INFO = 'info';
41
+ const DEBUG = 'debug';
42
+
43
+ /**
44
+ * System is unusable.
45
+ *
46
+ * @param string $message
47
+ * @param array $context
48
+ */
49
+ public function emergency($message, array $context = array());
50
+
51
+ /**
52
+ * Action must be taken immediately.
53
+ *
54
+ * Example: Entire website down, database unavailable, etc. This should
55
+ * trigger the SMS alerts and wake you up.
56
+ *
57
+ * @param string $message
58
+ * @param array $context
59
+ */
60
+ public function alert($message, array $context = array());
61
+
62
+ /**
63
+ * Critical conditions.
64
+ *
65
+ * Example: Application component unavailable, unexpected exception.
66
+ *
67
+ * @param string $message
68
+ * @param array $context
69
+ */
70
+ public function critical($message, array $context = array());
71
+
72
+ /**
73
+ * Runtime errors that do not require immediate action but should typically
74
+ * be logged and monitored.
75
+ *
76
+ * @param string $message
77
+ * @param array $context
78
+ */
79
+ public function error($message, array $context = array());
80
+
81
+ /**
82
+ * Exceptional occurrences that are not errors.
83
+ *
84
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
85
+ * that are not necessarily wrong.
86
+ *
87
+ * @param string $message
88
+ * @param array $context
89
+ */
90
+ public function warning($message, array $context = array());
91
+
92
+ /**
93
+ * Normal but significant events.
94
+ *
95
+ * @param string $message
96
+ * @param array $context
97
+ */
98
+ public function notice($message, array $context = array());
99
+
100
+ /**
101
+ * Interesting events.
102
+ *
103
+ * Example: User logs in, SQL logs.
104
+ *
105
+ * @param string $message
106
+ * @param array $context
107
+ */
108
+ public function info($message, array $context = array());
109
+
110
+ /**
111
+ * Detailed debug information.
112
+ *
113
+ * @param string $message
114
+ * @param array $context
115
+ */
116
+ public function debug($message, array $context = array());
117
+
118
+ /**
119
+ * Logs with an arbitrary level.
120
+ *
121
+ * @param mixed $level
122
+ * @param string $message
123
+ * @param array $context
124
+ */
125
+ public function log($level, $message, array $context = array());
126
+ }
lib/vendor/Mustache/Logger/AbstractLogger.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * This is a simple Logger implementation that other Loggers can inherit from.
14
+ *
15
+ * This is identical to the Psr\Log\AbstractLogger.
16
+ *
17
+ * It simply delegates all log-level-specific methods to the `log` method to
18
+ * reduce boilerplate code that a simple Logger that does the same thing with
19
+ * messages regardless of the error level has to implement.
20
+ */
21
+ abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
22
+ {
23
+ /**
24
+ * System is unusable.
25
+ *
26
+ * @param string $message
27
+ * @param array $context
28
+ */
29
+ public function emergency($message, array $context = array())
30
+ {
31
+ $this->log(Mustache_Logger::EMERGENCY, $message, $context);
32
+ }
33
+
34
+ /**
35
+ * Action must be taken immediately.
36
+ *
37
+ * Example: Entire website down, database unavailable, etc. This should
38
+ * trigger the SMS alerts and wake you up.
39
+ *
40
+ * @param string $message
41
+ * @param array $context
42
+ */
43
+ public function alert($message, array $context = array())
44
+ {
45
+ $this->log(Mustache_Logger::ALERT, $message, $context);
46
+ }
47
+
48
+ /**
49
+ * Critical conditions.
50
+ *
51
+ * Example: Application component unavailable, unexpected exception.
52
+ *
53
+ * @param string $message
54
+ * @param array $context
55
+ */
56
+ public function critical($message, array $context = array())
57
+ {
58
+ $this->log(Mustache_Logger::CRITICAL, $message, $context);
59
+ }
60
+
61
+ /**
62
+ * Runtime errors that do not require immediate action but should typically
63
+ * be logged and monitored.
64
+ *
65
+ * @param string $message
66
+ * @param array $context
67
+ */
68
+ public function error($message, array $context = array())
69
+ {
70
+ $this->log(Mustache_Logger::ERROR, $message, $context);
71
+ }
72
+
73
+ /**
74
+ * Exceptional occurrences that are not errors.
75
+ *
76
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
77
+ * that are not necessarily wrong.
78
+ *
79
+ * @param string $message
80
+ * @param array $context
81
+ */
82
+ public function warning($message, array $context = array())
83
+ {
84
+ $this->log(Mustache_Logger::WARNING, $message, $context);
85
+ }
86
+
87
+ /**
88
+ * Normal but significant events.
89
+ *
90
+ * @param string $message
91
+ * @param array $context
92
+ */
93
+ public function notice($message, array $context = array())
94
+ {
95
+ $this->log(Mustache_Logger::NOTICE, $message, $context);
96
+ }
97
+
98
+ /**
99
+ * Interesting events.
100
+ *
101
+ * Example: User logs in, SQL logs.
102
+ *
103
+ * @param string $message
104
+ * @param array $context
105
+ */
106
+ public function info($message, array $context = array())
107
+ {
108
+ $this->log(Mustache_Logger::INFO, $message, $context);
109
+ }
110
+
111
+ /**
112
+ * Detailed debug information.
113
+ *
114
+ * @param string $message
115
+ * @param array $context
116
+ */
117
+ public function debug($message, array $context = array())
118
+ {
119
+ $this->log(Mustache_Logger::DEBUG, $message, $context);
120
+ }
121
+ }
lib/vendor/Mustache/Logger/StreamLogger.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * A Mustache Stream Logger.
14
+ *
15
+ * The Stream Logger wraps a file resource instance (such as a stream) or a
16
+ * stream URL. All log messages over the threshold level will be appended to
17
+ * this stream.
18
+ *
19
+ * Hint: Try `php://stderr` for your stream URL.
20
+ */
21
+ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
22
+ {
23
+ protected static $levels = array(
24
+ self::DEBUG => 100,
25
+ self::INFO => 200,
26
+ self::NOTICE => 250,
27
+ self::WARNING => 300,
28
+ self::ERROR => 400,
29
+ self::CRITICAL => 500,
30
+ self::ALERT => 550,
31
+ self::EMERGENCY => 600,
32
+ );
33
+
34
+ protected $level;
35
+ protected $stream = null;
36
+ protected $url = null;
37
+
38
+ /**
39
+ * @throws InvalidArgumentException if the logging level is unknown
40
+ *
41
+ * @param resource|string $stream Resource instance or URL
42
+ * @param int $level The minimum logging level at which this handler will be triggered
43
+ */
44
+ public function __construct($stream, $level = Mustache_Logger::ERROR)
45
+ {
46
+ $this->setLevel($level);
47
+
48
+ if (is_resource($stream)) {
49
+ $this->stream = $stream;
50
+ } else {
51
+ $this->url = $stream;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Close stream resources.
57
+ */
58
+ public function __destruct()
59
+ {
60
+ if (is_resource($this->stream)) {
61
+ fclose($this->stream);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Set the minimum logging level.
67
+ *
68
+ * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
69
+ *
70
+ * @param int $level The minimum logging level which will be written
71
+ */
72
+ public function setLevel($level)
73
+ {
74
+ if (!array_key_exists($level, self::$levels)) {
75
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
76
+ }
77
+
78
+ $this->level = $level;
79
+ }
80
+
81
+ /**
82
+ * Get the current minimum logging level.
83
+ *
84
+ * @return int
85
+ */
86
+ public function getLevel()
87
+ {
88
+ return $this->level;
89
+ }
90
+
91
+ /**
92
+ * Logs with an arbitrary level.
93
+ *
94
+ * @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
95
+ *
96
+ * @param mixed $level
97
+ * @param string $message
98
+ * @param array $context
99
+ */
100
+ public function log($level, $message, array $context = array())
101
+ {
102
+ if (!array_key_exists($level, self::$levels)) {
103
+ throw new Mustache_Exception_InvalidArgumentException(sprintf('Unexpected logging level: %s', $level));
104
+ }
105
+
106
+ if (self::$levels[$level] >= self::$levels[$this->level]) {
107
+ $this->writeLog($level, $message, $context);
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Write a record to the log.
113
+ *
114
+ * @throws Mustache_Exception_LogicException If neither a stream resource nor url is present
115
+ * @throws Mustache_Exception_RuntimeException If the stream url cannot be opened
116
+ *
117
+ * @param int $level The logging level
118
+ * @param string $message The log message
119
+ * @param array $context The log context
120
+ */
121
+ protected function writeLog($level, $message, array $context = array())
122
+ {
123
+ if (!is_resource($this->stream)) {
124
+ if (!isset($this->url)) {
125
+ throw new Mustache_Exception_LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
126
+ }
127
+
128
+ $this->stream = fopen($this->url, 'a');
129
+ if (!is_resource($this->stream)) {
130
+ // @codeCoverageIgnoreStart
131
+ throw new Mustache_Exception_RuntimeException(sprintf('The stream or file "%s" could not be opened.', $this->url));
132
+ // @codeCoverageIgnoreEnd
133
+ }
134
+ }
135
+
136
+ fwrite($this->stream, self::formatLine($level, $message, $context));
137
+ }
138
+
139
+ /**
140
+ * Gets the name of the logging level.
141
+ *
142
+ * @throws InvalidArgumentException if the logging level is unknown
143
+ *
144
+ * @param int $level
145
+ *
146
+ * @return string
147
+ */
148
+ protected static function getLevelName($level)
149
+ {
150
+ return strtoupper($level);
151
+ }
152
+
153
+ /**
154
+ * Format a log line for output.
155
+ *
156
+ * @param int $level The logging level
157
+ * @param string $message The log message
158
+ * @param array $context The log context
159
+ *
160
+ * @return string
161
+ */
162
+ protected static function formatLine($level, $message, array $context = array())
163
+ {
164
+ return sprintf(
165
+ "%s: %s\n",
166
+ self::getLevelName($level),
167
+ self::interpolateMessage($message, $context)
168
+ );
169
+ }
170
+
171
+ /**
172
+ * Interpolate context values into the message placeholders.
173
+ *
174
+ * @param string $message
175
+ * @param array $context
176
+ *
177
+ * @return string
178
+ */
179
+ protected static function interpolateMessage($message, array $context = array())
180
+ {
181
+ if (strpos($message, '{') === false) {
182
+ return $message;
183
+ }
184
+
185
+ // build a replacement array with braces around the context keys
186
+ $replace = array();
187
+ foreach ($context as $key => $val) {
188
+ $replace['{' . $key . '}'] = $val;
189
+ }
190
+
191
+ // interpolate replacement values into the the message and return
192
+ return strtr($message, $replace);
193
+ }
194
+ }
lib/vendor/Mustache/Parser.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Parser class.
14
+ *
15
+ * This class is responsible for turning a set of Mustache tokens into a parse tree.
16
+ */
17
+ class Mustache_Parser
18
+ {
19
+ private $lineNum;
20
+ private $lineTokens;
21
+ private $pragmas;
22
+ private $defaultPragmas = array();
23
+
24
+ private $pragmaFilters;
25
+ private $pragmaBlocks;
26
+
27
+ /**
28
+ * Process an array of Mustache tokens and convert them into a parse tree.
29
+ *
30
+ * @param array $tokens Set of Mustache tokens
31
+ *
32
+ * @return array Mustache token parse tree
33
+ */
34
+ public function parse(array $tokens = array())
35
+ {
36
+ $this->lineNum = -1;
37
+ $this->lineTokens = 0;
38
+ $this->pragmas = $this->defaultPragmas;
39
+
40
+ $this->pragmaFilters = isset($this->pragmas[Mustache_Engine::PRAGMA_FILTERS]);
41
+ $this->pragmaBlocks = isset($this->pragmas[Mustache_Engine::PRAGMA_BLOCKS]);
42
+
43
+ return $this->buildTree($tokens);
44
+ }
45
+
46
+ /**
47
+ * Enable pragmas across all templates, regardless of the presence of pragma
48
+ * tags in the individual templates.
49
+ *
50
+ * @internal Users should set global pragmas in Mustache_Engine, not here :)
51
+ *
52
+ * @param string[] $pragmas
53
+ */
54
+ public function setPragmas(array $pragmas)
55
+ {
56
+ $this->pragmas = array();
57
+ foreach ($pragmas as $pragma) {
58
+ $this->enablePragma($pragma);
59
+ }
60
+ $this->defaultPragmas = $this->pragmas;
61
+ }
62
+
63
+ /**
64
+ * Helper method for recursively building a parse tree.
65
+ *
66
+ * @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered
67
+ *
68
+ * @param array &$tokens Set of Mustache tokens
69
+ * @param array $parent Parent token (default: null)
70
+ *
71
+ * @return array Mustache Token parse tree
72
+ */
73
+ private function buildTree(array &$tokens, array $parent = null)
74
+ {
75
+ $nodes = array();
76
+
77
+ while (!empty($tokens)) {
78
+ $token = array_shift($tokens);
79
+
80
+ if ($token[Mustache_Tokenizer::LINE] === $this->lineNum) {
81
+ $this->lineTokens++;
82
+ } else {
83
+ $this->lineNum = $token[Mustache_Tokenizer::LINE];
84
+ $this->lineTokens = 0;
85
+ }
86
+
87
+ if ($this->pragmaFilters && isset($token[Mustache_Tokenizer::NAME])) {
88
+ list($name, $filters) = $this->getNameAndFilters($token[Mustache_Tokenizer::NAME]);
89
+ if (!empty($filters)) {
90
+ $token[Mustache_Tokenizer::NAME] = $name;
91
+ $token[Mustache_Tokenizer::FILTERS] = $filters;
92
+ }
93
+ }
94
+
95
+ switch ($token[Mustache_Tokenizer::TYPE]) {
96
+ case Mustache_Tokenizer::T_DELIM_CHANGE:
97
+ $this->checkIfTokenIsAllowedInParent($parent, $token);
98
+ $this->clearStandaloneLines($nodes, $tokens);
99
+ break;
100
+
101
+ case Mustache_Tokenizer::T_SECTION:
102
+ case Mustache_Tokenizer::T_INVERTED:
103
+ $this->checkIfTokenIsAllowedInParent($parent, $token);
104
+ $this->clearStandaloneLines($nodes, $tokens);
105
+ $nodes[] = $this->buildTree($tokens, $token);
106
+ break;
107
+
108
+ case Mustache_Tokenizer::T_END_SECTION:
109
+ if (!isset($parent)) {
110
+ $msg = sprintf(
111
+ 'Unexpected closing tag: /%s on line %d',
112
+ $token[Mustache_Tokenizer::NAME],
113
+ $token[Mustache_Tokenizer::LINE]
114
+ );
115
+ throw new Mustache_Exception_SyntaxException($msg, $token);
116
+ }
117
+
118
+ if ($token[Mustache_Tokenizer::NAME] !== $parent[Mustache_Tokenizer::NAME]) {
119
+ $msg = sprintf(
120
+ 'Nesting error: %s (on line %d) vs. %s (on line %d)',
121
+ $parent[Mustache_Tokenizer::NAME],
122
+ $parent[Mustache_Tokenizer::LINE],
123
+ $token[Mustache_Tokenizer::NAME],
124
+ $token[Mustache_Tokenizer::LINE]
125
+ );
126
+ throw new Mustache_Exception_SyntaxException($msg, $token);
127
+ }
128
+
129
+ $this->clearStandaloneLines($nodes, $tokens);
130
+ $parent[Mustache_Tokenizer::END] = $token[Mustache_Tokenizer::INDEX];
131
+ $parent[Mustache_Tokenizer::NODES] = $nodes;
132
+
133
+ return $parent;
134
+
135
+ case Mustache_Tokenizer::T_PARTIAL:
136
+ $this->checkIfTokenIsAllowedInParent($parent, $token);
137
+ //store the whitespace prefix for laters!
138
+ if ($indent = $this->clearStandaloneLines($nodes, $tokens)) {
139
+ $token[Mustache_Tokenizer::INDENT] = $indent[Mustache_Tokenizer::VALUE];
140
+ }
141
+ $nodes[] = $token;
142
+ break;
143
+
144
+ case Mustache_Tokenizer::T_PARENT:
145
+ $this->checkIfTokenIsAllowedInParent($parent, $token);
146
+ $nodes[] = $this->buildTree($tokens, $token);
147
+ break;
148
+
149
+ case Mustache_Tokenizer::T_BLOCK_VAR:
150
+ if ($this->pragmaBlocks) {
151
+ // BLOCKS pragma is enabled, let's do this!
152
+ if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
153
+ $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG;
154
+ }
155
+ $this->clearStandaloneLines($nodes, $tokens);
156
+ $nodes[] = $this->buildTree($tokens, $token);
157
+ } else {
158
+ // pretend this was just a normal "escaped" token...
159
+ $token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_ESCAPED;
160
+ // TODO: figure out how to figure out if there was a space after this dollar:
161
+ $token[Mustache_Tokenizer::NAME] = '$' . $token[Mustache_Tokenizer::NAME];
162
+ $nodes[] = $token;
163
+ }
164
+ break;
165
+
166
+ case Mustache_Tokenizer::T_PRAGMA:
167
+ $this->enablePragma($token[Mustache_Tokenizer::NAME]);
168
+ // no break
169
+
170
+ case Mustache_Tokenizer::T_COMMENT:
171
+ $this->clearStandaloneLines($nodes, $tokens);
172
+ $nodes[] = $token;
173
+ break;
174
+
175
+ default:
176
+ $nodes[] = $token;
177
+ break;
178
+ }
179
+ }
180
+
181
+ if (isset($parent)) {
182
+ $msg = sprintf(
183
+ 'Missing closing tag: %s opened on line %d',
184
+ $parent[Mustache_Tokenizer::NAME],
185
+ $parent[Mustache_Tokenizer::LINE]
186
+ );
187
+ throw new Mustache_Exception_SyntaxException($msg, $parent);
188
+ }
189
+
190
+ return $nodes;
191
+ }
192
+
193
+ /**
194
+ * Clear standalone line tokens.
195
+ *
196
+ * Returns a whitespace token for indenting partials, if applicable.
197
+ *
198
+ * @param array $nodes Parsed nodes
199
+ * @param array $tokens Tokens to be parsed
200
+ *
201
+ * @return array|null Resulting indent token, if any
202
+ */
203
+ private function clearStandaloneLines(array &$nodes, array &$tokens)
204
+ {
205
+ if ($this->lineTokens > 1) {
206
+ // this is the third or later node on this line, so it can't be standalone
207
+ return;
208
+ }
209
+
210
+ $prev = null;
211
+ if ($this->lineTokens === 1) {
212
+ // this is the second node on this line, so it can't be standalone
213
+ // unless the previous node is whitespace.
214
+ if ($prev = end($nodes)) {
215
+ if (!$this->tokenIsWhitespace($prev)) {
216
+ return;
217
+ }
218
+ }
219
+ }
220
+
221
+ if ($next = reset($tokens)) {
222
+ // If we're on a new line, bail.
223
+ if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
224
+ return;
225
+ }
226
+
227
+ // If the next token isn't whitespace, bail.
228
+ if (!$this->tokenIsWhitespace($next)) {
229
+ return;
230
+ }
231
+
232
+ if (count($tokens) !== 1) {
233
+ // Unless it's the last token in the template, the next token
234
+ // must end in newline for this to be standalone.
235
+ if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
236
+ return;
237
+ }
238
+ }
239
+
240
+ // Discard the whitespace suffix
241
+ array_shift($tokens);
242
+ }
243
+
244
+ if ($prev) {
245
+ // Return the whitespace prefix, if any
246
+ return array_pop($nodes);
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Check whether token is a whitespace token.
252
+ *
253
+ * True if token type is T_TEXT and value is all whitespace characters.
254
+ *
255
+ * @param array $token
256
+ *
257
+ * @return bool True if token is a whitespace token
258
+ */
259
+ private function tokenIsWhitespace(array $token)
260
+ {
261
+ if ($token[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_TEXT) {
262
+ return preg_match('/^\s*$/', $token[Mustache_Tokenizer::VALUE]);
263
+ }
264
+
265
+ return false;
266
+ }
267
+
268
+ /**
269
+ * Check whether a token is allowed inside a parent tag.
270
+ *
271
+ * @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
272
+ *
273
+ * @param array|null $parent
274
+ * @param array $token
275
+ */
276
+ private function checkIfTokenIsAllowedInParent($parent, array $token)
277
+ {
278
+ if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
279
+ throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token);
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Split a tag name into name and filters.
285
+ *
286
+ * @param string $name
287
+ *
288
+ * @return array [Tag name, Array of filters]
289
+ */
290
+ private function getNameAndFilters($name)
291
+ {
292
+ $filters = array_map('trim', explode('|', $name));
293
+ $name = array_shift($filters);
294
+
295
+ return array($name, $filters);
296
+ }
297
+
298
+ /**
299
+ * Enable a pragma.
300
+ *
301
+ * @param string $name
302
+ */
303
+ private function enablePragma($name)
304
+ {
305
+ $this->pragmas[$name] = true;
306
+
307
+ switch ($name) {
308
+ case Mustache_Engine::PRAGMA_BLOCKS:
309
+ $this->pragmaBlocks = true;
310
+ break;
311
+
312
+ case Mustache_Engine::PRAGMA_FILTERS:
313
+ $this->pragmaFilters = true;
314
+ break;
315
+ }
316
+ }
317
+ }
lib/vendor/Mustache/Source.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache template Source interface.
14
+ */
15
+ interface Mustache_Source
16
+ {
17
+ /**
18
+ * Get the Source key (used to generate the compiled class name).
19
+ *
20
+ * This must return a distinct key for each template source. For example, an
21
+ * MD5 hash of the template contents would probably do the trick. The
22
+ * ProductionFilesystemLoader uses mtime and file path. If your production
23
+ * source directory is under version control, you could use the current Git
24
+ * rev and the file path...
25
+ *
26
+ * @throws RuntimeException when a source file cannot be read
27
+ *
28
+ * @return string
29
+ */
30
+ public function getKey();
31
+
32
+ /**
33
+ * Get the template Source.
34
+ *
35
+ * @throws RuntimeException when a source file cannot be read
36
+ *
37
+ * @return string
38
+ */
39
+ public function getSource();
40
+ }
lib/vendor/Mustache/Source/FilesystemSource.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache template Filesystem Source.
14
+ *
15
+ * This template Source uses stat() to generate the Source key, so that using
16
+ * pre-compiled templates doesn't require hitting the disk to read the source.
17
+ * It is more suitable for production use, and is used by default in the
18
+ * ProductionFilesystemLoader.
19
+ */
20
+ class Mustache_Source_FilesystemSource implements Mustache_Source
21
+ {
22
+ private $fileName;
23
+ private $statProps;
24
+ private $stat;
25
+
26
+ /**
27
+ * Filesystem Source constructor.
28
+ *
29
+ * @param string $fileName
30
+ * @param array $statProps
31
+ */
32
+ public function __construct($fileName, array $statProps)
33
+ {
34
+ $this->fileName = $fileName;
35
+ $this->statProps = $statProps;
36
+ }
37
+
38
+ /**
39
+ * Get the Source key (used to generate the compiled class name).
40
+ *
41
+ * @throws RuntimeException when a source file cannot be read
42
+ *
43
+ * @return string
44
+ */
45
+ public function getKey()
46
+ {
47
+ $chunks = array(
48
+ 'fileName' => $this->fileName,
49
+ );
50
+
51
+ if (!empty($this->statProps)) {
52
+ if (!isset($this->stat)) {
53
+ $this->stat = @stat($this->fileName);
54
+ }
55
+
56
+ if ($this->stat === false) {
57
+ throw new RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName));
58
+ }
59
+
60
+ foreach ($this->statProps as $prop) {
61
+ $chunks[$prop] = $this->stat[$prop];
62
+ }
63
+ }
64
+
65
+ return json_encode($chunks);
66
+ }
67
+
68
+ /**
69
+ * Get the template Source.
70
+ *
71
+ * @return string
72
+ */
73
+ public function getSource()
74
+ {
75
+ return file_get_contents($this->fileName);
76
+ }
77
+ }
lib/vendor/Mustache/Template.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Abstract Mustache Template class.
14
+ *
15
+ * @abstract
16
+ */
17
+ abstract class Mustache_Template
18
+ {
19
+ /**
20
+ * @var Mustache_Engine
21
+ */
22
+ protected $mustache;
23
+
24
+ /**
25
+ * @var bool
26
+ */
27
+ protected $strictCallables = false;
28
+
29
+ /**
30
+ * Mustache Template constructor.
31
+ *
32
+ * @param Mustache_Engine $mustache
33
+ */
34
+ public function __construct(Mustache_Engine $mustache)
35
+ {
36
+ $this->mustache = $mustache;
37
+ }
38
+
39
+ /**
40
+ * Mustache Template instances can be treated as a function and rendered by simply calling them.
41
+ *
42
+ * $m = new Mustache_Engine;
43
+ * $tpl = $m->loadTemplate('Hello, {{ name }}!');
44
+ * echo $tpl(array('name' => 'World')); // "Hello, World!"
45
+ *
46
+ * @see Mustache_Template::render
47
+ *
48
+ * @param mixed $context Array or object rendering context (default: array())
49
+ *
50
+ * @return string Rendered template
51
+ */
52
+ public function __invoke($context = array())
53
+ {
54
+ return $this->render($context);
55
+ }
56
+
57
+ /**
58
+ * Render this template given the rendering context.
59
+ *
60
+ * @param mixed $context Array or object rendering context (default: array())
61
+ *
62
+ * @return string Rendered template
63
+ */
64
+ public function render($context = array())
65
+ {
66
+ return $this->renderInternal(
67
+ $this->prepareContextStack($context)
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Internal rendering method implemented by Mustache Template concrete subclasses.
73
+ *
74
+ * This is where the magic happens :)
75
+ *
76
+ * NOTE: This method is not part of the Mustache.php public API.
77
+ *
78
+ * @param Mustache_Context $context
79
+ * @param string $indent (default: '')
80
+ *
81
+ * @return string Rendered template
82
+ */
83
+ abstract public function renderInternal(Mustache_Context $context, $indent = '');
84
+
85
+ /**
86
+ * Tests whether a value should be iterated over (e.g. in a section context).
87
+ *
88
+ * In most languages there are two distinct array types: list and hash (or whatever you want to call them). Lists
89
+ * should be iterated, hashes should be treated as objects. Mustache follows this paradigm for Ruby, Javascript,
90
+ * Java, Python, etc.
91
+ *
92
+ * PHP, however, treats lists and hashes as one primitive type: array. So Mustache.php needs a way to distinguish
93
+ * between between a list of things (numeric, normalized array) and a set of variables to be used as section context
94
+ * (associative array). In other words, this will be iterated over:
95
+ *
96
+ * $items = array(
97
+ * array('name' => 'foo'),
98
+ * array('name' => 'bar'),
99
+ * array('name' => 'baz'),
100
+ * );
101
+ *
102
+ * ... but this will be used as a section context block:
103
+ *
104
+ * $items = array(
105
+ * 1 => array('name' => 'foo'),
106
+ * 'banana' => array('name' => 'bar'),
107
+ * 42 => array('name' => 'baz'),
108
+ * );
109
+ *
110
+ * @param mixed $value
111
+ *
112
+ * @return bool True if the value is 'iterable'
113
+ */
114
+ protected function isIterable($value)
115
+ {
116
+ switch (gettype($value)) {
117
+ case 'object':
118
+ return $value instanceof Traversable;
119
+
120
+ case 'array':
121
+ $i = 0;
122
+ foreach ($value as $k => $v) {
123
+ if ($k !== $i++) {
124
+ return false;
125
+ }
126
+ }
127
+
128
+ return true;
129
+
130
+ default:
131
+ return false;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Helper method to prepare the Context stack.
137
+ *
138
+ * Adds the Mustache HelperCollection to the stack's top context frame if helpers are present.
139
+ *
140
+ * @param mixed $context Optional first context frame (default: null)
141
+ *
142
+ * @return Mustache_Context
143
+ */
144
+ protected function prepareContextStack($context = null)
145
+ {
146
+ $stack = new Mustache_Context();
147
+
148
+ $helpers = $this->mustache->getHelpers();
149
+ if (!$helpers->isEmpty()) {
150
+ $stack->push($helpers);
151
+ }
152
+
153
+ if (!empty($context)) {
154
+ $stack->push($context);
155
+ }
156
+
157
+ return $stack;
158
+ }
159
+
160
+ /**
161
+ * Resolve a context value.
162
+ *
163
+ * Invoke the value if it is callable, otherwise return the value.
164
+ *
165
+ * @param mixed $value
166
+ * @param Mustache_Context $context
167
+ *
168
+ * @return string
169
+ */
170
+ protected function resolveValue($value, Mustache_Context $context)
171
+ {
172
+ if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
173
+ return $this->mustache
174
+ ->loadLambda((string) call_user_func($value))
175
+ ->renderInternal($context);
176
+ }
177
+
178
+ return $value;
179
+ }
180
+ }
lib/vendor/Mustache/Tokenizer.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Mustache.php.
5
+ *
6
+ * (c) 2010-2017 Justin Hileman
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Mustache Tokenizer class.
14
+ *
15
+ * This class is responsible for turning raw template source into a set of Mustache tokens.
16
+ */
17
+ class Mustache_Tokenizer
18
+ {
19
+ // Finite state machine states
20
+ const IN_TEXT = 0;
21
+ const IN_TAG_TYPE = 1;
22
+ const IN_TAG = 2;
23
+
24
+ // Token types
25
+ const T_SECTION = '#';
26
+ const T_INVERTED = '^';
27
+ const T_END_SECTION = '/';
28
+ const T_COMMENT = '!';
29
+ const T_PARTIAL = '>';
30
+ const T_PARENT = '<';
31
+ const T_DELIM_CHANGE = '=';
32
+ const T_ESCAPED = '_v';
33
+ const T_UNESCAPED = '{';
34
+ const T_UNESCAPED_2 = '&';
35
+ const T_TEXT = '_t';
36
+ const T_PRAGMA = '%';
37
+ const T_BLOCK_VAR = '$';
38
+ const T_BLOCK_ARG = '$arg';
39
+
40
+ // Valid token types
41
+ private static $tagTypes = array(
42
+ self::T_SECTION => true,
43
+ self::T_INVERTED => true,
44
+ self::T_END_SECTION => true,
45
+ self::T_COMMENT => true,
46
+ self::T_PARTIAL => true,
47
+ self::T_PARENT => true,
48
+ self::T_DELIM_CHANGE => true,
49
+ self::T_ESCAPED => true,
50
+ self::T_UNESCAPED => true,
51
+ self::T_UNESCAPED_2 => true,
52
+ self::T_PRAGMA => true,
53
+ self::T_BLOCK_VAR => true,
54
+ );
55
+
56
+ // Token properties
57
+ const TYPE = 'type';
58
+ const NAME = 'name';
59
+ const OTAG = 'otag';
60
+ const CTAG = 'ctag';
61
+ const LINE = 'line';
62
+ const INDEX = 'index';
63
+ const END = 'end';
64
+ const INDENT = 'indent';
65
+ const NODES = 'nodes';
66
+ const VALUE = 'value';
67
+ const FILTERS = 'filters';
68
+
69
+ private $state;
70
+ private $tagType;
71
+ private $buffer;
72
+ private $tokens;
73
+ private $seenTag;
74
+ private $line;
75
+ private $otag;
76
+ private $ctag;
77
+ private $otagLen;
78
+ private $ctagLen;
79
+
80
+ /**
81
+ * Scan and tokenize template source.
82
+ *
83
+ * @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered
84
+ *
85
+ * @param string $text Mustache template source to tokenize
86
+ * @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null)
87
+ *
88
+ * @return array Set of Mustache tokens
89
+ */
90
+ public function scan($text, $delimiters = null)
91
+ {
92
+ // Setting mbstring.func_overload makes things *really* slow.
93
+ // Let's do everyone a favor and scan this string as ASCII instead.
94
+ //
95
+ // @codeCoverageIgnoreStart
96
+ $encoding = null;
97
+ if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
98
+ $encoding = mb_internal_encoding();
99
+ mb_internal_encoding('ASCII');
100
+ }
101
+ // @codeCoverageIgnoreEnd
102
+
103
+ $this->reset();
104
+
105
+ if ($delimiters = trim($delimiters)) {
106
+ $this->setDelimiters($delimiters);
107
+ }
108
+
109
+ $len = strlen($text);
110
+ for ($i = 0; $i < $len; $i++) {
111
+ switch ($this->state) {
112
+ case self::IN_TEXT:
113
+ if ($this->tagChange($this->otag, $this->otagLen, $text, $i)) {
114
+ $i--;
115
+ $this->flushBuffer();
116
+ $this->state = self::IN_TAG_TYPE;
117
+ } else {
118
+ $char = $text[$i];
119
+ $this->buffer .= $char;
120
+ if ($char === "\n") {
121
+ $this->flushBuffer();
122
+ $this->line++;
123
+ }
124
+ }
125
+ break;
126
+
127
+ case self::IN_TAG_TYPE:
128
+ $i += $this->otagLen - 1;
129
+ $char = $text[$i + 1];
130
+ if (isset(self::$tagTypes[$char])) {
131
+ $tag = $char;
132
+ $this->tagType = $tag;
133
+ } else {
134
+ $tag = null;
135
+ $this->tagType = self::T_ESCAPED;
136
+ }
137
+
138
+ if ($this->tagType === self::T_DELIM_CHANGE) {
139
+ $i = $this->changeDelimiters($text, $i);
140
+ $this->state = self::IN_TEXT;
141
+ } elseif ($this->tagType === self::T_PRAGMA) {
142
+ $i = $this->addPragma($text, $i);
143
+ $this->state = self::IN_TEXT;
144
+ } else {
145
+ if ($tag !== null) {
146
+ $i++;
147
+ }
148
+ $this->state = self::IN_TAG;
149
+ }
150
+ $this->seenTag = $i;
151
+ break;
152
+
153
+ default:
154
+ if ($this->tagChange($this->ctag, $this->ctagLen, $text, $i)) {
155
+ $token = array(
156
+ self::TYPE => $this->tagType,
157
+ self::NAME => trim($this->buffer),
158
+ self::OTAG => $this->otag,
159
+ self::CTAG => $this->ctag,
160
+ self::LINE => $this->line,
161
+ self::INDEX => ($this->tagType === self::T_END_SECTION) ? $this->seenTag - $this->otagLen : $i + $this->ctagLen,
162
+ );
163
+
164
+ if ($this->tagType === self::T_UNESCAPED) {
165
+ // Clean up `{{{ tripleStache }}}` style tokens.
166
+ if ($this->ctag === '}}') {
167
+ if (($i + 2 < $len) && $text[$i + 2] === '}') {
168
+ $i++;
169
+ } else {
170
+ $msg = sprintf(
171
+ 'Mismatched tag delimiters: %s on line %d',
172
+ $token[self::NAME],
173
+ $token[self::LINE]
174
+ );
175
+
176
+ throw new Mustache_Exception_SyntaxException($msg, $token);
177
+ }
178
+ } else {
179
+ $lastName = $token[self::NAME];
180
+ if (substr($lastName, -1) === '}') {
181
+ $token[self::NAME] = trim(substr($lastName, 0, -1));
182
+ } else {
183
+ $msg = sprintf(
184
+ 'Mismatched tag delimiters: %s on line %d',
185
+ $token[self::NAME],
186
+ $token[self::LINE]
187
+ );
188
+
189
+ throw new Mustache_Exception_SyntaxException($msg, $token);
190
+ }
191
+ }
192
+ }
193
+
194
+ $this->buffer = '';
195
+ $i += $this->ctagLen - 1;
196
+ $this->state = self::IN_TEXT;
197
+ $this->tokens[] = $token;
198
+ } else {
199
+ $this->buffer .= $text[$i];
200
+ }
201
+ break;
202
+ }
203
+ }
204
+
205
+ $this->flushBuffer();
206
+
207
+ // Restore the user's encoding...
208
+ // @codeCoverageIgnoreStart
209
+ if ($encoding) {
210
+ mb_internal_encoding($encoding);
211
+ }
212
+ // @codeCoverageIgnoreEnd
213
+
214
+ return $this->tokens;
215
+ }
216
+
217
+ /**
218
+ * Helper function to reset tokenizer internal state.
219
+ */
220
+ private function reset()
221
+ {
222
+ $this->state = self::IN_TEXT;
223
+ $this->tagType = null;
224
+ $this->buffer = '';
225
+ $this->tokens = array();
226
+ $this->seenTag = false;
227
+ $this->line = 0;
228
+ $this->otag = '{{';
229
+ $this->ctag = '}}';
230
+ $this->otagLen = 2;
231
+ $this->ctagLen = 2;
232
+ }
233
+
234
+ /**
235
+ * Flush the current buffer to a token.
236
+ */
237
+ private function flushBuffer()
238
+ {
239
+ if (strlen($this->buffer) > 0) {
240
+ $this->tokens[] = array(
241
+ self::TYPE => self::T_TEXT,
242
+ self::LINE => $this->line,
243
+ self::VALUE => $this->buffer,
244
+ );
245
+ $this->buffer = '';
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Change the current Mustache delimiters. Set new `otag` and `ctag` values.
251
+ *
252
+ * @param string $text Mustache template source
253
+ * @param int $index Current tokenizer index
254
+ *
255
+ * @return int New index value
256
+ */
257
+ private function changeDelimiters($text, $index)
258
+ {
259
+ $startIndex = strpos($text, '=', $index) + 1;
260
+ $close = '=' . $this->ctag;
261
+ $closeIndex = strpos($text, $close, $index);
262
+
263
+ $this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));
264
+
265
+ $this->tokens[] = array(
266
+ self::TYPE => self::T_DELIM_CHANGE,
267
+ self::LINE => $this->line,
268
+ );
269
+
270
+ return $closeIndex + strlen($close) - 1;
271
+ }
272
+
273
+ /**
274
+ * Set the current Mustache `otag` and `ctag` delimiters.
275
+ *
276
+ * @param string $delimiters
277
+ */
278
+ private function setDelimiters($delimiters)
279
+ {
280
+ list($otag, $ctag) = explode(' ', $delimiters);
281
+ $this->otag = $otag;
282
+ $this->ctag = $ctag;
283
+ $this->otagLen = strlen($otag);
284
+ $this->ctagLen = strlen($ctag);
285
+ }
286
+
287
+ /**
288
+ * Add pragma token.
289
+ *
290
+ * Pragmas are hoisted to the front of the template, so all pragma tokens
291
+ * will appear at the front of the token list.
292
+ *
293
+ * @param string $text
294
+ * @param int $index
295
+ *
296
+ * @return int New index value
297
+ */
298
+ private function addPragma($text, $index)
299
+ {
300
+ $end = strpos($text, $this->ctag, $index);
301
+ $pragma = trim(substr($text, $index + 2, $end - $index - 2));
302
+
303
+ // Pragmas are hoisted to the front of the template.
304
+ array_unshift($this->tokens, array(
305
+ self::TYPE => self::T_PRAGMA,
306
+ self::NAME => $pragma,
307
+ self::LINE => 0,
308
+ ));
309
+
310
+ return $end + $this->ctagLen - 1;
311
+ }
312
+
313
+ /**
314
+ * Test whether it's time to change tags.
315
+ *
316
+ * @param string $tag Current tag name
317
+ * @param int $tagLen Current tag name length
318
+ * @param string $text Mustache template source
319
+ * @param int $index Current tokenizer index
320
+ *
321
+ * @return bool True if this is a closing section tag
322
+ */
323
+ private function tagChange($tag, $tagLen, $text, $index)
324
+ {
325
+ return substr($text, $index, $tagLen) === $tag;
326
+ }
327
+ }
license.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
readme.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Adapta RGPD ===
2
+ Plugin Name: Adapta RGPD
3
+ Version: 1.0.0
4
+ Author: cesarmaeso
5
+ Author URI: https://superadmin.es
6
+ Contributors: cesarmaeso
7
+ Tags: LOPD, RGPD, AGPD, cookies, legal, privacidad, clausulas, proteccion datos, superadmin
8
+ Requires at least: 4.7
9
+ Tested up to: 4.9.5
10
+ Stable tag: 1.0.0
11
+ Requires PHP: 5.2.4
12
+ License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
+
14
+ Te ayuda a adaptar tu web a RGPD LOPD. Crea páginas para el aviso legal, la política de privacidad y la política de cookies. Añade enlaces a las páginas legales en el footer y el banner de aviso de Cookies.
15
+
16
+ == Description ==
17
+
18
+ <strong>Ayuda para adaptar tu web a RGPD LOPD. Crea páginas para el aviso legal, la política de privacidad y la política de cookies. Añade enlaces a las páginas legales en el footer y el banner de aviso de Cookies.</strong>
19
+
20
+ <h4>Características de Adapta RGPD:</h4>
21
+ <br>
22
+ <ul>
23
+ <li>Crea páginas para el Aviso Legal, Política de privacidad y política de cookies.</li>
24
+ <li>El contenido de las páginas se actualiza automáticamente en base a tu configuración.</li>
25
+ <li>Añade claúsulas de exclusión, mayoría de edad, datos especialmente protegidos y portabilidad de datos.</li>
26
+ <li>Añade casilla de verificación y satisface el deber de información para los comentarios y los formularios.</li>
27
+ <li>Añade un banner de cookies en todas tus páginas.</li>
28
+ </ul>
29
+
30
+
31
+ == Installation ==
32
+
33
+ 1. Descomprime el fichero y sube la carpeta `adaptargpd` a tu directorio de plugins `/wp-content/plugins/`.
34
+ 1. Activa el plugin en el menú 'Plugins' de tu escritorio.
35
+ 1. Configura las opciones desde el menú 'Adapta RGPD'.
36
+ 1. ¡Listo!
37
+
38
+
39
+ == Changelog ==
40
+ = 1.0 =
41
+ * Primera versión.
tests/bootstrap.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adapta_RGPD Test Bootstrapper.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Adapta_RGPD
7
+ */
8
+
9
+ // Get our tests directory.
10
+ $_tests_dir = ( getenv( 'WP_TESTS_DIR' ) ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';
11
+
12
+ // Include our tests functions.
13
+ require_once $_tests_dir . '/includes/functions.php';
14
+
15
+ /**
16
+ * Manually require our plugin for testing.
17
+ *
18
+ * @since 0.0.0
19
+ */
20
+ function _manually_load_adaptargpd_plugin() {
21
+
22
+ // Include the REST API main plugin file if we're using it so we can run endpoint tests.
23
+ if ( class_exists( 'WP_REST_Controller' ) && file_exists( WP_PLUGIN_DIR . '/rest-api/plugin.php' ) ) {
24
+ require WP_PLUGIN_DIR . '/rest-api/plugin.php';
25
+ }
26
+
27
+ // Require our plugin.
28
+ require dirname( dirname( __FILE__ ) ) . '/adaptargpd.php';
29
+ }
30
+
31
+ // Inject in our plugin.
32
+ tests_add_filter( 'muplugins_loaded', '_manually_load_adaptargpd_plugin' );
33
+
34
+ // Include the main tests bootstrapper.
35
+ require $_tests_dir . '/includes/bootstrap.php';
tests/test-admin.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nos Adaptamos RGPD Admin Tests.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Nos_Adaptamos_RGPD
7
+ */
8
+ class ARGPD_Admin_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'ARGPD_Admin' ) );
17
+ }
18
+
19
+ /**
20
+ * Test that we can access our class through our helper function.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_class_access() {
25
+ $this->assertInstanceOf( 'ARGPD_Admin', adaptargpd()->admin );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
tests/test-base.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adapta_RGPD.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Adapta_RGPD
7
+ */
8
+ class Adapta_RGPD_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'Adapta_RGPD') );
17
+ }
18
+
19
+ /**
20
+ * Test that our main helper function is an instance of our class.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_get_instance() {
25
+ $this->assertInstanceOf( 'Adapta_RGPD', adaptargpd() );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
tests/test-integration.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nos Adaptamos RGPD Integration Tests.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Nos_Adaptamos_RGPD
7
+ */
8
+ class ARGPD_Integration_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'ARGPD_Integration' ) );
17
+ }
18
+
19
+ /**
20
+ * Test that we can access our class through our helper function.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_class_access() {
25
+ $this->assertInstanceOf( 'ARGPD_Integration', adaptargpd()->integration );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
tests/test-pages.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nos Adaptamos RGPD Pages Tests.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Nos_Adaptamos_RGPD
7
+ */
8
+ class ARGPD_Pages_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'ARGPD_Pages' ) );
17
+ }
18
+
19
+ /**
20
+ * Test that we can access our class through our helper function.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_class_access() {
25
+ $this->assertInstanceOf( 'ARGPD_Pages', adaptargpd()->pages );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
tests/test-settings.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nos Adaptamos RGPD Settings Tests.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Nos_Adaptamos_RGPD
7
+ */
8
+ class ARGPD_Settings_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'ARGPD_Settings' ) );
17
+ }
18
+
19
+ /**
20
+ * Test that we can access our class through our helper function.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_class_access() {
25
+ $this->assertInstanceOf( 'ARGPD_Settings', adaptargpd()->settings );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
tests/test-shortcodes.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Nos Adaptamos RGPD Shortcodes Tests.
4
+ *
5
+ * @since 0.0.0
6
+ * @package Nos_Adaptamos_RGPD
7
+ */
8
+ class ARGPD_Shortcodes_Test extends WP_UnitTestCase {
9
+
10
+ /**
11
+ * Test if our class exists.
12
+ *
13
+ * @since 0.0.0
14
+ */
15
+ function test_class_exists() {
16
+ $this->assertTrue( class_exists( 'ARGPD_Shortcodes' ) );
17
+ }
18
+
19
+ /**
20
+ * Test that we can access our class through our helper function.
21
+ *
22
+ * @since 0.0.0
23
+ */
24
+ function test_class_access() {
25
+ $this->assertInstanceOf( 'ARGPD_Shortcodes', adaptargpd()->shortcodes );
26
+ }
27
+
28
+ /**
29
+ * Replace this with some actual testing code.
30
+ *
31
+ * @since 0.0.0
32
+ */
33
+ function test_sample() {
34
+ $this->assertTrue( true );
35
+ }
36
+ }
views/aviso-legal.mustache ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <h2>Identificación y Titularidad</h2>
22
+
23
+
24
+ <p>
25
+ {{#pais-ue}}
26
+ En cumplimiento del artículo 10 de la Ley 34/2002, de 11 de julio, de Servicios de la Sociedad de la Información y Comercio Electrónico, a continuación se exponen los datos identificativos del titular.
27
+ {{/pais-ue}}
28
+ {{^pais-ue}}
29
+ A continuación se exponen los datos identificativos del titular.
30
+ {{/pais-ue}}
31
+ </p>
32
+
33
+
34
+ <p>
35
+ <ul>
36
+ <li><b>Titular:</b> {{titular}}</li>
37
+ {{#id-fiscal}}<li><b>NIF/CIF:</b> {{id-fiscal}}</li>{{/id-fiscal}}
38
+ <li><b>Domicilio:</b> {{# domicilio }} {{domicilio}}, {{/ domicilio }} {{provincia}} - {{pais-nombre}}.</li>
39
+ {{#correo }}<li><b>Correo electrónico:</b> {{correo}}</li>{{/correo}}
40
+ </ul>
41
+ </p>
42
+
43
+ {{# finalidad }}
44
+ <h2>Finalidad</h2>
45
+ <p>
46
+ La finalidad del sitio web <a rel="nofollow" href="{{dominio}}">{{dominio}}</a> es {{finalidad}}
47
+ </p>
48
+ {{/ finalidad}}
49
+
50
+
51
+ <h2>Condiciones de Uso</h2>
52
+ <p>
53
+ La simple y mera utilización de la página Web otorga la condición de usuario de la página, bien sea persona física o jurídica, y obligatoriamente implica la aceptación completa, plena y sin reservas de todas y cada una de las cláusulas y condiciones generales incluidas en el Aviso Legal. Si el Usuario no estuviera conforme con las cláusulas y condiciones de uso de este Aviso Legal, se abstendrá de utilizar la página Web.
54
+ </p>
55
+
56
+ <p>
57
+ El usuario queda informado, y acepta, que el acceso a la presente web no supone, en modo alguno, el inicio de una relación comercial con {{titular}}.
58
+ </p>
59
+
60
+ <p>
61
+ A través de la página Web el {{titular}} facilita a los usuarios el acceso y la utilización de diversos Contenidos publicados por medio de Internet.
62
+ </p>
63
+
64
+ <p>
65
+ A tal efecto, el Usuario se obliga y se compromete a NO utilizar cualquiera de los Contenidos con fines o efectos ilícitos, prohibidos en el Aviso Legal o por la legislación vigente, lesivos de los derechos e intereses de terceros, o que de cualquier forma puedan dañar, inutilizar, sobrecargar, deteriorar o impedir la normal utilización de los Contenidos, los equipos informáticos o los documentos, archivos y toda clase de contenidos almacenados en cualquier equipo informático propios o contratados por {{titular}}, de otros Usuarios o de cualquier usuario de Internet (hardware y software).
66
+ </p>
67
+
68
+
69
+ {{# clause-edad }}
70
+ <p>
71
+ Debes tener al menos 18 años de edad para usar nuestros Servicios o la mayoría de edad que se requiera en tu país para registrarte en nuestros Servicios o utilizarlos. Si resides en un país que no pertenezca a la Región europea, debes tener al menos 13 años de edad para usar nuestros Servicios o la mayoría de edad que se requiera en tu país para registrarte en nuestros Servicios o utilizarlos. Además de tener la edad mínima requerida para usar nuestros Servicios en virtud de la ley aplicable, si no tienes la edad suficiente para poder aceptar nuestras Condiciones en tu país, tu padre, madre, o tutor deben aceptar nuestras Condiciones en tu nombre.
72
+ </p>
73
+ {{/ clause-edad }}
74
+
75
+
76
+
77
+ <h2>Medidas de seguridad</h2>
78
+
79
+ <p>
80
+ Los datos personales comunicados por el usuario a {{titular}} pueden ser almacenados en bases de datos automatizadas o no, cuya titularidad corresponde en exclusiva a {{titular}}, asumiendo ésta todas las medidas de índole técnica, organizativa y de seguridad que garantizan la confidencialidad, integridad y calidad de la información contenida en las mismas de acuerdo con lo establecido en la normativa vigente en protección de datos.
81
+ </p>
82
+ <p>
83
+ No obstante, el usuario debe ser consciente de que las medidas de seguridad de los sistemas informáticos en Internet no son enteramente fiables y que, por tanto {{titular}} no puede garantizar la inexistencia de malware u otros elementos que puedan producir alteraciones en los sistemas informáticos (software y hardware) del usuario o en sus documentos electrónicos y ficheros contenidos en los mismos aunque se ponen todos los medios necesarios y las medidas de seguridad oportunas para evitar la presencia de estos elementos dañinos.
84
+ </p>
85
+
86
+
87
+ {{#privacidadURL}}
88
+ <h2>Datos personales que recabamos y cómo lo hacemos</h2>
89
+ <p>
90
+ Puedes consultar toda la información relativa a los datos personales que recogemos en la página de <a href="{{privacidadURL}}" rel="nofollow">política de privacidad</a>.
91
+ </p>
92
+ {{/privacidadURL}}
93
+
94
+ <h2>Contenidos</h2>
95
+ <p>
96
+ {{titular}} ha obtenido la información y los materiales incluidos en la Web de fuentes consideradas como fiables, pero, si bien se han tomado medidas razonables para asegurarse de que la Información contenida sea correcta, {{titular}} no garantiza que sea exacta, completa, o actualizada. {{titular}} declina expresamente cualquier responsabilidad por error u omisión en la Información contenida en las páginas de esta Web.
97
+ </p>
98
+
99
+ <p>
100
+ Queda prohibido transmitir o enviar a través de la Web cualquier contenido ilegal o ilícito, virus informáticos, o mensajes que, en general, afecten o violen derechos de {{titular}} o de terceros.
101
+ </p>
102
+
103
+ <p>
104
+ Los contenidos de esta Web tienen únicamente finalidad informativa y bajo ninguna circunstancia deben usarse ni considerarse como oferta de venta, solicitud de una oferta de compra ni recomendación para realizar cualquier otra operación, salvo que así se indique expresamente.
105
+ </p>
106
+
107
+ <p>
108
+ {{titular}} se reserva el derecho a modificar, suspender, cancelar o restringir el contenido de la Web, los vínculos o la información obtenida a través de ella, sin necesidad de previo aviso.
109
+ </p>
110
+
111
+ <p>
112
+ {{titular}} no es responsable de los datos y perjuicios que pudieran derivarse de la utilización de los documentos por el usuario receptor.
113
+ </p>
114
+
115
+
116
+ <h2>Política de cookies</h2>
117
+ {{# cookiesURL }}
118
+ <p>
119
+ Puede consultar aquí <a target="_blank" rel="nofollow" href="{{ cookiesURL }}"> la política de cookies</a>.
120
+ </p>
121
+ {{/ cookiesURL }}
122
+ {{^cookiesURL}}
123
+ <p>
124
+ {{titular}} sólo obtiene y conserva la siguiente información acerca de los visitantes de nuestro Web:
125
+ </p>
126
+ <p>
127
+ <ul>
128
+ <li>El nombre de dominio del proveedor (PSI) y/o dirección IP que les da acceso a la red.</li>
129
+ <li>La fecha y hora de acceso a nuestro Web.</li>
130
+ <li>La dirección de Internet desde la que partió el link que dirige a nuestro Web.</li>
131
+ <li>El número de visitantes diarios de cada sección.</li>
132
+ <li>La información obtenida es totalmente anónima, y en ningún caso puede ser asociada a un usuario concreto e identificado.</li>
133
+ </ul>
134
+ </p>
135
+ {{/cookiesURL}}
136
+
137
+
138
+ <h2>Enlaces de acceso a otros sitios web</h2>
139
+ <p>
140
+ {{titular}} proporciona al usuario el acceso a otros sitios Web de terceras personas mediante links (enlaces) con la finalidad exclusiva de informarle sobre la existencia de otras fuentes de información en Internet con las que podrá ampliar los datos que se le ofrecen en este sitio Web.
141
+ </p>
142
+
143
+ <p>
144
+ Estos enlaces a otros sitios Web no suponen en ningún caso una sugerencia o recomendación de visitar las páginas Web de destino, que se encuentran fuera del control de {{titular}}, por lo que {{titular}}. no es responsable del contenido de los sitios Web vinculados ni del resultado obtenido por el usuario a través de dichos enlaces hipertextuales.
145
+ </p>
146
+
147
+ <p>
148
+ Asimismo, {{titular}} no responde de los links o enlaces ubicados en los sitios vinculados a los que proporciona acceso.
149
+ </p>
150
+
151
+ <h2>Propiedad intelectual e industrial </h2>
152
+ <p>
153
+ Todos los derechos están reservados. Todo acceso a esta página Web está sujeto a las siguientes condiciones: la reproducción, almacenaje permanente y la difusión de los contenidos o cualquier otro uso que tenga finalidad pública o comercial queda expresamente prohibida sin el consentimiento previo expreso y por escrito de {{titular}}.
154
+ </p>
155
+
156
+
157
+
158
+ <h2>Limitación de responsabilidad</h2>
159
+ <p>
160
+ La información y servicios incluidos o disponibles a través del sitio <a href="{{dominio}}" rel="nofollow">{{dominio}}</a> pueden incluir incorrecciones o errores tipográficos. De forma periódica se incorporan cambios a la información contenida. {{titular}} puede introducir en cualquier momento mejoras y/o cambios en los servicios o contenidos.
161
+ </p>
162
+ <p>
163
+ {{titular}} declina cualquier responsabilidad en caso de que existan interrupciones o un mal funcionamiento de los servicios o contenidos ofrecidos en Internet, cualquiera que sea su causa. Asimismo, {{titular}} no se hace responsable por caídas de la red, pérdidas de negocio a consecuencia de dichas caídas, suspensiones temporales de fluido eléctrico o cualquier otro tipo de daño indirecto que le pueda ser causado a los Usuarios por causas ajenas a {{titular}}
164
+ </p>
165
+ <p>
166
+ {{titular}} no declara ni garantiza que los servicios o contenidos sean interrumpidos o que estén libres de errores, que los defectos sean corregidos, o que el servicio o el servidor que lo pone a disposición estén libres de virus u otros componentes nocivos sin perjuicio de que {{titular}} realiza sus mejores esfuerzos en evitar este tipo de incidentes. En caso de que el Usuario tomara determinadas decisiones o realizara acciones con base a la información incluida en cualquiera de los sitios Web, se recomienda la comprobación de la información recibida con otras fuentes.
167
+ </p>
168
+
169
+ {{# clause-exclusion }}
170
+ <h2>Derecho de exclusión</h2>
171
+ {{titular}} se reserva el derecho a denegar o retirar el acceso a portal y/o los servicios ofrecidos sin necesidad de preaviso, a instancia propia o de un tercero, a aquellos usuarios que incumplan las presentes Condiciones Generales de Uso.
172
+ {{/ clause-exclusion }}
173
+
174
+
175
+
176
+ {{# provincia }}
177
+ <h2>Juridiscción</h2>
178
+ <p>
179
+ Para cuantas cuestiones se susciten sobre la interpretación, aplicación y cumplimiento de este Aviso Legal, así como de las reclamaciones que puedan derivarse de su uso, todos las partes intervinientes se someten a los Jueces y Tribunales de la provincia de {{provincia}}, renunciando de forma expresa a cualquier otro fuero que pudiera corresponderles.
180
+ </p>
181
+ {{/ provincia}}
182
+
183
+ {{#correo}}
184
+ <h2>Contacto</h2>
185
+ <p>
186
+ En caso de que cualquier usuario tuviese alguna duda acerca de estas Condiciones legales o cualquier comentario sobre el portal <a href="{{dominio}}" rel="nofollow">{{dominio}}</a>, puede enviar un correo a {{correo}}.
187
+ </p>
188
+ {{/correo}}
189
+
190
+
191
+
views/ayuda.mustache ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <div class="theme-browser">
22
+ <div class="themes wp-clearfix">
23
+ <a target="_blank" href="https://superadmin.es/adapta-rgpd">
24
+ <div class="theme">
25
+ <div class="theme-screenshot">
26
+
27
+ <img src="{{url}}assets/images/1.png" alt="">
28
+ </div>
29
+ <div class="theme-id-container">
30
+
31
+ <h3 class="theme-name">Ayuda</h3>
32
+ </div>
33
+ </div>
34
+ </a>
35
+
36
+
37
+ <a target="_blank" href="https://superadmin.es/adapta-rgpd/consulta">
38
+ <div class="theme">
39
+ <div class="theme-screenshot">
40
+ <img src="{{url}}assets/images/2.png" alt="">
41
+ </div>
42
+ <div class="theme-id-container">
43
+ <h3 class="theme-name">Consulta</h3>
44
+ </div>
45
+ </div>
46
+ </a>
47
+ </div>
48
+ </div>
49
+
50
+
51
+ <div style="max-width: 540px">
52
+ <h2 class="title">Actualizaciones</h2>
53
+ <p>
54
+ Actualizamos continuamente Adapta RGPD para añadir nuevas características y herramientas. Encontrarás más información y en la página del Plugin que puedes visitar en este <a href="https://superadmin.es/adapta-rgpd" target="_blank">enlace</a>.
55
+ </p>
56
+ </div>
57
+
58
+
59
+
views/consentimiento.mustache ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <p>
22
+ <label>
23
+ <input style="width:inherit" type="checkbox" name="agdpr-consentimiento" id="agdpr-consentimiento" value="1">
24
+
25
+ {{^consentimiento-label}}
26
+ {{#privacidadURL}}
27
+ He leído y acepto la <a rel="nofollow" href="{{ privacidadURL }}">política de privacidad</a>.
28
+ {{/privacidadURL}}
29
+
30
+ {{^privacidadURL}}
31
+ Acepto la política de privacidad.
32
+ {{/privacidadURL}}
33
+ {{/consentimiento-label}}
34
+
35
+ {{#consentimiento-label}}
36
+ {{consentimiento-label}}
37
+ {{#privacidadURL}}
38
+ <a rel="nofollow" href="{{ privacidadURL }}">Ver</a>.
39
+ {{/privacidadURL}}
40
+ {{/consentimiento-label}}
41
+
42
+ </label>
43
+ </p>
views/cookies-banner.mustache ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <div class="argpd-cookies" id="cookies-consentimiento">
22
+ <div class="argpd-cookies-bar">
23
+ {{^cookies-label}}
24
+ Esta web utiliza cookies {{# cookiesURL }} puedes ver aquí <a class="argpd-cookies-politica" target="_blank" rel="nofollow" href="{{ cookiesURL }}"> la política de cookies</a>{{/ cookiesURL }}. Si continuas navegando estás aceptándola
25
+ {{/cookies-label}}
26
+
27
+ {{#cookies-label}}
28
+ {{cookies-label}}
29
+ &nbsp;&nbsp;
30
+ {{# cookiesURL }}<a target="_blank" rel="nofollow" href="{{ cookiesURL }}">Ver</a>{{/ cookiesURL }}
31
+ {{/cookies-label}}
32
+
33
+ <button id="argpd-cookies-btn" >Aceptar</button>
34
+ </div>
35
+ </div>
36
+
views/deber-de-informar.mustache ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <div class="argpd-informar">
22
+ <ul>
23
+ <li><b>Responsable</b> {{ titular }}</li>
24
+ <li><b>Finalidad</b> Moderar los comentarios.</li>
25
+ <li><b>Destinatarios</b> Tu consentimiento.</li>
26
+ <li><b>Derechos</b> Acceder, rectificar y suprimir los datos.</li>
27
+ <li><b>Información Adicional</b> Puede consultar la información detallada en <a href="{{ avisolegalURL}}">{{ avisolegalURL }}</a>.</li>
28
+ </ul>
29
+ </div>
views/disclaimer.mustache ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <div style="max-width: 540px; padding-top:20px">
22
+ <p>
23
+ <h4>Renuncia de responsabilidad</h4>
24
+ </p>
25
+ <p>
26
+ El uso del plugin <b>Adapta RGPD</b> te sirve para crear tus textos legales adecuados a las regulaciones europeas de privacidad conocidas como RGPD, sin embargo <b>NO garantiza el cumplimiento de GDPR o cualquier otra disposición legal</b>.
27
+ </p>
28
+ <p>
29
+ Expresamente declinamos toda responsabilidad con respecto al uso de este plugin.
30
+ </p>
31
+ <p>
32
+ Este plugin le brinda información general y herramientas, pero NO está diseñado para servir como un paquete completo de cumplimiento. Considera que es tu responsabilidad usar estos recursos correctamente, para ofrecer la información que requiera tu política de privacidad, y para asegurar que la información es actual y precisa.
33
+ </p>
34
+ <p>
35
+ Para auditoría de cumplimiento o ayuda adicional contacte a profesionales legales. Como cada negocio y situación es único, es posible que deba modificar, agregar o eliminar información en estas plantillas.
36
+ </p>
37
+ <p>
38
+ Además de esto, necesitará auditar todas sus actividades de procesamiento para lograr el cumplimiento de GDPR o cualquier otra disposición legal.
39
+ </p>
40
+
41
+ <p>
42
+ Visita la <a href="https://superadmin.es/adapta-rgpd">página del plugin</a> para ver información detallada.
43
+ </p>
44
+ </div>
views/pie-de-pagina-legal.mustache ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <div class="argpd-footer">
22
+ <ul>
23
+ {{# avisolegalURL }}<li><a href="{{ avisolegalURL }}">Aviso Legal</a></li>{{/ avisolegalURL }}
24
+ {{# privacidadURL }}<li><a href="{{ privacidadURL }}">Política de Privacidad</a></li>{{/ privacidadURL }}
25
+ {{# cookiesURL }}<li><a href="{{ cookiesURL }}">Política de Cookies</a></li>{{/ cookiesURL }}
26
+ </ul>
27
+ </div>
views/politica-cookies.mustache ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <p>
22
+ El sitio Web <a href="{{dominio}}">{{dominio}}</a> utiliza cookies.
23
+ </p>
24
+
25
+ <p>
26
+ En cumplimiento con lo dispuesto en el artículo 22.2 de la Ley 34/2002, de 11 de julio, de Servicios de la Sociedad de la Información y de Comercio Electrónico, esta página web le informa, en esta sección, sobre la política de recogida y tratamiento de cookies.
27
+ </p>
28
+
29
+
30
+ <h2>¿Qué son las cookies?</h2>
31
+
32
+ <p>
33
+ Una cookie es un fichero que se descarga en su ordenador al acceder a determinadas páginas web. Las cookies permiten a una página web, entre otras cosas, almacenar y recuperar información sobre los hábitos de navegación de un usuario o de su equipo y, dependiendo de la información que contengan y de la forma en que utilice su equipo, pueden utilizarse para reconocer al usuario.
34
+ </p>
35
+
36
+
37
+ <h2>¿Qué tipos de cookies utiliza esta página web?</h2>
38
+
39
+ <p>
40
+ El sitio web <a href="{{dominio}}">{{dominio}}</a> utiliza los siguientes tipos de cookies:
41
+ </p>
42
+
43
+ <p>
44
+ <ul>
45
+ <li>
46
+ <b>Cookies de análisis:</b> Son aquéllas que bien tratadas por nosotros o por terceros, nos permiten cuantificar el número de usuarios y así realizar la medición y análisis estadístico de la utilización que hacen los usuarios del servicio ofertado. Para ello se analiza su navegación en nuestra página web con el fin de mejorar la oferta de productos o servicios que le ofrecemos.
47
+ </li>
48
+ <li>
49
+ <b>Cookies técnicas:</b> Son aquellas que permiten al usuario la navegación a través del área restringida y la utilización de sus diferentes funciones, como por ejemplo, llevar a cambio el proceso de compra de un artículo.
50
+ </li>
51
+ <li>
52
+ <b>Cookies de personalización:</b> Son aquellas que permiten al usuario acceder al servicio con algunas características de carácter general predefinidas en función de una serie de criterios en el terminal del usuario como por ejemplo serian el idioma o el tipo de navegador a través del cual se conecta al servicio.
53
+ </li>
54
+ <li>
55
+ <b>Cookies publicitarias:</b> Son aquéllas que, bien tratadas por esta web o por terceros, permiten gestionar de la forma más eficaz posible la oferta de los espacios publicitarios que hay en la página web, adecuando el contenido del anuncio al contenido del servicio solicitado o al uso que realice de nuestra página web. Para ello podemos analizar sus hábitos de navegación en Internet y podemos mostrarle publicidad relacionada con su perfil de navegación.
56
+ </li>
57
+ <li>
58
+ <b>Cookies de publicidad comportamental:</b> Son aquellas que permiten la gestión, de la forma más eficaz posible, de los espacios publicitarios que, en su caso, el editor haya incluido en una página web, aplicación o plataforma desde la que presta el servicio solicitado. Este tipo de cookies almacenan información del comportamiento de los visitantes obtenida a través de la observación continuada de sus hábitos de navegación, lo que permite desarrollar un perfil específico para mostrar avisos publicitarios en función del mismo.
59
+ </li>
60
+ </ul>
61
+ </p>
62
+
63
+ <h2>Desactivar las cookies</h2>
64
+
65
+ <p>
66
+ Puede usted permitir, bloquear o eliminar las cookies instaladas en su equipo mediante la configuración de las opciones del navegador instalado en su ordenador.
67
+ </p>
68
+
69
+ <p>
70
+ En la mayoría de los navegadores web se ofrece la posibilidad de permitir, bloquear o eliminar las cookies instaladas en su equipo.
71
+ </p>
72
+
73
+ <p>
74
+ A continuación puede acceder a la configuración de los navegadores webs más frecuentes para aceptar, instalar o desactivar las cookies:
75
+ </p>
76
+
77
+ <p>
78
+ <ul>
79
+ <li><b>Firefox</b> <a href="http://support.mozilla.org/es/kb/habilitar-y-deshabilitar-cookies-que-los-sitios-we">http://support.mozilla.org/es/kb/habilitar-y-deshabilitar-cookies-que-los-sitios-we</a></li>
80
+ <li><b>Safari</b> <a href="http://support.apple.com/kb/HT1677?viewlocale=es_ES">http://support.apple.com/kb/HT1677?viewlocale=es_ES</a></li>
81
+ <li><b>Google Chrome</b> <a href="https://support.google.com/chrome/answer/95647?hl=es">https://support.google.com/chrome/answer/95647?hl=es</a></li>
82
+ </ul>
83
+ </p>
84
+
85
+ <h2>Cookies de terceros</h2>
86
+
87
+ {{# thirdparty-dclick }}
88
+ <p>
89
+ Esta página web utiliza servicios de terceros para recopilar información con fines estadísticos y de uso de la web. Se usan cookies de DoubleClick para mejorar la publicidad que se incluye en el sitio web. Son utilizadas para orientar la publicidad según el contenido que es relevante para un usuario, mejorando así la calidad de experiencia en el uso del mismo.
90
+ </p>
91
+ {{/ thirdparty-dclick }}
92
+
93
+ {{# thirdparty-ganalytics }}
94
+ <p>
95
+ En concreto, usamos los servicios de Google Adsense y de Google Analytics para nuestras estadísticas y publicidad. Algunas cookies son esenciales para el funcionamiento del sitio, por ejemplo el buscador incorporado.
96
+ </p>
97
+ {{/ thirdparty-ganalytics }}
98
+
99
+
100
+ {{# thirdparty-social }}
101
+ <p>
102
+ Nuestro sitio incluye otras funcionalidades proporcionadas por terceros. Usted puede fácilmente compartir el contenido en redes sociales como Facebook, Twitter o Google +, con los botones que hemos incluido a tal efecto.
103
+ </p>
104
+ {{/ thirdparty-social }}
105
+
106
+
107
+ <h2>Advertencia sobre eliminar cookies</h2>
108
+
109
+ <p>
110
+ Usted puede eliminar y bloquear todas las cookies de este sitio, pero parte del sitio no funcionará o la calidad de la página web puede verse afectada.
111
+ </p>
112
+
113
+
114
+ {{# correo }}
115
+ <p>
116
+ Si tiene cualquier duda acerca de nuestra política de cookies, puede contactar con esta página web a través de la dirección de correo electrónico {{ correo }}.
117
+ </p>
118
+ {{/ correo }}
119
+
120
+
views/politica-privacidad.mustache ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{!
2
+
3
+ Copyright (c) 2018 superadmin (email : superadmin@superadmin.es)
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License, version 2 or, at
7
+ your discretion, any later version, as published by the Free
8
+ Software Foundation.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ }}
20
+
21
+ <p>
22
+ {{titular}} informa a los usuarios del sitio web sobre su política respecto del tratamiento y protección de los datos de carácter personal de los usuarios y clientes que puedan ser recabados por la navegación o contratación de servicios a través de su sitio web.
23
+ </p>
24
+
25
+ <p>
26
+ {{#pais-ue}}
27
+ En este sentido, {{titular}} garantiza el cumplimiento de la normativa vigente en materia de protección de datos personales, reflejada en la Ley Orgánica 15⁄1999, de 13 de diciembre, de Protección de Datos de Carácter Personal (LOPD), y al Real Decreto 1720⁄2007, de 21 de diciembre, conocido como el Reglamento de desarrollo de la LOPD. Cumple también con el Reglamento (UE) 2016⁄679 del Parlamento Europeo y del Consejo de 27 de abril de 2016 relativo a la protección de las personas físicas (RGPD).
28
+ {{/pais-ue}}
29
+ {{^pais-ue}}
30
+ En este sentido, {{titular}} cumple con el Reglamento (UE) 2016⁄679 del Parlamento Europeo y del Consejo de 27 de abril de 2016 relativo a la protección de las personas físicas (RGPD).
31
+ {{/pais-ue}}
32
+ </p>
33
+
34
+
35
+
36
+ <p>
37
+ El uso de esta web implica la aceptación de esta política de privacidad.
38
+ </p>
39
+
40
+ <h2>Identidad del responsable</h2>
41
+ <p>
42
+ <ul>
43
+ <li><b>Titular:</b> {{titular}}</li>
44
+ {{#id-fiscal}}<li><b>NIF/CIF:</b> {{id-fiscal}}</li>{{/id-fiscal}}
45
+ <li><b>Domicilio:</b> {{# domicilio }} {{domicilio}}, {{/ domicilio }} {{provincia}} - {{pais-nombre}}.</li>
46
+ {{#correo }}<li><b>Correo electrónico:</b> {{correo}}</li>{{/correo}}
47
+ </ul>
48
+ </p>
49
+
50
+
51
+
52
+ <h2>Principios que aplicaremos a tu información personal</h2>
53
+ <p>
54
+ En el tratamiento de tus datos personales, aplicaremos los siguientes principios que se ajustan a las exigencias del nuevo reglamento europeo de protección de datos:
55
+ </p>
56
+
57
+ <p>
58
+ <ul>
59
+ <li>
60
+ <b>Principio de licitud, lealtad y transparencia:</b> Siempre vamos a requerir tu consentimiento para el tratamiento de tus datos personales para uno o varios fines específicos que te informaremos previamente con absoluta transparencia.
61
+ </li>
62
+ <li>
63
+ <b>Principio de minimización de datos:</b> Solo vamos a solicitar datos estrictamente necesarios en relación con los fines para los que los requerimos. Los mínimos posibles.
64
+ </li>
65
+ <li>
66
+ <b>Principio de limitación del plazo de conservación:</b> Los datos serán mantenidos durante no más tiempo del necesario para los fines del tratamiento, en función a la finalidad, te informaremos del plazo de conservación correspondiente, en el caso de suscripciones, periódicamente revisaremos nuestras listas y eliminaremos aquellos registros inactivos durante un tiempo considerable.
67
+ </li>
68
+ <li>
69
+ <b>Principio de integridad y confidencialidad:</b> Tus datos serán tratados de tal manera que se garantice una seguridad adecuada de los datos personales y se garantice confidencialidad. Debes saber que tomamos todas las precauciones necesarias para evitar el acceso no autorizado o uso indebido de los datos de nuestros usuarios por parte de terceros.
70
+ </li>
71
+ </ul>
72
+ </p>
73
+
74
+
75
+
76
+ <h2>¿Cómo hemos obtenido tus datos?</h2>
77
+ <p>
78
+ Para que puedas navegar por <a rel="nofollow" href="{{dominio}}">{{dominio}}</a>, no es necesario que facilites ningún dato personal.
79
+ </p>
80
+ <p>
81
+ Los casos en los que si me das tus datos son los siguientes:
82
+ </p>
83
+ <p>
84
+ <ul>
85
+ {{#option-forms}}<li>Al contactar a través de los formularios de contacto o enviarme un correo electrónico.</li>{{/option-forms}}
86
+ {{#option-comments}}<li>Al realizar un comentario en un artículo o página.</li>{{/option-comments}}
87
+ {{#thirdparty-mailchimp}}<li>Al inscribirte en un formulario de suscripción.</li>{{/thirdparty-mailchimp}}
88
+ </ul>
89
+ </p>
90
+
91
+
92
+ <h2>¿Cuáles son tus derechos cuando nos facilitas tus datos?</h2>
93
+ <p>
94
+ Las personas interesadas tienen derecho a:
95
+ </p>
96
+ <p>
97
+ <ul>
98
+ <li>Solicitar el acceso a los datos personales relativos al interesado.</li>
99
+ <li>Solicitar su rectificación o supresión.</li>
100
+ <li>Solicitar la limitación de su tratamiento.</li>
101
+ <li>Oponerse al tratamiento.</li>
102
+ {{#clause-portabilidad}}<li>Portabilidad de datos.</li>{{/clause-portabilidad}}
103
+ </ul>
104
+ </p>
105
+ {{^clause-portabilidad}}
106
+ <p>
107
+ No se puede ejercitar el derecho a la portabilidad de los datos.
108
+ </p>
109
+ {{/clause-portabilidad}}
110
+
111
+ <p>
112
+ El ejercicio de estos derechos es personal y debe por tanto ser ejercido directamente por el interesado, solicitándolo directamente a {{titular}}, lo que significa que cualquier cliente, suscriptor o colaborador que me haya facilitado sus datos en algún momento, puede dirigirse a {{titular}} y pedirme información sobre los datos que tengo almacenados y cómo los he obtenido (derecho de acceso), puede solicitar la rectificación de los mismos, oponerse al tratamito, que limite su uso o en su caso la cancelación de esos datos en mis ficheros.
113
+ </p>
114
+ <p>
115
+ Puedes enviar cualquier petición de este tipo y ejercitar los derechos de acceso, rectificación, cancelación y oposición a través de
116
+ {{#correo}}
117
+ correo electrónico enviando un correo electrónico a {{correo}} junto con la prueba válida en derecho como una fotocopia del D.N.I. o equivalente.
118
+ {{/correo}}
119
+ {{^correo}}
120
+ correo postal a {{titular}}, {{# domicilio }} {{domicilio}}, {{/ domicilio }} {{provincia}} - España <br/> junto con la prueba válida en derecho como una fotocopia del D.N.I. o equivalente.
121
+ {{/correo}}
122
+ </p>
123
+ <p>
124
+ Los interesados también tendrán derecho a la tutela judicial efectiva y a presentar una reclamación ante la autoridad de control, en este caso, la Agencia Española de Protección de Datos, si consideran que el tratamiento de datos personales que le conciernen infringe el Reglamento.
125
+ </p>
126
+
127
+
128
+
129
+ <h2>¿Con qué finalidad tratamos tus datos personales?</h2>
130
+ <p>
131
+ Cuando un usuario se conecta a <a rel="nofollow" href="{{dominio}}">{{dominio}}</a> para mandar un correo al titular, suscribirse o realizar alguna contratación, está facilitando información de carácter personal de la que es responsable {{titular}}. Esa información puede incluir datos de carácter personal como pueden ser tu dirección IP, nombre, dirección física, dirección de correo electrónico, número de teléfono, y otra información. Al facilitar esta información, el usuario da su consentimiento para que su información sea recopilada, utilizada, gestionada y almacenada por
132
+ {{#hosting-info}}{{hosting-info}}{{/hosting-info}}
133
+ {{^hosting-info}}{{titular}}{{/hosting-info}},
134
+ {{#avisolegalURL}}
135
+ sólo como se describe en el <a rel="nofollow" href="{{avisolegalURL}}">Aviso Legal</a> y en la presente <a rel="nofollow" href="{{privacidadURL}}">Política de Privacidad</a>.
136
+ {{/avisolegalURL}}
137
+ </p>
138
+ <p>
139
+ En <a rel="nofollow" href="{{dominio}}">{{dominio}}</a> existen diferentes sistemas de captura de información personal y tratamos la información que nos facilitan las personas interesadas con el siguiente fin por cada sistema de captura (formularios):
140
+ </p>
141
+ <p>
142
+ <ul>
143
+ {{#option-forms}}
144
+ <li>
145
+ <b>Formularios de contacto:</b> Solicitamos los siguientes datos personales: Nombre, Email, Teléfono, web y en qué pueden ayudarte, para responder a los requerimientos de los usuarios de <a href="{{dominio}}" rel="nofollow">{{dominio}}</a>.<br>
146
+ Por ejemplo, podemos utilizar esos datos para responder a tu solicitud y dar respuesta a las dudas, quejas, comentarios o inquietudes que puedas tener relativas a la información incluida en la web, los servicios que se prestan a través de la web, el tratamiento de sus datos personales, cuestiones referentes a los textos legales incluidos en la web, así como cualesquiera otras consultas que puedas tener y que no estén sujetas a las condiciones de contratación.
147
+ </li>
148
+ {{/option-forms}}
149
+ {{#thirdparty-mailchimp}}
150
+ <li>
151
+ <b>Formularios de suscripción a contenidos:</b> En este caso, solicitamos los siguientes datos personales: Nombre, Email, Teléfono, para gestionar la lista de suscripciones, enviar boletines, promociones y ofertas especiales, facilitados por el usuario al realizar la suscripción. Te informamos que los datos que nos facilitas estarán ubicados en los servidores de The Rocket Science Group LLC d/b/a , con domicilio en EEUU. (Mailchimp).
152
+ </li>
153
+ {{/thirdparty-mailchimp}}
154
+ </ul>
155
+ </p>
156
+ <p>
157
+ Existen otras finalidades por la que tratamos tus datos personales:
158
+ </p>
159
+ <p>
160
+ <ul>
161
+ <li>
162
+ Para garantizar el cumplimiento de las condiciones de uso y la ley aplicable. Esto puede incluir el desarrollo de herramientas y algoritmos que ayudan a esta web a garantizar la confidencialidad de los datos personales que recoge.
163
+ </li>
164
+ <li>
165
+ Para apoyar y mejorar los servicios que ofrece esta web.
166
+ </li>
167
+ <li>
168
+ También se recogen otros datos no identificativos que se obtienen mediante algunas cookies que se descargan en el ordenador del usuario cuando navega en esta web{{#cookiesID}}, y que detallamos en la política de cookies{{/cookiesID}}.
169
+ </li>
170
+ {{#thirdparty-social}}
171
+ <li>
172
+ Para gestionar las redes sociales. {{titular}} puede tener presencia en redes sociales. El tratamiento de los datos que se lleve a cabo de las personas que se hagan seguidoras en las redes sociales de las páginas oficiales de {{titular}}, se regirá por este apartado. Así como por aquellas condiciones de uso, políticas de privacidad y normativas de acceso que pertenezcan a la red social que proceda en cada caso y aceptadas previamente por el usuario. {{titular}} tratará sus datos con las finalidades de administrar correctamente su presencia en la red social, informando de actividades, productos o servicios de {{titular}}. Así como para cualquier otra finalidad que las normativas de las redes sociales permitan. En ningún caso utilizaré los perfiles de seguidores en redes sociales para enviar publicidad de manera individual.
173
+ </li>
174
+ {{/thirdparty-social}}
175
+ </ul>
176
+ </p>
177
+
178
+
179
+ <h2>Cómo protegemos tus datos</h2>
180
+
181
+ {{#hosting-info}}
182
+ <p>
183
+ Este sitio web se encuentra alojado en {{hosting-info}}. La seguridad de tus datos está garantizada, ya que toman todas las medidas de seguridad necesarias para ello. Puedes consultar su política de privacidad para tener más información.
184
+ </p>
185
+ {{/hosting-info}}
186
+ {{^hosting-info}}
187
+ <p>
188
+ Tus datos podrán ser incorporados a un fichero de lista de correo, del cual soy responsable de su gestión y tratamiento. La seguridad de tus datos está garantizada, ya que tomo todas las medidas de seguridad necesarias para ello. Solo usaré dichos datos para la finalidad que me los has dado.
189
+ </p>
190
+ {{/hosting-info}}
191
+ <p>
192
+ Para proteger tu información personal, tomamos precauciones razonables y seguimos las mejores prácticas de la industria para asegurarnos de que no haya pérdida de manera inapropiada, mal uso, acceso, divulgación, alteración o destrucción de la misma.
193
+ </p>
194
+
195
+ {{^clause-terceros}}
196
+ <p>
197
+ {{titular}} informa a los usuarios de que sus datos personales no serán cedidos a terceras organizaciones, con la salvedad de que dicha cesión de datos este amparada en una obligación legal o cuando la prestación de un servicio implique la necesidad de una relación contractual con un encargado de tratamiento. En este último caso, solo se llevará a cabo la cesión de datos al tercero cuando {{titular}} disponga del consentimiento expreso del usuario.
198
+ </p>
199
+ <p>
200
+ Sin embargo, en algunos casos se pueden realizar colaboraciones con otros profesionales, en esos casos, se requerirá consentimiento a los usuarios informando sobre la identidad del colaborador y la finalidad de la colaboración. Siempre se realizará con los más estrictos estándares de seguridad.
201
+ </p>
202
+ {{/clause-terceros}}
203
+
204
+
205
+ <h2>Contenido de otros sitios web</h2>
206
+ <p>
207
+ Los artículos de este sitio pueden incluir contenido incrustado (por ejemplo, vídeos, imágenes, artículos, etc.). El contenido incrustado de otras web se comporta exactamente de la misma manera que si el visitante hubiera visitado la otra web.
208
+ </p>
209
+ <p>
210
+ Estas web pueden recopilar datos sobre ti, utilizar cookies, incrustar un seguimiento adicional de terceros, y supervisar tu interacción con ese contenido incrustado, incluido el seguimiento de su interacción con el contenido incrustado si tienes una cuenta y estás conectado a esa web.
211
+ </p>
212
+
213
+
214
+ <h2>Cookies</h2>
215
+ <p>
216
+ Te informo que para que el sitio funcione correctamente necesita utilizar cookies, que es información que se almacena en tu navegador para facilitar la navegación.
217
+
218
+ {{# cookiesURL }}
219
+ <p>
220
+ Puede consultar aquí <a target="_blank" rel="nofollow" href="{{ cookiesURL }}"> la política de cookies</a>.
221
+ </p>
222
+ {{/ cookiesURL }}
223
+ </p>
224
+
225
+
226
+
227
+ <h2>Legitimación para el tratamiento de tus datos</h2>
228
+ <p>
229
+ La base legal para el tratamiento de sus datos es: el consentimiento.
230
+ </p>
231
+ <p>
232
+ Para contactar o realizar comentarios en esta web se requiere la aceptación de esta política de privacidad.
233
+ </p>
234
+
235
+
236
+
237
+ <h2>Categoría de datos</h2>
238
+ <p>
239
+ <ul>
240
+ <li>Las categorías de datos que se tratan son datos identificativos.</li>
241
+ {{^clause-protegidos}}
242
+ <li>No se tratan categorías de datos especialmente protegidos.</li>
243
+ {{/clause-protegidos}}
244
+ </ul>
245
+ </p>
246
+
247
+
248
+ <h2>¿Por cuánto tiempo conservaremos tus datos?</h2>
249
+ <p>
250
+ Los datos personales proporcionados se conservarán hasta que se solicite su supresión por el interesado.
251
+ </p>
252
+
253
+
254
+ <h2>¿A qué destinatarios se comunicarán tus datos?</h2>
255
+ <p>
256
+ <ul>
257
+ {{#thirdparty-ganalytics}}
258
+ <li>
259
+ <b>Google Analytics</b> un servicio analítico de web prestado por Google, Inc., una compañía de Delaware cuya oficina principal está en 1600 Amphitheatre Parkway, Mountain View (California), CA 94043, Estados Unidos (“Google”). Google Analytics utiliza "cookies", que son archivos de texto ubicados en tu ordenador, para ayudar a {{dominio}} a analizar el uso que hacen los usuarios del sitio web. La información que genera la cookie acerca de su uso de {{dominio}} (incluyendo tu dirección IP) será directamente transmitida y archivada por Google en los servidores de Estados Unidos.
260
+ </li>
261
+ {{/thirdparty-ganalytics}}
262
+ {{#thirdparty-mailchimp}}
263
+ <li>
264
+ <b>Email marketing</b> The Rocket Science Group LLC d/b/a , con domicilio en EEUU. Más información en: https://mailchimp.com/ (The Rocket Science Group LLC d/b/a ). The Rocket Science Group LLC d/b/a trata los datos con la finalidad de realizar sus servicios de email marketing a {{titular}}.
265
+ </li>
266
+ {{/thirdparty-mailchimp}}
267
+ </ul>
268
+ </p>
269
+
270
+
271
+ <h2>Navegación Web</h2>
272
+ <p>
273
+ Al navegar por <a href="{{dominio}}" rel="nofollow">{{dominio}}</a> se pueden recoger datos no identificables, que pueden incluir, direcciones IP, ubicación geográfica (aproximadamente), un registro de cómo se utilizan los servicios y sitios, y otros datos que no pueden ser utilizados para identificar al usuario. Entre los datos no identificativos están también los relacionados a tus hábitos de navegación a través de servicios de terceros.
274
+ </p>
275
+
276
+ <p>
277
+ Estas webs utilizan los siguientes servicios de análisis de terceros:
278
+ </p>
279
+
280
+ <p>
281
+ <ul>
282
+ {{#thirdparty-ganalytics}}<li>Google Analytics</li>{{/thirdparty-ganalytics}}
283
+ </ul>
284
+ </p>
285
+ <p>
286
+ Utilizamos esta información para analizar tendencias, administrar el sitio, rastrear los movimientos de los usuarios alrededor del sitio y para recopilar información demográfica sobre nuestra base de usuarios en su conjunto.
287
+ </p>
288
+
289
+ <h2>Exactitud y veracidad de los datos</h2>
290
+ <p>
291
+ Como usuario, eres el único responsable de la veracidad y corrección de los datos que remitas a {{titular}} exonerando a {{titular}}, de cualquier responsabilidad al respecto.
292
+ </p>
293
+ <p>
294
+ Los usuarios garantizan y responden, en cualquier caso, de la exactitud, vigencia y autenticidad de los datos personales facilitados, y se comprometen a mantenerlos debidamente actualizados. El usuario acepta proporcionar información completa y correcta en el formulario de contacto o suscripción.
295
+ </p>
296
+
297
+
298
+ <h2>Aceptación y consentimiento</h2>
299
+ <p>
300
+ El usuario declara haber sido informado de las condiciones sobre protección de datos de carácter personal, aceptando y consintiendo el tratamiento de los mismos por parte de {{titular}} en la forma y para las finalidades indicadas en esta política de privacidad.
301
+ </p>
302
+
303
+
304
+ <h2>Revocabilidad</h2>
305
+ <p>
306
+ En todo momento, los usuarios que quieran acceder a sus datos, rectificarlos o cancelarlos me pueden mandar un email a {{correo}} y les explicaré como ejercer sus derechos de oposición, acceso e información, rectificación, cancelación de sus datos y revocación de su autorización.
307
+ </p>
308
+
309
+ <p>
310
+ Esto no incluye ningún dato que estemos obligados a conservar con fines administrativos, legales o de seguridad.
311
+ </p>
312
+
313
+
314
+
315
+ <h2>Cambios en la política de privacidad</h2>
316
+ <p>
317
+ {{titular}} se reserva el derecho a modificar la presente política para adaptarla a novedades legislativas o jurisprudenciales, así como a prácticas de la industria. En dichos supuestos, {{titular}} anunciará en esta página los cambios introducidos con razonable antelación a su puesta en práctica.
318
+ </p>
319
+
320
+