Blocksy Companion - Version 1.0.3

Version Description

  • Tested with WordPress 5.2
  • Checkbox for consent
  • Support Blocksy child themes variations
Download this release

Release Info

Developer creativethemeshq
Plugin Icon wp plugin Blocksy Companion
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.3

Files changed (114) hide show
  1. blocksy-companion.php +1 -1
  2. framework/autoload.php +18 -2
  3. framework/dashboard.php +8 -2
  4. framework/extensions-manager-api.php +9 -4
  5. framework/extensions-manager.php +68 -4
  6. framework/extensions/cookies-consent/config.php +5 -0
  7. framework/extensions/cookies-consent/customizer.php +177 -0
  8. framework/extensions/cookies-consent/extension.php +94 -0
  9. framework/extensions/cookies-consent/global.php +44 -0
  10. framework/extensions/cookies-consent/helpers.php +88 -0
  11. framework/extensions/cookies-consent/readme.php +26 -0
  12. framework/extensions/cookies-consent/static/bundle/main.css +8 -0
  13. framework/extensions/cookies-consent/static/bundle/main.js +8 -0
  14. framework/extensions/cookies-consent/static/bundle/sync.js +1 -0
  15. framework/extensions/cookies-consent/static/images/type-1.svg +44 -0
  16. framework/extensions/cookies-consent/static/images/type-2.svg +46 -0
  17. framework/extensions/cookies-consent/static/js/main.js +81 -0
  18. framework/extensions/cookies-consent/static/js/sync.js +54 -0
  19. framework/extensions/cookies-consent/static/js/variables.js +33 -0
  20. framework/extensions/cookies-consent/static/sass/main.scss +170 -0
  21. framework/extensions/instagram/config.php +1 -1
  22. framework/extensions/instagram/ct-instagram/view.php +0 -6
  23. framework/extensions/instagram/ct-instagram/widget.php +1 -3
  24. framework/extensions/instagram/customizer.php +92 -0
  25. framework/extensions/instagram/extension.php +37 -4
  26. framework/extensions/instagram/helpers.php +238 -0
  27. framework/extensions/instagram/readme.php +42 -0
  28. framework/extensions/instagram/static/bundle/0.17a36d03c4d4439f3e19.js +1 -0
  29. framework/extensions/instagram/static/bundle/main.css +8 -0
  30. framework/extensions/instagram/static/bundle/main.js +1 -0
  31. framework/extensions/instagram/static/bundle/sync.js +1 -0
  32. framework/extensions/instagram/static/js/instagram-widget.js +29 -0
  33. framework/extensions/instagram/static/js/lazy-load-helpers.js +18 -0
  34. framework/extensions/instagram/static/js/main.js +17 -0
  35. framework/extensions/instagram/static/js/public-path.js +1 -0
  36. framework/extensions/instagram/static/js/sync.js +60 -0
  37. framework/extensions/instagram/static/js/sync/helpers.js +133 -0
  38. framework/extensions/instagram/static/sass/main.scss +73 -0
  39. framework/extensions/mailchimp/admin-static/bundle/1.4b8b242225582999eec3.js +20 -0
  40. framework/extensions/mailchimp/admin-static/bundle/2.8838a376a98402a4d731.js +1 -0
  41. framework/extensions/mailchimp/admin-static/bundle/main.js +1 -0
  42. framework/extensions/mailchimp/admin-static/bundle/sync.js +1 -0
  43. framework/extensions/mailchimp/admin-static/js/ListPicker.js +22 -0
  44. framework/extensions/mailchimp/admin-static/js/ListPicker/Implementation.js +122 -0
  45. framework/extensions/mailchimp/admin-static/js/main.js +9 -0
  46. framework/extensions/mailchimp/admin-static/js/public-path.js +1 -0
  47. framework/extensions/mailchimp/admin-static/js/sync.js +51 -0
  48. framework/extensions/mailchimp/admin-static/js/variables.js +39 -0
  49. framework/extensions/mailchimp/config.php +6 -0
  50. framework/extensions/mailchimp/ct-mailchimp/options.php +89 -0
  51. framework/extensions/mailchimp/ct-mailchimp/view.php +88 -0
  52. framework/extensions/mailchimp/ct-mailchimp/widget.php +22 -0
  53. framework/extensions/mailchimp/customizer.php +234 -0
  54. framework/extensions/mailchimp/dashboard-static/bundle/main.js +20 -0
  55. framework/extensions/mailchimp/dashboard-static/js/EditCredentials.js +157 -0
  56. framework/extensions/mailchimp/dashboard-static/js/ListPicker.js +150 -0
  57. framework/extensions/mailchimp/dashboard-static/js/Mailchimp.js +66 -0
  58. framework/extensions/mailchimp/dashboard-static/js/hooks/useActivationWithRequirements.js +82 -0
  59. framework/extensions/mailchimp/dashboard-static/js/main.js +14 -0
  60. framework/extensions/mailchimp/extension.php +110 -0
  61. framework/extensions/mailchimp/global.php +65 -0
  62. framework/extensions/mailchimp/helpers.php +106 -0
  63. framework/extensions/mailchimp/mailchimp-manager.php +120 -0
  64. framework/extensions/mailchimp/pre-boot.php +112 -0
  65. framework/extensions/mailchimp/readme.php +43 -0
  66. framework/extensions/mailchimp/static/bundle/main.css +8 -0
  67. framework/extensions/mailchimp/static/sass/main.scss +30 -0
  68. framework/extensions/mailchimp/static/sass/single-block.scss +54 -0
  69. framework/extensions/mailchimp/static/sass/widget.scss +40 -0
  70. framework/extensions/read-progress/config.php +8 -0
  71. framework/extensions/read-progress/extension.php +76 -0
  72. framework/extensions/read-progress/helpers.php +10 -0
  73. framework/extensions/read-progress/readme.php +22 -0
  74. framework/extensions/read-progress/static/bundle/1.4e041077b3d19928a037.js +1 -0
  75. framework/extensions/read-progress/static/bundle/main.css +8 -0
  76. framework/extensions/read-progress/static/bundle/main.js +1 -0
  77. framework/extensions/read-progress/static/js/implementation.js +28 -0
  78. framework/extensions/read-progress/static/js/main.js +9 -0
  79. framework/extensions/read-progress/static/js/public-path.js +1 -0
  80. framework/extensions/read-progress/static/sass/main.scss +29 -0
  81. framework/extensions/widgets/config.php +5 -0
  82. framework/extensions/widgets/extension.php +36 -0
  83. framework/extensions/widgets/static/bundle/main.css +8 -0
  84. framework/extensions/widgets/static/sass/contact-info.scss +45 -0
  85. framework/extensions/widgets/static/sass/main.scss +4 -0
  86. framework/extensions/widgets/static/sass/posts.scss +49 -0
  87. framework/extensions/widgets/widgets/ct-advertisement/options.php +84 -0
  88. framework/extensions/widgets/widgets/ct-advertisement/view.php +55 -0
  89. framework/extensions/widgets/widgets/ct-advertisement/widget.php +21 -0
  90. framework/extensions/widgets/widgets/ct-contact-info/options.php +278 -0
  91. framework/extensions/widgets/widgets/ct-contact-info/view.php +146 -0
  92. framework/extensions/widgets/widgets/ct-contact-info/widget.php +21 -0
  93. framework/extensions/widgets/widgets/ct-posts/options.php +101 -0
  94. framework/extensions/widgets/widgets/ct-posts/view.php +120 -0
  95. framework/extensions/widgets/widgets/ct-posts/widget.php +22 -0
  96. framework/extensions/widgets/widgets/ct-socials/options.php +156 -0
  97. framework/extensions/widgets/widgets/ct-socials/view.php +55 -0
  98. framework/extensions/widgets/widgets/ct-socials/widget.php +22 -0
  99. framework/features/google-analytics.php +84 -0
  100. framework/theme-integration.php +23 -0
  101. framework/widgets-manager.php +192 -0
  102. plugin.php +12 -2
  103. readme.txt +15 -1
  104. static/bundle/dashboard.css +2 -2
  105. static/bundle/dashboard.js +2 -2
  106. static/img/extensions.svg +30 -0
  107. static/js/helpers/useActivationAction.js +42 -0
  108. static/js/helpers/useExtensionReadme.js +53 -0
  109. static/js/screens/Extensions.js +59 -45
  110. static/sass/common-frontend.scss +2 -0
  111. static/sass/dashboard.scss +1 -1
  112. static/sass/extensions/extensions-config.scss +47 -0
  113. static/sass/extensions/extensions-readme.scss +40 -0
  114. static/sass/extensions/main.scss +93 -0
blocksy-companion.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Blocksy Companion
5
  Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
6
- Version: 1.0.1
7
  Author: CreativeThemes
8
  Author URI: https://creativethemes.com
9
  Text Domain: blc
3
  /*
4
  Plugin Name: Blocksy Companion
5
  Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
6
+ Version: 1.0.3
7
  Author: CreativeThemes
8
  Author URI: https://creativethemes.com
9
  Text Domain: blc
framework/autoload.php CHANGED
@@ -24,7 +24,14 @@ class Autoloader {
24
  'ExtensionsManager' => 'framework/extensions-manager.php',
25
  'ExtensionsManagerApi' => 'framework/extensions-manager-api.php',
26
  'Dashboard' => 'framework/dashboard.php',
27
- 'ThemeIntegration' => 'framework/theme-integration.php'
 
 
 
 
 
 
 
28
  ];
29
 
30
  /**
@@ -77,7 +84,11 @@ class Autoloader {
77
  * @param string $class Class name.
78
  */
79
  private static function autoload( $class ) {
80
- if ( 0 !== strpos( $class, __NAMESPACE__ . '\\' ) ) {
 
 
 
 
81
  return;
82
  }
83
 
@@ -85,6 +96,11 @@ class Autoloader {
85
 
86
  $final_class_name = __NAMESPACE__ . '\\' . $relative_class_name;
87
 
 
 
 
 
 
88
  if ( ! class_exists( $final_class_name ) ) {
89
  self::load_class( $relative_class_name );
90
  }
24
  'ExtensionsManager' => 'framework/extensions-manager.php',
25
  'ExtensionsManagerApi' => 'framework/extensions-manager-api.php',
26
  'Dashboard' => 'framework/dashboard.php',
27
+ 'ThemeIntegration' => 'framework/theme-integration.php',
28
+
29
+ 'GoogleAnalytics' => 'framework/features/google-analytics.php',
30
+
31
+ /**
32
+ * No namespace
33
+ */
34
+ '_BlocksyWidgetFactory' => 'framework/widgets-manager.php'
35
  ];
36
 
37
  /**
84
  * @param string $class Class name.
85
  */
86
  private static function autoload( $class ) {
87
+ if (
88
+ 0 !== strpos( $class, __NAMESPACE__ . '\\' )
89
+ &&
90
+ ! isset( self::$classes_map[ '_' . $class ] )
91
+ ) {
92
  return;
93
  }
94
 
96
 
97
  $final_class_name = __NAMESPACE__ . '\\' . $relative_class_name;
98
 
99
+ if ( isset( self::$classes_map[ '_' . $relative_class_name ] ) ) {
100
+ $final_class_name = $relative_class_name;
101
+ $relative_class_name = '_' . $relative_class_name;
102
+ }
103
+
104
  if ( ! class_exists( $final_class_name ) ) {
105
  self::load_class( $relative_class_name );
106
  }
framework/dashboard.php CHANGED
@@ -6,7 +6,8 @@ class Dashboard {
6
  public function __construct() {
7
  add_action(
8
  'admin_enqueue_scripts',
9
- [ $this, 'enqueue_static' ]
 
10
  );
11
  }
12
 
@@ -16,10 +17,15 @@ class Dashboard {
16
 
17
  $data = get_plugin_data(BLOCKSY__FILE__);
18
 
 
 
 
 
 
19
  wp_enqueue_script(
20
  'blocksy-dashboard-scripts',
21
  BLOCKSY_URL . 'static/bundle/dashboard.js',
22
- ['wp-i18n', 'ct-dashboard-scripts'],
23
  $data['Version'],
24
  true
25
  );
6
  public function __construct() {
7
  add_action(
8
  'admin_enqueue_scripts',
9
+ [ $this, 'enqueue_static' ],
10
+ 100
11
  );
12
  }
13
 
17
 
18
  $data = get_plugin_data(BLOCKSY__FILE__);
19
 
20
+ $deps = apply_filters('blocksy-dashboard-scripts-dependencies', [
21
+ 'wp-i18n',
22
+ 'ct-options-scripts'
23
+ ]);
24
+
25
  wp_enqueue_script(
26
  'blocksy-dashboard-scripts',
27
  BLOCKSY_URL . 'static/bundle/dashboard.js',
28
+ $deps,
29
  $data['Version'],
30
  true
31
  );
framework/extensions-manager-api.php CHANGED
@@ -5,6 +5,11 @@ namespace Blocksy;
5
  class ExtensionsManagerApi {
6
  public function __construct() {
7
  $this->attach_ajax_actions();
 
 
 
 
 
8
  }
9
 
10
  protected $ajax_actions = [
@@ -16,14 +21,14 @@ class ExtensionsManagerApi {
16
 
17
  public function blocksy_extensions_status() {
18
  $this->check_capability( 'edit_plugins' );
 
19
 
20
- $manager = new ExtensionsManager();
21
  wp_send_json_success($manager->get_extensions());
22
  }
23
 
24
  public function blocksy_extension_activate() {
25
  $this->check_capability( 'edit_plugins' );
26
- $manager = new ExtensionsManager();
27
 
28
  $manager->activate_extension($this->get_extension_from_request());
29
 
@@ -32,7 +37,7 @@ class ExtensionsManagerApi {
32
 
33
  public function blocksy_extension_deactivate() {
34
  $this->check_capability( 'edit_plugins' );
35
- $manager = new ExtensionsManager();
36
 
37
  $manager->deactivate_extension($this->get_extension_from_request());
38
 
@@ -40,7 +45,7 @@ class ExtensionsManagerApi {
40
  }
41
 
42
  public function check_capability( $cap = 'install_plugins' ) {
43
- $manager = new ExtensionsManager();
44
 
45
  if ( ! $manager->can( $cap ) ) {
46
  wp_send_json_error();
5
  class ExtensionsManagerApi {
6
  public function __construct() {
7
  $this->attach_ajax_actions();
8
+
9
+ if (wp_doing_ajax()) {
10
+ $manager = Plugin::instance()->extensions;
11
+ $manager->do_extensions_preboot();
12
+ }
13
  }
14
 
15
  protected $ajax_actions = [
21
 
22
  public function blocksy_extensions_status() {
23
  $this->check_capability( 'edit_plugins' );
24
+ $manager = Plugin::instance()->extensions;
25
 
 
26
  wp_send_json_success($manager->get_extensions());
27
  }
28
 
29
  public function blocksy_extension_activate() {
30
  $this->check_capability( 'edit_plugins' );
31
+ $manager = Plugin::instance()->extensions;
32
 
33
  $manager->activate_extension($this->get_extension_from_request());
34
 
37
 
38
  public function blocksy_extension_deactivate() {
39
  $this->check_capability( 'edit_plugins' );
40
+ $manager = Plugin::instance()->extensions;
41
 
42
  $manager->deactivate_extension($this->get_extension_from_request());
43
 
45
  }
46
 
47
  public function check_capability( $cap = 'install_plugins' ) {
48
+ $manager = Plugin::instance()->extensions;
49
 
50
  if ( ! $manager->can( $cap ) ) {
51
  wp_send_json_error();
framework/extensions-manager.php CHANGED
@@ -20,14 +20,29 @@ class ExtensionsManager {
20
  public function __construct() {
21
  $this->read_installed_extensions();
22
 
 
 
 
 
23
  foreach ($this->get_activated_extensions() as $single_id) {
24
  $this->boot_activated_extension_for($single_id);
25
  }
 
 
 
 
 
 
 
26
 
27
- // print_r($this->extensions);
 
28
 
29
- // $this->activate_extension('simple');
30
- // $this->deactivate_extension('simple');
 
 
 
31
  }
32
 
33
  public function get_extensions() {
@@ -94,8 +109,39 @@ class ExtensionsManager {
94
  $this->extensions[$id] = [
95
  'path' => $path,
96
  '__object' => null,
97
- 'config' => $this->read_config_for($path)
 
 
98
  ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
 
101
  private function boot_activated_extension_for($id) {
@@ -113,6 +159,24 @@ class ExtensionsManager {
113
  $this->extensions[$id]['__object'] = new $class_name();
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  private function read_config_for( $file_path ) {
117
  $_extract_variables = [ 'config' => [] ];
118
 
20
  public function __construct() {
21
  $this->read_installed_extensions();
22
 
23
+ if ($this->is_dashboard_page()) {
24
+ $this->do_extensions_preboot();
25
+ }
26
+
27
  foreach ($this->get_activated_extensions() as $single_id) {
28
  $this->boot_activated_extension_for($single_id);
29
  }
30
+ }
31
+
32
+ public function do_extensions_preboot() {
33
+ foreach (array_keys($this->get_extensions()) as $single_id) {
34
+ $this->maybe_do_extension_preboot($single_id);
35
+ }
36
+ }
37
 
38
+ private function is_dashboard_page() {
39
+ global $pagenow;
40
 
41
+ $is_ct_settings =
42
+ // 'themes.php' === $pagenow &&
43
+ isset( $_GET['page'] ) && 'ct-dashboard' === $_GET['page'];
44
+
45
+ return $is_ct_settings;
46
  }
47
 
48
  public function get_extensions() {
109
  $this->extensions[$id] = [
110
  'path' => $path,
111
  '__object' => null,
112
+ 'config' => $this->read_config_for($path),
113
+ 'readme' => $this->read_readme_for($path),
114
+ 'data' => null
115
  ];
116
+
117
+ // if (method_exists())
118
+ }
119
+
120
+ private function maybe_do_extension_preboot($id) {
121
+ if (! isset($this->extensions[$id])) return false;
122
+ if (isset($this->extensions[$id]['__object_preboot'])) return;
123
+
124
+ $class_name = explode( '-', $id );
125
+ $class_name = array_map( 'ucfirst', $class_name );
126
+ $class_name = 'BlocksyExtension' . implode( '', $class_name ) . 'PreBoot';
127
+
128
+ $path = $this->extensions[$id]['path'];
129
+
130
+ if (!file_exists($path . '/pre-boot.php')) {
131
+ return;
132
+ }
133
+
134
+ require_once($path . '/pre-boot.php');
135
+
136
+ $this->extensions[$id]['__object_preboot'] = new $class_name();
137
+
138
+ if (method_exists(
139
+ $this->extensions[$id]['__object_preboot'], 'ext_data'
140
+ )) {
141
+ $this->extensions[$id]['data'] = $this->extensions[
142
+ $id
143
+ ]['__object_preboot']->ext_data();
144
+ }
145
  }
146
 
147
  private function boot_activated_extension_for($id) {
159
  $this->extensions[$id]['__object'] = new $class_name();
160
  }
161
 
162
+ private function read_readme_for($path) {
163
+ $readme = '';
164
+
165
+ ob_start();
166
+
167
+ if (is_readable($path . '/readme.php')) {
168
+ require $path . '/readme.php';
169
+ }
170
+
171
+ $readme = ob_get_clean();
172
+
173
+ if (empty(trim($readme))) {
174
+ return null;
175
+ }
176
+
177
+ return trim($readme);
178
+ }
179
+
180
  private function read_config_for( $file_path ) {
181
  $_extract_variables = [ 'config' => [] ];
182
 
framework/extensions/cookies-consent/config.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ $config = [
4
+ 'description' => __('Enable this extension in order to comply with the GDPR regulations.', 'blc')
5
+ ];
framework/extensions/cookies-consent/customizer.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $options = [
4
+ 'title' => __('Cookie Consent', 'blc'),
5
+ 'container' => [ 'priority' => 8 ],
6
+ 'options' => [
7
+
8
+ 'cookie_consent_section_options' => [
9
+ 'type' => 'ct-options',
10
+ 'setting' => [ 'transport' => 'postMessage' ],
11
+ 'inner-options' => [
12
+
13
+ blocksy_rand_md5() => [
14
+ 'title' => __( 'General', 'blocksy' ),
15
+ 'type' => 'tab',
16
+ 'options' => [
17
+
18
+ 'cookie_consent_type' => [
19
+ 'label' => false,
20
+ 'type' => 'ct-image-picker',
21
+ 'value' => 'type-1',
22
+ 'attr' => [ 'data-type' => 'background' ],
23
+ 'setting' => [ 'transport' => 'postMessage' ],
24
+ 'choices' => [
25
+
26
+ 'type-1' => [
27
+ 'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-1.svg',
28
+ 'title' => __( 'Type 1', 'blocksy' ),
29
+ ],
30
+
31
+ 'type-2' => [
32
+ 'src' => BLOCKSY_URL . 'framework/extensions/cookies-consent/static/images/type-2.svg',
33
+ 'title' => __( 'Type 2', 'blocksy' ),
34
+ ],
35
+
36
+ ],
37
+ ],
38
+
39
+ 'cookie_consent_period' => [
40
+ 'label' => __('Cookie period', 'blc'),
41
+ 'type' => 'ct-select',
42
+ 'value' => 'onemonth',
43
+ 'design' => 'inline',
44
+ 'setting' => [ 'transport' => 'postMessage' ],
45
+ 'choices' => blocksy_ordered_keys(
46
+
47
+ [
48
+ 'onehour' => __( 'One hour', 'blc' ),
49
+ 'oneday' => __( 'One day', 'blc' ),
50
+ 'oneweek' => __( 'One week', 'blc' ),
51
+ 'onemonth' => __( 'One month', 'blc' ),
52
+ 'threemonths' => __( 'Three months', 'blc' ),
53
+ 'sixmonths' => __( 'Six months', 'blc' ),
54
+ 'oneyear' => __( 'One year', 'blc' ),
55
+ 'forever' => __('Forever', 'blc')
56
+ ]
57
+
58
+ ),
59
+ ],
60
+
61
+
62
+ 'cookie_consent_content' => [
63
+ 'label' => __( 'Content', 'blc' ),
64
+ 'type' => 'textarea',
65
+ 'design' => 'block',
66
+ 'value' => __('We use cookies to ensure that we give you the best experience on our website.', 'blc'),
67
+ 'setting' => [ 'transport' => 'postMessage' ],
68
+ ],
69
+
70
+ 'cookie_consent_button_text' => [
71
+ 'label' => __( 'Button text', 'blc' ),
72
+ 'type' => 'text',
73
+ 'design' => 'block',
74
+ 'value' => __('Accept', 'blc'),
75
+ 'setting' => [ 'transport' => 'postMessage' ],
76
+ ],
77
+
78
+ ],
79
+ ],
80
+
81
+ blocksy_rand_md5() => [
82
+ 'title' => __( 'Design', 'blocksy' ),
83
+ 'type' => 'tab',
84
+ 'options' => [
85
+
86
+ 'cookieContentColor' => [
87
+ 'label' => __( 'Content Color', 'blocksy' ),
88
+ 'type' => 'ct-color-picker',
89
+ 'design' => 'inline',
90
+ 'setting' => [ 'transport' => 'postMessage' ],
91
+
92
+ 'value' => [
93
+ 'default' => [
94
+ 'color' => 'var(--paletteColor3)',
95
+ ],
96
+ ],
97
+
98
+ 'pickers' => [
99
+ [
100
+ 'title' => __( 'Initial', 'blocksy' ),
101
+ 'id' => 'default',
102
+ ],
103
+ ],
104
+ ],
105
+
106
+ 'cookieButtonBackground' => [
107
+ 'label' => __( 'Button Color', 'blocksy' ),
108
+ 'type' => 'ct-color-picker',
109
+ 'design' => 'inline',
110
+ 'setting' => [ 'transport' => 'postMessage' ],
111
+ 'value' => [
112
+ 'default' => [
113
+ 'color' => 'var(--paletteColor1)',
114
+ ],
115
+
116
+ 'hover' => [
117
+ 'color' => 'var(--paletteColor2)',
118
+ ],
119
+ ],
120
+
121
+ 'pickers' => [
122
+ [
123
+ 'title' => __( 'Initial', 'blocksy' ),
124
+ 'id' => 'default',
125
+ ],
126
+
127
+ [
128
+ 'title' => __( 'Hover', 'blocksy' ),
129
+ 'id' => 'hover',
130
+ ],
131
+ ],
132
+ ],
133
+
134
+ 'cookieBackground' => [
135
+ 'label' => __( 'Background Color', 'blocksy' ),
136
+ 'type' => 'ct-color-picker',
137
+ 'design' => 'inline',
138
+ 'setting' => [ 'transport' => 'postMessage' ],
139
+
140
+ 'value' => [
141
+ 'default' => [
142
+ 'color' => '#ffffff',
143
+ ],
144
+ ],
145
+
146
+ 'pickers' => [
147
+ [
148
+ 'title' => __( 'Initial', 'blocksy' ),
149
+ 'id' => 'default',
150
+ ],
151
+ ],
152
+ ],
153
+
154
+ blocksy_rand_md5() => [
155
+ 'type' => 'ct-condition',
156
+ 'condition' => [ 'cookie_consent_type' => 'type-1' ],
157
+ 'options' => [
158
+
159
+ 'cookieMaxWidth' => [
160
+ 'label' => __( 'Maximum Width', 'blocksy' ),
161
+ 'type' => 'ct-slider',
162
+ 'value' => 400,
163
+ 'min' => 200,
164
+ 'max' => 500,
165
+ 'setting' => [ 'transport' => 'postMessage' ],
166
+ ],
167
+
168
+ ],
169
+ ],
170
+
171
+ ],
172
+ ],
173
+
174
+ ],
175
+ ],
176
+ ],
177
+ ];
framework/extensions/cookies-consent/extension.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname( __FILE__ ) . '/helpers.php';
4
+
5
+ class BlocksyExtensionCookiesConsent {
6
+ public static function should_display_notification() {
7
+ return !isset($_COOKIE['blocksy_cookies_consent_accepted']);
8
+ }
9
+
10
+ public function __construct() {
11
+ add_filter(
12
+ 'blocksy_extensions_customizer_options',
13
+ [$this, 'add_options_panel']
14
+ );
15
+
16
+ add_action(
17
+ 'customize_preview_init',
18
+ function () {
19
+ if (! function_exists('get_plugin_data')){
20
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
21
+ }
22
+
23
+ $data = get_plugin_data(BLOCKSY__FILE__);
24
+
25
+ wp_enqueue_script(
26
+ 'blocksy-cookies-consent-customizer-sync',
27
+ BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/sync.js',
28
+ [ 'customize-preview' ],
29
+ $data['Version'],
30
+ true
31
+ );
32
+ }
33
+ );
34
+
35
+ add_action('wp_enqueue_scripts', function () {
36
+ if (! function_exists('get_plugin_data')) {
37
+ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
38
+ }
39
+
40
+ $data = get_plugin_data(BLOCKSY__FILE__);
41
+
42
+ if (is_admin()) {
43
+ return;
44
+ }
45
+
46
+ if (! BlocksyExtensionCookiesConsent::should_display_notification()) {
47
+ if (! is_customize_preview()) {
48
+ return;
49
+ }
50
+ }
51
+
52
+ wp_enqueue_style(
53
+ 'blocksy-ext-cookies-consent-styles',
54
+ BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.css',
55
+ [],
56
+ $data['Version']
57
+ );
58
+
59
+ wp_enqueue_script(
60
+ 'blocksy-ext-cookies-consent-scripts',
61
+ BLOCKSY_URL . 'framework/extensions/cookies-consent/static/bundle/main.js',
62
+ [],
63
+ $data['Version'],
64
+ true
65
+ );
66
+ });
67
+
68
+ add_action('blocksy:global-dynamic-css:enqueue', function (
69
+ $css, $tablet_css, $mobile_css
70
+ ) {
71
+
72
+ blocksy_get_variables_from_file(
73
+ dirname( __FILE__ ) . '/global.php',
74
+ [],
75
+ [
76
+ 'css' => $css,
77
+ 'tablet_css' => $tablet_css,
78
+ 'mobile_css' => $mobile_css
79
+ ]
80
+ );
81
+
82
+ }, 10, 3);
83
+ }
84
+
85
+ public function add_options_panel($options) {
86
+ $options['cookie_consent_ext'] = blocksy_get_options(
87
+ dirname( __FILE__ ) . '/customizer.php',
88
+ [], false
89
+ );
90
+
91
+ return $options;
92
+ }
93
+ }
94
+
framework/extensions/cookies-consent/global.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Cookie
4
+ $cookieContentColor = blocksy_get_colors( get_theme_mod(
5
+ 'cookieContentColor',
6
+ [ 'default' => [ 'color' => 'var(--paletteColor3)' ] ]
7
+ ));
8
+
9
+ $css->put(
10
+ ':root',
11
+ "--cookieContentColor: {$cookieContentColor['default']}"
12
+ );
13
+
14
+ $cookieButtonBackground = blocksy_get_colors( get_theme_mod(
15
+ 'cookieButtonBackground',
16
+ [
17
+ 'default' => [ 'color' => 'var(--paletteColor1)' ],
18
+ 'hover' => [ 'color' => 'var(--paletteColor2)' ],
19
+ ]
20
+ ));
21
+
22
+ $css->put(
23
+ '.cookie-notification',
24
+ "--buttonInitialColor: {$cookieButtonBackground['default']}"
25
+ );
26
+
27
+ $css->put(
28
+ '.cookie-notification',
29
+ "--buttonHoverColor: {$cookieButtonBackground['hover']}"
30
+ );
31
+
32
+ $cookieBackground = blocksy_get_colors( get_theme_mod(
33
+ 'cookieBackground',
34
+ [ 'default' => [ 'color' => '#ffffff' ] ]
35
+ ));
36
+
37
+ $css->put(
38
+ ':root',
39
+ "--cookieBackground: {$cookieBackground['default']}"
40
+ );
41
+
42
+ $cookieMaxWidth = get_theme_mod( 'cookieMaxWidth', 400 );
43
+ $css->put( ':root', '--cookieMaxWidth: ' . $cookieMaxWidth . 'px' );
44
+
framework/extensions/cookies-consent/helpers.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function blc_ext_cookies_consent_cache() {
4
+ if (! is_customize_preview()) return;
5
+
6
+ blocksy_add_customizer_preview_cache(
7
+ blocksy_html_tag(
8
+ 'div',
9
+ [ 'data-id' => 'blocksy-cookies-consent-section' ],
10
+ blocksy_ext_cookies_consent_output(true)
11
+ )
12
+ );
13
+ }
14
+
15
+ function blocksy_ext_cookies_consent_output($forced = false) {
16
+ if (! $forced) {
17
+ blc_ext_cookies_consent_cache();
18
+ }
19
+
20
+ if (! BlocksyExtensionCookiesConsent::should_display_notification()) {
21
+ if (! $forced) {
22
+ return;
23
+ }
24
+ }
25
+
26
+ $content = get_theme_mod(
27
+ 'cookie_consent_content',
28
+ __('We use cookies to ensure that we give you the best experience on our website.', 'blc')
29
+ );
30
+
31
+ $button_text = get_theme_mod('cookie_consent_button_text', __('Accept', 'blc'));
32
+ $period = get_theme_mod('cookie_consent_period', 'onemonth');
33
+ $type = get_theme_mod('cookie_consent_type', 'type-1');
34
+
35
+ $class = 'container';
36
+
37
+ if ( $type === 'type-2' ) {
38
+ $class = 'ct-container';
39
+ }
40
+
41
+ ob_start();
42
+
43
+ ?>
44
+
45
+
46
+ <div class="cookie-notification ct-fade-in-start" data-period="<?php esc_attr_e($period) ?>" data-type="<?php esc_attr_e($type) ?>">
47
+
48
+ <div class="<?php esc_attr_e($class) ?>">
49
+
50
+ <?php if (!empty($content)) { ?>
51
+ <p><?php echo esc_html($content) ?></p>
52
+ <?php } ?>
53
+
54
+ <button class="ct-accept"><?php echo esc_html($button_text) ?></button>
55
+
56
+ <?php if ($type === 'type-1' || is_customize_preview()) { ?>
57
+ <button class="ct-close">×</button>
58
+ <?php } ?>
59
+
60
+ </div>
61
+ </div>
62
+ <?php
63
+
64
+ return ob_get_clean();
65
+ }
66
+
67
+ function blocksy_ext_cookies_checkbox() {
68
+ ob_start();
69
+
70
+ $message = sprintf(
71
+ __('I accept the %s', 'blc'),
72
+ sprintf(
73
+ '<a href="' . site_url('/privacy-policy') . '">%s</a>',
74
+ __('Privacy Policy', 'blc')
75
+ )
76
+ );
77
+
78
+ ?>
79
+
80
+ <div class="gdpr-confirm-policy">
81
+ <input id="gdprconfirm" name="gdprconfirm" type="checkbox" required />
82
+ <label for="gdprconfirm"><?php echo $message ?></label>
83
+ </div>
84
+
85
+ <?php
86
+
87
+ return ob_get_clean();
88
+ }
framework/extensions/cookies-consent/readme.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1><?php echo __('Instructions', 'blc'); ?></h1>
2
+
3
+ <p>
4
+ <?php echo __('After installing and activating the Cookies Consent extension you will be able to configure it from this location:', 'blc') ?>
5
+ </p>
6
+
7
+ <ul>
8
+ <li>
9
+ <b>
10
+ <?php echo __('Customizer', 'blc') ?>
11
+ </b>
12
+ <i>
13
+ <?php
14
+ echo sprintf(
15
+ __('Navigate to %s and customize the notification to meet your needs.', 'blc'),
16
+ sprintf(
17
+ '<code>%s</code>',
18
+ __('Customizer ➝ Cookie Consent', 'blc')
19
+ )
20
+ );
21
+ ?>
22
+ </i>
23
+ </li>
24
+ </ul>
25
+
26
+
framework/extensions/cookies-consent/static/bundle/main.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /**
2
+ * - v1.0.3
3
+ *
4
+ * Copyright (c) 2019
5
+ * Licensed GPLv2+
6
+ */
7
+
8
+ .cookie-notification{position:fixed;left:0;bottom:0;z-index:999999;color:var(--cookieContentColor)}@media (max-width: 479.98px){.cookie-notification>div{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}}@media (max-width: 689.98px){.cookie-notification{right:0}.cookie-notification>div{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding-top:15px;padding-bottom:15px}}@media (max-width: 689.98px){.cookie-notification[data-type='type-1']{background:var(--cookieBackground)}}@media (min-width: 690px){.cookie-notification[data-type='type-1']{padding:0 25px 25px 25px}.cookie-notification[data-type='type-1'] p{margin-bottom:15px;max-width:90%}}.cookie-notification[data-type='type-1'] .container{position:relative}@media (max-width: 689.98px){.cookie-notification[data-type='type-1'] .container{width:88%;margin:0 auto}}@media (min-width: 690px){.cookie-notification[data-type='type-1'] .container{background:var(--cookieBackground);-webkit-box-shadow:0px 12px 18px -6px rgba(34,56,101,0.2);box-shadow:0px 12px 18px -6px rgba(34,56,101,0.2);padding:25px 40px 25px 25px;border-radius:3px;max-width:var(--cookieMaxWidth)}}.cookie-notification[data-type='type-2']{right:0;background:var(--cookieBackground)}@media (min-width: 690px){.cookie-notification[data-type='type-2']{padding:15px 0}.cookie-notification[data-type='type-2'] .ct-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.cookie-notification[data-type='type-2'] .ct-accept{margin-left:25px}}.cookie-notification[data-type='type-2'] .ct-close{display:none}.cookie-notification p{opacity:0.8;line-height:1.4}@media (max-width: 479.98px){.cookie-notification p{text-align:center;margin-bottom:15px}}@media (max-width: 689.98px){.cookie-notification p{font-size:13px}}@media (min-width: 690px){.cookie-notification p{font-size:14px}}.cookie-notification .ct-accept{font-size:13px;font-weight:500;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;color:#fff;height:35px;padding:0 20px;border:none;border-radius:3px;background-color:var(--buttonInitialColor);-webkit-transition:color 0.2s ease, background 0.2s ease, -webkit-transform 0.2s ease;transition:color 0.2s ease, background 0.2s ease, -webkit-transform 0.2s ease;transition:color 0.2s ease, transform 0.2s ease, background 0.2s ease;transition:color 0.2s ease, transform 0.2s ease, background 0.2s ease, -webkit-transform 0.2s ease}.cookie-notification .ct-accept:hover{background-color:var(--buttonHoverColor)}.cookie-notification .ct-accept:focus{outline:none}@media (max-width: 479.98px){.cookie-notification .ct-accept{width:100%}}@media (min-width: 480px) and (max-width: 689.98px){.cookie-notification .ct-accept{margin-left:20px}}.cookie-notification .ct-close{position:absolute;top:0;right:0;border:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:45px;height:45px;padding:0;opacity:0.5;color:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;-webkit-transition:opacity 0.2s ease;transition:opacity 0.2s ease}.cookie-notification .ct-close:focus{outline:none}.cookie-notification .ct-close:hover{opacity:1}@media (max-width: 689.98px){.cookie-notification .ct-close{display:none}}.cookie-notification.ct-fade-in-start,.cookie-notification.ct-fade-in-end,.cookie-notification.ct-fade-start,.cookie-notification.ct-fade-end{-webkit-transition:all 0.3s ease;transition:all 0.3s ease}.cookie-notification.ct-fade-in-start{opacity:0;-webkit-transform:translate3d(0, 15px, 0);transform:translate3d(0, 15px, 0)}.cookie-notification.ct-fade-end{opacity:0;-webkit-transform:translate3d(0, 15px, 0);transform:translate3d(0, 15px, 0)}
framework/extensions/cookies-consent/static/bundle/main.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var o,r;
2
+ /*!
3
+ * JavaScript Cookie v2.2.0
4
+ * https://github.com/js-cookie/js-cookie
5
+ *
6
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
7
+ * Released under the MIT license
8
+ */!function(i){if(void 0===(r="function"==typeof(o=i)?o.call(t,n,t,e):o)||(e.exports=r),!0,e.exports=i(),!!0){var c=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=c,a}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var o in n)t[o]=n[o]}return t}return function t(n){function o(t,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},o.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=n.write?n.write(r,t):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var s="";for(var u in i)i[u]&&(s+="; "+u,!0!==i[u]&&(s+="="+i[u]));return document.cookie=t+"="+r+s}t||(c={});for(var f=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,l=0;l<f.length;l++){var p=f[l].split("="),v=p.slice(1).join("=");this.json||'"'!==v.charAt(0)||(v=v.slice(1,-1));try{var m=p[0].replace(d,decodeURIComponent);if(v=n.read?n.read(v,m):n(v,m)||v.replace(d,decodeURIComponent),this.json)try{v=JSON.parse(v)}catch(e){}if(t===m){c=v;break}t||(c[m]=v)}catch(e){}}return c}}return o.set=o,o.get=function(e){return o.call(o,e)},o.getJSON=function(){return o.apply({json:!0},[].slice.call(arguments))},o.defaults={},o.remove=function(t,n){o(t,"",e(n,{expires:-1}))},o.withConverter=t,o}(function(){})})},function(e,t,n){"use strict";n.r(t);n(2);var o=n(0),r=n.n(o);var i=function(){var e=document.querySelector(".cookie-notification");e&&(requestAnimationFrame(function(){e.classList.remove("ct-fade-in-start"),e.classList.add("ct-fade-in-end"),c(e,function(){e.classList.remove("ct-fade-in-end")})}),[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e.querySelectorAll("button"))).map(function(t){t.addEventListener("click",function(n){if(n.preventDefault(),t.classList.contains("ct-accept")){r.a.set("blocksy_cookies_consent_accepted","true",{expires:new Date(1*new Date+{onehour:36e5,oneday:864e5,oneweek:6048e5,onemonth:26784e5,threemonths:80352e5,sixmonths:160704e5,oneyear:31536e6,forever:864e9}[t.closest("[data-period]").dataset.period])})}e.classList.add("ct-fade-start"),requestAnimationFrame(function(){e.classList.remove("ct-fade-start"),e.classList.add("ct-fade-end"),c(e,function(){e.parentNode.removeChild(e)})})})}))};function c(e,t){setTimeout(function(){t()},300)}document.addEventListener("DOMContentLoaded",function(){i(),window.ctEvents.on("blocksy:cookies:init",function(){i()})})},function(e,t){e.exports=window.ctEvents}]);
framework/extensions/cookies-consent/static/bundle/sync.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r,o=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"desktop",r=document.querySelector("#"+{desktop:"ct-main-styles-inline-css",tablet:"ct-main-styles-tablet-inline-css",mobile:"ct-main-styles-mobile-inline-css"}[n]),o=r.innerText,i=e.selector||":root",c=new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{[\\s\\S]*?}","gm"),l=o.match(c);l&&(r.innerText=o.replace(c,l[0].indexOf("--"+e.variable+":")>-1?l[0].replace(new RegExp("--"+e.variable+":[\\s\\S]*?;","gm"),"CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"):l[0].replace(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?{","gm"),i+" {"+("CT_CSS_SKIP_RULE"===t?"":"--"+e.variable+": "+t+";"))))},i=function(e,t){return[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e.selector?document.querySelectorAll(e.selector):[document.documentElement])).map(function(n){if(!e.responsive){var r=(e.type||"").indexOf("color")>-1?t["color"===e.type?"default":e.type.split(":")[1]].color:e.extractValue?e.extractValue(t):t;return"border"===(e.type||"")&&(r="none"===t.style?"none":t.width+"px "+t.style+" "+t.color.color),void o(e,""+r+(e.unit||""))}t=function(e){return e.desktop?e:{desktop:e,tablet:e,mobile:e}}(t),t=e.extractValue?e.extractValue(t):t,e.respect_visibility&&(wp.customize(e.respect_visibility)().mobile||(t.mobile="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().tablet||(t.tablet="0"+(e.unit?"":"px")),wp.customize(e.respect_visibility)().desktop||(t.desktop="0"+(e.unit?"":"px"))),e.respect_stacking&&(wp.customize(e.respect_stacking)().mobile&&(t.mobile=2*parseInt(t.mobile,10)+(e.unit?"":"px")),wp.customize(e.respect_stacking)().tablet&&(t.tablet=2*parseInt(t.tablet,10)+(e.unit?"":"px"))),e.enabled&&"no"===!wp.customize(e.enabled)()&&(t.mobile="0"+(e.unit?"":"px"),t.tablet="0"+(e.unit?"":"px"),t.desktop="0"+(e.unit?"":"px")),o(e,""+t.desktop+(e.unit||""),"desktop"),o(e,""+t.tablet+(e.unit||""),"tablet"),o(e,""+t.mobile+(e.unit||""),"mobile")})};r={cookieContentColor:{variable:"cookieContentColor",type:"color"},cookieBackground:{variable:"cookieBackground",type:"color"},cookieButtonBackground:[{selector:".cookie-notification",variable:"buttonInitialColor",type:"color:default"},{selector:".cookie-notification",variable:"buttonHoverColor",type:"color:hover"}],cookieMaxWidth:{variable:"cookieMaxWidth",unit:"px"}},wp.customize.bind("change",function(e){return r[e.id]&&(Array.isArray(r[e.id])?r[e.id]:[r[e.id]]).map(function(t){return i(t,e())})});var c=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var c,l=e[Symbol.iterator]();!(r=(c=l.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var a=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";n||((t=document.createElement("div")).innerHTML=document.querySelector(".ct-customizer-preview-cache-container").value,n=t);var o=n.querySelector(".ct-customizer-preview-cache [data-"+r+'="'+e+'"]').innerHTML,i=document.createElement("div");return i.innerHTML=o,i},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=l({fragment_id:null,selector:null,parent_selector:null,strategy:"append",whenInserted:function(){},beforeInsert:function(e){},should_insert:!0},e);var t=document.querySelector(e.parent_selector);if([].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(document.querySelectorAll(e.parent_selector+" "+e.selector))).map(function(e){return e.parentNode.removeChild(e)}),e.should_insert){for(var n=a(e.fragment_id);n.firstElementChild;)if(e.beforeInsert(n.firstElementChild),"append"===e.strategy&&t.appendChild(n.firstElementChild),"firstChild"===e.strategy&&t.insertBefore(n.firstElementChild,t.firstElementChild),e.strategy.indexOf("maybeBefore")>-1){var r=e.strategy.split(":"),o=c(r,2),i=(o[0],o[1]);t.querySelector(i)?t.insertBefore(n.firstElementChild,t.querySelector(i)):t.appendChild(n.firstElementChild)}e.whenInserted()}},s=function(){var e=function(e){if(!document.querySelector(".cookie-notification"))return u({fragment_id:"blocksy-cookies-consent-section",selector:".cookie-notification",parent_selector:"#main-container"}),!0}(),t=document.querySelector(".cookie-notification");if(t){t.querySelector("p").innerHTML=wp.customize("cookie_consent_content")(),t.querySelector("button.ct-accept").innerHTML=wp.customize("cookie_consent_button_text")();var n=wp.customize("cookie_consent_type")();t.dataset.type=n,t.firstElementChild.classList.remove("ct-container","container"),t.firstElementChild.classList.add("type-1"===n?"container":"ct-container"),e&&setTimeout(function(){return window.ctEvents.trigger("blocksy:cookies:init")})}};wp.customize("cookie_consent_content",function(e){return e.bind(function(e){s()})}),wp.customize("cookie_consent_button_text",function(e){return e.bind(function(e){return s()})}),wp.customize("cookie_consent_type",function(e){return e.bind(function(e){return s()})})}]);
framework/extensions/cookies-consent/static/images/type-1.svg ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#FFFFFF;}
7
+ .st1{fill:#EDEFF0;}
8
+ .st2{fill:#6E747A;}
9
+ .st3{fill:#565D66;}
10
+ .st4{fill:#4F5459;}
11
+ </style>
12
+ <path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
13
+ H13z"/>
14
+ <path class="st1" d="M11,15h78v14H11V15z"/>
15
+ <path class="st2" d="M89.5,15h-79v-2c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5V15z"/>
16
+ <path class="st3" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
17
+ c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
18
+ <path class="st0" d="M25.5,13.4h-3c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S25.8,13.4,25.5,13.4z
19
+ M31.5,13.4h-3c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S31.8,13.4,31.5,13.4z M37.5,13.4h-3
20
+ c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S37.8,13.4,37.5,13.4z"/>
21
+ <circle class="st0" cx="77.1" cy="12.9" r="0.9"/>
22
+ <circle class="st0" cx="73.3" cy="12.9" r="0.9"/>
23
+ <circle class="st0" cx="69.5" cy="12.9" r="0.9"/>
24
+ <path class="st4" d="M77.5,22.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S77.8,22.5,77.5,22.5z
25
+ M70.5,22.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S70.8,22.5,70.5,22.5z M63.5,22.5h-4
26
+ c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,22.5,63.5,22.5z M22.4,20.5c0.5-0.9,1.4-1.4,2.4-1.4
27
+ c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V21
28
+ c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,21
29
+ c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,20.5,22.4,20.5,22.4,20.5z M22.7,20.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
30
+ c0,1.1,0.7,2.1,1.7,2.5L22.7,20.9z M27.2,20.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
31
+ C27.6,21.4,27.4,20.9,27.2,20.5 M24.9,22.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,22.8z"/>
32
+ <g>
33
+ <path class="st2" d="M48.2,65.9H16.6c-0.5,0-1-0.5-1-1V45.7c0-0.6,0.5-1,1-1h31.6c0.5,0,1,0.4,1,1v19.1
34
+ C49.2,65.4,48.8,65.9,48.2,65.9z"/>
35
+ <path class="st0" d="M35.9,53.3h-17c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h17c0.3,0,0.5,0.2,0.5,0.5S36.2,53.3,35.9,53.3z"/>
36
+ <path class="st0" d="M24.7,56.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S25,56.3,24.7,56.3z"/>
37
+ <path class="st0" d="M35.9,56.3h-9.2c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h9.2c0.3,0,0.5,0.2,0.5,0.5S36.2,56.3,35.9,56.3z"/>
38
+ <path class="st0" d="M27.8,63.2h-7.3c-1.1,0-2.1-0.9-2.1-2.1v0c0-1.1,0.9-2.1,2.1-2.1h7.3c1.1,0,2.1,0.9,2.1,2.1v0
39
+ C29.9,62.3,28.9,63.2,27.8,63.2z"/>
40
+ <path class="st0" d="M43.7,53.3h-5.8c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5S44,53.3,43.7,53.3z"/>
41
+ <path class="st0" d="M38.7,49.9H19.4c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0
42
+ C39.7,49.4,39.2,49.9,38.7,49.9z"/>
43
+ </g>
44
+ </svg>
framework/extensions/cookies-consent/static/images/type-2.svg ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 100 70" style="enable-background:new 0 0 100 70;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#FFFFFF;}
7
+ .st1{fill:#6E747A;}
8
+ .st2{fill:#EDEFF0;}
9
+ .st3{fill:#565D66;}
10
+ .st4{fill:#4F5459;}
11
+ </style>
12
+ <path class="st0" d="M13,73.5c-1.4,0-2.5-1.1-2.5-2.5V13c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5v58c0,1.4-1.1,2.5-2.5,2.5
13
+ H13z"/>
14
+ <g>
15
+ <rect x="10.4" y="59.2" class="st1" width="79.1" height="13"/>
16
+ <path class="st0" d="M32.3,67.5h-17c-0.3,0-0.5-0.2-0.5-0.5c0-0.3,0.2-0.5,0.5-0.5h17c0.3,0,0.5,0.2,0.5,0.5
17
+ C32.8,67.3,32.6,67.5,32.3,67.5z"/>
18
+ <path class="st0" d="M45.5,67.5h-5.8c-0.3,0-0.5-0.2-0.5-0.5c0-0.3,0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5
19
+ C46,67.3,45.8,67.5,45.5,67.5z"/>
20
+ <path class="st0" d="M56.7,67.5h-9.2c-0.3,0-0.5-0.2-0.5-0.5c0-0.3,0.2-0.5,0.5-0.5h9.2c0.3,0,0.5,0.2,0.5,0.5
21
+ C57.2,67.3,57,67.5,56.7,67.5z"/>
22
+ <path class="st0" d="M84.2,67.1h-7.3c-1.1,0-2.1-0.9-2.1-2.1v0c0-1.1,0.9-2.1,2.1-2.1h7.3c1.1,0,2.1,0.9,2.1,2.1v0
23
+ C86.3,66.2,85.4,67.1,84.2,67.1z"/>
24
+ <path class="st0" d="M40.1,67.5h-5.8c-0.3,0-0.5-0.2-0.5-0.5c0-0.3,0.2-0.5,0.5-0.5h5.8c0.3,0,0.5,0.2,0.5,0.5
25
+ C40.6,67.3,40.4,67.5,40.1,67.5z"/>
26
+ <path class="st0" d="M35.1,64H15.9c-0.6,0-1-0.5-1-1l0,0c0-0.6,0.5-1,1-1h19.2c0.6,0,1,0.5,1,1l0,0C36.1,63.6,35.7,64,35.1,64z"/>
27
+ </g>
28
+ <path class="st2" d="M11,15h78v14H11V15z"/>
29
+ <path class="st1" d="M89.5,15h-79v-2c0-1.4,1.1-2.5,2.5-2.5h74c1.4,0,2.5,1.1,2.5,2.5V15z"/>
30
+ <path class="st3" d="M87,11c1.1,0,2,0.9,2,2v58c0,1.1-0.9,2-2,2H13c-1.1,0-2-0.9-2-2V13c0-1.1,0.9-2,2-2H87 M87,10H13
31
+ c-1.7,0-3,1.3-3,3v58c0,1.7,1.3,3,3,3h74c1.6,0,3-1.3,3-3V13C90,11.3,88.6,10,87,10z"/>
32
+ <path class="st0" d="M25.5,13.4h-3c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S25.8,13.4,25.5,13.4z
33
+ M31.5,13.4h-3c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S31.8,13.4,31.5,13.4z M37.5,13.4h-3
34
+ c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h3c0.3,0,0.5,0.2,0.5,0.5S37.8,13.4,37.5,13.4z"/>
35
+ <circle class="st0" cx="77.1" cy="12.9" r="0.9"/>
36
+ <circle class="st0" cx="73.3" cy="12.9" r="0.9"/>
37
+ <circle class="st0" cx="69.5" cy="12.9" r="0.9"/>
38
+ <path class="st4" d="M77.5,22.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S77.8,22.5,77.5,22.5z
39
+ M70.5,22.5h-4c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S70.8,22.5,70.5,22.5z M63.5,22.5h-4
40
+ c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5h4c0.3,0,0.5,0.2,0.5,0.5S63.8,22.5,63.5,22.5z M22.4,20.5c0.5-0.9,1.4-1.4,2.4-1.4
41
+ c0.7,0,1.3,0.3,1.8,0.7c-0.1,0-0.3,0-0.4,0.1c-0.4,0.2-0.5,0.8,0,1.1c0.3,0.2,0.4,0.6,0.4,0.9s-0.7,1.5-0.7,1.5l-0.6-2.2V21
42
+ c0-0.1,0-0.1,0.1-0.2l0.1-0.1h0.3v-0.2H24v0.2h0.1c0.1,0,0.1,0.1,0.2,0.1c0.1,0.1,0.1,0.3,0.2,0.5l0.2,0.8l-0.5,1.2L23.6,21
43
+ c0,0,0-0.2,0.1-0.2l0.1-0.1v-0.2C23.8,20.5,22.4,20.5,22.4,20.5z M22.7,20.9c0,0-0.1-0.2-0.3-0.2h-0.1c-0.1,0.3-0.2,0.7-0.2,1.1
44
+ c0,1.1,0.7,2.1,1.7,2.5L22.7,20.9z M27.2,20.5c0.1,0.2,0,0.5-0.1,0.9c-0.3,0.9-0.9,2.4-1.2,3c1-0.4,1.6-1.4,1.6-2.5
45
+ C27.6,21.4,27.4,20.9,27.2,20.5 M24.9,22.8l-0.7,1.7c0.2,0,0.4,0.1,0.6,0.1s0.5,0,0.7-0.1L24.9,22.8z"/>
46
+ </svg>
framework/extensions/cookies-consent/static/js/main.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctEvents from 'ct-events'
2
+ import cookie from 'js-cookie'
3
+
4
+ const initCookies = () => {
5
+ const notification = document.querySelector('.cookie-notification')
6
+
7
+ if (!notification) return
8
+
9
+ requestAnimationFrame(() => {
10
+ notification.classList.remove('ct-fade-in-start')
11
+ notification.classList.add('ct-fade-in-end')
12
+
13
+ whenTransitionEnds(notification, () => {
14
+ notification.classList.remove('ct-fade-in-end')
15
+ })
16
+ })
17
+ ;[...notification.querySelectorAll('button')].map(el => {
18
+ el.addEventListener('click', e => {
19
+ e.preventDefault()
20
+
21
+ if (el.classList.contains('ct-accept')) {
22
+ const periods = {
23
+ onehour: 36e5,
24
+ oneday: 864e5,
25
+ oneweek: 7 * 864e5,
26
+ onemonth: 31 * 864e5,
27
+ threemonths: 3 * 31 * 864e5,
28
+ sixmonths: 6 * 31 * 864e5,
29
+ oneyear: 365 * 864e5,
30
+ forever: 10000 * 864e5
31
+ }
32
+
33
+ cookie.set('blocksy_cookies_consent_accepted', 'true', {
34
+ expires: new Date(
35
+ new Date() * 1 +
36
+ periods[el.closest('[data-period]').dataset.period]
37
+ )
38
+ })
39
+ }
40
+
41
+ notification.classList.add('ct-fade-start')
42
+
43
+ requestAnimationFrame(() => {
44
+ notification.classList.remove('ct-fade-start')
45
+ notification.classList.add('ct-fade-end')
46
+
47
+ whenTransitionEnds(notification, () => {
48
+ notification.parentNode.removeChild(notification)
49
+ })
50
+ })
51
+ })
52
+ })
53
+ }
54
+
55
+ document.addEventListener('DOMContentLoaded', () => {
56
+ initCookies()
57
+
58
+ window.ctEvents.on('blocksy:cookies:init', () => {
59
+ initCookies()
60
+ })
61
+ })
62
+
63
+ function whenTransitionEnds(el, cb) {
64
+ setTimeout(() => {
65
+ cb()
66
+ }, 300)
67
+ return
68
+
69
+ const end = () => {
70
+ el.removeEventListener('transitionend', onEnd)
71
+ cb()
72
+ }
73
+
74
+ const onEnd = e => {
75
+ if (e.target === el) {
76
+ end()
77
+ }
78
+ }
79
+
80
+ el.addEventListener('transitionend', onEnd)
81
+ }
framework/extensions/cookies-consent/static/js/sync.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './variables'
2
+
3
+ import { renderWithStrategy } from '../../../instagram/static/js/sync/helpers'
4
+
5
+ const maybeAnimateCookiesConsent = cb => {
6
+ if (document.querySelector('.cookie-notification')) return
7
+
8
+ renderWithStrategy({
9
+ fragment_id: 'blocksy-cookies-consent-section',
10
+ selector: '.cookie-notification',
11
+ parent_selector: '#main-container'
12
+ })
13
+
14
+ return true
15
+ }
16
+
17
+ const render = () => {
18
+ const didInsert = maybeAnimateCookiesConsent()
19
+
20
+ const notification = document.querySelector('.cookie-notification')
21
+
22
+ if (!notification) {
23
+ return
24
+ }
25
+
26
+ notification.querySelector('p').innerHTML = wp.customize(
27
+ 'cookie_consent_content'
28
+ )()
29
+
30
+ notification.querySelector('button.ct-accept').innerHTML = wp.customize(
31
+ 'cookie_consent_button_text'
32
+ )()
33
+
34
+ const type = wp.customize('cookie_consent_type')()
35
+
36
+ notification.dataset.type = type
37
+
38
+ notification.firstElementChild.classList.remove('ct-container', 'container')
39
+ notification.firstElementChild.classList.add(
40
+ type === 'type-1' ? 'container' : 'ct-container'
41
+ )
42
+
43
+ if (didInsert) {
44
+ setTimeout(() => window.ctEvents.trigger('blocksy:cookies:init'))
45
+ }
46
+ }
47
+
48
+ wp.customize('cookie_consent_content', val =>
49
+ val.bind(to => {
50
+ render()
51
+ })
52
+ )
53
+ wp.customize('cookie_consent_button_text', val => val.bind(to => render()))
54
+ wp.customize('cookie_consent_type', val => val.bind(to => render()))
framework/extensions/cookies-consent/static/js/variables.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { handleVariablesFor } from 'customizer-sync-helpers'
2
+
3
+ handleVariablesFor({
4
+ // Cookie
5
+ cookieContentColor: {
6
+ variable: 'cookieContentColor',
7
+ type: 'color'
8
+ },
9
+
10
+ cookieBackground: {
11
+ variable: 'cookieBackground',
12
+ type: 'color'
13
+ },
14
+
15
+ cookieButtonBackground: [
16
+ {
17
+ selector: '.cookie-notification',
18
+ variable: 'buttonInitialColor',
19
+ type: 'color:default'
20
+ },
21
+
22
+ {
23
+ selector: '.cookie-notification',
24
+ variable: 'buttonHoverColor',
25
+ type: 'color:hover'
26
+ }
27
+ ],
28
+
29
+ cookieMaxWidth: {
30
+ variable: 'cookieMaxWidth',
31
+ unit: 'px'
32
+ }
33
+ })
framework/extensions/cookies-consent/static/sass/main.scss ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import '../../../../../static/sass/common-frontend';
2
+
3
+ .cookie-notification {
4
+ position: fixed;
5
+ left: 0;
6
+ bottom: 0;
7
+ z-index: 999999;
8
+ color: var(--cookieContentColor);
9
+
10
+ @include media-breakpoint-down (xs) {
11
+ > div {
12
+ flex-direction: column;
13
+ }
14
+ }
15
+
16
+ @include media-breakpoint-down (sm) {
17
+ right: 0;
18
+
19
+ > div {
20
+ display: flex;
21
+ align-items: center;
22
+ padding-top: 15px;
23
+ padding-bottom: 15px;
24
+ }
25
+ }
26
+
27
+ // type 1
28
+ &[data-type='type-1'] {
29
+ @include media-breakpoint-down (sm) {
30
+ background: var(--cookieBackground);
31
+ }
32
+
33
+ @include media-breakpoint-up (md) {
34
+ padding: 0 25px 25px 25px;
35
+
36
+ p {
37
+ margin-bottom: 15px;
38
+ max-width: 90%;
39
+ }
40
+ }
41
+
42
+ .container {
43
+ position: relative;
44
+
45
+ @include media-breakpoint-down (sm) {
46
+ width: 88%;
47
+ margin: 0 auto;
48
+ }
49
+
50
+ @include media-breakpoint-up (md) {
51
+ background: var(--cookieBackground);
52
+ box-shadow: 0px 12px 18px -6px rgba(34, 56, 101, 0.2);
53
+ padding: 25px 40px 25px 25px;
54
+ border-radius: 3px;
55
+ max-width: var(--cookieMaxWidth);
56
+ }
57
+ }
58
+ }
59
+
60
+ // type 2
61
+ &[data-type='type-2'] {
62
+ right: 0;
63
+ background: var(--cookieBackground);
64
+
65
+ @include media-breakpoint-up (md) {
66
+ padding: 15px 0;
67
+
68
+ .ct-container {
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ }
73
+
74
+ .ct-accept {
75
+ margin-left: 25px;
76
+ }
77
+ }
78
+
79
+ .ct-close {
80
+ display: none;
81
+ }
82
+ }
83
+
84
+ p {
85
+ opacity: 0.8;
86
+ line-height: 1.4;
87
+
88
+ @include media-breakpoint-down (xs) {
89
+ text-align: center;
90
+ margin-bottom: 15px;
91
+ }
92
+
93
+ @include media-breakpoint-down (sm) {
94
+ font-size: 13px;
95
+ }
96
+
97
+ @include media-breakpoint-up (md) {
98
+ font-size: 14px;
99
+ }
100
+ }
101
+
102
+ .ct-accept {
103
+ font-size: 13px;
104
+ font-weight: 500;
105
+
106
+ @include button((
107
+ height: 35px,
108
+ padding: 20px,
109
+ shadow: false,
110
+ translate: false
111
+ ));
112
+
113
+ @include media-breakpoint-down (xs) {
114
+ width: 100%;
115
+ }
116
+
117
+ @include media-breakpoint-only (sm) {
118
+ margin-left: 20px;
119
+ }
120
+ }
121
+
122
+ .ct-close {
123
+ position: absolute;
124
+ top: 0;
125
+ right: 0;
126
+ border: 0;
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ width: 45px;
131
+ height: 45px;
132
+ padding: 0;
133
+ opacity: 0.5;
134
+ color: inherit;
135
+ cursor: pointer;
136
+ appearance: none;
137
+ background: transparent;
138
+ transition: opacity 0.2s ease;
139
+
140
+ &:focus {
141
+ outline: none;
142
+ }
143
+
144
+ &:hover {
145
+ opacity: 1;
146
+ }
147
+
148
+ @include media-breakpoint-down (sm) {
149
+ display: none;
150
+ }
151
+ }
152
+
153
+ // animation
154
+ &.ct-fade-in-start,
155
+ &.ct-fade-in-end,
156
+ &.ct-fade-start,
157
+ &.ct-fade-end {
158
+ transition: all 0.3s ease;
159
+ }
160
+
161
+ &.ct-fade-in-start {
162
+ opacity: 0;
163
+ transform: translate3d(0, 15px, 0);
164
+ }
165
+
166
+ &.ct-fade-end {
167
+ opacity: 0;
168
+ transform: translate3d(0, 15px, 0);
169
+ }
170
+ }
framework/extensions/instagram/config.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  $config = [
4
- 'description' => __('Instagram Widget', 'blc')
5
  ];
6
 
7
 
1
  <?php
2
 
3
  $config = [
4
+ 'description' => __('Show your instagram feed anywhere on your site with the help of a widget or a block.', 'blc')
5
  ];
6
 
7
 
framework/extensions/instagram/ct-instagram/view.php CHANGED
@@ -16,7 +16,6 @@ if ( empty( $title ) ) {
16
 
17
  $images_per_row = blocksy_akg( 'instagram_images_per_row', $atts, '2' );
18
 
19
-
20
  echo $before_widget . $before_title . $title . $after_title;
21
 
22
  $photos_number = intval( blocksy_default_akg( 'photos_number', $atts, '6' ) );
@@ -30,11 +29,6 @@ $widget_data = json_encode(
30
 
31
  ?>
32
 
33
- <?php if ( false && ! empty( $instagram_photos ) ) { ?>
34
- <ul data-row="<?php echo $images_per_row; ?>">
35
- </ul>
36
- <?php } ?>
37
-
38
  <ul
39
  class="ct-loading"
40
  data-widget='<?php echo $widget_data; ?>'
16
 
17
  $images_per_row = blocksy_akg( 'instagram_images_per_row', $atts, '2' );
18
 
 
19
  echo $before_widget . $before_title . $title . $after_title;
20
 
21
  $photos_number = intval( blocksy_default_akg( 'photos_number', $atts, '6' ) );
29
 
30
  ?>
31
 
 
 
 
 
 
32
  <ul
33
  class="ct-loading"
34
  data-widget='<?php echo $widget_data; ?>'
framework/extensions/instagram/ct-instagram/widget.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
 
3
- require_once dirname( __FILE__ ) . '/helpers.php';
4
-
5
- class Blocksy_Widget_Ct_Instagram extends Blocksy_Widget_Factory {
6
  protected function get_config() {
7
  return [
8
  'name' => 'Instagram',
1
  <?php
2
 
3
+ class Blocksy_Widget_Ct_Instagram extends BlocksyWidgetFactory {
 
 
4
  protected function get_config() {
5
  return [
6
  'name' => 'Instagram',
framework/extensions/instagram/customizer.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $options = [
4
+ 'title' => __('Instagram Extension', 'blc'),
5
+ 'container' => [ 'priority' => 8 ],
6
+ 'options' => [
7
+
8
+ 'instagram_section_options' => [
9
+ 'type' => 'ct-options',
10
+ 'setting' => [ 'transport' => 'postMessage' ],
11
+ 'inner-options' => [
12
+ 'insta_block_enabled' => [
13
+ 'label' => __( 'Instagram section', 'blc' ),
14
+ 'type' => 'ct-switch',
15
+ 'value' => 'no',
16
+ 'setting' => [ 'transport' => 'postMessage' ],
17
+ ],
18
+
19
+ blocksy_rand_md5() => [
20
+ 'type' => 'ct-condition',
21
+ 'condition' => [ 'insta_block_enabled' => 'yes' ],
22
+ 'options' => [
23
+
24
+ 'insta_block_location' => [
25
+ 'label' => __( 'Block Location', 'blc' ),
26
+ 'type' => 'ct-radio',
27
+ 'value' => 'above',
28
+ 'view' => 'text',
29
+ 'design' => 'block',
30
+ 'setting' => [ 'transport' => 'postMessage' ],
31
+ 'choices' => [
32
+ 'above' => __( 'Above Footer', 'blc' ),
33
+ 'below' => __( 'Below Footer', 'blc' ),
34
+ ],
35
+ ],
36
+
37
+ blocksy_rand_md5() => [
38
+ 'type' => 'ct-divider',
39
+ 'attr' => [ 'data-type' => 'small' ],
40
+ ],
41
+
42
+ 'insta_block_username' => [
43
+ 'label' => __( 'Username', 'blc' ),
44
+ 'type' => 'text',
45
+ 'design' => 'inline',
46
+ 'value' => '',
47
+ 'setting' => [ 'transport' => 'postMessage' ],
48
+ ],
49
+
50
+ 'insta_block_count' => [
51
+ 'type' => 'ct-number',
52
+ 'label' => __( 'Images Count', 'blc' ),
53
+ 'min' => 1,
54
+ 'max' => 18,
55
+ 'value' => 6,
56
+ 'design' => 'inline',
57
+ 'setting' => [ 'transport' => 'postMessage' ],
58
+ ],
59
+
60
+ blocksy_rand_md5() => [
61
+ 'type' => 'ct-divider',
62
+ 'attr' => [ 'data-type' => 'small' ],
63
+ ],
64
+
65
+ 'insta_block_visibility' => [
66
+ 'label' => __( 'Visibility', 'blc' ),
67
+ 'type' => 'ct-visibility',
68
+ 'design' => 'block',
69
+ 'setting' => [ 'transport' => 'postMessage' ],
70
+ 'value' => [
71
+ 'desktop' => true,
72
+ 'tablet' => true,
73
+ 'mobile' => false,
74
+ ],
75
+
76
+ 'choices' => blocksy_ordered_keys([
77
+ 'desktop' => __( 'Desktop', 'blc' ),
78
+ 'tablet' => __( 'Tablet', 'blc' ),
79
+ 'mobile' => __( 'Mobile', 'blc' ),
80
+ ]),
81
+ ],
82
+
83
+
84
+ ],
85
+ ],
86
+
87
+
88
+ ],
89
+ ],
90
+ ],
91
+ ];
92
+
framework/extensions/instagram/extension.php CHANGED
@@ -1,7 +1,14 @@
1
  <?php
2
 
 
 
3
  class BlocksyExtensionInstagram {
4
  public function __construct() {
 
 
 
 
 
5
  add_filter('blocksy_widgets_paths', function ($all_widgets) {
6
  $all_widgets[] = dirname(__FILE__) . '/ct-instagram';
7
  return $all_widgets;
@@ -18,14 +25,14 @@ class BlocksyExtensionInstagram {
18
 
19
  wp_enqueue_style(
20
  'blocksy-ext-instagram-styles',
21
- BLOCKSY_URL . 'framework/extensions/instagram/ct-instagram/static/bundle/main.css',
22
  [],
23
  $data['Version']
24
  );
25
 
26
  wp_enqueue_script(
27
  'blocksy-ext-instagram-scripts',
28
- BLOCKSY_URL . 'framework/extensions/instagram/ct-instagram/static/bundle/main.js',
29
  [],
30
  $data['Version'],
31
  true
@@ -33,7 +40,7 @@ class BlocksyExtensionInstagram {
33
 
34
  $data = [
35
  'ajax_url' => admin_url( 'admin-ajax.php' ),
36
- 'public_url' => BLOCKSY_URL . 'framework/extensions/instagram/ct-instagram/static/bundle/',
37
  ];
38
 
39
  wp_localize_script(
@@ -42,7 +49,33 @@ class BlocksyExtensionInstagram {
42
  $data
43
  );
44
  });