Schema & Structured Data for WP & AMP - Version 1.9.21

Version Description

(06 Jan 2020) =

  • Added: Schema Blocks (Event, Job, Course, Review/Collection ) #436
  • Added: Data tracking and deactivate question #12
  • Added: MusicComposition schema type #688
  • Added: Movie schema type #688
  • Added: Movie as a Item Reviewed Type in Review schema #684
  • Added: Support For Plugin AMP WP ( https://wordpress.org/plugins/amp-wp ) #674
  • Added: Collection schema for shop page. #687
  • Added: id property in HowTo Schema #677
  • Added: Show time field in schema markup if user is using modify schema option #682
  • Fixed: Custom schema option enhancement #701
  • Fixed: Organization type entered in Knowledge Graph is not displayed same in the markup. #690
  • Fixed: Review/Ratings problem in display. #693
  • Fixed: Images are not displaying when user adding through the Advanced custom field. #705
  • Fixed: DiscussionForumPosting is always 1970-01-01T00:00:00+00:00 when bbpress support is on #702
  • Fixed: The name of guest users is empty (registered users are OK) #706
  • Fixed: When BBPress compatibility is on. Coment author name appears on front html multiple time #707
  • Fixed: Conflict with NT Conversi Shortcodes plugin #704
  • Fixed: #primaryimage size should be 1200*(maintain aspect ratio) size so that the image should display perfectly in rich result preview. #692
  • Fixed: Article schema:- Website Markup is showing description meta of post and not of the website. #691
Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Schema & Structured Data for WP & AMP
Version 1.9.21
Comparing to
See all releases

Code changes from version 1.9.19 to 1.9.21

Files changed (49) hide show
  1. admin_section/add-schema/add_new.php +1 -1
  2. admin_section/ajax-selectbox.php +421 -0
  3. admin_section/common-function.php +163 -20
  4. admin_section/fields-generator.php +640 -0
  5. admin_section/js/main-script.js +52 -0
  6. admin_section/js/main-script.min.js +1 -1
  7. admin_section/plugin-installer/install.php +10 -5
  8. admin_section/settings.php +128 -17
  9. admin_section/structure_admin.php +41 -27
  10. admin_section/tracking/class-saswp-plugin-usage-tracker.php +986 -0
  11. core/3rd-party/aqua_resizer.php +5 -2
  12. core/3rd-party/class-amp-review-form-blacklist.php +29 -4
  13. core/array-list/compatibility-list.php +32 -0
  14. core/array-list/repeater-fields.php +36 -5
  15. core/array-list/schema-properties.php +193 -25
  16. core/array-list/schemas.php +2 -1
  17. modules/gutenberg/assets/blocks/collection.js +64 -0
  18. modules/gutenberg/assets/blocks/course.js +280 -0
  19. modules/gutenberg/assets/blocks/event.js +552 -0
  20. modules/gutenberg/assets/blocks/job.js +402 -0
  21. modules/gutenberg/assets/css/amp/course.css +3 -0
  22. modules/gutenberg/assets/css/{style.css → amp/event.css} +3 -0
  23. modules/gutenberg/assets/css/amp/job.css +77 -0
  24. modules/gutenberg/assets/css/course.css +3 -0
  25. modules/gutenberg/assets/css/editor.css +31 -1
  26. modules/gutenberg/assets/css/event.css +12 -0
  27. modules/gutenberg/assets/css/job.css +77 -0
  28. modules/gutenberg/includes/class-gutenberg.php +283 -70
  29. modules/gutenberg/includes/render.php +190 -0
  30. modules/gutenberg/includes/service.php +8 -0
  31. modules/rating-box/frontend.php +11 -75
  32. modules/reviews/reviews_admin.php +1 -1
  33. modules/reviews/reviews_collection.php +15 -4
  34. modules/reviews/reviews_form.php +17 -7
  35. modules/reviews/reviews_service.php +1 -1
  36. modules/reviews/reviews_setup.php +23 -4
  37. modules/reviews/reviews_widget.php +13 -9
  38. output/compatibility.php +25 -15
  39. output/function.php +269 -45
  40. output/gutenberg.php +463 -0
  41. output/markup.php +219 -75
  42. output/output.php +171 -282
  43. output/service.php +156 -40
  44. output/single.php +34 -5
  45. readme.txt +42 -1
  46. structured-data-for-wp.php +27 -4
  47. view/common.php +0 -11
  48. view/post_specific.php +11 -12
  49. view/schema_type.php +6 -13
admin_section/add-schema/add_new.php CHANGED
@@ -61,7 +61,7 @@ $saswp_add_data_type_config = array(
61
 
62
  function saswp_add_new_init(){
63
  // Exit if the user does not have proper permissions
64
- if(! current_user_can( 'manage_options' ) ) {
65
  return ;
66
  }
67
 
61
 
62
  function saswp_add_new_init(){
63
  // Exit if the user does not have proper permissions
64
+ if(! current_user_can( saswp_current_user_can() ) ) {
65
  return ;
66
  }
67
 
admin_section/ajax-selectbox.php CHANGED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ajax Selectbox Page
4
+ *
5
+ * @author Magazine3
6
+ * @category Admin
7
+ * @path admin_section/ajax-selectbox
8
+ * @version 1.1
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ /**
15
+ * List of hooks used in this context
16
+ */
17
+ add_action('wp_ajax_create_ajax_select_sdwp','saswp_ajax_select_creator');
18
+ add_action('wp_ajax_create_ajax_select_sdwp_taxonomy','saswp_create_ajax_select_taxonomy');
19
+
20
+
21
+ function saswp_ajax_select_creator($data = '', $saved_data= '', $current_number = '', $current_group_number ='') {
22
+
23
+ $response = $data;
24
+ $is_ajax = false;
25
+
26
+ if( $_SERVER['REQUEST_METHOD']=='POST'){
27
+
28
+ $is_ajax = true;
29
+
30
+ if(wp_verify_nonce($_POST["saswp_call_nonce"],'saswp_select_action_nonce')){
31
+
32
+ if ( isset( $_POST["id"] ) ) {
33
+ $response = sanitize_text_field(wp_unslash($_POST["id"]));
34
+ }
35
+ if ( isset( $_POST["number"] ) ) {
36
+ $current_number = intval(sanitize_text_field($_POST["number"]));
37
+ }
38
+ if ( isset( $_POST["group_number"] ) ) {
39
+ $current_group_number = intval(sanitize_text_field($_POST["group_number"]));
40
+ }
41
+
42
+ }else{
43
+
44
+ exit;
45
+
46
+ }
47
+
48
+ }
49
+ // send the response back to the front end
50
+ // vars
51
+ $choices = array();
52
+
53
+ $options['param'] = $response;
54
+ // some case's have the same outcome
55
+ if($options['param'] == "page_parent")
56
+ {
57
+ $options['param'] = "page";
58
+ }
59
+
60
+ switch($options['param'])
61
+ {
62
+ case "post_type":
63
+
64
+ $choices = saswp_post_type_generator();
65
+
66
+ $choices = apply_filters('saswp_modify_select_post_type', $choices );
67
+
68
+ unset($choices['saswp']);
69
+
70
+ break;
71
+
72
+ case "homepage":
73
+
74
+ $choices = array(
75
+ 'true' => 'True',
76
+ 'false' => 'False',
77
+ );
78
+
79
+ break;
80
+
81
+ case "page":
82
+
83
+ $post_type = 'page';
84
+
85
+ $posts = get_posts(array(
86
+ 'posts_per_page' => -1,
87
+ 'post_type' => $post_type,
88
+ 'orderby' => 'menu_order title',
89
+ 'order' => 'ASC',
90
+ 'post_status' => 'any',
91
+ 'suppress_filters' => false,
92
+ 'update_post_meta_cache' => false,
93
+ ));
94
+
95
+ if( $posts )
96
+ {
97
+ // sort into hierachial order!
98
+ if( is_post_type_hierarchical( $post_type ) )
99
+ {
100
+ $posts = get_page_children( 0, $posts );
101
+ }
102
+
103
+ foreach( $posts as $page )
104
+ {
105
+ $title = '';
106
+ $ancestors = get_ancestors($page->ID, 'page');
107
+ if($ancestors)
108
+ {
109
+ foreach($ancestors as $a)
110
+ {
111
+ $title .= '- ';
112
+ }
113
+ }
114
+
115
+ $title .= apply_filters( 'the_title', $page->post_title, $page->ID );
116
+ // status
117
+ if($page->post_status != "publish")
118
+ {
119
+ $title .= " ($page->post_status)";
120
+ }
121
+
122
+ $choices[ $page->ID ] = $title;
123
+
124
+ }
125
+ // foreach($pages as $page)
126
+
127
+ }
128
+
129
+ break;
130
+
131
+ case "page_template" :
132
+
133
+ $choices = array(
134
+ 'default' => esc_html__('Default Template','schema-and-structured-data-for-wp'),
135
+ );
136
+
137
+ $templates = get_page_templates();
138
+
139
+ if($templates){
140
+
141
+ foreach($templates as $k => $v){
142
+
143
+ $choices[$v] = $k;
144
+
145
+ }
146
+
147
+ }
148
+
149
+
150
+ break;
151
+
152
+ case "post" :
153
+
154
+ $post_types = get_post_types();
155
+
156
+ unset( $post_types['page'], $post_types['attachment'], $post_types['revision'] , $post_types['nav_menu_item'], $post_types['acf'] , $post_types['amp_acf'],$post_types['saswp'] );
157
+
158
+ if( $post_types )
159
+ {
160
+ foreach( $post_types as $post_type ){
161
+
162
+ $posts = get_posts(array(
163
+
164
+ 'numberposts' => '-1',
165
+ 'post_type' => $post_type,
166
+ 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
167
+ 'suppress_filters' => false,
168
+
169
+ ));
170
+
171
+ if( $posts){
172
+
173
+ $choices[$post_type] = array();
174
+
175
+ foreach($posts as $post){
176
+
177
+ $title = apply_filters( 'the_title', $post->post_title, $post->ID );
178
+ // status
179
+ if($post->post_status != "publish"){
180
+
181
+ $title .= " ($post->post_status)";
182
+ }
183
+
184
+ $choices[$post_type][$post->ID] = $title;
185
+
186
+ }
187
+ // foreach($posts as $post)
188
+ }
189
+ // if( $posts )
190
+ }
191
+ // foreach( $post_types as $post_type )
192
+ }
193
+ // if( $post_types )
194
+
195
+
196
+ break;
197
+
198
+ case "post_category" :
199
+
200
+ $terms = get_terms( 'category', array( 'hide_empty' => false ) );
201
+
202
+ if( !empty($terms) ) {
203
+
204
+ foreach( $terms as $term ) {
205
+
206
+ $choices[ $term->term_id ] = $term->name;
207
+
208
+ }
209
+
210
+ }
211
+
212
+ break;
213
+
214
+ case "post_format" :
215
+
216
+ $choices = get_post_format_strings();
217
+
218
+ break;
219
+
220
+ case "user_type" :
221
+
222
+ global $wp_roles;
223
+
224
+ $choices = $wp_roles->get_names();
225
+
226
+ if( is_multisite() ){
227
+
228
+ $choices['super_admin'] = esc_html__('Super Admin','schema-and-structured-data-for-wp');
229
+
230
+ }
231
+
232
+ break;
233
+
234
+ case "ef_taxonomy" :
235
+
236
+ $choices = array('all' => esc_html__('All','schema-and-structured-data-for-wp'));
237
+ $taxonomies = saswp_post_taxonomy_generator();
238
+ $choices = array_merge($choices, $taxonomies);
239
+
240
+ break;
241
+
242
+ }
243
+ // allow custom location rules
244
+ $choices = $choices;
245
+
246
+ // Add None if no elements found in the current selected items
247
+ if ( empty( $choices) ) {
248
+ $choices = array('none' => esc_html__('No Items', 'schema-and-structured-data-for-wp') );
249
+ }
250
+
251
+
252
+ $output = '<select class="widefat ajax-output" name="data_group_array[group-'.esc_attr($current_group_number).'][data_array]['. esc_attr($current_number) .'][key_3]">';
253
+
254
+ // Generate Options for Posts
255
+ if ( $options['param'] == 'post' ) {
256
+
257
+ foreach ($choices as $choice_post_type) {
258
+
259
+ foreach ($choice_post_type as $key => $value) {
260
+
261
+ if ( $saved_data == $key ) {
262
+
263
+ $selected = 'selected="selected"';
264
+
265
+ } else {
266
+
267
+ $selected = '';
268
+
269
+ }
270
+
271
+ $output .= '<option '. esc_attr($selected) .' value="' . esc_attr($key) .'"> ' . esc_html__($value, 'schema-and-structured-data-for-wp') .' </option>';
272
+ }
273
+ }
274
+ // Options for Other then posts
275
+ } else {
276
+
277
+ foreach ($choices as $key => $value) {
278
+
279
+ if ( $saved_data == $key ) {
280
+
281
+ $selected = 'selected="selected"';
282
+
283
+ } else {
284
+
285
+ $selected = '';
286
+
287
+ }
288
+
289
+ $output .= '<option '. esc_attr($selected) .' value="' . esc_attr($key) .'"> ' . esc_html__($value, 'schema-and-structured-data-for-wp') .' </option>';
290
+ }
291
+ }
292
+
293
+ $output .= ' </select> ';
294
+ $allowed_html = saswp_expanded_allowed_tags();
295
+ echo wp_kses($output, $allowed_html);
296
+
297
+ if ( $is_ajax ) {
298
+ die();
299
+ }
300
+ // endif;
301
+
302
+ }
303
+ /**
304
+ * Function to Generate Proper Post Taxonomy for select and to add data.
305
+ * @return type array
306
+ * @since version 1.0
307
+ */
308
+ function saswp_post_taxonomy_generator(){
309
+
310
+ $taxonomies = '';
311
+ $choices = array();
312
+
313
+ $taxonomies = get_taxonomies( array('public' => true), 'objects' );
314
+
315
+ if($taxonomies){
316
+
317
+ foreach($taxonomies as $taxonomy) {
318
+
319
+ $choices[ $taxonomy->name ] = $taxonomy->labels->name;
320
+
321
+ }
322
+
323
+ }
324
+
325
+ // unset post_format (why is this a public taxonomy?)
326
+ if( isset($choices['post_format']) ) {
327
+
328
+ unset( $choices['post_format']) ;
329
+
330
+ }
331
+
332
+ return $choices;
333
+ }
334
+ /**
335
+ * Function to create taxonomy
336
+ * @param type $selectedParentValue
337
+ * @param type $selectedValue
338
+ * @param type $current_number
339
+ * @param type $current_group_number
340
+ * @since version 1.0
341
+ */
342
+ function saswp_create_ajax_select_taxonomy($selectedParentValue = '',$selectedValue='', $current_number ='', $current_group_number = ''){
343
+
344
+ $is_ajax = false;
345
+
346
+ if( $_SERVER['REQUEST_METHOD']=='POST'){
347
+
348
+ $is_ajax = true;
349
+
350
+ if(! current_user_can( saswp_current_user_can() ) ) {
351
+ exit;
352
+ }
353
+
354
+ if(wp_verify_nonce($_POST["saswp_call_nonce"],'saswp_select_action_nonce')){
355
+
356
+ if(isset($_POST['id'])){
357
+
358
+ $selectedParentValue = sanitize_text_field(wp_unslash($_POST['id']));
359
+
360
+ }
361
+
362
+ if(isset($_POST['number'])){
363
+
364
+ $current_number = intval(sanitize_text_field($_POST['number']));
365
+
366
+ }
367
+
368
+ if ( isset( $_POST["group_number"] ) ) {
369
+
370
+ $current_group_number = intval(sanitize_text_field($_POST["group_number"]));
371
+
372
+ }
373
+
374
+ }else{
375
+
376
+ exit;
377
+
378
+ }
379
+ }
380
+ $taxonomies = array();
381
+
382
+ if($selectedParentValue == 'all'){
383
+
384
+ $taxonomies = get_terms( array(
385
+ 'hide_empty' => true,
386
+ ) );
387
+
388
+ }else{
389
+
390
+ $taxonomies = get_terms($selectedParentValue, array(
391
+ 'hide_empty' => true,
392
+ ) );
393
+ }
394
+
395
+ $choices = '<option value="all">'.esc_html__('All','schema-and-structured-data-for-wp').'</option>';
396
+
397
+ if(!empty($taxonomies)){
398
+
399
+ foreach($taxonomies as $taxonomy) {
400
+
401
+ $sel="";
402
+
403
+ if($selectedValue == $taxonomy->slug){
404
+
405
+ $sel = "selected";
406
+
407
+ }
408
+ $choices .= '<option value="'.esc_attr($taxonomy->slug).'" '.esc_attr($sel).'>'.esc_html__($taxonomy->name,'schema-and-structured-data-for-wp').'</option>';
409
+
410
+ }
411
+
412
+ $allowed_html = saswp_expanded_allowed_tags();
413
+
414
+ echo '<select class="widefat ajax-output-child" name="data_group_array[group-'. esc_attr($current_group_number) .'][data_array]['.esc_attr($current_number).'][key_4]">'. wp_kses($choices, $allowed_html).'</select>';
415
+
416
+ }
417
+
418
+ if($is_ajax){
419
+ die;
420
+ }
421
+ }
admin_section/common-function.php CHANGED
@@ -63,7 +63,7 @@ if ( ! defined('ABSPATH') ) exit;
63
  */
64
  function saswp_import_all_settings_and_schema(){
65
 
66
- if ( ! current_user_can( 'manage_options' ) ) {
67
  return;
68
  }
69
 
@@ -200,7 +200,7 @@ if ( ! defined('ABSPATH') ) exit;
200
  */
201
  function saswp_export_all_settings_and_schema(){
202
 
203
- if ( ! current_user_can( 'manage_options' ) ) {
204
  return;
205
  }
206
  if ( ! isset( $_GET['_wpnonce'] ) ){
@@ -1587,7 +1587,11 @@ if ( ! defined('ABSPATH') ) exit;
1587
  'type' => array(),
1588
  'style' => array(),
1589
  'width' => array(),
1590
- );
 
 
 
 
1591
  //textarea
1592
  $my_allowed['textarea'] = array(
1593
  'class' => array(),
@@ -1600,11 +1604,12 @@ if ( ! defined('ABSPATH') ) exit;
1600
  );
1601
  // select
1602
  $my_allowed['select'] = array(
1603
- 'class' => array(),
1604
- 'id' => array(),
1605
- 'name' => array(),
1606
- 'value' => array(),
1607
- 'type' => array(),
 
1608
  );
1609
  // checkbox
1610
  $my_allowed['checkbox'] = array(
@@ -1618,7 +1623,8 @@ if ( ! defined('ABSPATH') ) exit;
1618
  // options
1619
  $my_allowed['option'] = array(
1620
  'selected' => array(),
1621
- 'value' => array(),
 
1622
  );
1623
  // style
1624
  $my_allowed['style'] = array(
@@ -2069,20 +2075,23 @@ if ( ! defined('ABSPATH') ) exit;
2069
 
2070
  $blog_desc = get_bloginfo('description');
2071
 
 
 
2072
  if(isset($sd_data['saswp-yoast']) && $sd_data['saswp-yoast'] == 1){
2073
 
2074
  if(class_exists('WPSEO_Frontend')){
2075
 
2076
  $front = WPSEO_Frontend::get_instance();
2077
  $blog_desc = $front->metadesc( false );
2078
-
2079
- }
2080
-
2081
- }
2082
-
 
 
2083
  return $blog_desc;
2084
- }
2085
-
2086
  /**
2087
  * since @1.8.7
2088
  * Here we are modifying the default title
@@ -2461,7 +2470,7 @@ function saswp_get_permalink(){
2461
  }
2462
  function saswp_get_taxonomy_term_list(){
2463
 
2464
- if ( ! current_user_can( 'manage_options' ) ) {
2465
  return;
2466
  }
2467
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -2536,10 +2545,12 @@ function saswp_format_date_time($date, $time=null){
2536
 
2537
  $formated = '';
2538
 
2539
- if($time){
2540
  $formated = date('c',strtotime($date.' '.$time));
2541
  }else{
2542
- $formated = date('c',strtotime($date));
 
 
2543
  }
2544
 
2545
  return $formated;
@@ -2707,12 +2718,15 @@ function saswp_remove_anonymous_object_filter_or_action( $tag, $class, $method,
2707
  function saswp_get_field_note($pname){
2708
 
2709
  $notes = array(
 
2710
  'strong_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/strong-testimonials">Strong Testimonials</a>',
 
2711
  'wordlift' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wordlift/">WordLift</a>',
2712
  'ampforwp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/accelerated-mobile-pages/">AMP for WP</a>',
2713
  'ampbyautomatic' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/amp/">AMP</a>',
2714
  'betteramp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">Better AMP</a>',
2715
  'wpamp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://codecanyon.net/item/wp-amp-accelerated-mobile-pages-for-wordpress-and-woocommerce/16278608">WP AMP</a>',
 
2716
  'kk_star_ratings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">kk Star Rating</a>',
2717
  'wp_post_ratings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-postratings/">WP-PostRatings</a>',
2718
  'bb_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bbpress/">bbPress</a>',
@@ -2742,6 +2756,7 @@ function saswp_get_field_note($pname){
2742
  'woocommerce_bookings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Bookings</a>',
2743
  'extra' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.elegantthemes.com/gallery/extra/">Extra Theme</a>',
2744
  'homeland' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/homeland-responsive-real-estate-theme-for-wordpress/6518965">Homeland</a>',
 
2745
  'realhomes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/real-homes-wordpress-real-estate-theme/5373914">RealHomes</a>',
2746
  'jannah' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://codecanyon.net/item/taqyeem-wordpress-review-plugin/4558799">Taqyeem</a>',
2747
  'soledad' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/soledad-multiconcept-blogmagazine-wp-theme/12945398">Soledad Theme</a>',
@@ -2750,7 +2765,8 @@ function saswp_get_field_note($pname){
2750
  'ht_recipes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/culinier-food-recipe-wordpress-theme/11088564/">HT-Recipes</a>',
2751
  'easy_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easy-testimonials">Easy Testimonials</a>',
2752
  'bne_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bne-testimonials/">BNE Testimonials</a>',
2753
- 'testimonial_pro' => esc_html__('Testimonial Pro','schema-and-structured-data-for-wp').' <a target="_blank" href="https://shapedplugin.com/plugin/testimonial-pro/">Testimonial Pro</a>'
 
2754
 
2755
  );
2756
 
@@ -2814,4 +2830,131 @@ function saswp_remove_slash($url){
2814
 
2815
  return $url;
2816
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2817
  }
63
  */
64
  function saswp_import_all_settings_and_schema(){
65
 
66
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
67
  return;
68
  }
69
 
200
  */
201
  function saswp_export_all_settings_and_schema(){
202
 
203
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
204
  return;
205
  }
206
  if ( ! isset( $_GET['_wpnonce'] ) ){
1587
  'type' => array(),
1588
  'style' => array(),
1589
  'width' => array(),
1590
+ );
1591
+ $my_allowed['script'] = array(
1592
+ 'class' => array(),
1593
+ 'type' => array(),
1594
+ );
1595
  //textarea
1596
  $my_allowed['textarea'] = array(
1597
  'class' => array(),
1604
  );
1605
  // select
1606
  $my_allowed['select'] = array(
1607
+ 'class' => array(),
1608
+ 'multiple' => array(),
1609
+ 'id' => array(),
1610
+ 'name' => array(),
1611
+ 'value' => array(),
1612
+ 'type' => array(),
1613
  );
1614
  // checkbox
1615
  $my_allowed['checkbox'] = array(
1623
  // options
1624
  $my_allowed['option'] = array(
1625
  'selected' => array(),
1626
+ 'value' => array(),
1627
+ 'disabled' => array(),
1628
  );
1629
  // style
1630
  $my_allowed['style'] = array(
2075
 
2076
  $blog_desc = get_bloginfo('description');
2077
 
2078
+ if(is_home() || is_front_page() || ( function_exists('ampforwp_is_home') && ampforwp_is_home()) ){
2079
+
2080
  if(isset($sd_data['saswp-yoast']) && $sd_data['saswp-yoast'] == 1){
2081
 
2082
  if(class_exists('WPSEO_Frontend')){
2083
 
2084
  $front = WPSEO_Frontend::get_instance();
2085
  $blog_desc = $front->metadesc( false );
2086
+
2087
+ if(empty($blog_desc)){
2088
+ $blog_desc = get_bloginfo('description');
2089
+ }
2090
+ }
2091
+ }
2092
+ }
2093
  return $blog_desc;
2094
+ }
 
2095
  /**
2096
  * since @1.8.7
2097
  * Here we are modifying the default title
2470
  }
2471
  function saswp_get_taxonomy_term_list(){
2472
 
2473
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
2474
  return;
2475
  }
2476
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
2545
 
2546
  $formated = '';
2547
 
2548
+ if($date && $time){
2549
  $formated = date('c',strtotime($date.' '.$time));
2550
  }else{
2551
+ if($date){
2552
+ $formated = date('c',strtotime($date));
2553
+ }
2554
  }
2555
 
2556
  return $formated;
2718
  function saswp_get_field_note($pname){
2719
 
2720
  $notes = array(
2721
+ 'easy_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easyrecipe/">EasyRecipe</a>',
2722
  'strong_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/strong-testimonials">Strong Testimonials</a>',
2723
+ 'wp_event_aggregator' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-event-aggregator/">WP Event Aggregator</a>',
2724
  'wordlift' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wordlift/">WordLift</a>',
2725
  'ampforwp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/accelerated-mobile-pages/">AMP for WP</a>',
2726
  'ampbyautomatic' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/amp/">AMP</a>',
2727
  'betteramp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">Better AMP</a>',
2728
  'wpamp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://codecanyon.net/item/wp-amp-accelerated-mobile-pages-for-wordpress-and-woocommerce/16278608">WP AMP</a>',
2729
+ 'ampwp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/amp-wp/">AMP WP</a>',
2730
  'kk_star_ratings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">kk Star Rating</a>',
2731
  'wp_post_ratings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-postratings/">WP-PostRatings</a>',
2732
  'bb_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bbpress/">bbPress</a>',
2756
  'woocommerce_bookings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Bookings</a>',
2757
  'extra' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.elegantthemes.com/gallery/extra/">Extra Theme</a>',
2758
  'homeland' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/homeland-responsive-real-estate-theme-for-wordpress/6518965">Homeland</a>',
2759
+ 'wpresidence' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wpresidence.net/">WP Residence</a>',
2760
  'realhomes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/real-homes-wordpress-real-estate-theme/5373914">RealHomes</a>',
2761
  'jannah' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://codecanyon.net/item/taqyeem-wordpress-review-plugin/4558799">Taqyeem</a>',
2762
  'soledad' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/soledad-multiconcept-blogmagazine-wp-theme/12945398">Soledad Theme</a>',
2765
  'ht_recipes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://themeforest.net/item/culinier-food-recipe-wordpress-theme/11088564/">HT-Recipes</a>',
2766
  'easy_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easy-testimonials">Easy Testimonials</a>',
2767
  'bne_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bne-testimonials/">BNE Testimonials</a>',
2768
+ 'testimonial_pro' => esc_html__('Testimonial Pro','schema-and-structured-data-for-wp').' <a target="_blank" href="https://shapedplugin.com/plugin/testimonial-pro/">Testimonial Pro</a>',
2769
+ 'tevolution_events' => esc_html__('Tevolution Events','schema-and-structured-data-for-wp').' <a target="_blank" href="https://templatic.com/wordpress-plugins/tevolution/">Tevolution Events</a>'
2770
 
2771
  );
2772
 
2830
 
2831
  return $url;
2832
 
2833
+ }
2834
+
2835
+ function saswp_get_user_roles(){
2836
+
2837
+ global $wp_roles;
2838
+ $allroles = array();
2839
+
2840
+ foreach ( $wp_roles->roles as $key=>$value ){
2841
+ $allroles[esc_attr($key)] = esc_html($value['name']);
2842
+ }
2843
+
2844
+ return $allroles;
2845
+ }
2846
+
2847
+ function saswp_get_capability_by_role($role){
2848
+
2849
+ $cap = 'manage_options';
2850
+
2851
+ switch ($role) {
2852
+
2853
+ case 'editor':
2854
+ $cap = 'edit_pages';
2855
+ break;
2856
+ case 'author':
2857
+ $cap = 'publish_posts';
2858
+ break;
2859
+ case 'contributor':
2860
+ $cap = 'edit_posts';
2861
+ break;
2862
+ case 'subscriber':
2863
+ $cap = 'read';
2864
+ break;
2865
+
2866
+ default:
2867
+ break;
2868
+ }
2869
+
2870
+ return $cap;
2871
+
2872
+ }
2873
+
2874
+ function saswp_current_user_role(){
2875
+
2876
+ if( is_user_logged_in() ) {
2877
+
2878
+ $user = wp_get_current_user();
2879
+ $role = (array) $user->roles;
2880
+
2881
+ return $role[0];
2882
+
2883
+ }
2884
+
2885
+ }
2886
+
2887
+ function saswp_current_user_allowed(){
2888
+
2889
+ global $sd_data;
2890
+
2891
+ if( is_user_logged_in() ) {
2892
+
2893
+ $currentUser = wp_get_current_user();
2894
+ $saswp_roles = isset($sd_data['saswp-role-based-access']) ? $sd_data['saswp-role-based-access'] : array('administrator');
2895
+ $currentuserrole = (array) $currentUser->roles;
2896
+
2897
+ $hasrole = array_intersect( $currentuserrole, $saswp_roles );
2898
+
2899
+ if( !empty($hasrole)){
2900
+ return $hasrole[0];
2901
+ }
2902
+
2903
+ }
2904
+
2905
+ return false;
2906
+ }
2907
+
2908
+ function saswp_current_user_can(){
2909
+
2910
+ $capability = saswp_current_user_allowed() ? saswp_get_capability_by_role(saswp_current_user_allowed()) : 'manage_options';
2911
+ return $capability;
2912
+ }
2913
+
2914
+ function saswp_post_type_capabilities(){
2915
+
2916
+ $caplist = array();
2917
+
2918
+ $cap = saswp_current_user_can();
2919
+
2920
+ if(saswp_current_user_role() != 'administrator'){
2921
+
2922
+ $caplist = array(
2923
+ 'publish_posts' => $cap,
2924
+ 'edit_posts' => $cap,
2925
+ 'edit_others_posts' => $cap,
2926
+ 'delete_posts' => $cap,
2927
+ 'delete_others_posts' => $cap,
2928
+ 'read_private_posts' => $cap,
2929
+ 'edit_post' => $cap,
2930
+ 'delete_post' => $cap,
2931
+ 'read_post' => $cap,
2932
+ );
2933
+
2934
+ }
2935
+
2936
+ return $caplist;
2937
+ }
2938
+
2939
+ function saswp_get_image_by_id($image_id){
2940
+
2941
+ $response = array();
2942
+
2943
+ if($image_id){
2944
+
2945
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
2946
+
2947
+ if($image_details){
2948
+
2949
+ $response['@type'] = 'ImageObject';
2950
+ $response['url'] = $image_details[0];
2951
+ $response['width'] = $image_details[1];
2952
+ $response['height'] = $image_details[2];
2953
+
2954
+ }
2955
+
2956
+ }
2957
+
2958
+ return $response;
2959
+
2960
  }
admin_section/fields-generator.php CHANGED
@@ -0,0 +1,640 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Field Generator class
4
+ *
5
+ * @author Magazine3
6
+ * @category Admin
7
+ * @path google_review/google_review
8
+ * @Version 1.8
9
+ */
10
+
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ /*
15
+ Metabox to show ads type such as custom and adsense
16
+ */
17
+ class saswp_fields_generator {
18
+
19
+ public function saswp_tooltip_message($meta_field_id){
20
+
21
+ $tooltip_message = '';
22
+
23
+ switch ($meta_field_id) {
24
+
25
+ case 'saswp_kb_type':
26
+ //$tooltip_message = 'Test Message';
27
+ break;
28
+
29
+ default:
30
+ break;
31
+ }
32
+
33
+ return $tooltip_message;
34
+ }
35
+ /**
36
+ * Function to generate html element from the given elements array
37
+ * @param type $meta_fields
38
+ * @param type $settings
39
+ * @param type $field_type
40
+ * @since version 1.0
41
+ */
42
+ public function saswp_field_generator( $meta_fields, $settings, $field_type = null ) {
43
+
44
+ $output = '';
45
+ $tooltip_message = '';
46
+
47
+
48
+ foreach ( $meta_fields as $meta_field ) {
49
+
50
+ $tooltip_message = $this->saswp_tooltip_message($meta_field['id']);
51
+
52
+ $class = "";
53
+ $note = "";
54
+ $proversion = false;
55
+ $hidden = array();
56
+ $attribute = array();
57
+
58
+ $on = 'Reviews';
59
+ $license_key = '';
60
+ $license_status = 'inactive';
61
+ $license_status_msg = '';
62
+ $rv_limits = '';
63
+
64
+ if(isset($settings[strtolower($on).'_addon_license_key'])){
65
+ $license_key = $settings[strtolower($on).'_addon_license_key'];
66
+ }
67
+
68
+ if(isset($settings[strtolower($on).'_addon_license_key_status'])){
69
+ $license_status = $settings[strtolower($on).'_addon_license_key_status'];
70
+ }
71
+
72
+ if(isset($settings[strtolower($on).'_addon_license_key_message'])){
73
+ $license_status_msg = $settings[strtolower($on).'_addon_license_key_message'];
74
+ }
75
+
76
+ if($license_status =='active'){
77
+ $rv_limits = get_option(strtolower($on).'_addon_reviews_limits');
78
+ }
79
+
80
+ if(array_key_exists('class', $meta_field)){
81
+
82
+ $class = $meta_field['class'];
83
+
84
+ }
85
+ if(array_key_exists('proversion', $meta_field)){
86
+
87
+ $proversion = $meta_field['proversion'];
88
+
89
+ }
90
+ if(array_key_exists('note', $meta_field)){
91
+
92
+ $note = $meta_field['note'];
93
+
94
+ }
95
+ if(array_key_exists('hidden', $meta_field)){
96
+
97
+ $hidden = $meta_field['hidden'];
98
+
99
+ }
100
+ if(array_key_exists('attributes', $meta_field)){
101
+
102
+ $attribute = $meta_field['attributes'];
103
+
104
+ }
105
+ if($tooltip_message){
106
+
107
+ $label = '<label class="saswp-tooltip" for="' . esc_attr($meta_field['id']) . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ).' <span class="saswp-tooltiptext">'.esc_html__($tooltip_message, 'schema-and-structured-data-for-wp').'</span></label>';
108
+
109
+ }else{
110
+
111
+ $label = '<label class="saswp-tooltip" for="' . esc_attr($meta_field['id']) . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ).' <span class="saswp-tooltiptext"></span></label>';
112
+
113
+ }
114
+
115
+ $attribute_str ='';
116
+
117
+ if(!empty($attribute)){
118
+
119
+ foreach ($attribute as $key => $attr ){
120
+
121
+ $attribute_str .=''.esc_attr($key).'="'.esc_attr($attr).'"';
122
+
123
+ }
124
+
125
+ }
126
+
127
+ switch ( $meta_field['type'] ) {
128
+
129
+ case 'media':
130
+
131
+ $mediavalue = array();
132
+
133
+ if(isset($settings[$meta_field['id']])){
134
+
135
+ $mediavalue = $settings[$meta_field['id']];
136
+
137
+ }
138
+
139
+ $image_pre = '';
140
+ if(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')){
141
+
142
+ $image_pre = '<div class="saswp_image_thumbnail">
143
+ <img class="saswp_image_prev" src="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'" />
144
+ <a data-id="'.esc_attr($meta_field['id']).'" href="#" class="saswp_prev_close">X</a>
145
+ </div>';
146
+
147
+ }
148
+
149
+ $input = sprintf(
150
+ '<fieldset><input %s class="%s" style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
151
+ . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
152
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_id" class="upload-id " name="sd_data['.esc_attr($meta_field['id']).'][id]" id="sd_data['.esc_attr($meta_field['id']).'][id]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'id', 'saswp_string')).'">'
153
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="sd_data['.esc_attr($meta_field['id']).'][height]" id="sd_data['.esc_attr($meta_field['id']).'][height]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'height', 'saswp_string')).'">'
154
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="sd_data['.esc_attr($meta_field['id']).'][width]" id="sd_data['.esc_attr($meta_field['id']).'][width]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'width', 'saswp_string')).'">'
155
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" id="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'">'
156
+ . '<div class="saswp_image_div_'.esc_attr($meta_field['id']).'">'
157
+ . $image_pre
158
+ . '</div>'
159
+ . '</fieldset>',
160
+ $attribute_str,
161
+ $class,
162
+ esc_attr($meta_field['id']),
163
+ esc_attr($meta_field['name']),
164
+ esc_url(saswp_remove_warnings($mediavalue, 'url', 'saswp_string')),
165
+ esc_attr($meta_field['id']),
166
+ esc_attr($meta_field['id'])
167
+ );
168
+ break;
169
+ case 'checkbox':
170
+
171
+ $hiddenvalue ="";
172
+
173
+ if(array_key_exists('id', $hidden) && isset($settings[$hidden['id']])){
174
+
175
+ $hiddenvalue = $settings[$hidden['id']];
176
+
177
+ }
178
+ $hiddenfield="";
179
+
180
+ if(!empty($hidden)){
181
+
182
+ $hiddenfield = sprintf(
183
+ '<input id="%s" name="%s" type="hidden" value="%s">',
184
+ esc_attr($hidden['id']),
185
+ esc_attr($hidden['name']),
186
+ esc_attr($hiddenvalue)
187
+ );
188
+
189
+ }
190
+ $message ='';
191
+
192
+ $input = sprintf(
193
+ '<input class="%s" id="%s" name="%s" type="checkbox" %s %s><p>'.$message.'</p>',
194
+ esc_attr($class),
195
+ esc_attr($meta_field['id']),
196
+ esc_attr($meta_field['name']),
197
+ $hiddenvalue == 1 ? 'checked' : '',
198
+ $attribute_str
199
+ );
200
+ $input .=$hiddenfield;
201
+ break;
202
+ case 'select':
203
+ $input = sprintf(
204
+ '<select class="%s" id="%s" name="%s">',
205
+ $class,
206
+ esc_attr($meta_field['id']),
207
+ esc_attr($meta_field['name'])
208
+ );
209
+ foreach ( $meta_field['options'] as $key => $value ) {
210
+ $settings_meta_field = '';
211
+ if(isset($settings[$meta_field['id']])){
212
+ $settings_meta_field = $settings[$meta_field['id']];
213
+ }
214
+
215
+ $input .= sprintf(
216
+ '<option %s value="%s">%s</option>',
217
+ $settings_meta_field == $key ? 'selected' : '',
218
+ $key,
219
+ esc_html__( $value, 'schema-and-structured-data-for-wp' )
220
+ );
221
+ }
222
+ $input .= '</select>';
223
+ break;
224
+ case 'multiselect':
225
+ $input = sprintf(
226
+ '<select class="%s" id="%s" name="%s[]" multiple>',
227
+ $class,
228
+ esc_attr($meta_field['id']),
229
+ esc_attr($meta_field['name'])
230
+ );
231
+ $settings_meta_field = array();
232
+ if(isset($settings[$meta_field['id']])){
233
+ $settings_meta_field = $settings[$meta_field['id']];
234
+ }
235
+
236
+ foreach ( $meta_field['options'] as $key => $value ) {
237
+
238
+ if($key == 'administrator'){
239
+
240
+ $input .= sprintf(
241
+ '<option %s value="%s">%s (Default)</option>',
242
+ 'selected',
243
+ $key,
244
+ esc_html__( $value, 'schema-and-structured-data-for-wp' )
245
+ );
246
+
247
+ }else{
248
+ $input .= sprintf(
249
+ '<option %s value="%s">%s</option>',
250
+ in_array($key, $settings_meta_field) ? 'selected' : '',
251
+ $key,
252
+ esc_html__( $value, 'schema-and-structured-data-for-wp' )
253
+ );
254
+
255
+ }
256
+ }
257
+ $input .= '</select>';
258
+ break;
259
+ default:
260
+
261
+ switch ($meta_field['id']) {
262
+
263
+ case 'saswp-reviews-pro-api':
264
+
265
+ $pro_api = '<div class="" style="display:block;">
266
+ '.saswp_get_license_section_html($on, $license_key, $license_status, $license_status_msg, $lable=false, $rv_limits).'
267
+ </div>';
268
+
269
+
270
+ $input = $pro_api;
271
+
272
+ break;
273
+
274
+ case 'saswp-reviews-module-section':
275
+
276
+ $input = '<div class="saswp_rv_module_pro_notice">
277
+ <h2>Get Your 5 Stars Reviews on Google SERPs</h2>
278
+ <p class="saswp_desc">Automatically Fetch your customer reviews from 80+ Platforms and show them on your website with proper schema support. <a target="_blank" href="https://structured-data-for-wp.com/reviews-for-schema">Learn More...</a></p>
279
+ <div class="saswp_cmpny_lst">
280
+ <span class="saswp_lst saswp_avlbl">Integrations Avaliable</span>
281
+ <ul>
282
+ <li class="check-img"><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/google-1-img.png">
283
+ <span class="saswp_cmpny">Google Reviews</span>
284
+ </li>
285
+ <li class="check-img"><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/shopper-approved-img.png">
286
+ <span class="saswp_cmpny">Shopper Approved</span>
287
+ </li>
288
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/agoda-img.png">
289
+ <span class="saswp_cmpny">Agoda</span>
290
+ </li>
291
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/airbnb-img.png">
292
+ <span class="saswp_cmpny">Airbnb</span>
293
+ </li>
294
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/alternativeto-img.png">
295
+ <span>AlternativeTo</span>
296
+ </li>
297
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/amazon-img.png">
298
+ <span>Amazon</span>
299
+ </li>
300
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/angies-list-img.png">
301
+ <span>Angies List</span>
302
+ </li>
303
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/aliexpress-img.png">
304
+ <span>Ali Express</span>
305
+ </li>
306
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/appstore-img.png">
307
+ <span>App Store</span>
308
+ </li>
309
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/avvo-img.png">
310
+ <span>Avvo</span>
311
+ </li>
312
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/bbb-img.png">
313
+ <span>BBB</span>
314
+ </li>
315
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/bestbuy-img.png">
316
+ <span>Bestbuy</span>
317
+ </li>
318
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/booking-com-img.png">
319
+ <span>Booking.com</span>
320
+ </li>
321
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/capterra-img.png">
322
+ <span>Capterra</span>
323
+ </li>
324
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/cars-com-img.png">
325
+ <span>Cars.com</span>
326
+ </li>
327
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/cargurus-img.png">
328
+ <span>Cargurus</span>
329
+ </li>
330
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/clutch-img.png">
331
+ <span>Clutch</span>
332
+ </li>
333
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/citysearch-img.png">
334
+ <span>Citysearch</span>
335
+ </li>
336
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/consumer-affairs-img.png">
337
+ <span>Consumer Affairs</span>
338
+ </li>
339
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/creditkarma-img.png">
340
+ <span>CreditKarma</span>
341
+ </li>
342
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/customerlobby-img.png">
343
+ <span>CustomerLobby</span>
344
+ </li>
345
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/dealerrater-img.png">
346
+ <span>DealerRater</span>
347
+ </li>
348
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/ebay-img.png">
349
+ <span>Ebay</span>
350
+ </li>
351
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/edmunds-img.png">
352
+ <span>Edmunds</span>
353
+ </li>
354
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/etsy-img.png">
355
+ <span>Etsy</span>
356
+ </li>
357
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/expedia-img.png">
358
+ <span>Expedia</span>
359
+ </li>
360
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/facebook-img.png">
361
+ <span>Facebook</span>
362
+ </li>
363
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/flipkart-img.png">
364
+ <span>Flipkart</span>
365
+ </li>
366
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/foursquare-img.png">
367
+ <span>Foursquare</span>
368
+ </li>
369
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/g2crowd-img.png">
370
+ <span>G2Crowd</span>
371
+ </li>
372
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/gearbest-img.png">
373
+ <span>Gearbest</span>
374
+ </li>
375
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/glassdoor-img.png">
376
+ <span>Glassdoor</span>
377
+ </li>
378
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/healthgrades-img.png">
379
+ <span>Healthgrades</span>
380
+ </li>
381
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/homeadvisor-img.png">
382
+ <span>HomeAdvisor</span>
383
+ </li>
384
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/homestars-img.png">
385
+ <span>Homestars</span>
386
+ </li>
387
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/houzz-img.png">
388
+ <span>Houzz</span>
389
+ </li>
390
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/hotels-com-img.png">
391
+ <span>Hotels.com</span>
392
+ </li>
393
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/hungerstation-img.png">
394
+ <span>Hungerstation</span>
395
+ </li>
396
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/imdb-img.png">
397
+ <span>Imdb</span>
398
+ </li>
399
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/indeed-img.png">
400
+ <span>Indeed</span>
401
+ </li>
402
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/insiderpages-img.png">
403
+ <span>Insider Pages</span>
404
+ </li>
405
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/jet-img.png">
406
+ <span>Jet</span>
407
+ </li>
408
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/lawyers-com-img.png">
409
+ <span>Lawyers.com</span>
410
+ </li>
411
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/lendingtree-img.png">
412
+ <span>Lending Tree</span>
413
+ </li>
414
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/martindale-img.png">
415
+ <span>Martindale</span>
416
+ </li>
417
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/newegg-img.png">
418
+ <span>Newegg</span>
419
+ </li>
420
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/openrice-img.png">
421
+ <span>OpenRice</span>
422
+ </li>
423
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/opentable-img.png">
424
+ <span>Opentable</span>
425
+ </li>
426
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/playstore-img.png">
427
+ <span>Playstore</span>
428
+ </li>
429
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/producthunt-img.png">
430
+ <span>ProductHunt</span>
431
+ </li>
432
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/ratemds-img.png">
433
+ <span>RateMDs</span>
434
+ </li>
435
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/reserveout-img.png">
436
+ <span>Reserveout</span>
437
+ </li>
438
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/rottentomatoes-img.png">
439
+ <span>Rottentomatoes</span>
440
+ </li>
441
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/siftery-img.png">
442
+ <span>Siftery</span>
443
+ </li>
444
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/sitejabber-img.png">
445
+ <span>Sitejabber</span>
446
+ </li>
447
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/softwareadvice-img.png">
448
+ <span>SoftwareAdvice</span>
449
+ </li>
450
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/steam-img.png">
451
+ <span>Steam</span>
452
+ </li>
453
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/talabat-img.png">
454
+ <span>Talabat</span>
455
+ </li>
456
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/theknot-img.png">
457
+ <span>The Knot</span>
458
+ </li>
459
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/thumbtack-img.png">
460
+ <span>Thumbtack</span>
461
+ </li>
462
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/tripadvisor-img.png">
463
+ <span>TripAdvisor</span>
464
+ </li>
465
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/trulia-img.png">
466
+ <span>Trulia</span>
467
+ </li>
468
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/trustedshops-img.png">
469
+ <span>TrustedShops</span>
470
+ </li>
471
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/trustpilot-img.png">
472
+ <span>Trustpilot</span>
473
+ </li>
474
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/trustradius-img.png">
475
+ <span>TrustRadius</span>
476
+ </li>
477
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/vitals-img.png">
478
+ <span>Vitals</span>
479
+ </li>
480
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/walmart-img.png">
481
+ <span>Walmart</span>
482
+ </li>
483
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/weddingwire-img.png">
484
+ <span>WeddingWire</span>
485
+ </li>
486
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/wish-img.png">
487
+ <span>Wish </span>
488
+ </li>
489
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/yelp-img.png">
490
+ <span>Yelp</span>
491
+ </li>
492
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/yellowpages-img.png">
493
+ <span>Yellow Pages</span>
494
+ </li>
495
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/zillow-img.png">
496
+ <span>Zillow</span>
497
+ </li>
498
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/zocdoc-img.png">
499
+ <span>ZocDoc</span>
500
+ </li>
501
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/zomato-img.png">
502
+ <span>Zomato</span>
503
+ </li>
504
+ <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/judge-me-img.png">
505
+ <span>Judge.me</span>
506
+ </li>
507
+ </ul>
508
+ </div>
509
+ <div class="saswp-rev-btn">
510
+ <span>With our API service, you can fetch reviews from anywhere you want! and we are always increasing the number of integrations. You can also request for an integration as well.</span>
511
+ <a target="_blank" href="https://structured-data-for-wp.com/reviews-for-schema">Get The Reviews Addon Now</a>
512
+ </div>
513
+ </div>';
514
+
515
+ break;
516
+
517
+ case 'saswp-google-place-section':
518
+
519
+ $location = '';
520
+
521
+ if(isset($settings['saswp_reviews_location_name']) && !empty($settings['saswp_reviews_location_name'])){
522
+
523
+ $rv_loc = $settings['saswp_reviews_location_name'];
524
+ $rv_blocks = isset($settings['saswp_reviews_location_blocks'])? $settings['saswp_reviews_location_blocks']:array();
525
+
526
+ $i=0;
527
+
528
+ foreach($rv_loc as $rvl){
529
+
530
+ if($rvl){
531
+
532
+ $blocks_fields = apply_filters('saswp_modify_blocks_field', '<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="5" step="5" placeholder="5" value="5" disabled="disabled">', isset($rv_blocks[$i])? $rv_blocks[$i]: 5);
533
+
534
+ $location .= '<tr>'
535
+ . '<td style="width:12%;"><strong>'.esc_html__( 'Place Id', 'schema-and-structured-data-for-wp' ).'</strong></td>'
536
+ . '<td style="width:20%;"><input class="saswp-g-location-field" name="sd_data[saswp_reviews_location_name][]" type="text" value="'. esc_attr($rvl).'"></td>'
537
+ . '<td style="width:10%;"><strong>'.esc_html__( 'Reviews', 'schema-and-structured-data-for-wp' ).'</strong></td>'
538
+ . '<td style="width:10%;">'.$blocks_fields.'</td>'
539
+ . '<td style="width:10%;"><a class="button button-default saswp-fetch-g-reviews">'.esc_html__( 'Fetch', 'schema-and-structured-data-for-wp' ).'</a></td>'
540
+ . '<td style="width:10%;"><a type="button" class="saswp-remove-review-item button">x</a></td>'
541
+ . '<td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td>'
542
+ . '</tr>';
543
+ }
544
+ $i++;
545
+ }
546
+
547
+ }
548
+
549
+ $reviews = '<div class="saswp-g-reviews-settings saswp-knowledge-label">'
550
+ . '<table class="saswp-g-reviews-settings-table" style="width:100%">'
551
+ . $location
552
+ . '</table>'
553
+ . '<div>'
554
+ . '<a class="button button-default saswp-add-g-location-btn">'.esc_html__( 'Add Location', 'schema-and-structured-data-for-wp' ).'</a>'
555
+ . '<p><a target="_blank" href="https://developers.google.com/maps/documentation/javascript/examples/places-placeid-finder">'.esc_html__( 'Place ID Finder', 'schema-and-structured-data-for-wp' ).'</a></p>'
556
+ . '</div>'
557
+ . '</div>';
558
+
559
+ $input = $reviews;
560
+
561
+ break;
562
+
563
+ case 'saswp-shopper-approved-section':
564
+
565
+ $reviews = '<div class="saswp-s-approved-reviews-settings saswp-knowledge-label">'
566
+ . '<table class="saswp-s-reviews-settings-table" style="width:100%">'
567
+ . '<tr>'
568
+ . '<td style="width:12%;"><strong>'.esc_html__( 'Site Id', 'schema-and-structured-data-for-wp' ).'</strong></td>'
569
+ . '<td style="width:10%;"><input class="saswp-g-location-field" id="saswp_s_approved_site_id" name="sd_data[saswp_s_approved_site_id]" type="text" value="'.$settings['saswp_s_approved_site_id'].'"></td>'
570
+ . '<td style="width:10%;"><strong>'.esc_html__( 'Token', 'schema-and-structured-data-for-wp' ).'</strong></td>'
571
+ . '<td style="width:20%;"><input class="saswp-g-blocks-field" id="saswp_s_approved_token" name="sd_data[saswp_s_approved_token]" type="text" value="'.$settings['saswp_s_approved_token'].'"></td>'
572
+ . '<td style="width:5%;"><strong>'.esc_html__( 'Reviews', 'schema-and-structured-data-for-wp' ).'</strong></td>'
573
+ . '<td style="width:15%;"><input class="saswp-g-blocks-field" id="saswp_s_approved_reviews" name="sd_data[saswp_s_approved_reviews]" type="number" min="1" max="500" value="'.$settings['saswp_s_approved_reviews'].'"></td>'
574
+ . '<td style="width:10%;"><a class="button button-default saswp-fetch-s-approved-reviews">'.esc_html__( 'Fetch', 'schema-and-structured-data-for-wp' ).'</a></td>'
575
+ . '<td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td>'
576
+ . '</tr>'
577
+ . '</table>'
578
+ . '<div>'
579
+ . '</div>'
580
+ . '</div>';
581
+
582
+ $input = $reviews;
583
+
584
+ break;
585
+
586
+
587
+ default:
588
+
589
+ $stng_meta_field = '';
590
+
591
+ if(isset($settings[$meta_field['id']])){
592
+
593
+ $stng_meta_field = $settings[$meta_field['id']];
594
+
595
+ }
596
+
597
+ $input = sprintf(
598
+ '<input class="%s" %s id="%s" name="%s" type="%s" value="%s" %s>',
599
+ $class,
600
+ $meta_field['type'] !== 'color' ? 'style="width: 100%"' : '',
601
+ esc_attr(saswp_remove_warnings($meta_field, 'id', 'saswp_string')),
602
+ esc_attr(saswp_remove_warnings($meta_field, 'name', 'saswp_string')),
603
+ esc_attr(saswp_remove_warnings($meta_field, 'type', 'saswp_string')),
604
+ esc_attr($stng_meta_field),
605
+ $attribute_str
606
+ );
607
+
608
+ break;
609
+ }
610
+
611
+
612
+
613
+ }
614
+ $reviews = $pro_api = $toggle_button = '';
615
+
616
+ if($meta_field['id'] == 'saswp_google_place_api_key'){
617
+
618
+ }
619
+
620
+ $allowed_html = saswp_expanded_allowed_tags();
621
+
622
+ if($meta_field['id'] == 'saswp-reviews-module-section'){
623
+ $output .= '<li class="saswp-rev-mod">'
624
+ . '<div class="saswp-knowledge-label">'.$label.'</div>'
625
+ . '<div class="saswp-knowledge-field">'.$input.'<p class="">'.$note.'</p></div>'
626
+
627
+ . '</li>';
628
+ }else{
629
+ $output .= '<li>'
630
+ . '<div class="saswp-knowledge-label">'.$label.'</div>'
631
+ . '<div class="saswp-knowledge-field">'.$input.'<p class="">'.$note.'</p></div>'
632
+
633
+ . '</li>';
634
+ }
635
+
636
+ }
637
+
638
+ echo '<div><div class="saswp-settings-list"><ul>' . wp_kses($output, $allowed_html) . '</ul></div></div>';
639
+ }
640
+ }
admin_section/js/main-script.js CHANGED
@@ -370,6 +370,7 @@ return false;
370
  || schematype == 'VideoObject'
371
  || schematype == 'local_business'
372
  || schematype == 'Product'
 
373
 
374
  ){
375
 
@@ -465,6 +466,7 @@ return false;
465
  || schematype == 'VideoObject'
466
  || schematype == 'local_business'
467
  || schematype == 'Product'
 
468
 
469
  ){
470
 
@@ -811,6 +813,15 @@ return false;
811
  }
812
  break;
813
 
 
 
 
 
 
 
 
 
 
814
  case 'saswp-realhomes-checkbox':
815
  saswp_compatibliy_notes(current, id);
816
  if ($(this).is(':checked')) {
@@ -1124,6 +1135,47 @@ return false;
1124
 
1125
  break;
1126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1127
  case 'saswp-strong-testimonials-checkbox':
1128
  saswp_compatibliy_notes(current, id);
1129
  if ($(this).is(':checked')) {
370
  || schematype == 'VideoObject'
371
  || schematype == 'local_business'
372
  || schematype == 'Product'
373
+ || schematype == 'Review'
374
 
375
  ){
376
 
466
  || schematype == 'VideoObject'
467
  || schematype == 'local_business'
468
  || schematype == 'Product'
469
+ || schematype == 'Review'
470
 
471
  ){
472
 
813
  }
814
  break;
815
 
816
+ case 'saswp-wpresidence-checkbox':
817
+ saswp_compatibliy_notes(current, id);
818
+ if ($(this).is(':checked')) {
819
+ $("#saswp-wpresidence").val(1);
820
+ }else{
821
+ $("#saswp-wpresidence").val(0);
822
+ }
823
+ break;
824
+
825
  case 'saswp-realhomes-checkbox':
826
  saswp_compatibliy_notes(current, id);
827
  if ($(this).is(':checked')) {
1135
 
1136
  break;
1137
 
1138
+ case 'saswp-ampwp-checkbox':
1139
+
1140
+ saswp_compatibliy_notes(current, id);
1141
+ if ($(this).is(':checked')) {
1142
+ $("#saswp-ampwp").val(1);
1143
+ }else{
1144
+ $("#saswp-ampwp").val(0);
1145
+ }
1146
+
1147
+ break;
1148
+
1149
+ case 'saswp-wp-event-aggregator-checkbox':
1150
+ saswp_compatibliy_notes(current, id);
1151
+ if ($(this).is(':checked')) {
1152
+ $("#saswp-wp-event-aggregator").val(1);
1153
+ }else{
1154
+ $("#saswp-wp-event-aggregator").val(0);
1155
+ }
1156
+
1157
+ break;
1158
+
1159
+ case 'saswp-easy-recipe-checkbox':
1160
+ saswp_compatibliy_notes(current, id);
1161
+ if ($(this).is(':checked')) {
1162
+ $("#saswp-easy-recipe").val(1);
1163
+ }else{
1164
+ $("#saswp-easy-recipe").val(0);
1165
+ }
1166
+
1167
+ break;
1168
+
1169
+ case 'saswp-tevolution-events-checkbox':
1170
+ saswp_compatibliy_notes(current, id);
1171
+ if ($(this).is(':checked')) {
1172
+ $("#saswp-tevolution-events").val(1);
1173
+ }else{
1174
+ $("#saswp-tevolution-events").val(0);
1175
+ }
1176
+
1177
+ break;
1178
+
1179
  case 'saswp-strong-testimonials-checkbox':
1180
  saswp_compatibliy_notes(current, id);
1181
  if ($(this).is(':checked')) {
admin_section/js/main-script.min.js CHANGED
@@ -1 +1 @@
1
- var saswp_attached_rv=[];jQuery(document).ready(function(s){if(s(document).on("click",".saswp-attach-reviews",function(){s(".saswp-enable-append-reviews").is(":checked")?(tb_show("Attach reviews to this schema type","#TB_inline??width=615&height=400&inlineId=saswp-embed-code-div"),s(document).find("#TB_window").width(600).height(415).css({top:"200px","margin-top":"0px"}),s(".saswp-attached-rv-count").show()):s(".saswp-attached-rv-count").hide()}),s("#saswp_attahced_reviews").val()&&(saswp_attached_rv=JSON.parse(s("#saswp_attahced_reviews").val())),s(document).on("click",".saswp-attach-rv-checkbox",function(){var e;e=parseInt(s(this).parent().attr("review-id")),s(this).is(":checked")?saswp_attached_rv.push(e):saswp_attached_rv.splice(saswp_attached_rv.indexOf(e),1),s(".saswp-attached-rv-count").text(saswp_attached_rv.length+" Reviews Attached"),s("#saswp_attahced_reviews").val(JSON.stringify(saswp_attached_rv))}),s(".saswp-load-more-rv").on("click",function(e){var a=s(".saswp-add-rv-loop").length,t=a/10+1;s("#saswp-add-rv-automatic .spinner").addClass("is-active"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_get_reviews_on_load",offset:a,paged:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){var a="";e.result&&(s.each(e.result,function(s,e){var t="";saswp_attached_rv.includes(parseInt(e.saswp_review_id))&&(t="checked"),a+='<div class="saswp-add-rv-loop" review-id="'+e.saswp_review_id+'">',a+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+t+"> <strong> "+e.saswp_reviewer_name+" ( Rating - "+e.saswp_review_rating+' ) <span class="saswp-g-plus"><img src="'+e.saswp_review_platform_icon+'"/></span></strong>',a+="</div>"}),s(".saswp-add-rv-automatic-list").append(a)),e.message&&(s(".saswp-rv-not-found").removeClass("saswp_hide"),s(".saswp-load-more-rv").addClass("saswp_hide"))}else alert(e.message);s("#saswp-add-rv-automatic .spinner").removeClass("is-active")},"json")}),s(".saswp-modify-schema-toggle").click(function(e){e.preventDefault(),s(".saswp-modify-container").slideToggle("300");var a=s("#saswp_enable_custom_field"),t=a.val();a.val("1"===t?"0":"1"),s(".saswp-enable-modify-schema-output").change()}),s(".saswp-enable-itemlist").change(function(){s(this).is(":checked")?(s("#saswp_item_list_tags").show(),s(".saspw-item-list-note").show(),"custom"==s("#saswp_item_list_tags").val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()):(s(".saspw-item-list-note").hide(),s("#saswp_item_list_tags").hide(),s("#saswp_item_list_custom").hide())}),s("#saswp_item_list_tags").change(function(){"custom"==s(this).val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()}),s(document).on("click",".saswp-add-g-location-btn",function(e){var a="";a=s("#saswp_google_place_api_key").length?'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="5" step="5" placeholder="5" disabled="disabled">':'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="10" step="10" placeholder="10">',e.preventDefault();var t="";(t+='<tr><td style="width:12%;"><strong>Place Id</strong></td><td style="width:20%;"><input class="saswp-g-location-field" name="sd_data[saswp_reviews_location_name][]" type="text" value=""></td><td style="width:10%;"><strong>Reviews</strong></td><td style="width:10%;">'+a+'</td><td style="width:10%;"><a class="button button-default saswp-fetch-g-reviews">Fetch</a></td><td style="width:10%;"><a type="button" class="saswp-remove-review-item button">x</a></td><td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td></tr>')&&s(".saswp-g-reviews-settings-table").append(t)}),s(document).on("click",".saswp-fetch-g-reviews",function(){var e=s(this),a="free";e.addClass("updating-message");var t=s(this).parent().parent().find(".saswp-g-location-field").val(),i=s(this).parent().parent().find(".saswp-g-blocks-field").val(),o=s("#saswp_google_place_api_key").val(),p=s("#reviews_addon_license_key").val(),c=s("#reviews_addon_license_key_status").val();if("premium"==(a=s("#saswp_google_place_api_key").length?"free":"premium")){if(!(i>0))return alert("Blocks value is zero"),e.removeClass("updating-message"),!1;if(0!=i%10)return e.parent().parent().find(".saswp-rv-fetched-msg").text("Reviews count should be in step of 10"),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b"),e.removeClass("updating-message"),!1}""!=t&&(p||o)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_fetch_google_reviews",reviews_api_status:c,reviews_api:p,location:t,blocks:i,g_api:o,premium_status:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){"t"==s.status?(e.parent().parent().find(".saswp-rv-fetched-msg").text("Success"),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","green")):(e.parent().parent().find(".saswp-rv-fetched-msg").text(s.message),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b")),e.removeClass("updating-message")},error:function(s){console.log(s)}}):(""==t&&alert("Please enter place id"),""==o&&alert("Please enter api key"),""==p&&alert("Please enter reviews api key"),e.removeClass("updating-message"))}),saswp_localize_data.do_tour){var e,a="<h3>Thanks for using Structured Data!</h3>";a+="<p>Do you want the latest on <b>Structured Data update</b> before others and some best resources on monetization in a single email? - Free just for users of Structured Data!</p>",a+='<style type="text/css">',a+=".wp-pointer-buttons{ padding:0; overflow: hidden; }",a+=".wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #afw_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }",a+="</style>",a+='<div id="afw_mc_embed_signup">',a+='<form action="//app.mailerlite.com/webforms/submit/z7t4b8" data-id="258182" data-code="z7t4b8" method="POST" target="_blank">',a+='<div id="afw_mc_embed_signup_scroll">',a+='<div class="afw-mc-field-group" style=" margin-left: 15px; width: 195px; float: left;">',a+='<input type="text" name="fields[name]" class="form-control" placeholder="Name" hidden value="'+saswp_localize_data.current_user_name+'" style="display:none">',a+='<input type="text" value="'+saswp_localize_data.current_user_email+'" name="fields[email]" class="form-control" placeholder="Email*" style=" width: 180px; padding: 6px 5px;">',a+='<input type="text" name="fields[company]" class="form-control" placeholder="Website" hidden style=" display:none; width: 168px; padding: 6px 5px;" value="'+saswp_localize_data.get_home_url+'">',a+='<input type="hidden" name="ml-submit" value="1" />',a+="</div>",a+='<div id="mce-responses">',a+='<div class="response" id="mce-error-response" style="display:none"></div>',a+='<div class="response" id="mce-success-response" style="display:none"></div>',a+="</div>",a+='<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_a631df13442f19caede5a5baf_c9a71edce6" tabindex="-1" value=""></div>',a+='<input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">',a+="</div>",a+="</form>";var t={content:a+="</div>",position:{edge:"top",align:"left"}};e=function(){s(saswp_localize_data.displayID).pointer(t).pointer("open"),saswp_localize_data.button2&&(jQuery("#pointer-close").after('<a id="pointer-primary" class="button-primary">'+saswp_localize_data.button2+"</a>"),jQuery("#pointer-primary").click(function(){saswp_localize_data.function_name}),jQuery("#pointer-close").click(function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})}))},(t=s.extend(t,{buttons:function(s,e){return button=jQuery('<a id="pointer-close" class="button-secondary">'+saswp_localize_data.button1+"</a>"),button_2=jQuery("#pointer-close.button"),button.bind("click.pointer",function(){e.element.pointer("close")}),button_2.on("click",function(){e.element.pointer("close")}),button},close:function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})},show:function(s,e){e.pointer.css({left:"170px",top:"160px"})}})).position&&t.position.defer_loading?s(window).bind("load.wp-pointers",e):e()}s(".saswp-tabs a").click(function(e){var a=s(this).attr("href"),t=getParameterByName("tab",a);return t||(t="general"),s(this).siblings().removeClass("nav-tab-active"),s(this).addClass("nav-tab-active"),s(".form-wrap").find(".saswp-"+t).siblings().hide(),s(".form-wrap .saswp-"+t).show(),window.history.pushState("","",a),!1}),s(".saswp-schame-type-select").change(function(e){e.preventDefault(),s(".saswp-custom-fields-table").html("");var a=s(this).val();s(".saswp-option-table-class tr").each(function(e,a){e>0&&s(this).hide()}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-option-table-class tr").eq(1).show(),s(".saswp-business-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".select-post-type").val("show_globally").trigger("change")),"Service"==a&&(s(".saswp-service-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-item-reivewed-list").change()),saswp_enable_rating_review(),s(".saswp-manual-modification").html(""),s(".saswp-static-container .spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_manual_fields_on_ajax",schema_type:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-static-container .spinner").removeClass("is-active"),s(".saswp-manual-modification").append(e),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_item_reviewed_call()}),"HowTo"==a||"local_business"==a||"FAQ"==a?s(".saswp-enable-modify-schema").show():(s(".saswp-enable-modify-schema-output").val("automatic"),s(".saswp-enable-modify-schema-output").change(),s(".saswp-enable-modify-schema").hide())}),s("#saswp_business_type").change(function(){var e=s(this).val(),a=s(".saswp-schame-type-select").val();s(".saswp-option-table-class tr").each(function(e,a){e>1&&(s(this).hide(),s(this).find(".saswp-local-sub-type-2").attr("disabled",!0))}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-"+e+"-tr").show(),s(".saswp-business-text-field-tr").show(),s(".saswp-"+e+"-tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-review-text-field-tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),saswp_enable_rating_review()}).change(),s(".saswp-checkbox").change(function(){var e=s(this).attr("id"),a=s(this);switch(e){case"saswp-the-seo-framework-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-seo-framework").val(1):s("#saswp-the-seo-framework").val(0);break;case"saswp-seo-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-seo-press").val(1):s("#saswp-seo-press").val(0);break;case"saswp-aiosp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-aiosp").val(1):s("#saswp-aiosp").val(0);break;case"saswp-smart-crawl-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-smart-crawl").val(1):s("#saswp-smart-crawl").val(0);break;case"saswp-squirrly-seo-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-squirrly-seo").val(1):s("#saswp-squirrly-seo").val(0);break;case"saswp-wp-recipe-maker-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-recipe-maker").val(1):s("#saswp-wp-recipe-maker").val(0);break;case"saswp-wp-ultimate-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-ultimate-recipe").val(1):s("#saswp-wp-ultimate-recipe").val(0);break;case"saswp-zip-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-zip-recipes").val(1):s("#saswp-zip-recipes").val(0);break;case"saswp-mediavine-create-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-mediavine-create").val(1):s("#saswp-mediavine-create").val(0);break;case"saswp-ht-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ht-recipes").val(1):s("#saswp-ht-recipes").val(0);break;case"saswp-wpsso-core-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpsso-core").val(1):s("#saswp-wpsso-core").val(0);break;case"saswp-for-wordpress-checkbox":s(this).is(":checked")?s("#saswp-for-wordpress").val(1):s("#saswp-for-wordpress").val(0);break;case"saswp-for-amp-checkbox":s(this).is(":checked")?s("#saswp-for-amp").val(1):s("#saswp-for-amp").val(0);break;case"saswp_kb_contact_1_checkbox":s(this).is(":checked")?(s("#saswp_kb_contact_1").val(1),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").removeClass("saswp-display-none")):(s("#saswp_kb_contact_1").val(0),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").addClass("saswp-display-none"));break;case"saswp-logo-dimensions-check":s(this).is(":checked")?(s("#saswp-logo-dimensions").val(1),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").show()):(s("#saswp-logo-dimensions").val(0),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").hide());break;case"saswp_archive_schema_checkbox":s(this).is(":checked")?(s("#saswp_archive_schema").val(1),s(".saswp_archive_schema_type_class").parent().parent().show()):(s("#saswp_archive_schema").val(0),s(".saswp_archive_schema_type_class").parent().parent().hide());break;case"saswp_website_schema_checkbox":s(this).is(":checked")?(s("#saswp_website_schema").val(1),s("#saswp_search_box_schema").parent().parent().show()):(s("#saswp_website_schema").val(0),s("#saswp_search_box_schema").parent().parent().hide());break;case"saswp_search_box_schema_checkbox":s(this).is(":checked")?s("#saswp_search_box_schema").val(1):s("#saswp_search_box_schema").val(0);break;case"saswp_breadcrumb_schema_checkbox":s(this).is(":checked")?s("#saswp_breadcrumb_schema").val(1):s("#saswp_breadcrumb_schema").val(0);break;case"saswp_comments_schema_checkbox":s(this).is(":checked")?s("#saswp_comments_schema").val(1):s("#saswp_comments_schema").val(0);break;case"saswp-compativility-checkbox":s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-review-module-checkbox":s(this).is(":checked")?s("#saswp-review-module").val(1):s("#saswp-review-module").val(0);break;case"saswp-kk-star-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-kk-star-raring").val(1):s("#saswp-kk-star-raring").val(0);break;case"saswp-woocommerce-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce").val(1):s("#saswp-woocommerce").val(0);break;case"saswp-default-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp_default_review").val(1):s("#saswp_default_review").val(0);break;case"saswp-extra-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-extra").val(1):s("#saswp-extra").val(0);break;case"saswp-soledad-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-soledad").val(1):s("#saswp-soledad").val(0);break;case"saswp-dw-question-answer-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-dw-question-answer").val(1):s("#saswp-dw-question-answer").val(0);break;case"saswp-wp-job-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-job-manager").val(1):s("#saswp-wp-job-manager").val(0);break;case"saswp-yoast-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yoast").val(1):s("#saswp-yoast").val(0);break;case"saswp-rankmath-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-rankmath").val(1):s("#saswp-rankmath").val(0);break;case"saswp-tagyeem-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-tagyeem").val(1):s("#saswp-tagyeem").val(0);break;case"saswp-the-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-events-calendar").val(1):s("#saswp-the-events-calendar").val(0);break;case"saswp-homeland-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-homeland").val(1):s("#saswp-homeland").val(0);break;case"saswp-realhomes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realhomes").val(1):s("#saswp-realhomes").val(0);break;case"saswp-learn-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-press").val(1):s("#saswp-learn-press").val(0);break;case"saswp-learn-dash-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-dash").val(1):s("#saswp-learn-dash").val(0);break;case"saswp-lifter-lms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-lifter-lms").val(1):s("#saswp-lifter-lms").val(0);break;case"saswp-wp-event-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-manager").val(1):s("#saswp-wp-event-manager").val(0);break;case"saswp-events-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-events-manager").val(1):s("#saswp-events-manager").val(0);break;case"saswp-event-calendar-wd-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-calendar-wd").val(1):s("#saswp-event-calendar-wd").val(0);break;case"saswp-event-organiser-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-organiser").val(1):s("#saswp-event-organiser").val(0);break;case"saswp-modern-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-modern-events-calendar").val(1):s("#saswp-modern-events-calendar").val(0);break;case"saswp-woocommerce-booking-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking").val(1),s("#saswp-woocommerce-booking-main").val(1)):(s("#saswp-woocommerce-booking").val(0),s("#saswp-woocommerce-booking-main").val(0));break;case"saswp-woocommerce-booking-main-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking-main").val(1),s("#saswp-woocommerce-booking").val(1)):(s("#saswp-woocommerce-booking-main").val(0),s("#saswp-woocommerce-booking").val(0));break;case"saswp-woocommerce-membership-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce-membership").val(1):s("#saswp-woocommerce-membership").val(0);break;case"saswp-defragment-checkbox":s(this).is(":checked")?s("#saswp-defragment").val(1):s("#saswp-defragment").val(0);break;case"saswp-cooked-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-cooked").val(1):s("#saswp-cooked").val(0);break;case"saswp-flexmlx-compativility-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-shopper-approved-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-shopper-approved-review").val(1),s(".saswp-s-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-shopper-approved-review").val(0),s(".saswp-s-reviews-settings-table").parent().parent().parent().hide());break;case"saswp-google-review-checkbox":s(this).is(":checked")?(s("#saswp-google-review").val(1),s("#saswp-google-rv-free-checkbox").length?(s("#saswp-google-review-free").parent().parent().show(),s("#saswp-google-rv-free-checkbox").is(":checked")?s("#saswp_google_place_api_key").parent().parent().show():s("#saswp_google_place_api_key").parent().parent().hide()):s("#saswp_google_place_api_key").parent().parent().show(),s(".saswp-g-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-google-review").val(0),s("#saswp_google_place_api_key").parent().parent().hide(),s(".saswp-g-reviews-settings-table").parent().parent().parent().hide(),s("#saswp-google-rv-free-checkbox").length&&s("#saswp-google-review-free").parent().parent().hide());break;case"saswp-google-rv-free-checkbox":s("#saswp-google-review-checkbox").is(":checked")&&s(this).is(":checked")?(s("#saswp-google-review-free").val(1),s("#saswp_google_place_api_key").parent().parent().show()):(s("#saswp-google-review-free").val(0),s("#saswp_google_place_api_key").parent().parent().hide());break;case"saswp-markup-footer-checkbox":s(this).is(":checked")?s("#saswp-markup-footer").val(1):s("#saswp-markup-footer").val(0);break;case"saswp-pretty-print-checkbox":s(this).is(":checked")?s("#saswp-pretty-print").val(1):s("#saswp-pretty-print").val(0);break;case"saswp-wppostratings-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wppostratings-raring").val(1):s("#saswp-wppostratings-raring").val(0);break;case"saswp-bbpress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-bbpress").val(1):s("#saswp-bbpress").val(0);break;case"saswp-microdata-cleanup-checkbox":s(this).is(":checked")?s("#saswp-microdata-cleanup").val(1):s("#saswp-microdata-cleanup").val(0);break;case"saswp-other-images-checkbox":s(this).is(":checked")?s("#saswp-other-images").val(1):s("#saswp-other-images").val(0);break;case"saswp-easy-testimonials-checkbox":s(this).is(":checked")?s("#saswp-easy-testimonials").val(1):s("#saswp-easy-testimonials").val(0);break;case"saswp-testimonial-pro-checkbox":s(this).is(":checked")?s("#saswp-testimonial-pro").val(1):s("#saswp-testimonial-pro").val(0);break;case"saswp-bne-testimonials-checkbox":s(this).is(":checked")?s("#saswp-bne-testimonials").val(1):s("#saswp-bne-testimonials").val(0);break;case"saswp-ampforwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampforwp").val(1):s("#saswp-ampforwp").val(0);break;case"saswp-ampbyautomatic-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampbyautomatic").val(1):s("#saswp-ampbyautomatic").val(0);break;case"saswp-strong-testimonials-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-strong-testimonials").val(1):s("#saswp-strong-testimonials").val(0);break;case"saswp-wordlift-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordlift").val(1):s("#saswp-wordlift").val(0);break;case"saswp-betteramp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-betteramp").val(1):s("#saswp-betteramp").val(0);break;case"saswp-wpamp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpamp").val(1):s("#saswp-wpamp").val(0)}}).change(),s("#saswp_kb_type").change(function(){var e=s(this).val();s(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().addClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide"),"Organization"==e&&(s(".saswp_org_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide")),"Person"==e&&(s(".saswp_org_fields").parent().parent().addClass("saswp_hide"),s(".saswp_person_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().removeClass("saswp_hide"))}).change(),s(document).on("click","input[data-id=media]",function(e){e.preventDefault();var a=s(this),t=a.attr("id").replace("_button",""),i=wp.media({title:"Application Icon",button:{text:"Select Icon"},multiple:!1,library:{type:"image"}}).on("select",function(){var e=i.state().get("selection").first().toJSON();s("#"+t).val(e.url),s("input[data-id='"+t+"_id']").val(e.id),s("input[data-id='"+t+"_height']").val(e.height),s("input[data-id='"+t+"_width']").val(e.width),s("input[data-id='"+t+"_thumbnail']").val(e.url),"sd_default_image_button"===a.attr("id")&&(s("#sd_default_image_width").val(e.width),s("#sd_default_image_height").val(e.height));var o="";"saswp_image_div_"+t=="saswp_image_div_sd_default_image"&&e.height<1200&&(o='<p class="saswp_warning">Image size is smaller than recommended size</p>'),s(".saswp_image_div_"+t).html('<div class="saswp_image_thumbnail"><img class="saswp_image_prev" src="'+e.url+'"/><a data-id="'+t+'" href="#" class="saswp_prev_close">X</a></div>'+o)}).open()}),s(document).on("click",".saswp_prev_close",function(e){e.preventDefault();var a=s(this).attr("data-id");s(this).parent().remove(),s("#"+a).val(""),s("input[data-id='"+a+"_id']").val(""),s("input[data-id='"+a+"_height']").val(""),s("input[data-id='"+a+"_width']").val(""),s("input[data-id='"+a+"_thumbnail']").val(""),"sd_default_image"===a&&(s("#sd_default_image_width").val(""),s("#sd_default_image_height").val(""))}),s(document).on("change",".saswp-schema-type-toggle",function(e){var a=s(this).attr("data-schema-id"),t=s(this).attr("data-post-id");if(s(this).is(":checked"))var i=1;else i=0;s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_enable_disable_schema_on_post",status:i,schema_id:a,post_id:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-reset-data",function(e){e.preventDefault(),1==confirm("Are you sure?")&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_reset_all_settings",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){setTimeout(function(){location.reload()},1e3)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp_license_activation",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("license-status"),i=s(this).attr("add-on"),o=s("#"+i+"_addon_license_key").val();t&&i&&o?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_license_status_check",license_key:o,license_status:t,add_on:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){s("#"+i+"_addon_license_key_status").val(e.status),"active"==e.status?(s(".saswp-"+i+"-dashicons").addClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").css("color","green"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","inactive"),s(".saswp_license_activation[add-on='"+i+"']").text("Deactivate"),s(".saswp_license_status_msg[add-on='"+i+"']").text("Activated"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","green"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)):(s(".saswp-"+i+"-dashicons").addClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").css("color","red"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","active"),s(".saswp_license_activation[add-on='"+i+"']").text("Activate"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","red"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)),a.removeClass("updating-message")},error:function(s){console.log(s)}}):(alert("Please enter value license key"),a.removeClass("updating-message"))}),s(".saswp-send-query").on("click",function(e){e.preventDefault();var a=s("#saswp_query_message").val(),t=s("#saswp_query_premium_cus").val();""!=s.trim(a)&&t?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_send_query_message",premium_cus:t,message:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){"t"==e.status?(s(".saswp-query-success").show(),s(".saswp-query-error").hide()):(s(".saswp-query-success").hide(),s(".saswp-query-error").show())},error:function(s){console.log(s)}}):""==s.trim(a)&&""==t?alert("Please enter the message and select customer type"):(""==t&&alert("Select Customer type"),""==s.trim(a)&&alert("Please enter the message"))}),s(".saswp-import-plugins").on("click",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id");s.get(ajaxurl,{action:"saswp_import_plugin_data",plugin_name:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status?(s(a).parent().find(".saswp-imported-message").text(e.message),s(a).parent().find(".saswp-imported-message").removeClass("saswp-error"),setTimeout(function(){location.reload()},2e3)):(s(a).parent().find(".saswp-imported-message").addClass("saswp-error"),s(a).parent().find(".saswp-imported-message").text(e.message)),a.removeClass("updating-message")},"json")}),s(".saswp-feedback-no-thanks").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_no_thanks",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(".saswp-feedback-remindme").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_remindme",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(document).on("change",".saswp-local-business-type-select",function(e){e.preventDefault();var a=s(this),t=s(this).val();s.get(ajaxurl,{action:"saswp_get_sub_business_ajax",business_type:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){s(".saswp-local-business-name-select").parents("tr").remove();var t=a.parents(".saswp-post-specific-wrapper").attr("data-id"),i='<tr><th><label for="saswp_business_name_'+t+'">Sub Business Type</label></th>';i+='<td><select class="saswp-local-business-name-select" id="saswp_business_name_'+t+'" name="saswp_business_name_'+t+'">',s.each(e.result,function(s,e){i+='<option value="'+s+'">'+e+"</option>"}),i+="</select></td>",i+="</tr>",a.parents(".form-table tr:first").after(i)}else s(".saswp-local-business-name-select").parents("tr").remove()},"json")}),saswp_item_reviewed_call(),s(".saswp-local-schema-time-picker").timepicker({timeFormat:"H:i:s"}),s(document).on("click",".saswp-add-custom-schema",function(e){e.preventDefault(),s(".saswp-add-custom-schema-field").removeClass("saswp_hide"),s(this).hide()}),s(document).on("click",".saswp-delete-custom-schema",function(e){e.preventDefault(),s("#saswp_custom_schema_field").val(""),s(".saswp-add-custom-schema-field").addClass("saswp_hide"),s(".saswp-add-custom-schema").show()}),s(".saswp-modify_schema_post_enable").on("click",function(e){var a=s(this);a.addClass("updating-message"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_modify_schema_post_enable",post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){a.remove(),s(".saswp-add-custom-schema-div").remove(),s("#post_specific .inside").append(e),a.removeClass("updating-message"),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_enable_rating_review(),saswp_item_reviewed_call()})}),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_reviews_datepicker(),s(document).on("click",".saswp-add-more-item",function(e){e.preventDefault();s(".saswp-review-item-list-table").append('<tr class="saswp-review-item-tr"><td>Review Item Feature</td><td><input type="text" name="saswp-review-item-feature[]"></td><td>Rating</td><td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]"></td><td><a type="button" class="saswp-remove-review-item button">x</a></td></tr>')}),s(document).on("click",".saswp-remove-review-item",function(e){e.preventDefault(),s(this).parent().parent("tr").remove()}),s(document).on("focusout",".saswp-review-item-tr input[type=number]",function(e){e.preventDefault();var a=0,t=s(".saswp-review-item-tr input[type=number]").length;s(".saswp-review-item-tr input[type=number]").each(function(e,t){""==s(t).val()?a+=parseFloat(0):a+=parseFloat(s(t).val())});var i=a/t;s("#saswp-review-item-over-all").val(i)}),s("#saswp-review-location").change(function(){var e=s(this).val();s(".saswp-review-shortcode").addClass("saswp_hide"),3==e&&s(".saswp-review-shortcode").removeClass("saswp_hide")}).change(),s("#saswp-review-item-enable").change(function(){s(this).is(":checked")?s(".saswp-review-fields").show():s(".saswp-review-fields").hide()}).change(),s(document).on("click",".saswp-restore-post-schema",function(e){e.preventDefault();var a=s(this);if(a.addClass("updating-message"),s(".saswp-post-specific-schema-ids").val())var t=JSON.parse(s(".saswp-post-specific-schema-ids").val());s.post(ajaxurl,{action:"saswp_restore_schema",schema_ids:t,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){"t"==s.status?setTimeout(function(){location.reload()},1e3):(alert(s.msg),setTimeout(function(){location.reload()},1e3)),a.removeClass("updating-message")},"json")}),s(document).on("click","div.saswp-tab ul.saswp-tab-nav a",function(e){e.preventDefault();var a=s(this).attr("data-id");s(".saswp-post-specific-wrapper").hide(),s("#"+a).show(),s("div.saswp-tab ul.saswp-tab-nav a").removeClass("selected"),s("div.saswp-tab ul.saswp-tab-nav li").removeClass("selected"),s(this).addClass("selected"),s(this).parent().addClass("selected"),saswp_enable_rating_review()}),s("#saswp-global-tabs a:first").addClass("saswp-global-selected"),s(".saswp-global-container").hide(),"#saswp-default-container"==window.location.hash?s(".saswp-global-container:eq(2)").show():s(".saswp-global-container:first").show(),s("#saswp-global-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-global-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-global-container").hide(),s("#"+e).show())}),s("#saswp-tools-tabs a:first").addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s(".saswp-tools-container:first").show(),s("#saswp-tools-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-tools-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s("#"+e).show())}),s("#saswp-review-tabs a:first").addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s(".saswp-review-container:first").show(),s("#saswp-review-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-review-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s("#"+e).show())}),s("#saswp-compatibility-tabs a:first").addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s(".saswp-compatibility-container:first").show(),s("#saswp-compatibility-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-compatibility-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s("#"+e).show())}),s('a[href="'+saswp_localize_data.new_url_selector+'"]').attr("href",saswp_localize_data.new_url_href),s(".saswp-enable-modify-schema-output").on("change",function(){s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide"),"manual"==s(this).val()&&(s(".saswp-static-container").removeClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide")),"automatic"==s(this).val()&&(s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").removeClass("saswp_hide"))}),s(document).on("change",".saswp-custom-fields-name",function(){var e="text",a=s(this).parent().parent("tr"),t=s(this).val();-1==t.indexOf("_image")&&-1==t.indexOf("_logo")||(e="image");var i=s(this).parent().parent("tr").find("td:eq(1)");saswp_get_meta_list(null,e,null,i,t,a)}),s(document).on("click",".saswp-skip-button",function(e){e.preventDefault(),s(this).parent().parent().hide(),s.post(ajaxurl,{action:"saswp_skip_wizard",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){},"json")}),s(document).on("click",".saswp_add_schema_fields_on_fly",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id"),i=s(this).attr("fields_type"),o=s(this).attr("div_type"),p=s("saswp_specific_"+t+" , .saswp-"+o+"-table-div").length,c=s("saswp_specific_"+t+" , .saswp-"+o+"-table-div:nth-child("+p+")").attr("data-id");(c=++c)||(c=0),saswp_get_post_specific_schema_fields(a,c,i,o,t,i+"_")}),s(document).on("click",".saswp-table-close",function(){s(this).parent().remove()}),s(document).on("click",".saswp-rmv-modify_row",function(e){e.preventDefault(),s(this).parent().parent().remove()}),s(document).on("change",".saswp-custom-meta-list",function(){var e=s(this),a=s("select#schema_type option:selected").val(),t=s(this).val(),i=s(this).parent().parent("tr").find(".saswp-custom-fields-name").val(),o="",p=a.toLowerCase()+"_"+i,c="saswp_fixed_image["+i+"]";"manual_text"==t?(o+='<td><input type="text" name="saswp_fixed_text['+i+']"></td>',o+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(o),saswpCustomSelect2()):"taxonomy_term"==t?saswp_taxonomy_term.taxonomy?(o+=saswp_taxonomy_term_html(saswp_taxonomy_term.taxonomy,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(o),saswpCustomSelect2()):s.get(ajaxurl,{action:"saswp_get_taxonomy_term_list",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){s&&(saswp_taxonomy_term.taxonomy=s,o+=saswp_taxonomy_term_html(s,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(o),saswpCustomSelect2())},"json"):"custom_field"==t?(o+='<td><select class="saswp-custom-fields-select2" name="saswp_custom_meta_field['+i+']">',o+="</select></td>",o+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(o),saswpCustomSelect2()):"fixed_image"==t?(o+="<td>",o+="<fieldset>",o+='<input data-id="media" style="width: 30%;" class="button" id="'+p+'_button" name="'+p+'_button" type="button" value="Upload" />',o+='<input type="hidden" data-id="'+p+'_height" class="upload-height" name="'+c+'[height]" id="'+p+'_height" value="">',o+='<input type="hidden" data-id="'+p+'_width" class="upload-width" name="'+c+'[width]" id="'+p+'_width" value="">',o+='<input type="hidden" data-id="'+p+'_thumbnail" class="upload-thumbnail" name="'+c+'[thumbnail]" id="'+p+'_thumbnail" value="">',o+='<div class="saswp_image_div_'+p+'">',o+="</div>",o+="</fieldset>",o+="</td>",o+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(o),saswpCustomSelect2()):(o+="<td></td>",o+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(o),saswpCustomSelect2())}),s(document).on("change",".saswp-item-reivewed-list",function(){s(".saswp-custom-fields-table").html(""),saswp_meta_list_fields=[];var e=s(this),a=s("select#schema_type option:selected").val();saswp_item_reviewed_ajax(a,e,"manual")}),s(document).on("click",".saswp-add-custom-fields",function(){var e=s(this);e.addClass("updating-message");var a=s("select#schema_type option:selected").val(),t="",i=null;"Review"==a&&(t=s("select.saswp-item-reivewed-list option:selected").val(),i="saswp_review_name");var o=s("#post_ID").val();""!=a&&(saswp_meta_list_fields[a]?saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null):s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_get_schema_type_fields",post_id:o,schema_type:a,schema_subtype:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){saswp_meta_list_fields[a]=s,saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null)},error:function(s){console.log(s)}}))}),saswpCustomSelect2(),saswp_enable_rating_review(),s('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr("href",saswp_localize_data.collection_post_add_new_url),s(document).on("click",".saswp_coonect_google_place",function(){var e=s("#saswp_google_place_id").val(),a=s("#saswp_language_list").val(),t=s("#saswp_googel_api").val();""!=e&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_connect_google_place",place_id:e,language:a,google_api:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){console.log(s.status)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-add-social-links",function(){s(".saswp-social-links-table").append('<tr><td><input type="text" placeholder="https://www.facebook.com/profile" name="sd_data[saswp_social_links][]" value=""></td><td><a class="button button-default saswp-rmv-modify_row">X</a></td></tr>')}),"saswp"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.saswp_settings_url+"' id='' class='page-title-action'>Settings</a>"),"saswp_reviews"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.collections_page_url+"' id='' class='page-title-action'>Collections</a>"),"undefined"!=typeof saswp_reviews_data&&s(".saswp-rating-div").rateYo({rating:saswp_reviews_data.rating_val,halfStar:!0,readOnly:saswp_reviews_data.readonly,onSet:function(e,a){s(this).next().val(e)}}),s("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){var e=s(this);e.parent().find(".saswp-phone-validation").remove();var a=s(this).val();/^\+([0-9]{1,3})\)?[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})$/.test(a)?e.parent().find(".saswp-phone-validation").remove():e.after('<span style="color:red;" class="saswp-phone-validation">Invalid Phone Number</span>')}),saswpCollectionSlider(),s(".saswp-accordion").click(function(){s(this).toggleClass("active"),s(this).next(".saswp-accordion-panel").slideToggle(200)}),s(document).on("click",".saswp-opn-cls-btn",function(){s("#saswp-reviews-cntn").toggle(),s("#saswp-reviews-cntn").is(":visible")?(s(".saswp-onclick-show").css("display","flex"),s(".saswp-onclick-hide").hide(),s(".saswp-open-class").css("width","500px")):(s(".saswp-onclick-show").css("display","none"),s(".saswp-onclick-hide").show(),s(".saswp-open-class").css("width","300px"))}),s(".saswp-collection-display-method").change(function(){"shortcode"==s(this).val()?s(".saswp-collection-shortcode").removeClass("saswp_hide"):s(".saswp-collection-shortcode").addClass("saswp_hide")}).change(),s(document).on("click",".saswp-remove-platform",function(e){e.preventDefault();var a=s(this).attr("platform-id");saswp_collection.splice(a,1),s(this).parent().remove(),saswp_on_collection_design_change()}),s(".saswp-number-change").bind("keyup mouseup",function(){saswp_on_collection_design_change()}),s(".saswp-coll-settings-options").change(function(){var e=s(".saswp-collection-desing").val();s(".saswp-coll-options").addClass("saswp_hide"),s(".saswp-collection-lp").css("height","auto"),"grid"==e&&s(".saswp-grid-options").removeClass("saswp_hide"),"gallery"==e&&s(".saswp-slider-options").removeClass("saswp_hide"),"fomo"==e&&(s(".saswp-fomo-options").removeClass("saswp_hide"),s(".saswp-collection-lp").css("height","31px")),"popup"==e&&s(".saswp-collection-lp").css("height","31px"),saswp_on_collection_design_change()}).change(),s(".saswp-add-to-collection").on("click",function(e){e.preventDefault();var a=s(this),t=s("#saswp-plaftorm-list").val(),i=s("#saswp-review-count").val();t&&i>0?(a.addClass("updating-message"),saswp_get_collection_data(i,t,a)):alert("Enter Count")});var i,o,p=s("#saswp_collection_id").val();p&&(s(".spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_collection_platforms",collection_id:p,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if(e.status){var a=e.message;s.each(a,function(s,e){saswp_get_collection_data(e,s,null)})}s(".spinner").removeClass("is-active")},"json")),(i=document.createElement("div")).style.cssText="position:absolute; background:black; color:white; padding:4px 6px;z-index:10000;border-radius:2px; font-size:12px;box-shadow:3px 3px 3px rgba(0,0,0,.4);opacity:0;transition:opacity 0.3s",i.innerHTML="Copied!",document.body.appendChild(i);var c=document.getElementById("motivatebox");c&&c.addEventListener("mouseup",function(s){var e=(s=s||event).target||s.srcElement;"motivate"==e.className&&(!function(s){var e=document.createRange();e.selectNodeContents(s);var a=window.getSelection();a.removeAllRanges(),a.addRange(e)}(e),function(){var s;try{s=document.execCommand("copy")}catch(e){s=!1}return s}()&&function(s){var e=s||event;clearTimeout(o),i.style.left=e.pageX-10+"px",i.style.top=e.pageY+15+"px",i.style.opacity=1,o=setTimeout(function(){i.style.opacity=0},500)}(s))},!1)});
1
+ var saswp_attached_rv=[];jQuery(document).ready(function(s){if(s(document).on("click",".saswp-attach-reviews",function(){s(".saswp-enable-append-reviews").is(":checked")?(tb_show("Attach reviews to this schema type","#TB_inline??width=615&height=400&inlineId=saswp-embed-code-div"),s(document).find("#TB_window").width(600).height(415).css({top:"200px","margin-top":"0px"}),s(".saswp-attached-rv-count").show()):s(".saswp-attached-rv-count").hide()}),s("#saswp_attahced_reviews").val()&&(saswp_attached_rv=JSON.parse(s("#saswp_attahced_reviews").val())),s(document).on("click",".saswp-attach-rv-checkbox",function(){var e;e=parseInt(s(this).parent().attr("review-id")),s(this).is(":checked")?saswp_attached_rv.push(e):saswp_attached_rv.splice(saswp_attached_rv.indexOf(e),1),s(".saswp-attached-rv-count").text(saswp_attached_rv.length+" Reviews Attached"),s("#saswp_attahced_reviews").val(JSON.stringify(saswp_attached_rv))}),s(".saswp-load-more-rv").on("click",function(e){var a=s(".saswp-add-rv-loop").length,t=a/10+1;s("#saswp-add-rv-automatic .spinner").addClass("is-active"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_get_reviews_on_load",offset:a,paged:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){var a="";e.result&&(s.each(e.result,function(s,e){var t="";saswp_attached_rv.includes(parseInt(e.saswp_review_id))&&(t="checked"),a+='<div class="saswp-add-rv-loop" review-id="'+e.saswp_review_id+'">',a+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+t+"> <strong> "+e.saswp_reviewer_name+" ( Rating - "+e.saswp_review_rating+' ) <span class="saswp-g-plus"><img src="'+e.saswp_review_platform_icon+'"/></span></strong>',a+="</div>"}),s(".saswp-add-rv-automatic-list").append(a)),e.message&&(s(".saswp-rv-not-found").removeClass("saswp_hide"),s(".saswp-load-more-rv").addClass("saswp_hide"))}else alert(e.message);s("#saswp-add-rv-automatic .spinner").removeClass("is-active")},"json")}),s(".saswp-modify-schema-toggle").click(function(e){e.preventDefault(),s(".saswp-modify-container").slideToggle("300");var a=s("#saswp_enable_custom_field"),t=a.val();a.val("1"===t?"0":"1"),s(".saswp-enable-modify-schema-output").change()}),s(".saswp-enable-itemlist").change(function(){s(this).is(":checked")?(s("#saswp_item_list_tags").show(),s(".saspw-item-list-note").show(),"custom"==s("#saswp_item_list_tags").val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()):(s(".saspw-item-list-note").hide(),s("#saswp_item_list_tags").hide(),s("#saswp_item_list_custom").hide())}),s("#saswp_item_list_tags").change(function(){"custom"==s(this).val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()}),s(document).on("click",".saswp-add-g-location-btn",function(e){var a="";a=s("#saswp_google_place_api_key").length?'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="5" step="5" placeholder="5" disabled="disabled">':'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="10" step="10" placeholder="10">',e.preventDefault();var t="";(t+='<tr><td style="width:12%;"><strong>Place Id</strong></td><td style="width:20%;"><input class="saswp-g-location-field" name="sd_data[saswp_reviews_location_name][]" type="text" value=""></td><td style="width:10%;"><strong>Reviews</strong></td><td style="width:10%;">'+a+'</td><td style="width:10%;"><a class="button button-default saswp-fetch-g-reviews">Fetch</a></td><td style="width:10%;"><a type="button" class="saswp-remove-review-item button">x</a></td><td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td></tr>')&&s(".saswp-g-reviews-settings-table").append(t)}),s(document).on("click",".saswp-fetch-g-reviews",function(){var e=s(this),a="free";e.addClass("updating-message");var t=s(this).parent().parent().find(".saswp-g-location-field").val(),i=s(this).parent().parent().find(".saswp-g-blocks-field").val(),p=s("#saswp_google_place_api_key").val(),o=s("#reviews_addon_license_key").val(),c=s("#reviews_addon_license_key_status").val();if("premium"==(a=s("#saswp_google_place_api_key").length?"free":"premium")){if(!(i>0))return alert("Blocks value is zero"),e.removeClass("updating-message"),!1;if(0!=i%10)return e.parent().parent().find(".saswp-rv-fetched-msg").text("Reviews count should be in step of 10"),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b"),e.removeClass("updating-message"),!1}""!=t&&(o||p)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_fetch_google_reviews",reviews_api_status:c,reviews_api:o,location:t,blocks:i,g_api:p,premium_status:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){"t"==s.status?(e.parent().parent().find(".saswp-rv-fetched-msg").text("Success"),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","green")):(e.parent().parent().find(".saswp-rv-fetched-msg").text(s.message),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b")),e.removeClass("updating-message")},error:function(s){console.log(s)}}):(""==t&&alert("Please enter place id"),""==p&&alert("Please enter api key"),""==o&&alert("Please enter reviews api key"),e.removeClass("updating-message"))}),saswp_localize_data.do_tour){var e,a="<h3>Thanks for using Structured Data!</h3>";a+="<p>Do you want the latest on <b>Structured Data update</b> before others and some best resources on monetization in a single email? - Free just for users of Structured Data!</p>",a+='<style type="text/css">',a+=".wp-pointer-buttons{ padding:0; overflow: hidden; }",a+=".wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #afw_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }",a+="</style>",a+='<div id="afw_mc_embed_signup">',a+='<form action="//app.mailerlite.com/webforms/submit/z7t4b8" data-id="258182" data-code="z7t4b8" method="POST" target="_blank">',a+='<div id="afw_mc_embed_signup_scroll">',a+='<div class="afw-mc-field-group" style=" margin-left: 15px; width: 195px; float: left;">',a+='<input type="text" name="fields[name]" class="form-control" placeholder="Name" hidden value="'+saswp_localize_data.current_user_name+'" style="display:none">',a+='<input type="text" value="'+saswp_localize_data.current_user_email+'" name="fields[email]" class="form-control" placeholder="Email*" style=" width: 180px; padding: 6px 5px;">',a+='<input type="text" name="fields[company]" class="form-control" placeholder="Website" hidden style=" display:none; width: 168px; padding: 6px 5px;" value="'+saswp_localize_data.get_home_url+'">',a+='<input type="hidden" name="ml-submit" value="1" />',a+="</div>",a+='<div id="mce-responses">',a+='<div class="response" id="mce-error-response" style="display:none"></div>',a+='<div class="response" id="mce-success-response" style="display:none"></div>',a+="</div>",a+='<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_a631df13442f19caede5a5baf_c9a71edce6" tabindex="-1" value=""></div>',a+='<input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">',a+="</div>",a+="</form>";var t={content:a+="</div>",position:{edge:"top",align:"left"}};e=function(){s(saswp_localize_data.displayID).pointer(t).pointer("open"),saswp_localize_data.button2&&(jQuery("#pointer-close").after('<a id="pointer-primary" class="button-primary">'+saswp_localize_data.button2+"</a>"),jQuery("#pointer-primary").click(function(){saswp_localize_data.function_name}),jQuery("#pointer-close").click(function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})}))},(t=s.extend(t,{buttons:function(s,e){return button=jQuery('<a id="pointer-close" class="button-secondary">'+saswp_localize_data.button1+"</a>"),button_2=jQuery("#pointer-close.button"),button.bind("click.pointer",function(){e.element.pointer("close")}),button_2.on("click",function(){e.element.pointer("close")}),button},close:function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})},show:function(s,e){e.pointer.css({left:"170px",top:"160px"})}})).position&&t.position.defer_loading?s(window).bind("load.wp-pointers",e):e()}s(".saswp-tabs a").click(function(e){var a=s(this).attr("href"),t=getParameterByName("tab",a);return t||(t="general"),s(this).siblings().removeClass("nav-tab-active"),s(this).addClass("nav-tab-active"),s(".form-wrap").find(".saswp-"+t).siblings().hide(),s(".form-wrap .saswp-"+t).show(),window.history.pushState("","",a),!1}),s(".saswp-schame-type-select").change(function(e){e.preventDefault(),s(".saswp-custom-fields-table").html("");var a=s(this).val();s(".saswp-option-table-class tr").each(function(e,a){e>0&&s(this).hide()}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-option-table-class tr").eq(1).show(),s(".saswp-business-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".select-post-type").val("show_globally").trigger("change")),"Service"==a&&(s(".saswp-service-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-item-reivewed-list").change()),saswp_enable_rating_review(),s(".saswp-manual-modification").html(""),s(".saswp-static-container .spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_manual_fields_on_ajax",schema_type:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-static-container .spinner").removeClass("is-active"),s(".saswp-manual-modification").append(e),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_item_reviewed_call()}),"HowTo"==a||"local_business"==a||"FAQ"==a?s(".saswp-enable-modify-schema").show():(s(".saswp-enable-modify-schema-output").val("automatic"),s(".saswp-enable-modify-schema-output").change(),s(".saswp-enable-modify-schema").hide())}),s("#saswp_business_type").change(function(){var e=s(this).val(),a=s(".saswp-schame-type-select").val();s(".saswp-option-table-class tr").each(function(e,a){e>1&&(s(this).hide(),s(this).find(".saswp-local-sub-type-2").attr("disabled",!0))}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-"+e+"-tr").show(),s(".saswp-business-text-field-tr").show(),s(".saswp-"+e+"-tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-review-text-field-tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),saswp_enable_rating_review()}).change(),s(".saswp-checkbox").change(function(){var e=s(this).attr("id"),a=s(this);switch(e){case"saswp-the-seo-framework-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-seo-framework").val(1):s("#saswp-the-seo-framework").val(0);break;case"saswp-seo-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-seo-press").val(1):s("#saswp-seo-press").val(0);break;case"saswp-aiosp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-aiosp").val(1):s("#saswp-aiosp").val(0);break;case"saswp-smart-crawl-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-smart-crawl").val(1):s("#saswp-smart-crawl").val(0);break;case"saswp-squirrly-seo-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-squirrly-seo").val(1):s("#saswp-squirrly-seo").val(0);break;case"saswp-wp-recipe-maker-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-recipe-maker").val(1):s("#saswp-wp-recipe-maker").val(0);break;case"saswp-wp-ultimate-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-ultimate-recipe").val(1):s("#saswp-wp-ultimate-recipe").val(0);break;case"saswp-zip-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-zip-recipes").val(1):s("#saswp-zip-recipes").val(0);break;case"saswp-mediavine-create-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-mediavine-create").val(1):s("#saswp-mediavine-create").val(0);break;case"saswp-ht-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ht-recipes").val(1):s("#saswp-ht-recipes").val(0);break;case"saswp-wpsso-core-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpsso-core").val(1):s("#saswp-wpsso-core").val(0);break;case"saswp-for-wordpress-checkbox":s(this).is(":checked")?s("#saswp-for-wordpress").val(1):s("#saswp-for-wordpress").val(0);break;case"saswp-for-amp-checkbox":s(this).is(":checked")?s("#saswp-for-amp").val(1):s("#saswp-for-amp").val(0);break;case"saswp_kb_contact_1_checkbox":s(this).is(":checked")?(s("#saswp_kb_contact_1").val(1),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").removeClass("saswp-display-none")):(s("#saswp_kb_contact_1").val(0),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").addClass("saswp-display-none"));break;case"saswp-logo-dimensions-check":s(this).is(":checked")?(s("#saswp-logo-dimensions").val(1),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").show()):(s("#saswp-logo-dimensions").val(0),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").hide());break;case"saswp_archive_schema_checkbox":s(this).is(":checked")?(s("#saswp_archive_schema").val(1),s(".saswp_archive_schema_type_class").parent().parent().show()):(s("#saswp_archive_schema").val(0),s(".saswp_archive_schema_type_class").parent().parent().hide());break;case"saswp_website_schema_checkbox":s(this).is(":checked")?(s("#saswp_website_schema").val(1),s("#saswp_search_box_schema").parent().parent().show()):(s("#saswp_website_schema").val(0),s("#saswp_search_box_schema").parent().parent().hide());break;case"saswp_search_box_schema_checkbox":s(this).is(":checked")?s("#saswp_search_box_schema").val(1):s("#saswp_search_box_schema").val(0);break;case"saswp_breadcrumb_schema_checkbox":s(this).is(":checked")?s("#saswp_breadcrumb_schema").val(1):s("#saswp_breadcrumb_schema").val(0);break;case"saswp_comments_schema_checkbox":s(this).is(":checked")?s("#saswp_comments_schema").val(1):s("#saswp_comments_schema").val(0);break;case"saswp-compativility-checkbox":s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-review-module-checkbox":s(this).is(":checked")?s("#saswp-review-module").val(1):s("#saswp-review-module").val(0);break;case"saswp-kk-star-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-kk-star-raring").val(1):s("#saswp-kk-star-raring").val(0);break;case"saswp-woocommerce-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce").val(1):s("#saswp-woocommerce").val(0);break;case"saswp-default-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp_default_review").val(1):s("#saswp_default_review").val(0);break;case"saswp-extra-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-extra").val(1):s("#saswp-extra").val(0);break;case"saswp-soledad-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-soledad").val(1):s("#saswp-soledad").val(0);break;case"saswp-dw-question-answer-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-dw-question-answer").val(1):s("#saswp-dw-question-answer").val(0);break;case"saswp-wp-job-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-job-manager").val(1):s("#saswp-wp-job-manager").val(0);break;case"saswp-yoast-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yoast").val(1):s("#saswp-yoast").val(0);break;case"saswp-rankmath-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-rankmath").val(1):s("#saswp-rankmath").val(0);break;case"saswp-tagyeem-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-tagyeem").val(1):s("#saswp-tagyeem").val(0);break;case"saswp-the-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-events-calendar").val(1):s("#saswp-the-events-calendar").val(0);break;case"saswp-homeland-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-homeland").val(1):s("#saswp-homeland").val(0);break;case"saswp-wpresidence-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpresidence").val(1):s("#saswp-wpresidence").val(0);break;case"saswp-realhomes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realhomes").val(1):s("#saswp-realhomes").val(0);break;case"saswp-learn-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-press").val(1):s("#saswp-learn-press").val(0);break;case"saswp-learn-dash-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-dash").val(1):s("#saswp-learn-dash").val(0);break;case"saswp-lifter-lms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-lifter-lms").val(1):s("#saswp-lifter-lms").val(0);break;case"saswp-wp-event-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-manager").val(1):s("#saswp-wp-event-manager").val(0);break;case"saswp-events-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-events-manager").val(1):s("#saswp-events-manager").val(0);break;case"saswp-event-calendar-wd-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-calendar-wd").val(1):s("#saswp-event-calendar-wd").val(0);break;case"saswp-event-organiser-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-organiser").val(1):s("#saswp-event-organiser").val(0);break;case"saswp-modern-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-modern-events-calendar").val(1):s("#saswp-modern-events-calendar").val(0);break;case"saswp-woocommerce-booking-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking").val(1),s("#saswp-woocommerce-booking-main").val(1)):(s("#saswp-woocommerce-booking").val(0),s("#saswp-woocommerce-booking-main").val(0));break;case"saswp-woocommerce-booking-main-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking-main").val(1),s("#saswp-woocommerce-booking").val(1)):(s("#saswp-woocommerce-booking-main").val(0),s("#saswp-woocommerce-booking").val(0));break;case"saswp-woocommerce-membership-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce-membership").val(1):s("#saswp-woocommerce-membership").val(0);break;case"saswp-defragment-checkbox":s(this).is(":checked")?s("#saswp-defragment").val(1):s("#saswp-defragment").val(0);break;case"saswp-cooked-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-cooked").val(1):s("#saswp-cooked").val(0);break;case"saswp-flexmlx-compativility-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-shopper-approved-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-shopper-approved-review").val(1),s(".saswp-s-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-shopper-approved-review").val(0),s(".saswp-s-reviews-settings-table").parent().parent().parent().hide());break;case"saswp-google-review-checkbox":s(this).is(":checked")?(s("#saswp-google-review").val(1),s("#saswp-google-rv-free-checkbox").length?(s("#saswp-google-review-free").parent().parent().show(),s("#saswp-google-rv-free-checkbox").is(":checked")?s("#saswp_google_place_api_key").parent().parent().show():s("#saswp_google_place_api_key").parent().parent().hide()):s("#saswp_google_place_api_key").parent().parent().show(),s(".saswp-g-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-google-review").val(0),s("#saswp_google_place_api_key").parent().parent().hide(),s(".saswp-g-reviews-settings-table").parent().parent().parent().hide(),s("#saswp-google-rv-free-checkbox").length&&s("#saswp-google-review-free").parent().parent().hide());break;case"saswp-google-rv-free-checkbox":s("#saswp-google-review-checkbox").is(":checked")&&s(this).is(":checked")?(s("#saswp-google-review-free").val(1),s("#saswp_google_place_api_key").parent().parent().show()):(s("#saswp-google-review-free").val(0),s("#saswp_google_place_api_key").parent().parent().hide());break;case"saswp-markup-footer-checkbox":s(this).is(":checked")?s("#saswp-markup-footer").val(1):s("#saswp-markup-footer").val(0);break;case"saswp-pretty-print-checkbox":s(this).is(":checked")?s("#saswp-pretty-print").val(1):s("#saswp-pretty-print").val(0);break;case"saswp-wppostratings-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wppostratings-raring").val(1):s("#saswp-wppostratings-raring").val(0);break;case"saswp-bbpress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-bbpress").val(1):s("#saswp-bbpress").val(0);break;case"saswp-microdata-cleanup-checkbox":s(this).is(":checked")?s("#saswp-microdata-cleanup").val(1):s("#saswp-microdata-cleanup").val(0);break;case"saswp-other-images-checkbox":s(this).is(":checked")?s("#saswp-other-images").val(1):s("#saswp-other-images").val(0);break;case"saswp-easy-testimonials-checkbox":s(this).is(":checked")?s("#saswp-easy-testimonials").val(1):s("#saswp-easy-testimonials").val(0);break;case"saswp-testimonial-pro-checkbox":s(this).is(":checked")?s("#saswp-testimonial-pro").val(1):s("#saswp-testimonial-pro").val(0);break;case"saswp-bne-testimonials-checkbox":s(this).is(":checked")?s("#saswp-bne-testimonials").val(1):s("#saswp-bne-testimonials").val(0);break;case"saswp-ampforwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampforwp").val(1):s("#saswp-ampforwp").val(0);break;case"saswp-ampbyautomatic-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampbyautomatic").val(1):s("#saswp-ampbyautomatic").val(0);break;case"saswp-ampwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampwp").val(1):s("#saswp-ampwp").val(0);break;case"saswp-wp-event-aggregator-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-aggregator").val(1):s("#saswp-wp-event-aggregator").val(0);break;case"saswp-easy-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-easy-recipe").val(1):s("#saswp-easy-recipe").val(0);break;case"saswp-tevolution-events-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-tevolution-events").val(1):s("#saswp-tevolution-events").val(0);break;case"saswp-strong-testimonials-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-strong-testimonials").val(1):s("#saswp-strong-testimonials").val(0);break;case"saswp-wordlift-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordlift").val(1):s("#saswp-wordlift").val(0);break;case"saswp-betteramp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-betteramp").val(1):s("#saswp-betteramp").val(0);break;case"saswp-wpamp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpamp").val(1):s("#saswp-wpamp").val(0)}}).change(),s("#saswp_kb_type").change(function(){var e=s(this).val();s(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().addClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide"),"Organization"==e&&(s(".saswp_org_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide")),"Person"==e&&(s(".saswp_org_fields").parent().parent().addClass("saswp_hide"),s(".saswp_person_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().removeClass("saswp_hide"))}).change(),s(document).on("click","input[data-id=media]",function(e){e.preventDefault();var a=s(this),t=a.attr("id").replace("_button",""),i=wp.media({title:"Application Icon",button:{text:"Select Icon"},multiple:!1,library:{type:"image"}}).on("select",function(){var e=i.state().get("selection").first().toJSON();s("#"+t).val(e.url),s("input[data-id='"+t+"_id']").val(e.id),s("input[data-id='"+t+"_height']").val(e.height),s("input[data-id='"+t+"_width']").val(e.width),s("input[data-id='"+t+"_thumbnail']").val(e.url),"sd_default_image_button"===a.attr("id")&&(s("#sd_default_image_width").val(e.width),s("#sd_default_image_height").val(e.height));var p="";"saswp_image_div_"+t=="saswp_image_div_sd_default_image"&&e.height<1200&&(p='<p class="saswp_warning">Image size is smaller than recommended size</p>'),s(".saswp_image_div_"+t).html('<div class="saswp_image_thumbnail"><img class="saswp_image_prev" src="'+e.url+'"/><a data-id="'+t+'" href="#" class="saswp_prev_close">X</a></div>'+p)}).open()}),s(document).on("click",".saswp_prev_close",function(e){e.preventDefault();var a=s(this).attr("data-id");s(this).parent().remove(),s("#"+a).val(""),s("input[data-id='"+a+"_id']").val(""),s("input[data-id='"+a+"_height']").val(""),s("input[data-id='"+a+"_width']").val(""),s("input[data-id='"+a+"_thumbnail']").val(""),"sd_default_image"===a&&(s("#sd_default_image_width").val(""),s("#sd_default_image_height").val(""))}),s(document).on("change",".saswp-schema-type-toggle",function(e){var a=s(this).attr("data-schema-id"),t=s(this).attr("data-post-id");if(s(this).is(":checked"))var i=1;else i=0;s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_enable_disable_schema_on_post",status:i,schema_id:a,post_id:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-reset-data",function(e){e.preventDefault(),1==confirm("Are you sure?")&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_reset_all_settings",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){setTimeout(function(){location.reload()},1e3)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp_license_activation",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("license-status"),i=s(this).attr("add-on"),p=s("#"+i+"_addon_license_key").val();t&&i&&p?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_license_status_check",license_key:p,license_status:t,add_on:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){s("#"+i+"_addon_license_key_status").val(e.status),"active"==e.status?(s(".saswp-"+i+"-dashicons").addClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").css("color","green"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","inactive"),s(".saswp_license_activation[add-on='"+i+"']").text("Deactivate"),s(".saswp_license_status_msg[add-on='"+i+"']").text("Activated"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","green"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)):(s(".saswp-"+i+"-dashicons").addClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").css("color","red"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","active"),s(".saswp_license_activation[add-on='"+i+"']").text("Activate"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","red"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)),a.removeClass("updating-message")},error:function(s){console.log(s)}}):(alert("Please enter value license key"),a.removeClass("updating-message"))}),s(".saswp-send-query").on("click",function(e){e.preventDefault();var a=s("#saswp_query_message").val(),t=s("#saswp_query_premium_cus").val();""!=s.trim(a)&&t?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_send_query_message",premium_cus:t,message:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){"t"==e.status?(s(".saswp-query-success").show(),s(".saswp-query-error").hide()):(s(".saswp-query-success").hide(),s(".saswp-query-error").show())},error:function(s){console.log(s)}}):""==s.trim(a)&&""==t?alert("Please enter the message and select customer type"):(""==t&&alert("Select Customer type"),""==s.trim(a)&&alert("Please enter the message"))}),s(".saswp-import-plugins").on("click",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id");s.get(ajaxurl,{action:"saswp_import_plugin_data",plugin_name:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status?(s(a).parent().find(".saswp-imported-message").text(e.message),s(a).parent().find(".saswp-imported-message").removeClass("saswp-error"),setTimeout(function(){location.reload()},2e3)):(s(a).parent().find(".saswp-imported-message").addClass("saswp-error"),s(a).parent().find(".saswp-imported-message").text(e.message)),a.removeClass("updating-message")},"json")}),s(".saswp-feedback-no-thanks").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_no_thanks",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(".saswp-feedback-remindme").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_remindme",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(document).on("change",".saswp-local-business-type-select",function(e){e.preventDefault();var a=s(this),t=s(this).val();s.get(ajaxurl,{action:"saswp_get_sub_business_ajax",business_type:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){s(".saswp-local-business-name-select").parents("tr").remove();var t=a.parents(".saswp-post-specific-wrapper").attr("data-id"),i='<tr><th><label for="saswp_business_name_'+t+'">Sub Business Type</label></th>';i+='<td><select class="saswp-local-business-name-select" id="saswp_business_name_'+t+'" name="saswp_business_name_'+t+'">',s.each(e.result,function(s,e){i+='<option value="'+s+'">'+e+"</option>"}),i+="</select></td>",i+="</tr>",a.parents(".form-table tr:first").after(i)}else s(".saswp-local-business-name-select").parents("tr").remove()},"json")}),saswp_item_reviewed_call(),s(".saswp-local-schema-time-picker").timepicker({timeFormat:"H:i:s"}),s(document).on("click",".saswp-add-custom-schema",function(e){e.preventDefault(),s(".saswp-add-custom-schema-field").removeClass("saswp_hide"),s(this).hide()}),s(document).on("click",".saswp-delete-custom-schema",function(e){e.preventDefault(),s("#saswp_custom_schema_field").val(""),s(".saswp-add-custom-schema-field").addClass("saswp_hide"),s(".saswp-add-custom-schema").show()}),s(".saswp-modify_schema_post_enable").on("click",function(e){var a=s(this);a.addClass("updating-message"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_modify_schema_post_enable",post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){a.remove(),s(".saswp-add-custom-schema-div").remove(),s("#post_specific .inside").append(e),a.removeClass("updating-message"),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_enable_rating_review(),saswp_item_reviewed_call()})}),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_reviews_datepicker(),s(document).on("click",".saswp-add-more-item",function(e){e.preventDefault();s(".saswp-review-item-list-table").append('<tr class="saswp-review-item-tr"><td>Review Item Feature</td><td><input type="text" name="saswp-review-item-feature[]"></td><td>Rating</td><td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]"></td><td><a type="button" class="saswp-remove-review-item button">x</a></td></tr>')}),s(document).on("click",".saswp-remove-review-item",function(e){e.preventDefault(),s(this).parent().parent("tr").remove()}),s(document).on("focusout",".saswp-review-item-tr input[type=number]",function(e){e.preventDefault();var a=0,t=s(".saswp-review-item-tr input[type=number]").length;s(".saswp-review-item-tr input[type=number]").each(function(e,t){""==s(t).val()?a+=parseFloat(0):a+=parseFloat(s(t).val())});var i=a/t;s("#saswp-review-item-over-all").val(i)}),s("#saswp-review-location").change(function(){var e=s(this).val();s(".saswp-review-shortcode").addClass("saswp_hide"),3==e&&s(".saswp-review-shortcode").removeClass("saswp_hide")}).change(),s("#saswp-review-item-enable").change(function(){s(this).is(":checked")?s(".saswp-review-fields").show():s(".saswp-review-fields").hide()}).change(),s(document).on("click",".saswp-restore-post-schema",function(e){e.preventDefault();var a=s(this);if(a.addClass("updating-message"),s(".saswp-post-specific-schema-ids").val())var t=JSON.parse(s(".saswp-post-specific-schema-ids").val());s.post(ajaxurl,{action:"saswp_restore_schema",schema_ids:t,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){"t"==s.status?setTimeout(function(){location.reload()},1e3):(alert(s.msg),setTimeout(function(){location.reload()},1e3)),a.removeClass("updating-message")},"json")}),s(document).on("click","div.saswp-tab ul.saswp-tab-nav a",function(e){e.preventDefault();var a=s(this).attr("data-id");s(".saswp-post-specific-wrapper").hide(),s("#"+a).show(),s("div.saswp-tab ul.saswp-tab-nav a").removeClass("selected"),s("div.saswp-tab ul.saswp-tab-nav li").removeClass("selected"),s(this).addClass("selected"),s(this).parent().addClass("selected"),saswp_enable_rating_review()}),s("#saswp-global-tabs a:first").addClass("saswp-global-selected"),s(".saswp-global-container").hide(),"#saswp-default-container"==window.location.hash?s(".saswp-global-container:eq(2)").show():s(".saswp-global-container:first").show(),s("#saswp-global-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-global-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-global-container").hide(),s("#"+e).show())}),s("#saswp-tools-tabs a:first").addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s(".saswp-tools-container:first").show(),s("#saswp-tools-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-tools-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s("#"+e).show())}),s("#saswp-review-tabs a:first").addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s(".saswp-review-container:first").show(),s("#saswp-review-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-review-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s("#"+e).show())}),s("#saswp-compatibility-tabs a:first").addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s(".saswp-compatibility-container:first").show(),s("#saswp-compatibility-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-compatibility-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s("#"+e).show())}),s('a[href="'+saswp_localize_data.new_url_selector+'"]').attr("href",saswp_localize_data.new_url_href),s(".saswp-enable-modify-schema-output").on("change",function(){s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide"),"manual"==s(this).val()&&(s(".saswp-static-container").removeClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide")),"automatic"==s(this).val()&&(s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").removeClass("saswp_hide"))}),s(document).on("change",".saswp-custom-fields-name",function(){var e="text",a=s(this).parent().parent("tr"),t=s(this).val();-1==t.indexOf("_image")&&-1==t.indexOf("_logo")||(e="image");var i=s(this).parent().parent("tr").find("td:eq(1)");saswp_get_meta_list(null,e,null,i,t,a)}),s(document).on("click",".saswp-skip-button",function(e){e.preventDefault(),s(this).parent().parent().hide(),s.post(ajaxurl,{action:"saswp_skip_wizard",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){},"json")}),s(document).on("click",".saswp_add_schema_fields_on_fly",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id"),i=s(this).attr("fields_type"),p=s(this).attr("div_type"),o=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div").length,c=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div:nth-child("+o+")").attr("data-id");(c=++c)||(c=0),saswp_get_post_specific_schema_fields(a,c,i,p,t,i+"_")}),s(document).on("click",".saswp-table-close",function(){s(this).parent().remove()}),s(document).on("click",".saswp-rmv-modify_row",function(e){e.preventDefault(),s(this).parent().parent().remove()}),s(document).on("change",".saswp-custom-meta-list",function(){var e=s(this),a=s("select#schema_type option:selected").val(),t=s(this).val(),i=s(this).parent().parent("tr").find(".saswp-custom-fields-name").val(),p="",o=a.toLowerCase()+"_"+i,c="saswp_fixed_image["+i+"]";"manual_text"==t?(p+='<td><input type="text" name="saswp_fixed_text['+i+']"></td>',p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"taxonomy_term"==t?saswp_taxonomy_term.taxonomy?(p+=saswp_taxonomy_term_html(saswp_taxonomy_term.taxonomy,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2()):s.get(ajaxurl,{action:"saswp_get_taxonomy_term_list",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){s&&(saswp_taxonomy_term.taxonomy=s,p+=saswp_taxonomy_term_html(s,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2())},"json"):"custom_field"==t?(p+='<td><select class="saswp-custom-fields-select2" name="saswp_custom_meta_field['+i+']">',p+="</select></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"fixed_image"==t?(p+="<td>",p+="<fieldset>",p+='<input data-id="media" style="width: 30%;" class="button" id="'+o+'_button" name="'+o+'_button" type="button" value="Upload" />',p+='<input type="hidden" data-id="'+o+'_height" class="upload-height" name="'+c+'[height]" id="'+o+'_height" value="">',p+='<input type="hidden" data-id="'+o+'_width" class="upload-width" name="'+c+'[width]" id="'+o+'_width" value="">',p+='<input type="hidden" data-id="'+o+'_thumbnail" class="upload-thumbnail" name="'+c+'[thumbnail]" id="'+o+'_thumbnail" value="">',p+='<div class="saswp_image_div_'+o+'">',p+="</div>",p+="</fieldset>",p+="</td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):(p+="<td></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2())}),s(document).on("change",".saswp-item-reivewed-list",function(){s(".saswp-custom-fields-table").html(""),saswp_meta_list_fields=[];var e=s(this),a=s("select#schema_type option:selected").val();saswp_item_reviewed_ajax(a,e,"manual")}),s(document).on("click",".saswp-add-custom-fields",function(){var e=s(this);e.addClass("updating-message");var a=s("select#schema_type option:selected").val(),t="",i=null;"Review"==a&&(t=s("select.saswp-item-reivewed-list option:selected").val(),i="saswp_review_name");var p=s("#post_ID").val();""!=a&&(saswp_meta_list_fields[a]?saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null):s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_get_schema_type_fields",post_id:p,schema_type:a,schema_subtype:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){saswp_meta_list_fields[a]=s,saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null)},error:function(s){console.log(s)}}))}),saswpCustomSelect2(),saswp_enable_rating_review(),s('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr("href",saswp_localize_data.collection_post_add_new_url),s(document).on("click",".saswp_coonect_google_place",function(){var e=s("#saswp_google_place_id").val(),a=s("#saswp_language_list").val(),t=s("#saswp_googel_api").val();""!=e&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_connect_google_place",place_id:e,language:a,google_api:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){console.log(s.status)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-add-social-links",function(){s(".saswp-social-links-table").append('<tr><td><input type="text" placeholder="https://www.facebook.com/profile" name="sd_data[saswp_social_links][]" value=""></td><td><a class="button button-default saswp-rmv-modify_row">X</a></td></tr>')}),"saswp"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.saswp_settings_url+"' id='' class='page-title-action'>Settings</a>"),"saswp_reviews"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.collections_page_url+"' id='' class='page-title-action'>Collections</a>"),"undefined"!=typeof saswp_reviews_data&&s(".saswp-rating-div").rateYo({rating:saswp_reviews_data.rating_val,halfStar:!0,readOnly:saswp_reviews_data.readonly,onSet:function(e,a){s(this).next().val(e)}}),s("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){var e=s(this);e.parent().find(".saswp-phone-validation").remove();var a=s(this).val();/^\+([0-9]{1,3})\)?[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})$/.test(a)?e.parent().find(".saswp-phone-validation").remove():e.after('<span style="color:red;" class="saswp-phone-validation">Invalid Phone Number</span>')}),saswpCollectionSlider(),s(".saswp-accordion").click(function(){s(this).toggleClass("active"),s(this).next(".saswp-accordion-panel").slideToggle(200)}),s(document).on("click",".saswp-opn-cls-btn",function(){s("#saswp-reviews-cntn").toggle(),s("#saswp-reviews-cntn").is(":visible")?(s(".saswp-onclick-show").css("display","flex"),s(".saswp-onclick-hide").hide(),s(".saswp-open-class").css("width","500px")):(s(".saswp-onclick-show").css("display","none"),s(".saswp-onclick-hide").show(),s(".saswp-open-class").css("width","300px"))}),s(".saswp-collection-display-method").change(function(){"shortcode"==s(this).val()?s(".saswp-collection-shortcode").removeClass("saswp_hide"):s(".saswp-collection-shortcode").addClass("saswp_hide")}).change(),s(document).on("click",".saswp-remove-platform",function(e){e.preventDefault();var a=s(this).attr("platform-id");saswp_collection.splice(a,1),s(this).parent().remove(),saswp_on_collection_design_change()}),s(".saswp-number-change").bind("keyup mouseup",function(){saswp_on_collection_design_change()}),s(".saswp-coll-settings-options").change(function(){var e=s(".saswp-collection-desing").val();s(".saswp-coll-options").addClass("saswp_hide"),s(".saswp-collection-lp").css("height","auto"),"grid"==e&&s(".saswp-grid-options").removeClass("saswp_hide"),"gallery"==e&&s(".saswp-slider-options").removeClass("saswp_hide"),"fomo"==e&&(s(".saswp-fomo-options").removeClass("saswp_hide"),s(".saswp-collection-lp").css("height","31px")),"popup"==e&&s(".saswp-collection-lp").css("height","31px"),saswp_on_collection_design_change()}).change(),s(".saswp-add-to-collection").on("click",function(e){e.preventDefault();var a=s(this),t=s("#saswp-plaftorm-list").val(),i=s("#saswp-review-count").val();t&&i>0?(a.addClass("updating-message"),saswp_get_collection_data(i,t,a)):alert("Enter Count")});var i,p,o=s("#saswp_collection_id").val();o&&(s(".spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_collection_platforms",collection_id:o,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if(e.status){var a=e.message;s.each(a,function(s,e){saswp_get_collection_data(e,s,null)})}s(".spinner").removeClass("is-active")},"json")),(i=document.createElement("div")).style.cssText="position:absolute; background:black; color:white; padding:4px 6px;z-index:10000;border-radius:2px; font-size:12px;box-shadow:3px 3px 3px rgba(0,0,0,.4);opacity:0;transition:opacity 0.3s",i.innerHTML="Copied!",document.body.appendChild(i);var c=document.getElementById("motivatebox");c&&c.addEventListener("mouseup",function(s){var e=(s=s||event).target||s.srcElement;"motivate"==e.className&&(!function(s){var e=document.createRange();e.selectNodeContents(s);var a=window.getSelection();a.removeAllRanges(),a.addRange(e)}(e),function(){var s;try{s=document.execCommand("copy")}catch(e){s=!1}return s}()&&function(s){var e=s||event;clearTimeout(p),i.style.left=e.pageX-10+"px",i.style.top=e.pageY+15+"px",i.style.opacity=1,p=setTimeout(function(){i.style.opacity=0},500)}(s))},!1)});
admin_section/plugin-installer/install.php CHANGED
@@ -74,7 +74,7 @@
74
 
75
  function saswp_installer_init(){
76
  // Exit if the user does not have proper permissions
77
- if(! current_user_can( 'manage_options' ) ) {
78
  return ;
79
  }
80
  global $saswp_installer_config;
@@ -363,7 +363,7 @@
363
 
364
  function saswp_save_steps_data(){
365
 
366
- if(! current_user_can( 'manage_options' ) ) {
367
  return ;
368
  }
369
  if ( ! isset( $_POST['wpnonce'] ) ){
@@ -665,7 +665,8 @@
665
 
666
  function saswp_general_setting_fields_callback(){
667
 
668
- global $sd_data;
 
669
  $saswp_kb_type ='';
670
 
671
  if(isset($sd_data['saswp_kb_type'])){
@@ -673,14 +674,18 @@ function saswp_general_setting_fields_callback(){
673
  }
674
  $about_page = '';
675
  $contact_page = '';
 
676
 
677
-
678
- $pages = get_posts( array(
 
679
  'order' => 'ASC',
680
  'orderby' => 'ID',
681
  'post_type' => 'page',
682
  'post_status' => 'publish',
683
  ) );
 
 
684
 
685
  if(!empty($pages)){
686
 
74
 
75
  function saswp_installer_init(){
76
  // Exit if the user does not have proper permissions
77
+ if(! current_user_can( saswp_current_user_can() ) ) {
78
  return ;
79
  }
80
  global $saswp_installer_config;
363
 
364
  function saswp_save_steps_data(){
365
 
366
+ if(! current_user_can( saswp_current_user_can() ) ) {
367
  return ;
368
  }
369
  if ( ! isset( $_POST['wpnonce'] ) ){
665
 
666
  function saswp_general_setting_fields_callback(){
667
 
668
+ global $sd_data;
669
+ global $wp_query;
670
  $saswp_kb_type ='';
671
 
672
  if(isset($sd_data['saswp_kb_type'])){
674
  }
675
  $about_page = '';
676
  $contact_page = '';
677
+ $pages = null;
678
 
679
+ if($wp_query){
680
+
681
+ $pages = get_posts( array(
682
  'order' => 'ASC',
683
  'orderby' => 'ID',
684
  'post_type' => 'page',
685
  'post_status' => 'publish',
686
  ) );
687
+
688
+ }
689
 
690
  if(!empty($pages)){
691
 
admin_section/settings.php CHANGED
@@ -57,16 +57,20 @@ function saswp_ext_installed_status(){
57
 
58
  }
59
 
60
- function saswp_add_menu_links() {
61
- // Settings page - Same as main menu page
62
- add_submenu_page( 'edit.php?post_type=saswp', esc_html__( 'Schema & Structured Data For Wp', 'schema-and-structured-data-for-wp' ), esc_html__( 'Settings', 'schema-and-structured-data-for-wp' ), 'manage_options', 'structured_data_options', 'saswp_admin_interface_render' );
 
 
 
 
 
 
63
 
64
  if(!saswp_ext_installed_status()){
65
  add_submenu_page( 'edit.php?post_type=saswp', esc_html__( 'Schema & Structured Data For Wp', 'schema-and-structured-data-for-wp' ), '<span style="color:#fff176;">'.esc_html__( 'Upgrade To Premium', 'schema-and-structured-data-for-wp' ).'</span>', 'manage_options', 'structured_data_premium', 'saswp_premium_interface_render' );
66
  }
67
-
68
-
69
-
70
  }
71
  add_action( 'admin_menu', 'saswp_add_menu_links' );
72
 
@@ -77,10 +81,11 @@ function saswp_premium_interface_render(){
77
 
78
  }
79
  function saswp_admin_interface_render(){
80
- // Authentication
81
- if ( ! current_user_can( 'manage_options' ) ) {
82
  return;
83
- }
 
84
  // Handing save settings
85
  if ( isset( $_GET['settings-updated'] ) ) {
86
  settings_errors();
@@ -359,7 +364,7 @@ add_action('upload_mimes', 'saswp_custom_upload_mimes');
359
 
360
  function saswp_handle_file_upload($option){
361
 
362
- if ( ! current_user_can( 'upload_files' ) ) {
363
  return $option;
364
  }
365
 
@@ -623,7 +628,8 @@ function saswp_amp_page_callback(){
623
  is_plugin_active('accelerated-mobile-pages/accelerated-moblie-pages.php') ||
624
  is_plugin_active('amp/amp.php') ||
625
  is_plugin_active('better-amp/better-amp.php') ||
626
- is_plugin_active('wp-amp/wp-amp.php')
 
627
 
628
  ) {
629
  }else{
@@ -1160,10 +1166,23 @@ function saswp_import_callback(){
1160
  'id' => 'saswp-other-images',
1161
  'name' => 'sd_data[saswp-other-images]',
1162
  )
1163
- ),
1164
 
1165
  );
1166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1167
 
1168
  ?>
1169
 
@@ -1579,7 +1598,7 @@ function saswp_review_page_callback(){
1579
  <div class="saswp-quick-links-div">
1580
  <h4><?php echo esc_html__('Quick Links','schema-and-structured-data-for-wp'); ?></h4>
1581
  <p><a href="<?php echo admin_url('edit.php?post_type=saswp_reviews'); ?>"><?php echo esc_html__('View Current Reviews','schema-and-structured-data-for-wp'); ?></a></p>
1582
- <p><a target="_blank" href="https://structured-data-for-wp.com/docs/article/how-to-show-reviews-on-the-website/"><?php echo esc_html__('How to show reviews on the website','schema-and-structured-data-for-wp'); ?></a></p>
1583
  </div>
1584
 
1585
  </div>
@@ -1677,6 +1696,42 @@ function saswp_compatibility_page_callback(){
1677
  'name' => 'sd_data[saswp-ampbyautomatic]',
1678
  )
1679
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1680
  $betteramp = array(
1681
  'label' => 'Better AMP',
1682
  'id' => 'saswp-betteramp-checkbox',
@@ -1763,6 +1818,18 @@ function saswp_compatibility_page_callback(){
1763
  'name' => 'sd_data[saswp-realhomes]',
1764
  )
1765
  );
 
 
 
 
 
 
 
 
 
 
 
 
1766
 
1767
  $learn_press = array(
1768
  'label' => 'LearnPress',
@@ -1940,6 +2007,18 @@ function saswp_compatibility_page_callback(){
1940
  'name' => 'sd_data[saswp-zip-recipes]',
1941
  )
1942
  );
 
 
 
 
 
 
 
 
 
 
 
 
1943
  $mediavine_create = array(
1944
  'label' => 'Create by Mediavine',
1945
  'id' => 'saswp-mediavine-create-checkbox',
@@ -2220,7 +2299,9 @@ function saswp_compatibility_page_callback(){
2220
  if(!is_plugin_active('real-estate-schema/real-estate-schema.php')){
2221
 
2222
  $homeland_theme['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/extensions/">Real Estate Schema Addon</a>';
2223
- $real_homes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/extensions/">Real Estate Schema Addon</a>';
 
 
2224
 
2225
  }
2226
 
@@ -2240,6 +2321,8 @@ function saswp_compatibility_page_callback(){
2240
  $events_manager['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2241
  $event_organiser['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2242
  $modern_events_calendar['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
 
 
2243
 
2244
  }
2245
 
@@ -2248,7 +2331,8 @@ function saswp_compatibility_page_callback(){
2248
  $zip_recipes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2249
  $wp_ultimate_recipe['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2250
  $mediavine_create['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2251
- $ht_recipes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
 
2252
 
2253
  }
2254
 
@@ -2259,6 +2343,7 @@ function saswp_compatibility_page_callback(){
2259
  $ampbyautomatic,
2260
  $betteramp,
2261
  $wpamp,
 
2262
  $kk_star,
2263
  $wppostratings,
2264
  $bbpress,
@@ -2279,11 +2364,13 @@ function saswp_compatibility_page_callback(){
2279
  $recipe_maker,
2280
  $wp_ultimate_recipe,
2281
  $zip_recipes,
 
2282
  $mediavine_create,
2283
  $ht_recipes,
2284
  $rankmath,
2285
  $homeland_theme,
2286
  $real_homes,
 
2287
  $learn_press,
2288
  $learn_dash,
2289
  $lifter_lms,
@@ -2293,10 +2380,12 @@ function saswp_compatibility_page_callback(){
2293
  $events_calendar_wd,
2294
  $event_organiser,
2295
  $modern_events_calendar,
 
 
2296
  $easy_testimonials,
2297
  $bne_testimonials,
2298
  $testimonial_pro,
2299
- // $strong_testimonials,
2300
  $WordLift,
2301
  $flex_lmx
2302
 
@@ -2546,4 +2635,26 @@ function saswp_enqueue_style_js( $hook ) {
2546
  wp_style_add_data( 'saswp-main-css', 'rtl', 'replace' );
2547
 
2548
  }
2549
- add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  }
59
 
60
+ function saswp_add_menu_links() {
61
+
62
+ add_submenu_page( 'edit.php?post_type=saswp',
63
+ esc_html__( 'Schema & Structured Data For Wp', 'schema-and-structured-data-for-wp' ),
64
+ esc_html__( 'Settings', 'schema-and-structured-data-for-wp' ),
65
+ saswp_current_user_can(),
66
+ 'structured_data_options',
67
+ 'saswp_admin_interface_render'
68
+ );
69
 
70
  if(!saswp_ext_installed_status()){
71
  add_submenu_page( 'edit.php?post_type=saswp', esc_html__( 'Schema & Structured Data For Wp', 'schema-and-structured-data-for-wp' ), '<span style="color:#fff176;">'.esc_html__( 'Upgrade To Premium', 'schema-and-structured-data-for-wp' ).'</span>', 'manage_options', 'structured_data_premium', 'saswp_premium_interface_render' );
72
  }
73
+
 
 
74
  }
75
  add_action( 'admin_menu', 'saswp_add_menu_links' );
76
 
81
 
82
  }
83
  function saswp_admin_interface_render(){
84
+
85
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
86
  return;
87
+ }
88
+
89
  // Handing save settings
90
  if ( isset( $_GET['settings-updated'] ) ) {
91
  settings_errors();
364
 
365
  function saswp_handle_file_upload($option){
366
 
367
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
368
  return $option;
369
  }
370
 
628
  is_plugin_active('accelerated-mobile-pages/accelerated-moblie-pages.php') ||
629
  is_plugin_active('amp/amp.php') ||
630
  is_plugin_active('better-amp/better-amp.php') ||
631
+ is_plugin_active('wp-amp/wp-amp.php') ||
632
+ is_plugin_active('amp-wp/amp-wp.php')
633
 
634
  ) {
635
  }else{
1166
  'id' => 'saswp-other-images',
1167
  'name' => 'sd_data[saswp-other-images]',
1168
  )
1169
+ )
1170
 
1171
  );
1172
 
1173
+ if(saswp_current_user_role() == 'administrator'){
1174
+
1175
+ $meta_fields[] = array(
1176
+ 'label' => 'Role Based Access',
1177
+ 'id' => 'saswp-role-based-access',
1178
+ 'name' => 'sd_data[saswp-role-based-access]',
1179
+ 'type' => 'multiselect',
1180
+ 'note' => 'Choose the users whom you want to allow full access to this plugin',
1181
+ 'class' => 'saswp-role-based-access-class',
1182
+ 'options' => saswp_get_user_roles()
1183
+ );
1184
+
1185
+ }
1186
 
1187
  ?>
1188
 
1598
  <div class="saswp-quick-links-div">
1599
  <h4><?php echo esc_html__('Quick Links','schema-and-structured-data-for-wp'); ?></h4>
1600
  <p><a href="<?php echo admin_url('edit.php?post_type=saswp_reviews'); ?>"><?php echo esc_html__('View Current Reviews','schema-and-structured-data-for-wp'); ?></a></p>
1601
+ <p><a target="_blank" href="https://structured-data-for-wp.com/docs/article/how-to-display-reviews-with-collection-feature/"><?php echo esc_html__('How to show reviews on the website','schema-and-structured-data-for-wp'); ?></a></p>
1602
  </div>
1603
 
1604
  </div>
1696
  'name' => 'sd_data[saswp-ampbyautomatic]',
1697
  )
1698
  );
1699
+ $ampwp = array(
1700
+ 'label' => 'AMP WP',
1701
+ 'id' => 'saswp-ampwp-checkbox',
1702
+ 'name' => 'saswp-ampwp-checkbox',
1703
+ 'type' => 'checkbox',
1704
+ 'class' => 'checkbox saswp-checkbox',
1705
+ 'note' => saswp_get_field_note('ampwp'),
1706
+ 'hidden' => array(
1707
+ 'id' => 'saswp-ampwp',
1708
+ 'name' => 'sd_data[saswp-ampwp]',
1709
+ )
1710
+ );
1711
+ $tevolution_events = array(
1712
+ 'label' => 'Tevolution Events',
1713
+ 'id' => 'saswp-tevolution-events-checkbox',
1714
+ 'name' => 'saswp-tevolution-events-checkbox',
1715
+ 'type' => 'checkbox',
1716
+ 'class' => 'checkbox saswp-checkbox',
1717
+ 'note' => saswp_get_field_note('tevolution_events'),
1718
+ 'hidden' => array(
1719
+ 'id' => 'saswp-tevolution-events',
1720
+ 'name' => 'sd_data[saswp-tevolution-events]',
1721
+ )
1722
+ );
1723
+ $wp_event_aggregator = array(
1724
+ 'label' => 'WP Event Aggregator',
1725
+ 'id' => 'saswp-wp-event-aggregator-checkbox',
1726
+ 'name' => 'saswp-wp-event-aggregator-checkbox',
1727
+ 'type' => 'checkbox',
1728
+ 'class' => 'checkbox saswp-checkbox',
1729
+ 'note' => saswp_get_field_note('wp_event_aggregator'),
1730
+ 'hidden' => array(
1731
+ 'id' => 'saswp-wp-event-aggregator',
1732
+ 'name' => 'sd_data[saswp-wp-event-aggregator]',
1733
+ )
1734
+ );
1735
  $betteramp = array(
1736
  'label' => 'Better AMP',
1737
  'id' => 'saswp-betteramp-checkbox',
1818
  'name' => 'sd_data[saswp-realhomes]',
1819
  )
1820
  );
1821
+ $wpresidence = array(
1822
+ 'label' => 'WP Residence Theme',
1823
+ 'id' => 'saswp-wpresidence-checkbox',
1824
+ 'name' => 'saswp-wpresidence-checkbox',
1825
+ 'type' => 'checkbox',
1826
+ 'class' => 'checkbox saswp-checkbox',
1827
+ 'note' => saswp_get_field_note('wpresidence'),
1828
+ 'hidden' => array(
1829
+ 'id' => 'saswp-wpresidence',
1830
+ 'name' => 'sd_data[saswp-wpresidence]',
1831
+ )
1832
+ );
1833
 
1834
  $learn_press = array(
1835
  'label' => 'LearnPress',
2007
  'name' => 'sd_data[saswp-zip-recipes]',
2008
  )
2009
  );
2010
+ $easyrecipe = array(
2011
+ 'label' => 'EasyRecipe',
2012
+ 'id' => 'saswp-easy-recipe-checkbox',
2013
+ 'name' => 'saswp-easy-recipe-checkbox',
2014
+ 'type' => 'checkbox',
2015
+ 'class' => 'checkbox saswp-checkbox',
2016
+ 'note' => saswp_get_field_note('easy_recipe'),
2017
+ 'hidden' => array(
2018
+ 'id' => 'saswp-easy-recipe',
2019
+ 'name' => 'sd_data[saswp-easy-recipe]',
2020
+ )
2021
+ );
2022
  $mediavine_create = array(
2023
  'label' => 'Create by Mediavine',
2024
  'id' => 'saswp-mediavine-create-checkbox',
2299
  if(!is_plugin_active('real-estate-schema/real-estate-schema.php')){
2300
 
2301
  $homeland_theme['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/extensions/">Real Estate Schema Addon</a>';
2302
+ $real_homes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/extensions/">Real Estate Schema Addon</a>';
2303
+ $wpresidence['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/extensions/">Real Estate Schema Addon</a>';
2304
+
2305
 
2306
  }
2307
 
2321
  $events_manager['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2322
  $event_organiser['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2323
  $modern_events_calendar['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2324
+ $tevolution_events['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2325
+ $wp_event_aggregator['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2326
 
2327
  }
2328
 
2331
  $zip_recipes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2332
  $wp_ultimate_recipe['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2333
  $mediavine_create['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2334
+ $ht_recipes['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/recipe-schema/">Recipe Schema Addon</a>';
2335
+ $easyrecipe['note'] = esc_html__('This feature requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://structured-data-for-wp.com/event-schema/">Event Schema Addon</a>';
2336
 
2337
  }
2338
 
2343
  $ampbyautomatic,
2344
  $betteramp,
2345
  $wpamp,
2346
+ $ampwp,
2347
  $kk_star,
2348
  $wppostratings,
2349
  $bbpress,
2364
  $recipe_maker,
2365
  $wp_ultimate_recipe,
2366
  $zip_recipes,
2367
+ $easyrecipe,
2368
  $mediavine_create,
2369
  $ht_recipes,
2370
  $rankmath,
2371
  $homeland_theme,
2372
  $real_homes,
2373
+ $wpresidence,
2374
  $learn_press,
2375
  $learn_dash,
2376
  $lifter_lms,
2380
  $events_calendar_wd,
2381
  $event_organiser,
2382
  $modern_events_calendar,
2383
+ $tevolution_events,
2384
+ $wp_event_aggregator,
2385
  $easy_testimonials,
2386
  $bne_testimonials,
2387
  $testimonial_pro,
2388
+ $strong_testimonials,
2389
  $WordLift,
2390
  $flex_lmx
2391
 
2635
  wp_style_add_data( 'saswp-main-css', 'rtl', 'replace' );
2636
 
2637
  }
2638
+ add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
2639
+
2640
+
2641
+ function saswp_option_page_capability( $capability ) {
2642
+ return saswp_current_user_can();
2643
+ }
2644
+
2645
+ add_filter( 'option_page_capability_sd_data_group', 'saswp_option_page_capability' );
2646
+
2647
+ function saswp_pre_update_settings($value, $old_value, $option){
2648
+
2649
+ if(saswp_current_user_role() != 'administrator'){
2650
+
2651
+ if(isset($old_value['saswp-role-based-access'])){
2652
+ $value['saswp-role-based-access'] = $old_value['saswp-role-based-access'];
2653
+ }
2654
+
2655
+ }
2656
+
2657
+ return $value;
2658
+ }
2659
+
2660
+ add_filter('pre_update_option_sd_data', 'saswp_pre_update_settings',10,3);
admin_section/structure_admin.php CHANGED
@@ -100,7 +100,7 @@ add_action( 'untrash_saswp', 'saswp_update_ids_on_untrash' );
100
 
101
  function saswp_reset_all_settings(){
102
 
103
- if ( ! current_user_can( 'manage_options' ) ) {
104
  return;
105
  }
106
 
@@ -596,7 +596,7 @@ function saswp_comparison_logic_checker($input){
596
  require_once( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/ajax-selectbox.php' );
597
  //Back End
598
  if(is_admin()){
599
-
600
  add_action( 'init', 'saswp_create_post_type' );
601
 
602
  function saswp_create_post_type() {
@@ -604,18 +604,16 @@ if(is_admin()){
604
  $nonce = wp_create_nonce( 'saswp_install_wizard_nonce' );
605
  $not_found_button = '<div><span class="dashicons dashicons-thumbs-up"></span>'.esc_html__("Thank you for using Schema & Structured Data For WP plugin!",'schema-and-structured-data-for-wp').' <a href="'.esc_url(admin_url( 'plugins.php?page=saswp-setup-wizard' ).'&_saswp_nonce='.$nonce).'">'.esc_html__("Start Quick Setup?",'schema-and-structured-data-for-wp').'</a></div>';
606
 
607
- register_post_type( 'saswp',
608
-
609
- array(
610
  'labels' => array(
611
- 'name' => esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
612
- 'singular_name' => esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
613
- 'add_new' => esc_html__( 'Add Schema Type', 'schema-and-structured-data-for-wp' ),
614
- 'add_new_item' => '',
615
- 'edit_item' => esc_html__( 'Edit Schema Type','schema-and-structured-data-for-wp'),
616
- 'all_items' => esc_html__( 'Schema Types', 'schema-and-structured-data-for-wp' ),
617
- 'not_found' => $not_found_button
618
- ),
619
  'public' => true,
620
  'has_archive' => false,
621
  'exclude_from_search' => true,
@@ -624,9 +622,20 @@ if(is_admin()){
624
  'supports' => array('title'),
625
  'menu_position' => 100
626
 
627
- )
628
- );
629
- }
 
 
 
 
 
 
 
 
 
 
 
630
 
631
  function saswp_select_callback($post) {
632
 
@@ -846,7 +855,7 @@ function saswp_dequeue_script() {
846
  if( !isset( $_POST['saswp_select_name_nonce'] ) || !wp_verify_nonce( $_POST['saswp_select_name_nonce'], 'saswp_select_action_nonce' ) ) return;
847
 
848
  // if our current user can't edit this post, bail
849
- if( !current_user_can( 'edit_post' ) ) return;
850
 
851
  $meta_value = get_post_meta( $post_id, null, true );
852
 
@@ -1179,13 +1188,14 @@ function saswp_custom_column_set( $column, $post_id ) {
1179
  case 'saswp_schema_type' :
1180
 
1181
  $schema_type = get_post_meta( $post_id, $key='schema_type', true);
 
1182
 
1183
  if($schema_type == 'local_business'){
1184
- echo 'LocalBusiness';
1185
  }else if($schema_type == 'qanda'){
1186
- echo 'Q&A';
1187
  }else{
1188
- echo esc_attr($schema_type);
1189
  }
1190
 
1191
 
@@ -1249,10 +1259,14 @@ add_action( 'manage_saswp_posts_custom_column' , 'saswp_custom_column_set', 10,
1249
  * @return string
1250
  */
1251
 
1252
- function saswp_custom_columns($columns) {
1253
 
1254
- unset($columns['date']);
1255
- $columns['saswp_schema_type'] = '<a>'.esc_html__( 'Type', 'schema-and-structured-data-for-wp' ).'<a>';
 
 
 
 
1256
  $columns['saswp_target_location'] = '<a>'.esc_html__( 'Target Location', 'schema-and-structured-data-for-wp' ).'<a>';
1257
 
1258
  return $columns;
@@ -1325,7 +1339,7 @@ add_action('wp_ajax_saswp_send_query_message', 'saswp_send_query_message');
1325
  */
1326
  function saswp_import_plugin_data(){
1327
 
1328
- if ( ! current_user_can( 'manage_options' ) ) {
1329
  return;
1330
  }
1331
 
@@ -1400,7 +1414,7 @@ add_action('wp_ajax_saswp_import_plugin_data', 'saswp_import_plugin_data');
1400
 
1401
  function saswp_feeback_no_thanks(){
1402
 
1403
- if ( ! current_user_can( 'manage_options' ) ) {
1404
  return;
1405
  }
1406
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -1430,7 +1444,7 @@ add_action('wp_ajax_saswp_feeback_no_thanks', 'saswp_feeback_no_thanks');
1430
 
1431
  function saswp_feeback_remindme(){
1432
 
1433
- if ( ! current_user_can( 'manage_options' ) ) {
1434
  return;
1435
  }
1436
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -1594,7 +1608,7 @@ function saswp_license_status($add_on, $license_status, $license_key){
1594
 
1595
  function saswp_license_status_check(){
1596
 
1597
- if ( ! current_user_can( 'manage_options' ) ) {
1598
  return;
1599
  }
1600
  if ( ! isset( $_POST['saswp_security_nonce'] ) ){
100
 
101
  function saswp_reset_all_settings(){
102
 
103
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
104
  return;
105
  }
106
 
596
  require_once( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/ajax-selectbox.php' );
597
  //Back End
598
  if(is_admin()){
599
+
600
  add_action( 'init', 'saswp_create_post_type' );
601
 
602
  function saswp_create_post_type() {
604
  $nonce = wp_create_nonce( 'saswp_install_wizard_nonce' );
605
  $not_found_button = '<div><span class="dashicons dashicons-thumbs-up"></span>'.esc_html__("Thank you for using Schema & Structured Data For WP plugin!",'schema-and-structured-data-for-wp').' <a href="'.esc_url(admin_url( 'plugins.php?page=saswp-setup-wizard' ).'&_saswp_nonce='.$nonce).'">'.esc_html__("Start Quick Setup?",'schema-and-structured-data-for-wp').'</a></div>';
606
 
607
+ $saswp = array(
 
 
608
  'labels' => array(
609
+ 'name' => esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
610
+ 'singular_name' => esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
611
+ 'add_new' => esc_html__( 'Add Schema Type', 'schema-and-structured-data-for-wp' ),
612
+ 'add_new_item' => '',
613
+ 'edit_item' => esc_html__( 'Edit Schema Type','schema-and-structured-data-for-wp'),
614
+ 'all_items' => esc_html__( 'Schema Types', 'schema-and-structured-data-for-wp' ),
615
+ 'not_found' => $not_found_button
616
+ ),
617
  'public' => true,
618
  'has_archive' => false,
619
  'exclude_from_search' => true,
622
  'supports' => array('title'),
623
  'menu_position' => 100
624
 
625
+ );
626
+
627
+ if(saswp_current_user_allowed()){
628
+
629
+ $cap = saswp_post_type_capabilities();
630
+
631
+ if(!empty($cap)){
632
+ $saswp['capabilities'] = $cap;
633
+ }
634
+
635
+ register_post_type( 'saswp', $saswp);
636
+ }
637
+
638
+ }
639
 
640
  function saswp_select_callback($post) {
641
 
855
  if( !isset( $_POST['saswp_select_name_nonce'] ) || !wp_verify_nonce( $_POST['saswp_select_name_nonce'], 'saswp_select_action_nonce' ) ) return;
856
 
857
  // if our current user can't edit this post, bail
858
+ if( !current_user_can( saswp_current_user_can() ) ) return;
859
 
860
  $meta_value = get_post_meta( $post_id, null, true );
861
 
1188
  case 'saswp_schema_type' :
1189
 
1190
  $schema_type = get_post_meta( $post_id, $key='schema_type', true);
1191
+ $url = admin_url( 'post.php?post='.$post_id.'&action=edit' );
1192
 
1193
  if($schema_type == 'local_business'){
1194
+ echo '<strong><a class="row-title" href="'.esc_url($url).'">LocalBusiness</a></strong>';
1195
  }else if($schema_type == 'qanda'){
1196
+ echo '<strong><a class="row-title" href="'.esc_url($url).'">Q&A</a></strong>';
1197
  }else{
1198
+ echo '<strong><a class="row-title" href="'.esc_url($url).'">'.esc_html($schema_type).'</a></strong>';
1199
  }
1200
 
1201
 
1259
  * @return string
1260
  */
1261
 
1262
+ function saswp_custom_columns($columns) {
1263
 
1264
+ $title = $columns['title'];
1265
+ $cb = $columns['cb'];
1266
+ unset($columns);
1267
+ $columns['cb'] = $cb;
1268
+ $columns['title'] = $title;
1269
+ $columns['saswp_schema_type'] = '<a>'.esc_html__( 'Schema Type', 'schema-and-structured-data-for-wp' ).'<a>';
1270
  $columns['saswp_target_location'] = '<a>'.esc_html__( 'Target Location', 'schema-and-structured-data-for-wp' ).'<a>';
1271
 
1272
  return $columns;
1339
  */
1340
  function saswp_import_plugin_data(){
1341
 
1342
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
1343
  return;
1344
  }
1345
 
1414
 
1415
  function saswp_feeback_no_thanks(){
1416
 
1417
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
1418
  return;
1419
  }
1420
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
1444
 
1445
  function saswp_feeback_remindme(){
1446
 
1447
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
1448
  return;
1449
  }
1450
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
1608
 
1609
  function saswp_license_status_check(){
1610
 
1611
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
1612
  return;
1613
  }
1614
  if ( ! isset( $_POST['saswp_security_nonce'] ) ){
admin_section/tracking/class-saswp-plugin-usage-tracker.php ADDED
@@ -0,0 +1,986 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This is the class that sends all the data back to the home site
4
+ * It also handles opting in and deactivation
5
+ * @version 1.2.0
6
+ */
7
+
8
+ // Exit if accessed directly
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if( ! class_exists( 'SASWP_Plugin_Usage_Tracker') ) {
14
+
15
+ class SASWP_Plugin_Usage_Tracker {
16
+
17
+ private $wisdom_version = '1.2.0';
18
+ private $home_url = '';
19
+ private $plugin_file = '';
20
+ private $plugin_name = '';
21
+ private $options = array();
22
+ private $require_optin = true;
23
+ private $include_goodbye_form = true;
24
+ private $marketing = false;
25
+ private $collect_email = false;
26
+ private $what_am_i = 'plugin';
27
+ private $theme_allows_tracking = 0;
28
+
29
+ /**
30
+ * Class constructor
31
+ *
32
+ * @param $_home_url The URL to the site we're sending data to
33
+ * @param $_plugin_file The file path for this plugin
34
+ * @param $_options Plugin options to track
35
+ * @param $_require_optin Whether user opt-in is required (always required on WordPress.org)
36
+ * @param $_include_goodbye_form Whether to include a form when the user deactivates
37
+ * @param $_marketing Marketing method:
38
+ * 0: Don't collect email addresses
39
+ * 1: Request permission same time as tracking opt-in
40
+ * 2: Request permission after opt-in
41
+ */
42
+ public function __construct(
43
+ $_plugin_file,
44
+ $_home_url,
45
+ $_options,
46
+ $_require_optin=true,
47
+ $_include_goodbye_form=true,
48
+ $_marketing=false ) {
49
+
50
+ $this->plugin_file = $_plugin_file;
51
+ $this->home_url = trailingslashit( $_home_url );
52
+
53
+ // If the filename is 'functions' then we're tracking a theme
54
+ if( basename( $this->plugin_file, '.php' ) != 'functions' ) {
55
+ $this->plugin_name = basename( $this->plugin_file, '.php' );
56
+ } else {
57
+ $this->what_am_i = 'theme';
58
+ $theme = wp_get_theme();
59
+ if( $theme->Name ) {
60
+ $this->plugin_name = sanitize_text_field( $theme->Name );
61
+ }
62
+ }
63
+
64
+ $this->options = $_options;
65
+ $this->require_optin = $_require_optin;
66
+ $this->include_goodbye_form = $_include_goodbye_form;
67
+ $this->marketing = $_marketing;
68
+
69
+ // Only use this on switching theme
70
+ $this->theme_allows_tracking = get_theme_mod( 'wisdom-allow-tracking', 0 );
71
+
72
+ // Schedule / deschedule tracking when activated / deactivated
73
+
74
+ if( $this->what_am_i == 'theme' ) {
75
+ // Need to think about scheduling for sites that have already activated the theme
76
+ add_action( 'after_switch_theme', array( $this, 'schedule_tracking' ) );
77
+ add_action( 'switch_theme', array( $this, 'deactivate_this_plugin' ) );
78
+ } else {
79
+ register_activation_hook( $this->plugin_file, array( $this, 'schedule_tracking' ) );
80
+ register_deactivation_hook( $this->plugin_file, array( $this, 'deactivate_this_plugin' ),11 );
81
+ }
82
+
83
+ // Get it going
84
+
85
+
86
+ $this->init();
87
+
88
+ }
89
+
90
+ public function init() {
91
+ // Check marketing
92
+ if( $this->marketing == 3 ) {
93
+ $this->set_can_collect_email( true, $this->plugin_name );
94
+ }
95
+
96
+ // Check whether opt-in is required
97
+ // If not, then tracking is allowed
98
+ if( ! $this->require_optin ) {
99
+ $this->set_can_collect_email( true, $this->plugin_name );
100
+ //$this->set_is_tracking_allowed( true );
101
+ $this->update_block_notice();
102
+ $this->do_tracking();
103
+ }
104
+
105
+ // Hook our do_tracking function to the daily action
106
+ add_action( 'put_do_weekly_action', array( $this, 'do_tracking' ) );
107
+
108
+ // Use this action for local testing
109
+ // add_action( 'admin_init', array( $this, 'do_tracking' ) );
110
+
111
+ // Display the admin notice on activation
112
+ add_action( 'admin_notices', array( $this, 'optin_notice' ) );
113
+ add_action( 'admin_notices', array( $this, 'marketing_notice' ) );
114
+
115
+ // Deactivation
116
+ add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filter_action_links' ),10 );
117
+ add_action( 'admin_footer-plugins.php', array( $this, 'goodbye_ajax' ) );
118
+ add_action( 'wp_ajax_goodbye_form', array( $this, 'goodbye_form_callback' ) );
119
+ /*$body = $this->get_data();
120
+
121
+ // Send the data
122
+ $this->send_data( $body );*/
123
+
124
+ }
125
+
126
+ /**
127
+ * When the plugin is activated
128
+ * Create scheduled event
129
+ * And check if tracking is enabled - perhaps the plugin has been reactivated
130
+ *
131
+ * @since 1.0.0
132
+ */
133
+ public function schedule_tracking() {
134
+ // For historical reasons, this is called 'weekly' but is in fact daily
135
+ if ( ! wp_next_scheduled( 'put_do_weekly_action' ) ) {
136
+ wp_schedule_event( time(), 'daily', 'put_do_weekly_action' );
137
+ }
138
+ }
139
+
140
+ /**
141
+ * This is our function to get everything going
142
+ * Check that user has opted in
143
+ * Collect data
144
+ * Then send it back
145
+ *
146
+ * @since 1.0.0
147
+ * @param $force Force tracking if it's not time
148
+ */
149
+ public function do_tracking( $force=false ) {
150
+
151
+ // If the home site hasn't been defined, we just drop out. Nothing much we can do.
152
+ if ( ! $this->home_url ) {
153
+ return;
154
+ }
155
+
156
+ // Check to see if the user has opted in to tracking
157
+ /*$allow_tracking = $this->get_is_tracking_allowed();
158
+ if( ! $allow_tracking ) {
159
+ return;
160
+ }
161
+ */
162
+ // Check to see if it's time to track
163
+ $track_time = $this->get_is_time_to_track();
164
+ if( ! $track_time && ! $force ) {
165
+ return;
166
+ }
167
+
168
+ $this->set_admin_email();
169
+
170
+ // Get our data
171
+ $body = $this->get_data();
172
+
173
+ // Send the data
174
+ $this->send_data( $body );
175
+
176
+ }
177
+
178
+ /**
179
+ * Send the data to the home site
180
+ *
181
+ * @since 1.0.0
182
+ */
183
+ public function send_data( $body ) {
184
+
185
+ $request = wp_remote_post(
186
+ esc_url( 'http://data.ampforwp.com/ssdw?usage_tracker=hello' ),
187
+ array(
188
+ 'method' => 'POST',
189
+ 'timeout' => 20,
190
+ 'redirection' => 5,
191
+ 'httpversion' => '1.1',
192
+ 'blocking' => true,
193
+ 'body' => $body,
194
+ 'user-agent' => 'PUT/1.0.0; ' . home_url()
195
+ )
196
+ );
197
+ //print_r($request['body']); die;
198
+
199
+
200
+ $this->set_track_time();
201
+
202
+ if( is_wp_error( $request ) ) {
203
+ return $request;
204
+ }
205
+
206
+ }
207
+
208
+ /**
209
+ * Here we collect most of the data
210
+ *
211
+ * @since 1.0.0
212
+ */
213
+ public function get_data() {
214
+
215
+ // Use this to pass error messages back if necessary
216
+ $body['message'] = '';
217
+
218
+ // Use this array to send data back
219
+ $body = array(
220
+ 'plugin_slug' => sanitize_text_field( $this->plugin_name ),
221
+ 'url' => home_url(),
222
+ 'site_name' => get_bloginfo( 'name' ),
223
+ 'site_version' => get_bloginfo( 'version' ),
224
+ 'site_language' => get_bloginfo( 'language' ),
225
+ 'charset' => get_bloginfo( 'charset' ),
226
+ 'wisdom_version' => $this->wisdom_version,
227
+ 'php_version' => phpversion(),
228
+ 'multisite' => is_multisite(),
229
+ 'file_location' => __FILE__,
230
+ 'product_type' => esc_html( $this->what_am_i )
231
+ );
232
+
233
+ // Collect the email if the correct option has been set
234
+ if( $this->get_can_collect_email() ) {
235
+ $body['email'] = $this->get_admin_email();
236
+ }
237
+ $body['marketing_method'] = $this->marketing;
238
+
239
+ $body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
240
+
241
+ // Retrieve current plugin information
242
+ if( ! function_exists( 'get_plugins' ) ) {
243
+ include ABSPATH . '/wp-admin/includes/plugin.php';
244
+ }
245
+
246
+ $plugins = array_keys( get_plugins() );
247
+ $active_plugins = get_option( 'active_plugins', array() );
248
+
249
+ foreach ( $plugins as $key => $plugin ) {
250
+ if ( in_array( $plugin, $active_plugins ) ) {
251
+ // Remove active plugins from list so we can show active and inactive separately
252
+ unset( $plugins[$key] );
253
+ }
254
+ }
255
+
256
+ $body['active_plugins'] = $active_plugins;
257
+ $body['inactive_plugins'] = $plugins;
258
+
259
+ // Check text direction
260
+ $body['text_direction'] = 'LTR';
261
+ if( function_exists( 'is_rtl' ) ) {
262
+ if( is_rtl() ) {
263
+ $body['text_direction'] = 'RTL';
264
+ }
265
+ } else {
266
+ $body['text_direction'] = 'not set';
267
+ }
268
+
269
+ /**
270
+ * Get our plugin data
271
+ * Currently we grab plugin name and version
272
+ * Or, return a message if the plugin data is not available
273
+ * @since 1.0.0
274
+ */
275
+ $plugin = $this->plugin_data();
276
+ if( empty( $plugin ) ) {
277
+ // We can't find the plugin data
278
+ // Send a message back to our home site
279
+ $body['message'] .= __( 'We can\'t detect any product information. This is most probably because you have not included the code snippet.', 'singularity' );
280
+ $body['status'] = 'Data not found'; // Never translated
281
+ } else {
282
+ if( isset( $plugin['Name'] ) ) {
283
+ $body['plugin'] = sanitize_text_field( $plugin['Name'] );
284
+ }
285
+ if( isset( $plugin['Version'] ) ) {
286
+ $body['version'] = sanitize_text_field( $plugin['Version'] );
287
+ }
288
+ $body['status'] = 'Active'; // Never translated
289
+ }
290
+
291
+ /**
292
+ * Get our plugin options
293
+ * @since 1.0.0
294
+ */
295
+ $options = $this->options;
296
+ $plugin_options = array();
297
+ if( ! empty( $options ) && is_array( $options ) ) {
298
+ foreach( $options as $option ) {
299
+ $fields = get_option( $option );
300
+ // Check for permission to send this option
301
+ if( isset( $fields['wisdom_registered_setting'] ) ) {
302
+ foreach( $fields as $key=>$value ) {
303
+ $plugin_options[$key] = $value;
304
+ }
305
+ }
306
+ }
307
+ }
308
+ $body['plugin_options'] = $this->options; // Returns array
309
+ $body['plugin_options_fields'] = $plugin_options; // Returns object
310
+
311
+ /**
312
+ * Get our theme data
313
+ * Currently we grab theme name and version
314
+ * @since 1.0.0
315
+ */
316
+ $theme = wp_get_theme();
317
+ if( $theme->Name ) {
318
+ $body['theme'] = sanitize_text_field( $theme->Name );
319
+ }
320
+ if( $theme->Version ) {
321
+ $body['theme_version'] = sanitize_text_field( $theme->Version );
322
+ }
323
+ if( $theme->Template ) {
324
+ $body['theme_parent'] = sanitize_text_field( $theme->Template );
325
+ }
326
+
327
+ if( false !== get_option( 'wisdom_deactivation_reason_' . $this->plugin_name ) ) {
328
+ $body['deactivation_reason'] = get_option( 'wisdom_deactivation_reason_' . $this->plugin_name );
329
+ }
330
+ // print_r($body); die;
331
+ // Return the data
332
+ return $body;
333
+
334
+ }
335
+
336
+ /**
337
+ * Return plugin data
338
+ * @since 1.0.0
339
+ */
340
+ public function plugin_data() {
341
+ // Being cautious here
342
+ if( ! function_exists( 'get_plugin_data' ) ) {
343
+ include ABSPATH . '/wp-admin/includes/plugin.php';
344
+ }
345
+ // Retrieve current plugin information
346
+ $plugin = get_plugin_data( $this->plugin_file );
347
+ return $plugin;
348
+ }
349
+
350
+ /**
351
+ * Deactivating plugin
352
+ * @since 1.0.0
353
+ */
354
+ public function deactivate_this_plugin() {
355
+
356
+ // Check to see if the user has opted in to tracking
357
+ /*if( $this->what_am_i == 'theme' ) {
358
+ $allow_tracking = $this->theme_allows_tracking;
359
+ } else {
360
+ $allow_tracking = $this->get_is_tracking_allowed();
361
+ }
362
+
363
+ if( ! $allow_tracking ) {
364
+ return;
365
+ }*/
366
+
367
+ $body = $this->get_data();
368
+
369
+ $body['status'] = 'Deactivated'; // Never translated
370
+ $body['deactivated_date'] = time();
371
+
372
+ // Add deactivation form data
373
+ if( false !== get_option( 'wisdom_deactivation_reason_' . $this->plugin_name ) ) {
374
+ $body['deactivation_reason'] = get_option( 'wisdom_deactivation_reason_' . $this->plugin_name );
375
+ }
376
+ if( false !== get_option( 'wisdom_deactivation_details_' . $this->plugin_name ) ) {
377
+ $body['deactivation_details'] = get_option( 'wisdom_deactivation_details_' . $this->plugin_name );
378
+ }
379
+
380
+ if( !empty($body) ){
381
+
382
+ $this->send_data( $body );
383
+ // Clear scheduled update
384
+ wp_clear_scheduled_hook( 'put_do_weekly_action' );
385
+ }
386
+ }
387
+
388
+ /**
389
+ * Is tracking allowed?
390
+ * @since 1.0.0
391
+ */
392
+ public function get_is_tracking_allowed() {
393
+ // First, check if the user has changed their mind and opted out of tracking
394
+ /*if( $this->has_user_opted_out() ) {
395
+ $this->set_is_tracking_allowed( false, $this->plugin_name );
396
+ return false;
397
+ }*/
398
+
399
+ if( $this->what_am_i == 'theme' ) {
400
+
401
+ $mod = get_theme_mod( 'wisdom-allow-tracking', 0 );
402
+ if( $mod ) {
403
+ return true;
404
+ }
405
+
406
+ } else {
407
+
408
+ // The wisdom_allow_tracking option is an array of plugins that are being tracked
409
+ $allow_tracking = get_option( 'wisdom_allow_tracking' );
410
+
411
+ // If this plugin is in the array, then tracking is allowed
412
+ if( isset( $allow_tracking[$this->plugin_name] ) ) {
413
+ return true;
414
+ }
415
+
416
+ }
417
+
418
+ return false;
419
+ }
420
+
421
+ /**
422
+ * Set if tracking is allowed
423
+ * Option is an array of all plugins with tracking permitted
424
+ * More than one plugin may be using the tracker
425
+ * @since 1.0.0
426
+ * @param $is_allowed Boolean true if tracking is allowed, false if not
427
+ */
428
+ public function set_is_tracking_allowed( $is_allowed, $plugin=null ) {
429
+
430
+ if( empty( $plugin ) ) {
431
+ $plugin = $this->plugin_name;
432
+ }
433
+
434
+ // The wisdom_allow_tracking option is an array of plugins that are being tracked
435
+ $allow_tracking = get_option( 'wisdom_allow_tracking' );
436
+
437
+ // If the user has decided to opt out
438
+ if( $this->has_user_opted_out() ) {
439
+ if( $this->what_am_i == 'theme' ) {
440
+ set_theme_mod( 'wisdom-allow-tracking', 0 );
441
+ } else {
442
+ if( isset( $allow_tracking[$plugin] ) ) {
443
+ unset( $allow_tracking[$plugin] );
444
+ }
445
+ }
446
+
447
+ } else if( $is_allowed || ! $this->require_optin ) {
448
+ // If the user has agreed to allow tracking or if opt-in is not required
449
+
450
+ if( $this->what_am_i == 'theme' ) {
451
+ set_theme_mod( 'wisdom-allow-tracking', 1 );
452
+ } else {
453
+ if( empty( $allow_tracking ) || ! is_array( $allow_tracking ) ) {
454
+ // If nothing exists in the option yet, start a new array with the plugin name
455
+ $allow_tracking = array( $plugin => $plugin );
456
+ } else {
457
+ // Else add the plugin name to the array
458
+ $allow_tracking[$plugin] = $plugin;
459
+ }
460
+ }
461
+
462
+ } else {
463
+
464
+ if( $this->what_am_i == 'theme' ) {
465
+ set_theme_mod( 'wisdom-allow-tracking', 0 );
466
+ } else {
467
+ if( isset( $allow_tracking[$plugin] ) ) {
468
+ unset( $allow_tracking[$plugin] );
469
+ }
470
+ }
471
+
472
+ }
473
+
474
+ update_option( 'wisdom_allow_tracking', $allow_tracking );
475
+
476
+ }
477
+
478
+ /**
479
+ * Has the user opted out of allowing tracking?
480
+ * Note that themes are opt in / plugins are opt out
481
+ * @since 1.1.0
482
+ * @return Boolean
483
+ */
484
+ public function has_user_opted_out() {
485
+ // Different opt-out methods for plugins and themes
486
+ if( $this->what_am_i == 'theme' ) {
487
+ // Look for the theme mod
488
+ $mod = get_theme_mod( 'wisdom-allow-tracking', 0 );
489
+ if( false === $mod ) {
490
+ // If the theme mod is not set, then return true - the user has opted out
491
+ return true;
492
+ }
493
+ } else {
494
+ // Iterate through the options that are being tracked looking for wisdom_opt_out setting
495
+ if( ! empty( $this->options ) ) {
496
+ foreach( $this->options as $option_name ) {
497
+ // Check each option
498
+ $options = get_option( $option_name );
499
+ // If we find the setting, return true
500
+ if( ! empty( $options['wisdom_opt_out'] ) ) {
501
+ return true;
502
+ }
503
+ }
504
+ }
505
+ }
506
+ return false;
507
+ }
508
+
509
+ /**
510
+ * Check if it's time to track
511
+ * @since 1.1.1
512
+ */
513
+ public function get_is_time_to_track() {
514
+ // Let's see if we're due to track this plugin yet
515
+ $track_times = get_option( 'wisdom_last_track_time', array() );
516
+ if( ! isset( $track_times[$this->plugin_name] ) ) {
517
+ // If we haven't set a time for this plugin yet, then we must track it
518
+ return true;
519
+ } else {
520
+ // If the time is set, let's see if it's more than a day ago
521
+ if( $track_times[$this->plugin_name] < strtotime( '-1 day' ) ) {
522
+ return true;
523
+ }
524
+ }
525
+ return false;
526
+ }
527
+
528
+ /**
529
+ * Record the time we send tracking data
530
+ * @since 1.1.1
531
+ */
532
+ public function set_track_time() {
533
+ // We've tracked, so record the time
534
+ $track_times = get_option( 'wisdom_last_track_time', array() );
535
+ // Set different times according to plugin, in case we are tracking multiple plugins
536
+ $track_times[$this->plugin_name] = time();
537
+ update_option( 'wisdom_last_track_time', $track_times );
538
+ }
539
+
540
+ /**
541
+ * Set if we should block the opt-in notice for this plugin
542
+ * Option is an array of all plugins that have received a response from the user
543
+ * @since 1.0.0
544
+ */
545
+ public function update_block_notice( $plugin=null ) {
546
+ if( empty( $plugin ) ) {
547
+ $plugin = $this->plugin_name;
548
+ }
549
+ $block_notice = get_option( 'saswp_wisdom_block_notice' );
550
+ if( empty( $block_notice ) || ! is_array( $block_notice ) ) {
551
+ // If nothing exists in the option yet, start a new array with the plugin name
552
+ $block_notice = array( $plugin => $plugin );
553
+ } else {
554
+ // Else add the plugin name to the array
555
+ $block_notice[$plugin] = $plugin;
556
+ }
557
+ update_option( 'saswp_wisdom_block_notice', $block_notice );
558
+ }
559
+
560
+ /**
561
+ * Can we collect the email address?
562
+ * @since 1.0.0
563
+ */
564
+ public function get_can_collect_email() {
565
+ // The wisdom_collect_email option is an array of plugins that are being tracked
566
+ $collect_email = get_option( 'wisdom_collect_email' );
567
+ // If this plugin is in the array, then we can collect the email address
568
+ if( isset( $collect_email[$this->plugin_name] ) ) {
569
+ return true;
570
+ }
571
+ return false;
572
+ }
573
+
574
+ /**
575
+ * Set if user has allowed us to collect their email address
576
+ * Option is an array of all plugins with email collection permitted
577
+ * More than one plugin may be using the tracker
578
+ * @since 1.0.0
579
+ * @param $can_collect Boolean true if collection is allowed, false if not
580
+ */
581
+ public function set_can_collect_email( $can_collect, $plugin=null ) {
582
+ if( empty( $plugin ) ) {
583
+ $plugin = $this->plugin_name;
584
+ }
585
+ // The wisdom_collect_email option is an array of plugins that are being tracked
586
+ $collect_email = get_option( 'wisdom_collect_email' );
587
+ // If the user has agreed to allow tracking or if opt-in is not required
588
+ if( $can_collect ) {
589
+ if( empty( $collect_email ) || ! is_array( $collect_email ) ) {
590
+ // If nothing exists in the option yet, start a new array with the plugin name
591
+ $collect_email = array( $plugin => $plugin );
592
+ } else {
593
+ // Else add the plugin name to the array
594
+ $collect_email[$plugin] = $plugin;
595
+ }
596
+ } else {
597
+ if( isset( $collect_email[$plugin] ) ) {
598
+ unset( $collect_email[$plugin] );
599
+ }
600
+ }
601
+ update_option( 'wisdom_collect_email', $collect_email );
602
+ }
603
+
604
+ /**
605
+ * Get the correct email address to use
606
+ * @since 1.1.2
607
+ * @return Email address
608
+ */
609
+ public function get_admin_email() {
610
+ // The wisdom_collect_email option is an array of plugins that are being tracked
611
+ $email = get_option( 'wisdom_admin_emails' );
612
+ // If this plugin is in the array, then we can collect the email address
613
+ if( isset( $email[$this->plugin_name] ) ) {
614
+ return $email[$this->plugin_name];
615
+ }
616
+ return false;
617
+ }
618
+
619
+ /**
620
+ * Set the correct email address to use
621
+ * There might be more than one admin on the site
622
+ * So we only use the first admin's email address
623
+ * @param $email Email address to set
624
+ * @param $plugin Plugin name to set email address for
625
+ * @since 1.1.2
626
+ */
627
+ public function set_admin_email( $email=null, $plugin=null ) {
628
+ if( empty( $plugin ) ) {
629
+ $plugin = $this->plugin_name;
630
+ }
631
+ // If no email address passed, try to get the current user's email
632
+ if( empty( $email ) ) {
633
+ // Have to check that current user object is available
634
+ if( function_exists( 'wp_get_current_user' ) ) {
635
+ $current_user = wp_get_current_user();
636
+ $email = $current_user->user_email;
637
+ }
638
+ }
639
+ // The wisdom_admin_emails option is an array of admin email addresses
640
+ $admin_emails = get_option( 'wisdom_admin_emails' );
641
+ if( empty( $admin_emails ) || ! is_array( $admin_emails ) ) {
642
+ // If nothing exists in the option yet, start a new array with the plugin name
643
+ $admin_emails = array( $plugin => sanitize_email( $email ) );
644
+ } else if( empty( $admin_emails[$plugin] ) ) {
645
+ // Else add the email address to the array, if not already set
646
+ $admin_emails[$plugin] = sanitize_email( $email );
647
+ }
648
+ update_option( 'wisdom_admin_emails', $admin_emails );
649
+ }
650
+
651
+ /**
652
+ * Display the admin notice to users to allow them to opt in
653
+ *
654
+ * @since 1.0.0
655
+ */
656
+ public function optin_notice() {
657
+ // Check for plugin args
658
+ if( isset( $_GET['plugin'] ) && isset( $_GET['plugin_action'] ) ) {
659
+ $plugin = sanitize_text_field( $_GET['plugin'] );
660
+ $action = sanitize_text_field( $_GET['plugin_action'] );
661
+ if( $action == 'yes' ) {
662
+ //$this->set_is_tracking_allowed( true, $plugin );
663
+ $this->do_tracking( true ); // Run this straightaway
664
+ } else {
665
+ //$this->set_is_tracking_allowed( false, $plugin );
666
+ }
667
+ $this->update_block_notice( $plugin );
668
+ }
669
+
670
+ // Check whether to block the notice, e.g. because we're in a local environment
671
+ // wisdom_block_notice works the same as wisdom_allow_tracking, an array of plugin names
672
+ $block_notice = get_option( 'saswp_wisdom_block_notice' );
673
+
674
+
675
+ if( isset( $block_notice[$this->plugin_name] ) ) {
676
+ return;
677
+ }
678
+
679
+ if ( ! current_user_can( 'manage_options' ) ) {
680
+ return;
681
+ }
682
+
683
+ // @credit EDD
684
+ // Don't bother asking user to opt in if they're in local dev
685
+ if ( stristr( network_site_url( '/' ), 'dev' ) !== false /*|| stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false*/ ) {
686
+ $this->update_block_notice();
687
+ } else {
688
+
689
+ // Display the notice requesting permission to track
690
+ // Retrieve current plugin information
691
+ $plugin = $this->plugin_data();
692
+ $plugin_name = $plugin['Name'];
693
+
694
+ // Args to add to query if user opts in to tracking
695
+ $yes_args = array(
696
+ 'plugin' => $this->plugin_name,
697
+ 'plugin_action' => 'yes'
698
+ );
699
+
700
+ // Decide how to request permission to collect email addresses
701
+ if( $this->marketing == 1 ) {
702
+ // Option 1 combines permissions to track and collect email
703
+ $yes_args['marketing_optin'] = 'yes';
704
+ } else if( $this->marketing == 2 ) {
705
+ // Option 2 enables a second notice that fires after the user opts in to tracking
706
+ $yes_args['marketing'] = 'yes';
707
+ }
708
+ $url_yes = add_query_arg( $yes_args );
709
+ $url_no = add_query_arg( array(
710
+ 'plugin' => $this->plugin_name,
711
+ 'plugin_action' => 'no'
712
+ ) );
713
+
714
+ // Decide on notice text
715
+ if( $this->marketing != 1 ) {
716
+ // Standard notice text
717
+ $notice_text = sprintf(
718
+ __( 'Become a super contributor by opting in to our anonymous %1$s data collection and to our updates. We guarantee no sensitive data is collected.'),
719
+ $this->what_am_i
720
+
721
+ );
722
+ } else {
723
+ // If we have option 1 for marketing, we include reference to sending product information here
724
+ $notice_text = sprintf(
725
+ __( 'Thank you for installing our %1$s. We\'d like your permission to track its usage on your site and subscribe you to our newsletter. We won\'t record any sensitive data, only information regarding the WordPress environment and %1$s settings, which we will use to help us make improvements to the %1$s. Tracking is completely optional.', 'singularity' ),
726
+ $this->what_am_i
727
+ );
728
+ }
729
+ // And we allow you to filter the text anyway
730
+ $notice_text = apply_filters( 'wisdom_notice_text_' . esc_attr( $this->plugin_name ), $notice_text ); ?>
731
+
732
+ <div class="notice notice-info updated put-dismiss-notice">
733
+ <p><?php echo '<strong>Love using Schema & Structured Data for WP & AMP?</strong>'; ?></p>
734
+ <p><?php echo esc_html( $notice_text ); ?> <a href="https://structured-data-for-wp.com/docs/article/how-to-set-up-schema-for-local-business/" target="_blank"><?php echo esc_html__( 'Learn more.', 'singularity' ); ?></a></p>
735
+ <p>
736
+ <a href="<?php echo esc_url( $url_yes ); ?>" class="button-primary"><?php echo _e( 'Sure! I\'d love to help', 'singularity' ); ?></a>&nbsp;&nbsp;
737
+ <a href="<?php echo esc_url( $url_no ); ?>" class="button-secondary"><?php echo _e( 'No thanks', 'singularity' ); ?></a>
738
+ </p>
739
+ </div>
740
+ <?php
741
+ }
742
+
743
+ }
744
+
745
+ /**
746
+ * Display the marketing notice to users if enabled
747
+ * Only displays after the user has opted in to tracking
748
+ *
749
+ * @since 1.0.0
750
+ */
751
+ public function marketing_notice() {
752
+ // Check if user has opted in to marketing
753
+ if( isset( $_GET['marketing_optin'] ) ) {
754
+ // Set marketing optin
755
+ $this->set_can_collect_email( sanitize_text_field( $_GET['marketing_optin'] ), $this->plugin_name );
756
+ // Do tracking
757
+ $this->do_tracking( true );
758
+ } else if( isset( $_GET['marketing'] ) && $_GET['marketing']=='yes' ) {
759
+ // Display the notice requesting permission to collect email address
760
+ // Retrieve current plugin information
761
+ $plugin = $this->plugin_data();
762
+ $plugin_name = $plugin['Name'];
763
+
764
+ $url_yes = add_query_arg( array(
765
+ 'plugin' => $this->plugin_name,
766
+ 'marketing_optin' => 'yes'
767
+ ) );
768
+ $url_no = add_query_arg( array(
769
+ 'plugin' => $this->plugin_name,
770
+ 'marketing_optin' => 'no'
771
+ ) );
772
+
773
+ $marketing_text = sprintf(
774
+ __( 'Thank you for opting in to tracking. Would you like to receive occasional news about this %s, including details of new features and special offers?', 'singularity' ),
775
+ $this->what_am_i
776
+ );
777
+ $marketing_text = apply_filters( 'wisdom_marketing_text_' . esc_attr( $this->plugin_name ), $marketing_text ); ?>
778
+
779
+ <div class="notice notice-info updated put-dismiss-notice">
780
+ <p><?php echo '<strong>' . esc_html( $plugin_name ) . '</strong>'; ?></p>
781
+ <p><?php echo esc_html( $marketing_text ); ?></p>
782
+ <p>
783
+ <a href="<?php echo esc_url( $url_yes ); ?>" data-putnotice="yes" class="button-secondary"><?php _e( 'Yes Please', 'singularity' ); ?></a>
784
+ <a href="<?php echo esc_url( $url_no ); ?>" data-putnotice="no" class="button-secondary"><?php _e( 'No Thank You', 'singularity' ); ?></a>
785
+ </p>
786
+ </div>
787
+ <?php }
788
+ }
789
+
790
+ /**
791
+ * Filter the deactivation link to allow us to present a form when the user deactivates the plugin
792
+ * @since 1.0.0
793
+ */
794
+ public function filter_action_links( $links ) {
795
+ // Check to see if the user has opted in to tracking
796
+ /*if( ! $this->get_is_tracking_allowed() ) {
797
+ return $links;
798
+ }*/
799
+ if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
800
+ $deactivation_link = $links['deactivate'];
801
+ // Insert an onClick action to allow form before deactivating
802
+ $deactivation_link = str_replace( '<a ', '<div class="put-goodbye-form-wrapper"><span class="put-goodbye-form" id="put-goodbye-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="put-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
803
+ $links['deactivate'] = $deactivation_link;
804
+ }
805
+ return $links;
806
+ }
807
+
808
+ /*
809
+ * Form text strings
810
+ * These are non-filterable and used as fallback in case filtered strings aren't set correctly
811
+ * @since 1.0.0
812
+ */
813
+ public function form_default_text() {
814
+ $form = array();
815
+ $form['heading'] = __( 'Sorry to see you go', 'singularity' );
816
+ $form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'singularity' );
817
+ $form['options'] = array(
818
+ __( 'Set up is too difficult', 'singularity' ),
819
+ __( 'Lack of documentation', 'singularity' ),
820
+ __( 'Not the features I wanted', 'singularity' ),
821
+ __( 'Found a better plugin', 'singularity' ),
822
+ __( 'Installed by mistake', 'singularity' ),
823
+ __( 'Only required temporarily', 'singularity' ),
824
+ __( 'Didn\'t work', 'singularity' )
825
+ );
826
+ $form['details'] = __( 'Details (optional)', 'singularity' );
827
+ return $form;
828
+ }
829
+
830
+ /**
831
+ * Form text strings
832
+ * These can be filtered
833
+ * The filter hook must be unique to the plugin
834
+ * @since 1.0.0
835
+ */
836
+ public function form_filterable_text() {
837
+ $form = $this->form_default_text();
838
+ return apply_filters( 'wisdom_form_text_' . esc_attr( $this->plugin_name ), $form );
839
+ }
840
+
841
+ /**
842
+ * Form text strings
843
+ * These can be filtered
844
+ * @since 1.0.0
845
+ */
846
+ public function goodbye_ajax() {
847
+ // Get our strings for the form
848
+ $form = $this->form_filterable_text();
849
+
850
+ if( ! isset( $form['heading'] ) || ! isset( $form['body'] ) || ! isset( $form['options'] ) || ! is_array( $form['options'] ) || ! isset( $form['details'] ) ) {
851
+ // If the form hasn't been filtered correctly, we revert to the default form
852
+ $form = $this->form_default_text();
853
+ }
854
+ // Build the HTML to go in the form
855
+ $html = '<div class="put-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
856
+ $html .= '<div class="put-goodbye-form-body"><p>' . esc_html( $form['body'] ) . '</p>';
857
+ if( is_array( $form['options'] ) ) {
858
+ $html .= '<div class="put-goodbye-options"><p>';
859
+ foreach( $form['options'] as $option ) {
860
+ $html .= '<input type="checkbox" name="put-goodbye-options[]" id="' . str_replace( " ", "", esc_attr( $option ) ) . '" value="' . esc_attr( $option ) . '"> <label for="' . str_replace( " ", "", esc_attr( $option ) ) . '">' . esc_attr( $option ) . '</label><br>';
861
+ }
862
+ $html .= '</p><label for="put-goodbye-reasons">' . esc_html( $form['details'] ) .'</label><textarea name="put-goodbye-reasons" id="put-goodbye-reasons" rows="2" style="width:100%"></textarea>';
863
+ $html .= '</div><!-- .put-goodbye-options -->';
864
+ }
865
+ $html .= '</div><!-- .put-goodbye-form-body -->';
866
+ $html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'singularity' ) . '</p>';
867
+ ?>
868
+ <div class="put-goodbye-form-bg"></div>
869
+ <style type="text/css">
870
+ .put-form-active .put-goodbye-form-bg {
871
+ background: rgba( 0, 0, 0, .5 );
872
+ position: fixed;
873
+ top: 0;
874
+ left: 0;
875
+ width: 100%;
876
+ height: 100%;
877
+ }
878
+ .put-goodbye-form-wrapper {
879
+ position: relative;
880
+ z-index: 999;
881
+ display: none;
882
+ }
883
+ .put-form-active .put-goodbye-form-wrapper {
884
+ display: block;
885
+ }
886
+ .put-goodbye-form {
887
+ display: none;
888
+ }
889
+ .put-form-active .put-goodbye-form {
890
+ position: absolute;
891
+ bottom: -196px;
892
+ left: 0;
893
+ max-width: 400px;
894
+ background: #fff;
895
+ white-space: normal;
896
+ }
897
+ .put-goodbye-form-head {
898
+ background: #0073aa;
899
+ color: #fff;
900
+ padding: 8px 18px;
901
+ }
902
+ .put-goodbye-form-body {
903
+ padding: 8px 18px;
904
+ color: #444;
905
+ }
906
+ .deactivating-spinner {
907
+ display: none;
908
+ }
909
+ .deactivating-spinner .spinner {
910
+ float: none;
911
+ margin: 4px 4px 0 18px;
912
+ vertical-align: bottom;
913
+ visibility: visible;
914
+ }
915
+ .put-goodbye-form-footer {
916
+ padding: 8px 18px;
917
+ }
918
+ </style>
919
+ <script>
920
+ jQuery(document).ready(function($){
921
+ $("#put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>").on("click",function(){
922
+ // We'll send the user to this deactivation link when they've completed or dismissed the form
923
+ var url = document.getElementById("put-goodbye-link-<?php echo esc_attr( $this->plugin_name ); ?>");
924
+ $('body').toggleClass('put-form-active');
925
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeIn();
926
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").html( '<?php echo $html; ?>' + '<div class="put-goodbye-form-footer"><p><a id="put-submit-form" class="button primary" href="#"><?php _e( 'Submit and Deactivate', 'singularity' ); ?></a>&nbsp;<a class="secondary button" href="'+url+'"><?php _e( 'Just Deactivate', 'singularity' ); ?></a></p></div>');
927
+ $('#put-submit-form').on('click', function(e){
928
+ // As soon as we click, the body of the form should disappear
929
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .put-goodbye-form-body").fadeOut();
930
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .put-goodbye-form-footer").fadeOut();
931
+ // Fade in spinner
932
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?> .deactivating-spinner").fadeIn();
933
+ e.preventDefault();
934
+ var values = new Array();
935
+ $.each($("input[name='put-goodbye-options[]']:checked"), function(){
936
+ values.push($(this).val());
937
+ });
938
+ var details = $('#put-goodbye-reasons').val();
939
+ var data = {
940
+ 'action': 'goodbye_form',
941
+ 'values': values,
942
+ 'details': details,
943
+ 'security': "<?php echo wp_create_nonce ( 'saswp_goodbye_form' ); ?>",
944
+ 'dataType': "json"
945
+ }
946
+ $.post(
947
+ ajaxurl,
948
+ data,
949
+ function(response){
950
+ // Redirect to original deactivation URL
951
+ window.location.href = url;
952
+ }
953
+ );
954
+ });
955
+ // If we click outside the form, the form will close
956
+ $('.put-goodbye-form-bg').on('click',function(){
957
+ $("#put-goodbye-form-<?php echo esc_attr( $this->plugin_name ); ?>").fadeOut();
958
+ $('body').removeClass('put-form-active');
959
+ });
960
+ });
961
+ });
962
+ </script>
963
+ <?php }
964
+
965
+ /**
966
+ * AJAX callback when the form is submitted
967
+ * @since 1.0.0
968
+ */
969
+ public function goodbye_form_callback() {
970
+ check_ajax_referer( 'saswp_goodbye_form', 'security' );
971
+ if( isset( $_POST['values'] ) ) {
972
+ $values = json_encode( wp_unslash( $_POST['values'] ) );
973
+ update_option( 'wisdom_deactivation_reason_' . $this->plugin_name, $values );
974
+ }
975
+ if( isset( $_POST['details'] ) ) {
976
+ $details = sanitize_text_field( $_POST['details'] );
977
+ update_option( 'wisdom_deactivation_details_' . $this->plugin_name, $details );
978
+ }
979
+ $this->do_tracking(); // Run this straightaway
980
+ echo 'success';
981
+ wp_die();
982
+ }
983
+
984
+ }
985
+
986
+ }
core/3rd-party/aqua_resizer.php CHANGED
@@ -36,8 +36,11 @@ if ( ! defined( 'ABSPATH' ) ) {
36
  */
37
 
38
  if(!class_exists('Aq_Resize')) {
39
- class Aq_Exception extends Exception {}
40
-
 
 
 
41
  class Aq_Resize
42
  {
43
  /**
36
  */
37
 
38
  if(!class_exists('Aq_Resize')) {
39
+
40
+ if(!class_exists('Aq_Exception')){
41
+ class Aq_Exception extends Exception {}
42
+ }
43
+
44
  class Aq_Resize
45
  {
46
  /**
core/3rd-party/class-amp-review-form-blacklist.php CHANGED
@@ -54,6 +54,24 @@ if ( class_exists( 'AMP_Blacklist_Sanitizer' ) ) {
54
  }
55
 
56
  $node_name = $node->nodeName;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  // Some nodes may contain valid content but are themselves invalid.
59
 
@@ -140,13 +158,17 @@ if ( class_exists( 'AMP_Blacklist_Sanitizer' ) ) {
140
  for ( $i = $length - 1; $i >= 0; $i-- ) {
141
 
142
  $element = $elements->item( $i );
143
-
 
 
 
 
 
 
144
  $parent_node = $element->parentNode;
145
 
146
  $parent_node->removeChild( $element );
147
 
148
-
149
-
150
  if ( 'body' !== $parent_node->nodeName && AMP_DOM_Utils::is_node_empty( $parent_node ) ) {
151
 
152
  $parent_node->parentNode->removeChild( $parent_node );
@@ -363,9 +385,12 @@ if ( class_exists( 'AMP_Blacklist_Sanitizer' ) ) {
363
 
364
  // Form works in AMP
365
 
366
- // 'form',
367
 
368
  // 'label',
 
 
 
369
 
370
  // 'input',
371
 
54
  }
55
 
56
  $node_name = $node->nodeName;
57
+
58
+ if($node->nodeName=='a' && $node->hasAttribute('href')){
59
+
60
+ $href = $node->getAttribute('href');
61
+
62
+ if( strpos($href,'tel:') ){
63
+ $disallowed = array('http://', 'https://');
64
+ foreach($disallowed as $d){
65
+ if(strpos($href, $d) === 0) {
66
+ $href = str_replace($d, '', $href);
67
+ }
68
+ }
69
+ $node->setAttribute('href',$href);
70
+ }
71
+
72
+ $node->setAttribute('href', \ampforwp_findInternalUrl($href));
73
+
74
+ }
75
 
76
  // Some nodes may contain valid content but are themselves invalid.
77
 
158
  for ( $i = $length - 1; $i >= 0; $i-- ) {
159
 
160
  $element = $elements->item( $i );
161
+
162
+ $form_class = $element->getAttribute('class');
163
+
164
+ if(strpos($form_class, 'saswp-review-submission-form') !== false){
165
+ continue;
166
+ }
167
+
168
  $parent_node = $element->parentNode;
169
 
170
  $parent_node->removeChild( $element );
171
 
 
 
172
  if ( 'body' !== $parent_node->nodeName && AMP_DOM_Utils::is_node_empty( $parent_node ) ) {
173
 
174
  $parent_node->parentNode->removeChild( $parent_node );
385
 
386
  // Form works in AMP
387
 
388
+ 'form',
389
 
390
  // 'label',
391
+
392
+
393
+
394
 
395
  // 'input',
396
 
core/array-list/compatibility-list.php CHANGED
@@ -4,6 +4,26 @@ if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  return array(
6
  'plugins' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  'strong_testimonials' => array(
8
  'name' => 'Strong Testimonials',
9
  'free' => 'strong-testimonials/strong-testimonials.php',
@@ -40,6 +60,12 @@ return array(
40
  'opt_name' => 'saswp-wpamp',
41
  'part_in' => 'free',
42
  ),
 
 
 
 
 
 
43
  'flex_mls_idx' => array(
44
  'name' => 'FlexMLS IDX',
45
  'free' => 'flexmls-idx/flexmls_connect.php',
@@ -279,5 +305,11 @@ return array(
279
  'opt_name' => 'saswp-realhomes',
280
  'part_in' => 'pro',
281
  ),
 
 
 
 
 
 
282
  )
283
  );
4
 
5
  return array(
6
  'plugins' => array(
7
+ 'easy_recipe' => array(
8
+ 'name' => 'EasyRecipe',
9
+ 'free' => 'easyrecipe/easyrecipe.php',
10
+ 'pro' => 'easyrecipe-pro/easyrecipe-pro.php',
11
+ 'opt_name' => 'saswp-easy-recipe',
12
+ 'part_in' => 'pro',
13
+ ),
14
+ 'wp_event_aggregator' => array(
15
+ 'name' => 'WP Event Aggregator',
16
+ 'free' => 'wp-event-aggregator/wp-event-aggregator.php',
17
+ 'pro' => 'wp-event-aggregator-pro/wp-event-aggregator-pro.php',
18
+ 'opt_name' => 'saswp-wp-event-aggregator',
19
+ 'part_in' => 'pro',
20
+ ),
21
+ 'tevolution_events' => array(
22
+ 'name' => 'Tevolution Events',
23
+ 'free' => 'Tevolution-Events/events.php',
24
+ 'opt_name' => 'saswp-tevolution-events',
25
+ 'part_in' => 'pro',
26
+ ),
27
  'strong_testimonials' => array(
28
  'name' => 'Strong Testimonials',
29
  'free' => 'strong-testimonials/strong-testimonials.php',
60
  'opt_name' => 'saswp-wpamp',
61
  'part_in' => 'free',
62
  ),
63
+ 'ampwp' => array(
64
+ 'name' => 'AMP WP',
65
+ 'free' => 'amp-wp/amp-wp.php',
66
+ 'opt_name' => 'saswp-ampwp',
67
+ 'part_in' => 'free',
68
+ ),
69
  'flex_mls_idx' => array(
70
  'name' => 'FlexMLS IDX',
71
  'free' => 'flexmls-idx/flexmls_connect.php',
305
  'opt_name' => 'saswp-realhomes',
306
  'part_in' => 'pro',
307
  ),
308
+ 'wpresidence' => array(
309
+ 'name' => 'WP Residence',
310
+ 'free' => 'wpresidence',
311
+ 'opt_name' => 'saswp-wpresidence',
312
+ 'part_in' => 'pro',
313
+ ),
314
  )
315
  );
core/array-list/repeater-fields.php CHANGED
@@ -2,7 +2,13 @@
2
  // Exit if accessed directly.
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
- return array( 'schema_type_element' => array(
 
 
 
 
 
 
6
  'Article' => array(
7
  'article_items' => 'article_items',
8
  ),
@@ -60,7 +66,31 @@ return array( 'schema_type_element' => array(
60
  'trip-itinerary' => 'trip_itinerary'
61
  )
62
  ),
63
- 'meta_name' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  'article_items' => array(
65
  array(
66
  'label' => 'Item Name',
@@ -145,9 +175,10 @@ return array( 'schema_type_element' => array(
145
  'label' => 'Performer Type',
146
  'name' => 'saswp_event_performer_type',
147
  'type' => 'select',
148
- 'options' => array(
149
- 'MusicGroup' => 'MusicGroup',
150
- 'Person' => 'Person'
 
151
  )
152
  ),
153
  array(
2
  // Exit if accessed directly.
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
+ return array( 'schema_type_element' => array(
6
+ 'MusicComposition' => array(
7
+ 'music_composer' => 'music_composer',
8
+ ),
9
+ 'Movie' => array(
10
+ 'movie_actor' => 'movie_actor',
11
+ ),
12
  'Article' => array(
13
  'article_items' => 'article_items',
14
  ),
66
  'trip-itinerary' => 'trip_itinerary'
67
  )
68
  ),
69
+ 'meta_name' => array(
70
+ 'movie_actor' => array(
71
+ array(
72
+ 'label' => 'Name',
73
+ 'name' => 'saswp_movie_actor_name',
74
+ 'type' => 'text',
75
+ ),
76
+ array(
77
+ 'label' => 'URL',
78
+ 'name' => 'saswp_movie_actor_url',
79
+ 'type' => 'text',
80
+ )
81
+ ),
82
+ 'music_composer' => array(
83
+ array(
84
+ 'label' => 'Name',
85
+ 'name' => 'saswp_music_composition_composer_name',
86
+ 'type' => 'text',
87
+ ),
88
+ array(
89
+ 'label' => 'URL',
90
+ 'name' => 'saswp_music_composition_composer_url',
91
+ 'type' => 'text',
92
+ )
93
+ ),
94
  'article_items' => array(
95
  array(
96
  'label' => 'Item Name',
175
  'label' => 'Performer Type',
176
  'name' => 'saswp_event_performer_type',
177
  'type' => 'select',
178
+ 'options' => array(
179
+ 'Person' => 'Person',
180
+ 'Organization' => 'Organization',
181
+ 'MusicGroup' => 'MusicGroup'
182
  )
183
  ),
184
  array(
core/array-list/schema-properties.php CHANGED
@@ -16,24 +16,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
16
 
17
  $post_id = $post->ID;
18
 
19
- $image_details = array();
20
-
21
- $image_id = get_post_thumbnail_id();
22
-
23
- if($image_id){
24
-
25
- $image_details = wp_get_attachment_image_src($image_id, 'full');
26
-
27
- }
28
-
29
- if(empty($image_details[0]) || $image_details[0] === NULL ){
30
-
31
- if(isset($sd_data['sd_logo']['url'])){
32
- $image_details[0] = $sd_data['sd_logo']['url'];
33
- }
34
-
35
- }
36
-
37
  $current_user = wp_get_current_user();
38
  $author_desc = get_the_author_meta( 'user_description' );
39
  $author_url = get_the_author_meta( 'user_url' );
@@ -843,6 +826,11 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
843
  'id' => 'saswp_event_schema_url_'.$schema_id,
844
  'type' => 'text',
845
  ),
 
 
 
 
 
846
  );
847
  break;
848
 
@@ -857,8 +845,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
857
  array(
858
  'label' => 'Image',
859
  'id' => 'saswp_tech_article_image_'.$schema_id,
860
- 'type' => 'media',
861
- 'default' => $image_details[0]
862
  ),
863
  array(
864
  'label' => 'Headline',
@@ -1005,8 +992,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1005
  array(
1006
  'label' => 'Image',
1007
  'id' => 'saswp_dfp_image_'.$schema_id,
1008
- 'type' => 'media',
1009
- 'default' => $image_details[0]
1010
  ),
1011
  array(
1012
  'label' => 'Date Published',
@@ -1571,7 +1557,9 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1571
  'Event' => 'Event',
1572
  'HowTo' => 'HowTo',
1573
  'local_business' => 'LocalBusiness',
1574
- 'MusicPlaylist' => 'Music Playlist',
 
 
1575
  'Product' => 'Product',
1576
  'Recipe' => 'Recipe',
1577
  'SoftwareApplication' => 'SoftwareApplication',
@@ -1760,8 +1748,7 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1760
  array(
1761
  'label' => 'Thumbnail Url',
1762
  'id' => 'saswp_video_object_thumbnail_url_'.$schema_id,
1763
- 'type' => 'text',
1764
- 'default' => $image_details[0]
1765
  ),
1766
  array(
1767
  'label' => 'Content Url',
@@ -1999,6 +1986,12 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1999
  case 'HowTo':
2000
 
2001
  $meta_field = array(
 
 
 
 
 
 
2002
  array(
2003
  'label' => 'Name',
2004
  'id' => 'saswp_howto_schema_name_'.$schema_id,
@@ -3482,6 +3475,181 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
3482
  ),
3483
  );
3484
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3485
 
3486
  default:
3487
  break;
16
 
17
  $post_id = $post->ID;
18
 
19
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  $current_user = wp_get_current_user();
21
  $author_desc = get_the_author_meta( 'user_description' );
22
  $author_url = get_the_author_meta( 'user_url' );
826
  'id' => 'saswp_event_schema_url_'.$schema_id,
827
  'type' => 'text',
828
  ),
829
+ array(
830
+ 'label' => 'Performer Name',
831
+ 'id' => 'saswp_event_schema_performer_name_'.$schema_id,
832
+ 'type' => 'text',
833
+ ),
834
  );
835
  break;
836
 
845
  array(
846
  'label' => 'Image',
847
  'id' => 'saswp_tech_article_image_'.$schema_id,
848
+ 'type' => 'media',
 
849
  ),
850
  array(
851
  'label' => 'Headline',
992
  array(
993
  'label' => 'Image',
994
  'id' => 'saswp_dfp_image_'.$schema_id,
995
+ 'type' => 'media',
 
996
  ),
997
  array(
998
  'label' => 'Date Published',
1557
  'Event' => 'Event',
1558
  'HowTo' => 'HowTo',
1559
  'local_business' => 'LocalBusiness',
1560
+ 'MusicPlaylist' => 'Music Playlist',
1561
+ 'Movie' => 'Movie',
1562
+ 'Organization' => 'Organization',
1563
  'Product' => 'Product',
1564
  'Recipe' => 'Recipe',
1565
  'SoftwareApplication' => 'SoftwareApplication',
1748
  array(
1749
  'label' => 'Thumbnail Url',
1750
  'id' => 'saswp_video_object_thumbnail_url_'.$schema_id,
1751
+ 'type' => 'text',
 
1752
  ),
1753
  array(
1754
  'label' => 'Content Url',
1986
  case 'HowTo':
1987
 
1988
  $meta_field = array(
1989
+ array(
1990
+ 'label' => 'ID',
1991
+ 'id' => 'saswp_howto_schema_id_'.$schema_id,
1992
+ 'type' => 'text',
1993
+ 'default' => 'HowTo'
1994
+ ),
1995
  array(
1996
  'label' => 'Name',
1997
  'id' => 'saswp_howto_schema_name_'.$schema_id,
3475
  ),
3476
  );
3477
  break;
3478
+
3479
+ case 'MusicComposition':
3480
+
3481
+ $meta_field = array(
3482
+ array(
3483
+ 'label' => 'Name',
3484
+ 'id' => 'saswp_music_composition_name_'.$schema_id,
3485
+ 'type' => 'text',
3486
+ ),
3487
+ array(
3488
+ 'label' => 'Description',
3489
+ 'id' => 'saswp_music_composition_description_'.$schema_id,
3490
+ 'type' => 'textarea',
3491
+ ),
3492
+ array(
3493
+ 'label' => 'Lyrics',
3494
+ 'id' => 'saswp_music_composition_lyrics_'.$schema_id,
3495
+ 'type' => 'textarea',
3496
+ ),
3497
+ array(
3498
+ 'label' => 'URL',
3499
+ 'id' => 'saswp_music_composition_url_'.$schema_id,
3500
+ 'type' => 'text',
3501
+ ),
3502
+ array(
3503
+ 'label' => 'ISWC Code',
3504
+ 'id' => 'saswp_music_composition_iswccode_'.$schema_id,
3505
+ 'type' => 'text',
3506
+ ),
3507
+ array(
3508
+ 'label' => 'Image',
3509
+ 'id' => 'saswp_music_composition_image_'.$schema_id,
3510
+ 'type' => 'media',
3511
+ ),
3512
+ array(
3513
+ 'label' => 'inLanguage',
3514
+ 'id' => 'saswp_music_composition_inlanguage_'.$schema_id,
3515
+ 'type' => 'text',
3516
+ ),
3517
+ array(
3518
+ 'label' => 'Publisher',
3519
+ 'id' => 'saswp_music_composition_publisher_'.$schema_id,
3520
+ 'type' => 'text',
3521
+ ),
3522
+ array(
3523
+ 'label' => 'Date Published',
3524
+ 'id' => 'saswp_music_composition_date_published_'.$schema_id,
3525
+ 'type' => 'text',
3526
+ 'default' => get_the_date("Y-m-d")
3527
+ ),
3528
+ );
3529
+ break;
3530
+
3531
+ case 'Organization':
3532
+
3533
+ $meta_field = array(
3534
+ array(
3535
+ 'label' => 'Name',
3536
+ 'id' => 'saswp_organization_name_'.$schema_id,
3537
+ 'type' => 'text',
3538
+ ),
3539
+ array(
3540
+ 'label' => 'Description',
3541
+ 'id' => 'saswp_organization_description_'.$schema_id,
3542
+ 'type' => 'text',
3543
+ ),
3544
+ array(
3545
+ 'label' => 'URL',
3546
+ 'id' => 'saswp_organization_url_'.$schema_id,
3547
+ 'type' => 'text',
3548
+ ),
3549
+ array(
3550
+ 'label' => 'Logo',
3551
+ 'id' => 'saswp_organization_logo_'.$schema_id,
3552
+ 'type' => 'media',
3553
+ ),
3554
+ array(
3555
+ 'label' => 'Street Address',
3556
+ 'id' => 'saswp_organization_street_address_'.$schema_id,
3557
+ 'type' => 'text',
3558
+ ),
3559
+ array(
3560
+ 'label' => 'City',
3561
+ 'id' => 'saswp_organization_city_'.$schema_id,
3562
+ 'type' => 'text',
3563
+ ),
3564
+ array(
3565
+ 'label' => 'State',
3566
+ 'id' => 'saswp_organization_state_'.$schema_id,
3567
+ 'type' => 'text',
3568
+ ),
3569
+ array(
3570
+ 'label' => 'Country',
3571
+ 'id' => 'saswp_organization_country_'.$schema_id,
3572
+ 'type' => 'text',
3573
+ ),
3574
+ array(
3575
+ 'label' => 'Postal Code',
3576
+ 'id' => 'saswp_organization_postal_code_'.$schema_id,
3577
+ 'type' => 'text',
3578
+ ),
3579
+ array(
3580
+ 'label' => 'Telephone',
3581
+ 'id' => 'saswp_organization_telephone_'.$schema_id,
3582
+ 'type' => 'text',
3583
+ ),
3584
+ array(
3585
+ 'label' => 'Aggregate Rating',
3586
+ 'id' => 'saswp_organization_enable_rating_'.$schema_id,
3587
+ 'type' => 'checkbox',
3588
+ ),
3589
+ array(
3590
+ 'label' => 'Rating',
3591
+ 'id' => 'saswp_organization_rating_value_'.$schema_id,
3592
+ 'type' => 'text',
3593
+ ),
3594
+ array(
3595
+ 'label' => 'Rating Count',
3596
+ 'id' => 'saswp_organization_rating_count_'.$schema_id,
3597
+ 'type' => 'text',
3598
+ ),
3599
+
3600
+ );
3601
+ break;
3602
+
3603
+ case 'Movie':
3604
+
3605
+ $meta_field = array(
3606
+ array(
3607
+ 'label' => 'Name',
3608
+ 'id' => 'saswp_movie_name_'.$schema_id,
3609
+ 'type' => 'text',
3610
+ ),
3611
+ array(
3612
+ 'label' => 'Description',
3613
+ 'id' => 'saswp_movie_description_'.$schema_id,
3614
+ 'type' => 'textarea',
3615
+ ),
3616
+ array(
3617
+ 'label' => 'URL',
3618
+ 'id' => 'saswp_movie_url_'.$schema_id,
3619
+ 'type' => 'text',
3620
+ ),
3621
+ array(
3622
+ 'label' => 'Image',
3623
+ 'id' => 'saswp_movie_image_'.$schema_id,
3624
+ 'type' => 'media',
3625
+ ),
3626
+ array(
3627
+ 'label' => 'Date Created',
3628
+ 'id' => 'saswp_movie_date_created_'.$schema_id,
3629
+ 'type' => 'text',
3630
+ ),
3631
+ array(
3632
+ 'label' => 'Director',
3633
+ 'id' => 'saswp_movie_director_'.$schema_id,
3634
+ 'type' => 'text',
3635
+ ),
3636
+ array(
3637
+ 'label' => 'Aggregate Rating',
3638
+ 'id' => 'saswp_movie_enable_rating_'.$schema_id,
3639
+ 'type' => 'checkbox',
3640
+ ),
3641
+ array(
3642
+ 'label' => 'Rating',
3643
+ 'id' => 'saswp_movie_rating_value_'.$schema_id,
3644
+ 'type' => 'text',
3645
+ ),
3646
+ array(
3647
+ 'label' => 'Rating Count',
3648
+ 'id' => 'saswp_movie_rating_count_'.$schema_id,
3649
+ 'type' => 'text',
3650
+ )
3651
+ );
3652
+ break;
3653
 
3654
  default:
3655
  break;
core/array-list/schemas.php CHANGED
@@ -21,6 +21,8 @@ return array(
21
  'ImageObject' => 'ImageObject',
22
  'MusicPlaylist' => 'MusicPlaylist',
23
  'MusicAlbum' => 'MusicAlbum',
 
 
24
  'NewsArticle' => 'NewsArticle',
25
  'qanda' => 'Q&A',
26
  'Review' => 'Review',
@@ -40,7 +42,6 @@ return array(
40
  'JobPosting' => 'JobPosting',
41
  'Service' => 'Service',
42
  'Trip' => 'Trip',
43
-
44
  ),
45
  'Media' => array(
46
  'AudioObject' => 'AudioObject',
21
  'ImageObject' => 'ImageObject',
22
  'MusicPlaylist' => 'MusicPlaylist',
23
  'MusicAlbum' => 'MusicAlbum',
24
+ 'MusicComposition' => 'MusicComposition',
25
+ 'Movie' => 'Movie',
26
  'NewsArticle' => 'NewsArticle',
27
  'qanda' => 'Q&A',
28
  'Review' => 'Review',
42
  'JobPosting' => 'JobPosting',
43
  'Service' => 'Service',
44
  'Trip' => 'Trip',
 
45
  ),
46
  'Media' => array(
47
  'AudioObject' => 'AudioObject',
modules/gutenberg/assets/blocks/collection.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const {SelectControl } = components;
7
+
8
+ blocks.registerBlockType( 'saswp/collection-block', {
9
+ title: __('Reviews Collections (SASWP)', 'schema-and-structured-data-for-wp'),
10
+ icon: 'admin-comments',
11
+ category: 'saswp-blocks',
12
+ keywords: ['schema', 'structured data', 'Reviews', 'reviews'],
13
+
14
+ attributes:{
15
+ id: {
16
+ type: 'integer'
17
+ }
18
+ },
19
+ supports: {
20
+ multiple: true
21
+ },
22
+ edit: function( props ) {
23
+
24
+ var collection = '';
25
+
26
+ if(saswpGutenbergCollection.collection){
27
+ collection = el(SelectControl,{
28
+ className:'saswp-rv-collection-list',
29
+ value: props.attributes.id,
30
+ options:saswpGutenbergCollection.collection,
31
+ onChange: function(value){
32
+
33
+ props.setAttributes( { id: parseInt(value) } );
34
+ }
35
+ }
36
+ );
37
+ }
38
+ if(saswpGutenbergCollection.collection_not_found){
39
+
40
+ collection = el('div',{className:'saswp-collection-not-found'},
41
+ __('Collection not found ', 'schema-and-structured-data-for-wp'),
42
+ el('a',{
43
+ href:saswpGutenbergCollection.collection_url
44
+ },
45
+ __('Create One', 'schema-and-structured-data-for-wp'),
46
+ )
47
+ );
48
+
49
+ }
50
+
51
+ return collection;
52
+ },
53
+ save: function( props ) {
54
+ return null;
55
+ }
56
+ } );
57
+ }(
58
+ window.wp.blocks,
59
+ window.wp.element,
60
+ window.wp.blockEditor,
61
+ window.wp.components,
62
+ window.wp.i18n
63
+ ) );
64
+
modules/gutenberg/assets/blocks/course.js ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const { RichText, AlignmentToolbar, BlockControls, InspectorControls, MediaUpload } = editor;
7
+ const {RadioControl, Popover, Button, IconButton, TextareaControl, TextControl, ToggleControl, PanelBody, DateTimePicker } = components;
8
+
9
+ blocks.registerBlockType( 'saswp/course-block', {
10
+ title: __('Course (SASWP)', 'schema-and-structured-data-for-wp'),
11
+ icon: 'welcome-learn-more',
12
+ category: 'saswp-blocks',
13
+ keywords: ['schema', 'structured data', 'Course', 'course'],
14
+
15
+ // Allow only one How To block per post.
16
+ supports: {
17
+ multiple: false
18
+ },
19
+
20
+ attributes: {
21
+ courses: {
22
+ default: [{index: 0}],
23
+ query: {
24
+ name: {
25
+ type: 'string'
26
+ },
27
+ description: {
28
+ type: 'string'
29
+ },
30
+ image_id: {
31
+ type: 'integer'
32
+ },
33
+ image_url: {
34
+ type: 'string'
35
+ },
36
+ provider_name: {
37
+ type: 'string'
38
+ },
39
+ provider_website: {
40
+ type: 'string'
41
+ },
42
+ index: {
43
+ type: 'number',
44
+ attribute: 'data-index'
45
+ },
46
+ isSelected: {
47
+ type: 'boolean',
48
+ default:false
49
+ }
50
+ }
51
+ }
52
+ },
53
+ edit: function( props ){
54
+
55
+ var attributes = props.attributes;
56
+
57
+ function saswpRemoveRepeater(oldItems, fieldname, item){
58
+
59
+ const oldAttributes = attributes;
60
+ const newTestimonials = oldItems.filter(function(itemFilter){
61
+
62
+ return itemFilter.index != item.index
63
+ }).map(function(t){
64
+ if (t.index > oldItems.index) {
65
+ t.index -= 1;
66
+ }
67
+ return t;
68
+ });
69
+
70
+ newTestimonials.forEach(function(value, index){
71
+ newTestimonials[index]['index'] = index;
72
+ });
73
+
74
+ oldAttributes[fieldname] = newTestimonials;
75
+ props.setAttributes({
76
+ attributes: oldAttributes
77
+ });
78
+
79
+ }
80
+
81
+ function _cloneArray(arr) {
82
+ if (Array.isArray(arr)) {
83
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
84
+ arr2[i] = arr[i];
85
+ }
86
+ return arr2;
87
+ } else {
88
+ return Array.from(arr);
89
+ }
90
+ }
91
+
92
+ var course_list = attributes.courses.sort(function(a , b){
93
+ return a.index - b.index;
94
+ }).map(function(course){
95
+
96
+ return el('li',{
97
+ className: 'course'
98
+ },
99
+ el('fieldset',{className:'saswp-course-fieldset'},
100
+ el(IconButton,{
101
+ icon:'trash',
102
+ className: 'saswp-remove-repeater',
103
+ onClick: function(){
104
+ const oldItems = attributes.courses;
105
+ const fieldname = 'courses';
106
+ saswpRemoveRepeater(oldItems, fieldname, course);
107
+ }
108
+ }),
109
+ el(TextControl,{
110
+ className:'saswp-course-name',
111
+ label : __('Name', 'schema-and-structured-data-for-wp'),
112
+ value : course.name,
113
+ onChange: function( value ) {
114
+ var newObject = Object.assign({}, course, {
115
+ name: value
116
+ });
117
+ return props.setAttributes({
118
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
119
+ return itemFilter.index != course.index;
120
+ })), [newObject])
121
+ });
122
+ }
123
+ }),
124
+ el(MediaUpload,{
125
+ className:'saswp-course-image',
126
+ allowedTypes:[ "image" ],
127
+ value: course.image_id,
128
+ onSelect: function(value){
129
+
130
+ var newObject = Object.assign({}, course, {
131
+ image_id: value.id,
132
+ image_url: value.url
133
+ });
134
+ return props.setAttributes({
135
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
136
+ return itemFilter.index != course.index;
137
+ })), [newObject])
138
+ });
139
+
140
+ },
141
+ render:function(obj){
142
+
143
+ var render_res;
144
+ if(course.image_url){
145
+
146
+ render_res = el('div',{
147
+ className:'saswp-course-image-panel'},
148
+ el('img',{
149
+ src:course.image_url,
150
+ onClick: obj.open,
151
+ }),
152
+ el(Button,{
153
+ className:'saswp-remove is-link',
154
+ isDestructive : true,
155
+ onClick: function(){
156
+ var newObject = Object.assign({}, course, {
157
+ image_id: null,
158
+ image_url: ''
159
+ });
160
+ return props.setAttributes({
161
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
162
+ return itemFilter.index != course.index;
163
+ })), [newObject])
164
+ });
165
+ }
166
+ },
167
+ __('Remove Image', 'schema-and-structured-data-for-wp')
168
+ )
169
+ );
170
+ }else{
171
+
172
+ render_res = el( Button, {
173
+ isSecondary: true,
174
+ className: 'editor-post-featured-image__toggle',
175
+ onClick: obj.open
176
+ },
177
+ __('Set Image', 'schema-and-structured-data-for-wp')
178
+ );
179
+ }
180
+ return render_res;
181
+
182
+ }
183
+ }
184
+ ),
185
+ el(TextareaControl,{
186
+ className:'saswp-course-description',
187
+ label : __('Description', 'schema-and-structured-data-for-wp'),
188
+ value : course.description,
189
+ onChange: function( value ) {
190
+ var newObject = Object.assign({}, course, {
191
+ description: value
192
+ });
193
+ return props.setAttributes({
194
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
195
+ return itemFilter.index != course.index;
196
+ })), [newObject])
197
+ });
198
+ }
199
+ }),
200
+ el(TextControl,{
201
+ className:'saswp-course-provider-name',
202
+ label : __('Provider Name', 'schema-and-structured-data-for-wp'),
203
+ value : course.provider_name,
204
+ onChange: function( value ) {
205
+ var newObject = Object.assign({}, course, {
206
+ provider_name: value
207
+ });
208
+ return props.setAttributes({
209
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
210
+ return itemFilter.index != course.index;
211
+ })), [newObject])
212
+ });
213
+ }
214
+ }),
215
+ el(TextControl,{
216
+ className:'saswp-course-provider-website',
217
+ label : __('Provider Website', 'schema-and-structured-data-for-wp'),
218
+ value : course.provider_website,
219
+ onChange: function( value ) {
220
+ var newObject = Object.assign({}, course, {
221
+ provider_website: value
222
+ });
223
+ return props.setAttributes({
224
+ courses: [].concat(_cloneArray(props.attributes.courses.filter(function (itemFilter) {
225
+ return itemFilter.index != course.index;
226
+ })), [newObject])
227
+ });
228
+ }
229
+ }),
230
+
231
+ )
232
+ )
233
+
234
+ });
235
+
236
+ var course_data = el('div',{
237
+ className:'saswp-course-list'
238
+ },
239
+ el('ul',{className:'saswp-course-ul'},
240
+ course_list
241
+ ),
242
+ el(Button,{
243
+ className:'saswp-course-repeater',
244
+ isSecondary: true,
245
+ isLarge : true,
246
+ onClick: function() {
247
+ return props.setAttributes({
248
+ courses: [].concat(_cloneArray(props.attributes.courses), [{
249
+ index: props.attributes.courses.length
250
+ }])
251
+ });
252
+ }
253
+ },
254
+ __('Add More Course', 'schema-and-structured-data-for-wp')
255
+ )
256
+ );
257
+
258
+ return [
259
+ el(InspectorControls,{
260
+ className: 'saswp-course-inspector',
261
+ },
262
+ ),
263
+ el('div',{className:'saswp-course-wrapper'},
264
+ course_data
265
+ )
266
+ ];
267
+
268
+ },
269
+ save: function( props ) {
270
+ return null
271
+ }
272
+ } );
273
+ }(
274
+ window.wp.blocks,
275
+ window.wp.element,
276
+ window.wp.blockEditor,
277
+ window.wp.components,
278
+ window.wp.i18n,
279
+ ) );
280
+
modules/gutenberg/assets/blocks/event.js ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const { RichText, AlignmentToolbar, BlockControls, InspectorControls, MediaUpload } = editor;
7
+ const {Popover, Button, IconButton, TextControl, ToggleControl, PanelBody, DateTimePicker } = components;
8
+
9
+ blocks.registerBlockType( 'saswp/event-block', {
10
+ title: __('Event (SASWP)', 'schema-and-structured-data-for-wp'),
11
+ icon: 'calendar',
12
+ category: 'saswp-blocks',
13
+ keywords: ['schema', 'structured data', 'Event', 'event'],
14
+
15
+ attributes:{
16
+ start_date: {
17
+ type: 'string'
18
+ },
19
+ start_time: {
20
+ type: 'string'
21
+ },
22
+ start_date_iso: {
23
+ type: 'string'
24
+ },
25
+ start_date_toggle: {
26
+ type: 'boolean',
27
+ default: false
28
+ },
29
+ end_date: {
30
+ type: 'string'
31
+ },
32
+ end_time: {
33
+ type: 'string'
34
+ },
35
+ end_date_iso: {
36
+ type: 'string'
37
+ },
38
+ end_date_toggle: {
39
+ type: 'boolean',
40
+ default: false
41
+ },
42
+ all_day: {
43
+ type: 'boolean',
44
+ default: false
45
+ },
46
+ website: {
47
+ type: 'string'
48
+
49
+ },
50
+ price: {
51
+ type: 'integer'
52
+ },
53
+ currency_code: {
54
+ type: 'string',
55
+ default: 'USD'
56
+ },
57
+ venue_name: {
58
+ type: 'string'
59
+ },
60
+ venue_address: {
61
+ type: 'string'
62
+ },
63
+ venue_city: {
64
+ type: 'string'
65
+ },
66
+ venue_country: {
67
+ type: 'string'
68
+ },
69
+ venue_state: {
70
+ type: 'string'
71
+ },
72
+ venue_postal_code: {
73
+ type: 'string'
74
+ },
75
+ venue_phone: {
76
+ type: 'string'
77
+ },
78
+ venue_website: {
79
+ type: 'string'
80
+ },
81
+ organizers: {
82
+ default: [{index: 0, name: '', phone: '', website: '', email: ''}],
83
+ query: {
84
+ index: {
85
+ type: 'number',
86
+ attribute: 'data-index'
87
+ },
88
+ isSelected: {
89
+ type: 'boolean',
90
+ default:false
91
+ },
92
+ name: {
93
+ type: 'string'
94
+ },
95
+ phone: {
96
+ type: 'string'
97
+ },
98
+ website: {
99
+ type: 'string'
100
+ },
101
+ email: {
102
+ type: 'string'
103
+ },
104
+ }
105
+ },
106
+ performers: {
107
+ default: [{index: 0, name: '', url: '', email: ''}],
108
+ query: {
109
+ index: {
110
+ type: 'number',
111
+ attribute: 'data-index'
112
+ },
113
+ isSelected: {
114
+ type: 'boolean',
115
+ default:false
116
+ },
117
+ name: {
118
+ type: 'string'
119
+ },
120
+ url: {
121
+ type: 'string'
122
+ },
123
+ email: {
124
+ type: 'string'
125
+ }
126
+ }
127
+ },
128
+
129
+ },
130
+
131
+ // Allow only one How To block per post.
132
+ supports: {
133
+ multiple: false
134
+ },
135
+
136
+ edit: function( props ) {
137
+
138
+ var attributes = props.attributes;
139
+
140
+ function saswpRemoveRepeater(oldItems, fieldname, item){
141
+
142
+ const oldAttributes = attributes;
143
+ const newTestimonials = oldItems.filter(function(itemFilter){
144
+
145
+ return itemFilter.index != item.index
146
+ }).map(function(t){
147
+ if (t.index > oldItems.index) {
148
+ t.index -= 1;
149
+ }
150
+ return t;
151
+ });
152
+
153
+ newTestimonials.forEach(function(value, index){
154
+ newTestimonials[index]['index'] = index;
155
+ });
156
+
157
+ oldAttributes[fieldname] = newTestimonials;
158
+ props.setAttributes({
159
+ attributes: oldAttributes
160
+ });
161
+
162
+ }
163
+ function _cloneArray(arr) {
164
+ if (Array.isArray(arr)) {
165
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
166
+ arr2[i] = arr[i];
167
+ }
168
+ return arr2;
169
+ } else {
170
+ return Array.from(arr);
171
+ }
172
+ }
173
+
174
+ function saswp_on_item_change(newObject, item, type){
175
+
176
+ if(type == 'performers'){
177
+ return props.setAttributes({
178
+ performers: [].concat(_cloneArray(props.attributes.performers.filter(function (itemFilter) {
179
+ return itemFilter.index != item.index;
180
+ })), [newObject])
181
+ });
182
+ }
183
+
184
+ if(type == 'organizers'){
185
+ return props.setAttributes({
186
+ organizers: [].concat(_cloneArray(props.attributes.organizers.filter(function (itemFilter) {
187
+ return itemFilter.index != item.index;
188
+ })), [newObject])
189
+ });
190
+ }
191
+
192
+ }
193
+
194
+ var start_date_div = el('div',{},el('span', {}, 'Start Date'),
195
+ el('span',{className:'saswp-event-date-fields'},
196
+ el(TextControl,{
197
+ className:'saswp-event-start-date',
198
+ value : attributes.start_date,
199
+ onClick:function(){
200
+ props.setAttributes( { start_date_toggle: true } );
201
+ }
202
+ }),
203
+ !attributes.all_day ?
204
+ el(TextControl,{
205
+ className:'saswp-event-start-time',
206
+ value : attributes.start_time,
207
+ onClick:function(){
208
+ props.setAttributes( { start_date_toggle: true } );
209
+ }
210
+ }) : ''
211
+ ),
212
+ attributes.start_date_toggle ?
213
+ el(
214
+ Popover,{
215
+ class:'saswp-calender-popover',
216
+ position: 'bottom',
217
+ onClose: function(){
218
+ props.setAttributes( { start_date_toggle: false } );
219
+ }
220
+ },
221
+ el(DateTimePicker,{
222
+ currentDate: attributes.start_date_iso,
223
+ is12Hour : true,
224
+ onChange: function(value){
225
+ attributes.start_date_iso = value;
226
+ var newDate = moment(value).format('YYYY-MM-DD');
227
+ var newTime = moment(value).format('h:mm:ss a');
228
+ props.setAttributes( { start_date: newDate } );
229
+ props.setAttributes( { start_time: newTime } );
230
+
231
+ }
232
+ })
233
+ )
234
+ : ''
235
+ );
236
+
237
+ var end_date_div = el('div',{},
238
+ el('span', {},
239
+ __('End Date', 'schema-and-structured-data-for-wp')),
240
+ el('span',{className:'saswp-event-date-fields'},
241
+ el(TextControl,{
242
+ className:'saswp-event-end-date',
243
+ value : attributes.end_date,
244
+ onClick:function(){
245
+ props.setAttributes( { end_date_toggle: true } );
246
+ }
247
+ }),
248
+ !attributes.all_day ?
249
+ el(TextControl,{
250
+ className:'saswp-event-end-time',
251
+ value : attributes.end_time,
252
+ onClick:function(){
253
+ props.setAttributes( { end_date_toggle: true } );
254
+ }
255
+ }) : ''
256
+ ),
257
+ attributes.end_date_toggle ? el(
258
+ Popover,{
259
+ class:'saswp-calender-popover',
260
+ position: 'bottom',
261
+ onClose: function(){
262
+ props.setAttributes( { end_date_toggle: false } );
263
+ }
264
+ },
265
+ el(DateTimePicker,{
266
+ currentDate: attributes.end_date_iso,
267
+ is12Hour : true,
268
+ onChange: function(value){
269
+ attributes.end_date_iso = value;
270
+ var newDate = moment(value).format('YYYY-MM-DD');
271
+ var newTime = moment(value).format('h:mm:ss a');
272
+ props.setAttributes( { end_date: newDate } );
273
+ props.setAttributes( { end_time: newTime } );
274
+
275
+ }
276
+ })) : '' );
277
+
278
+
279
+ var event_details = el('fieldset',{
280
+ className:'saswp-event-date-fieldset'},
281
+ start_date_div, end_date_div,
282
+ el(TextControl,{
283
+ value : attributes.website,
284
+ label: __('Website', 'schema-and-structured-data-for-wp'),
285
+ onChange: function(value){
286
+ props.setAttributes( { website: value } );
287
+ }
288
+ }),
289
+ el(TextControl,{
290
+ value : attributes.price,
291
+ label: __('Price', 'schema-and-structured-data-for-wp'),
292
+ onChange: function(value){
293
+ props.setAttributes( { price: parseInt(value) } );
294
+ }
295
+ }),
296
+ el(TextControl,{
297
+ value : attributes.currency_code,
298
+ label: __('Currency Code', 'schema-and-structured-data-for-wp'),
299
+ onChange: function(value){
300
+ props.setAttributes( { currency_code: value } );
301
+ }
302
+ })
303
+ );
304
+
305
+ var venue = el('fieldset',{className:'saswp-event-venue-fieldset'},el('div',{className:'saswp-event-venue'},
306
+ el('h3',{},__('Location', 'schema-and-structured-data-for-wp')),
307
+ el(TextControl,{
308
+ label:__('Name', 'schema-and-structured-data-for-wp'),
309
+ value:attributes.venue_name,
310
+ onChange: function(value){
311
+ props.setAttributes( { venue_name: value } );
312
+ }
313
+ }),
314
+ el(TextControl,{
315
+ label:__('Address', 'schema-and-structured-data-for-wp'),
316
+ value:attributes.venue_address,
317
+ onChange: function(value){
318
+ props.setAttributes( { venue_address: value } );
319
+ }
320
+ }),
321
+ el(TextControl,{
322
+ label:__('City', 'schema-and-structured-data-for-wp'),
323
+ value:attributes.venue_city,
324
+ onChange: function(value){
325
+ props.setAttributes( { venue_city: value } );
326
+ }
327
+ }),
328
+ el(TextControl,{
329
+ label:__('Country', 'schema-and-structured-data-for-wp'),
330
+ value:attributes.venue_country,
331
+ onChange: function(value){
332
+ props.setAttributes( { venue_country: value } );
333
+ }
334
+ }),
335
+ el(TextControl,{
336
+ label:__('State Or Province', 'schema-and-structured-data-for-wp'),
337
+ value:attributes.venue_state,
338
+ onChange: function(value){
339
+ props.setAttributes( { venue_state: value } );
340
+ }
341
+ }),
342
+ el(TextControl,{
343
+ label:__('Postal Code', 'schema-and-structured-data-for-wp'),
344
+ value:attributes.venue_postal_code,
345
+ onChange: function(value){
346
+ props.setAttributes( { venue_postal_code: value } );
347
+ }
348
+ }),
349
+ el(TextControl,{
350
+ label:__('Phone', 'schema-and-structured-data-for-wp'),
351
+ value:attributes.venue_phone,
352
+ onChange: function(value){
353
+ props.setAttributes( { venue_phone: value } );
354
+ }
355
+ }),
356
+ el(TextControl,{
357
+ label:__('Website', 'schema-and-structured-data-for-wp'),
358
+ value:attributes.venue_website,
359
+ onChange: function(value){
360
+ props.setAttributes( { venue_website: value } );
361
+ }
362
+ })
363
+ ));
364
+
365
+ var organizers_loop = attributes.organizers.sort(function(a, b){
366
+ return a.index - b.index;
367
+ }).map(function(item){
368
+
369
+ return el('fieldset',{className:'saswp-event-organisers-fieldset'},el('div',{className:'saswp-event-organisers'},
370
+ el(IconButton,{
371
+ icon:'trash',
372
+ className: 'saswp-remove-repeater',
373
+ onClick: function(e){
374
+
375
+ const oldItems = attributes.organizers;
376
+ const fieldname = 'organizers';
377
+ saswpRemoveRepeater(oldItems, fieldname, item);
378
+ }
379
+ }),
380
+ el(TextControl,{
381
+ label:__('Name', 'schema-and-structured-data-for-wp'),
382
+ value: item.name,
383
+ onChange: function( value ) {
384
+ var newObject = Object.assign({}, item, {
385
+ name: value
386
+ });
387
+ saswp_on_item_change(newObject, item, 'organizers');
388
+ }
389
+ }),
390
+ el(TextControl,{
391
+ label:__('Phone', 'schema-and-structured-data-for-wp'),
392
+ value: item.phone,
393
+ onChange: function(value){
394
+ var newObject = Object.assign({}, item, {
395
+ phone: value
396
+ });
397
+ saswp_on_item_change(newObject, item, 'organizers');
398
+ }
399
+ }),
400
+ el(TextControl,{
401
+ label:__('Website', 'schema-and-structured-data-for-wp'),
402
+ value: item.website,
403
+ onChange: function(value){
404
+ var newObject = Object.assign({}, item, {
405
+ website: value
406
+ });
407
+ saswp_on_item_change(newObject, item, 'organizers');
408
+
409
+ }
410
+ }),
411
+ el(TextControl,{
412
+ label:__('Email', 'schema-and-structured-data-for-wp'),
413
+ value: item.email,
414
+ onChange: function(value){
415
+ var newObject = Object.assign({}, item, {
416
+ email: value
417
+ });
418
+ saswp_on_item_change(newObject, item, 'organizers');
419
+ }
420
+ })
421
+ ));
422
+
423
+ });
424
+
425
+ var organizers = el('fieldset',{className:'saswp-event-organisers-fieldset'},el('div',{
426
+ className:'saswp-event-organisers-container'
427
+ },
428
+ el('h3',{},__('Organizers', 'schema-and-structured-data-for-wp')),
429
+ organizers_loop,
430
+ el(Button,{
431
+ className:'saswp-org-repeater',
432
+ isSecondary: true,
433
+ isLarge : true,
434
+ onClick: function() {
435
+ return props.setAttributes({
436
+ organizers: [].concat(_cloneArray(props.attributes.organizers), [{
437
+ index: props.attributes.organizers.length
438
+ }])
439
+ });
440
+ }
441
+ },
442
+ __('Add More Organizer', 'schema-and-structured-data-for-wp')
443
+ ),
444
+ ));
445
+
446
+ var performers_loop = attributes.performers.sort(function(a, b){
447
+ return a.index - b.index;
448
+ }).map(function(item){
449
+
450
+ return el('fieldset',{className:'saswp-event-performers-fieldset'},el('div',{className:'saswp-event-performers'},
451
+ el(IconButton,{
452
+ icon:'trash',
453
+ className: 'saswp-remove-repeater',
454
+ onClick: function(e){
455
+
456
+ const oldItems = attributes.performers;
457
+ const fieldname = 'performers';
458
+ saswpRemoveRepeater(oldItems, fieldname, item);
459
+ }
460
+ }),
461
+ el(TextControl,{
462
+ label:__('Name', 'schema-and-structured-data-for-wp'),
463
+ value: item.name,
464
+ onChange: function( value ) {
465
+ var newObject = Object.assign({}, item, {
466
+ name: value
467
+ });
468
+ saswp_on_item_change(newObject, item, 'performers');
469
+ }
470
+ }),
471
+ el(TextControl,{
472
+ label:__('URL', 'schema-and-structured-data-for-wp'),
473
+ value: item.url,
474
+ onChange: function(value){
475
+ var newObject = Object.assign({}, item, {
476
+ url: value
477
+ });
478
+ saswp_on_item_change(newObject, item, 'performers');
479
+ }
480
+ }),
481
+
482
+ el(TextControl,{
483
+ label:__('Email', 'schema-and-structured-data-for-wp'),
484
+ value: item.email,
485
+ onChange: function(value){
486
+ var newObject = Object.assign({}, item, {
487
+ email: value
488
+ });
489
+ saswp_on_item_change(newObject, item, 'performers');
490
+ }
491
+ })
492
+ ));
493
+
494
+ });
495
+
496
+ var performers = el('fieldset',{className:'saswp-event-performers-fieldset'},el('div',{
497
+ className:'saswp-event-performers-container'
498
+ },
499
+ el('h3',{},__('Performers', 'schema-and-structured-data-for-wp')),
500
+ performers_loop,
501
+ el(Button,{
502
+ className:'saswp-org-repeater',
503
+ isSecondary: true,
504
+ isLarge : true,
505
+ onClick: function() {
506
+ return props.setAttributes({
507
+ performers: [].concat(_cloneArray(props.attributes.performers), [{
508
+ index: props.attributes.performers.length
509
+ }])
510
+ });
511
+ }
512
+ },
513
+ __('Add More Performer', 'schema-and-structured-data-for-wp')
514
+ ),
515
+ ));
516
+
517
+
518
+ return [el(InspectorControls,{className:'saswp-event-inspector'},
519
+ el(PanelBody,
520
+ {className:'saswp-event-panel-body',
521
+ title: __('Settings', 'schema-and-structured-data-for-wp')
522
+ },
523
+ el(ToggleControl,
524
+ {
525
+ label : __('All Day Event', 'schema-and-structured-data-for-wp'),
526
+ className:'saswp-event-all-day',
527
+ checked:attributes.all_day,
528
+ onChange: function(newContent){
529
+ props.setAttributes( { all_day: newContent } );
530
+ }
531
+ }
532
+ )
533
+ )),
534
+ el('div',
535
+ {className:'saswp-event-block-container'},
536
+ event_details, venue, organizers, performers
537
+ )
538
+ ];
539
+
540
+ },
541
+ save: function( props ) {
542
+ return null
543
+ }
544
+ } );
545
+ }(
546
+ window.wp.blocks,
547
+ window.wp.element,
548
+ window.wp.blockEditor,
549
+ window.wp.components,
550
+ window.wp.i18n,
551
+ ) );
552
+
modules/gutenberg/assets/blocks/job.js ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const { RichText, AlignmentToolbar, BlockControls, InspectorControls, MediaUpload } = editor;
7
+ const {RadioControl, Popover, Button, IconButton, TextareaControl, TextControl, ToggleControl, PanelBody, DateTimePicker } = components;
8
+
9
+ blocks.registerBlockType( 'saswp/job-block', {
10
+ title: __('Job (SASWP)', 'schema-and-structured-data-for-wp'),
11
+ icon: 'id',
12
+ category: 'saswp-blocks',
13
+ keywords: ['schema', 'structured data', 'Job', 'job'],
14
+
15
+ attributes: {
16
+ posted_by:{
17
+ type:'string'
18
+ },
19
+ job_description : {
20
+ type: 'string'
21
+ },
22
+ job_types : {
23
+ type: 'string'
24
+ },
25
+ location_address:{
26
+ type:'string'
27
+ },
28
+ location_city:{
29
+ type:'string'
30
+ },
31
+ location_state:{
32
+ type:'string'
33
+ },
34
+ location_country:{
35
+ type:'string'
36
+ },
37
+ location_postal_code:{
38
+ type:'string'
39
+ },
40
+ app_email_or_website:{
41
+ type:'string'
42
+ },
43
+ company_name:{
44
+ type:'string'
45
+ },
46
+ company_website:{
47
+ type:'string'
48
+ },
49
+ company_tagline:{
50
+ type:'string'
51
+ },
52
+ company_twitter:{
53
+ type:'string'
54
+ },
55
+ company_facebook:{
56
+ type:'string'
57
+ },
58
+ // company_video_url:{
59
+ // type:'string'
60
+ // },
61
+ company_logo_url:{
62
+ type:'string'
63
+ },
64
+ company_logo_id:{
65
+ type:'integer'
66
+ },
67
+ listing_expire_date:{
68
+ type:'string'
69
+ },
70
+ listing_toggle:{
71
+ type:'boolean',
72
+ default:false
73
+ },
74
+ base_salary:{
75
+ type:'string'
76
+ },
77
+ currency_code:{
78
+ type:'string'
79
+ },
80
+ unit_text:{
81
+ type:'string'
82
+ }
83
+
84
+ },
85
+ // Allow only one How To block per post.
86
+ supports: {
87
+ multiple: false
88
+ },
89
+
90
+ edit: function( props ) {
91
+
92
+ var attributes = props.attributes;
93
+
94
+ var job_data = el('fieldset',{className:''},
95
+
96
+ el(TextControl,{
97
+ className:'saswp-job-posted-by',
98
+ value : attributes.posted_by,
99
+ label : __('Posted By', 'schema-and-structured-data-for-wp'),
100
+ onChange: function(value){
101
+ props.setAttributes( { posted_by: value } );
102
+ }
103
+ },
104
+ ),
105
+
106
+ el(TextareaControl,{
107
+ className:'saswp-job-description',
108
+ value : attributes.job_description,
109
+ label : __('Job Description', 'schema-and-structured-data-for-wp'),
110
+ onChange: function(value){
111
+ props.setAttributes( { job_description: value } );
112
+ }
113
+ },
114
+ ),
115
+
116
+ el(TextControl,{
117
+ className:'saswp-job-location',
118
+ value : attributes.location_address,
119
+ label : __('Location Address', 'schema-and-structured-data-for-wp'),
120
+ onChange: function(value){
121
+ props.setAttributes( { location_address: value } );
122
+ }
123
+ },
124
+ ),
125
+ el(TextControl,{
126
+ className:'saswp-job-location',
127
+ value : attributes.location_city,
128
+ label : __('Location City', 'schema-and-structured-data-for-wp'),
129
+ onChange: function(value){
130
+ props.setAttributes( { location_city: value } );
131
+ }
132
+ },
133
+ ),
134
+ el(TextControl,{
135
+ className:'saswp-job-location',
136
+ value : attributes.location_state,
137
+ label : __('Location State', 'schema-and-structured-data-for-wp'),
138
+ onChange: function(value){
139
+ props.setAttributes( { location_state: value } );
140
+ }
141
+ },
142
+ ),
143
+ el(TextControl,{
144
+ className:'saswp-job-location',
145
+ value : attributes.location_country,
146
+ label : __('Location Country', 'schema-and-structured-data-for-wp'),
147
+ onChange: function(value){
148
+ props.setAttributes( { location_country: value } );
149
+ }
150
+ },
151
+ ),
152
+ el(TextControl,{
153
+ className:'saswp-job-location',
154
+ value : attributes.location_postal_code,
155
+ label : __('Location Postal Code', 'schema-and-structured-data-for-wp'),
156
+ onChange: function(value){
157
+ props.setAttributes( { location_postal_code: value } );
158
+ }
159
+ },
160
+ ),
161
+
162
+ el(TextControl,{
163
+ className:'saswp-job-app-email-url',
164
+ value : attributes.app_email_or_website,
165
+ label : __('Application email/URL', 'schema-and-structured-data-for-wp'),
166
+ onChange: function(value){
167
+ props.setAttributes( { app_email_or_website: value } );
168
+ }
169
+ },
170
+ ),
171
+ el(TextControl,{
172
+ className:'saswp-job-company-name',
173
+ value : attributes.company_name,
174
+ label : __('Company Name', 'schema-and-structured-data-for-wp'),
175
+ onChange: function(value){
176
+ props.setAttributes( { company_name: value } );
177
+ }
178
+ },
179
+ ),
180
+ el(TextControl,{
181
+ className:'saswp-job-company-website',
182
+ value : attributes.company_website,
183
+ label : __('Company Website', 'schema-and-structured-data-for-wp'),
184
+ onChange: function(value){
185
+ props.setAttributes( { company_website: value } );
186
+ }
187
+ },
188
+ ),
189
+ el(TextareaControl,{
190
+ className:'saswp-job-company-tagline',
191
+ value : attributes.company_tagline,
192
+ label : __('Company Tagline', 'schema-and-structured-data-for-wp'),
193
+ onChange: function(value){
194
+ props.setAttributes( { company_tagline: value } );
195
+ }
196
+ },
197
+ ),
198
+ el(TextControl,{
199
+ className:'saswp-job-company-twitter',
200
+ value : attributes.company_twitter,
201
+ label : __('Company Twitter', 'schema-and-structured-data-for-wp'),
202
+ onChange: function(value){
203
+ props.setAttributes( { company_twitter: value } );
204
+ }
205
+ },
206
+ ),
207
+ el(TextControl,{
208
+ className:'saswp-job-company-facebook',
209
+ value : attributes.company_facebook,
210
+ label : __('Company Facebook', 'schema-and-structured-data-for-wp'),
211
+ onChange: function(value){
212
+ props.setAttributes( { company_facebook: value } );
213
+ }
214
+ },
215
+ ),
216
+
217
+ // el('div',{},
218
+ // el(TextControl,{
219
+ // className:'saswp-job-company-video',
220
+ // value : attributes.company_video_url,
221
+ // label : 'Company Video',
222
+ // onChange: function(value){
223
+ // props.setAttributes( { company_video_url: value } );
224
+ // }
225
+ // },
226
+ // ),
227
+ // el(MediaUpload,{
228
+ // className:'saswp-job-company-video-upload',
229
+ // value : attributes.company_video_url,
230
+ // allowedTypes:[ "video" ],
231
+ // onSelect: function(value){
232
+ // props.setAttributes( { company_video_url: value.url } );
233
+ // },
234
+ // render: function(obj){
235
+ // return el(IconButton,{
236
+ // isSecondary: true,
237
+ // icon : 'upload',
238
+ // onClick: obj.open
239
+ // },
240
+ // __('Upload', 'schema-and-structured-data-for-wp')
241
+ // );
242
+ // }
243
+ // },
244
+ // )
245
+ // ),
246
+
247
+ el('div',{className:'saswp-listing-fields'},
248
+
249
+ el(TextControl,{
250
+ className:'saswp-job-list-expire-date',
251
+ value : attributes.listing_expire_date,
252
+ label : __('Listing Expire Date', 'schema-and-structured-data-for-wp'),
253
+ onClick: function(value){
254
+ props.setAttributes( { listing_toggle: true } );
255
+ }
256
+ },
257
+ ),
258
+ attributes.listing_toggle ?
259
+ el(
260
+ Popover,{
261
+ class:'saswp-calender-popover',
262
+ position: 'bottom',
263
+ onClose: function(){
264
+ props.setAttributes( { listing_toggle: false } );
265
+ }
266
+ },
267
+ el(DateTimePicker,{
268
+ currentDate: attributes.listing_expire_date,
269
+ is12Hour : true,
270
+ onChange: function(value){
271
+ var newDate = moment(value).format('YYYY-MM-DD');
272
+ props.setAttributes( { listing_expire_date: newDate } );
273
+
274
+ }
275
+ })
276
+ )
277
+ : '',
278
+
279
+ ),
280
+
281
+ el(TextControl,{
282
+ className:'saswp-job-base-salary',
283
+ value : attributes.base_salary,
284
+ label : __('Base Salary', 'schema-and-structured-data-for-wp'),
285
+ onChange: function(value){
286
+ props.setAttributes( { base_salary: value } );
287
+ }
288
+ },
289
+ ),
290
+ el(TextControl,{
291
+ className:'saswp-job-base-salary',
292
+ value : attributes.currency_code,
293
+ label : __('Currency Code', 'schema-and-structured-data-for-wp'),
294
+ onChange: function(value){
295
+ props.setAttributes( { currency_code: value } );
296
+ }
297
+ },
298
+ ),
299
+ el(TextControl,{
300
+ className:'saswp-job-base-salary',
301
+ value : attributes.unit_text,
302
+ label : __('Unit Text', 'schema-and-structured-data-for-wp'),
303
+ onChange: function(value){
304
+ props.setAttributes( { unit_text: value } );
305
+ }
306
+ },
307
+ )
308
+ );
309
+
310
+ return [
311
+ el(InspectorControls,{class:'saswp-job-inspector'},
312
+ el(PanelBody,{
313
+ className:'saswp-job-types',
314
+ title:'Job Types'
315
+ },
316
+ el(RadioControl,{
317
+ selected: attributes.job_types,
318
+ options : [
319
+ { label: 'Freelance', value: 'freelance' },
320
+ { label: 'Full Time', value: 'full_time' },
321
+ { label: 'Internship', value: 'internship' },
322
+ { label: 'Part Time', value: 'part_time' },
323
+ { label: 'Temporary', value: 'temporary' },
324
+ ],
325
+ onChange: function(value) {
326
+ props.setAttributes( { job_types: value } );
327
+ }
328
+ },
329
+
330
+ )
331
+ ),
332
+ el(PanelBody,{
333
+ className: 'saswp-job-company-logo-panel',
334
+ title: 'Company Logo'
335
+ },
336
+ el(MediaUpload,{
337
+ className:'saswp-job-company-logo',
338
+ allowedTypes:[ "image" ],
339
+ value: attributes.company_logo_id,
340
+ onSelect: function(value){
341
+
342
+ props.setAttributes( { company_logo_url: value.url } );
343
+ props.setAttributes( { company_logo_id: value.id } );
344
+
345
+ },
346
+ render:function(obj){
347
+
348
+ var render_res;
349
+ if(attributes.company_logo_url){
350
+
351
+ render_res = el('div',{
352
+ className:'saswp-job-company-logo-panel'},
353
+ el('img',{
354
+ src:attributes.company_logo_url,
355
+ onClick: obj.open,
356
+ }),
357
+ el(Button,{
358
+ className:'saswp-remove is-link',
359
+ isDestructive : true,
360
+ onClick: function(){
361
+ props.setAttributes( { company_logo_url: '' } );
362
+ props.setAttributes( { company_logo_id: null } );
363
+ }
364
+ },
365
+ __('Remove Logo', 'schema-and-structured-data-for-wp')
366
+ )
367
+ );
368
+ }else{
369
+
370
+ render_res = el( Button, {
371
+ isSecondary: true,
372
+ className: 'editor-post-featured-image__toggle',
373
+ onClick: obj.open
374
+ },
375
+ __('Set Company Logo', 'schema-and-structured-data-for-wp')
376
+ );
377
+ }
378
+ return render_res;
379
+
380
+ }
381
+ }
382
+ )
383
+ )
384
+ ),
385
+ el('div',{className:'saswp-job-wrapper'},
386
+ job_data
387
+ )
388
+ ];
389
+
390
+ },
391
+ save: function( props ) {
392
+ return null
393
+ }
394
+ } );
395
+ }(
396
+ window.wp.blocks,
397
+ window.wp.element,
398
+ window.wp.blockEditor,
399
+ window.wp.components,
400
+ window.wp.i18n,
401
+ ) );
402
+
modules/gutenberg/assets/css/amp/course.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .saswp-course-loop{
2
+ margin-top:20px;
3
+ }
modules/gutenberg/assets/css/{style.css → amp/event.css} RENAMED
@@ -7,3 +7,6 @@ and open the template in the editor.
7
  Created on : Sep 15, 2019, 1:52:02 PM
8
  Author : acer
9
  */
 
 
 
7
  Created on : Sep 15, 2019, 1:52:02 PM
8
  Author : acer
9
  */
10
+ .saswp-event-venue-details, .saswp-event-organizers-details, .saswp-event-performers-details{
11
+ padding-top:15px;
12
+ }
modules/gutenberg/assets/css/amp/job.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : Sep 15, 2019, 1:52:02 PM
8
+ Author : acer
9
+ */
10
+ .saswp-job-listing-meta .saswp-date-posted:before {
11
+
12
+ }
13
+ .saswp-job-listing-meta .saswp-location:before {
14
+
15
+
16
+ }
17
+ .saswp-job-listing-meta li {
18
+ margin: 0 1em 0 0;
19
+ padding: .5em;
20
+ float: left;
21
+ line-height: 1em;
22
+ color: #999;
23
+ }
24
+ .saswp-job-listing-meta {
25
+ list-style: none outside;
26
+ padding: 0;
27
+ margin: 0 0 1.5em;
28
+ overflow: hidden;
29
+ zoom: 1;
30
+ clear: both;
31
+ }
32
+ .saswp-job-listing-wrapper .saswp-job-company {
33
+ position: relative;
34
+ border: 1px solid #eee;
35
+ padding: 1em;
36
+ margin: 0 0 2em;
37
+ display: block;
38
+ clear: both;
39
+ min-height: 3em;
40
+ box-shadow: 0 1px 1px rgba(0,0,0,.1);
41
+ box-sizing: content-box;
42
+ }
43
+ .saswp-job-listing-wrapper .saswp-job-company img {
44
+ width: 3em;
45
+ height: 3em;
46
+ position: absolute;
47
+ left: 1em;
48
+ float: left;
49
+ vertical-align: middle;
50
+ box-shadow: none;
51
+ }
52
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-name {
53
+ margin: 0 0 0 3em;
54
+ padding: 0 0 0 1em;
55
+ line-height: 1.5em;
56
+ }
57
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-name a {
58
+ float: right;
59
+ margin-left: 1em;
60
+ }
61
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-website:before {
62
+
63
+ }
64
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-twitter:before {
65
+
66
+ }
67
+ .saswp-job-listing-wrapper .saswp-job-application-details {
68
+ clear: both;
69
+ border: 1px solid #eee;
70
+ padding: .75em 1em 0;
71
+ margin: 1em 0;
72
+ line-height: 1.5em;
73
+ display: block;
74
+ position: relative;
75
+ padding-bottom: 10px;
76
+ box-shadow: 0 1px 1px rgba(0,0,0,.1);
77
+ }
modules/gutenberg/assets/css/course.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .saswp-course-loop{
2
+ margin-top:20px;
3
+ }
modules/gutenberg/assets/css/editor.css CHANGED
@@ -132,4 +132,34 @@ and open the template in the editor.
132
  }
133
  .saswp-how-to-material-button, .saswp-how-to-tool-button{
134
  margin: 5px;
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
  .saswp-how-to-material-button, .saswp-how-to-tool-button{
134
  margin: 5px;
135
+ }
136
+
137
+ /*
138
+ Event Block css starts here
139
+ */
140
+ .saswp-event-date-fields{
141
+ display:inline-flex;
142
+ }
143
+ .saswp-calender-popover{
144
+ padding: 20px;
145
+ }
146
+ .saswp-event-date-fields .components-base-control{
147
+ padding: 5px;
148
+ }
149
+ .saswp-remove-repeater{
150
+ float: right;
151
+ }
152
+ /*
153
+ Event Block css ends here
154
+ */
155
+
156
+ /*
157
+ Course Block css starts here
158
+ */
159
+ .saswp-course-list li{
160
+ list-style-type: none;
161
+ list-style: none;
162
+ }
163
+ /*
164
+ Course Block css ends here
165
+ */
modules/gutenberg/assets/css/event.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : Sep 15, 2019, 1:52:02 PM
8
+ Author : acer
9
+ */
10
+ .saswp-event-venue-details, .saswp-event-organizers-details, .saswp-event-performers-details{
11
+ padding-top:15px;
12
+ }
modules/gutenberg/assets/css/job.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : Sep 15, 2019, 1:52:02 PM
8
+ Author : acer
9
+ */
10
+ .saswp-job-listing-meta .saswp-date-posted:before {
11
+
12
+ }
13
+ .saswp-job-listing-meta .saswp-location:before {
14
+
15
+
16
+ }
17
+ .saswp-job-listing-meta li {
18
+ margin: 0 1em 0 0;
19
+ padding: .5em;
20
+ float: left;
21
+ line-height: 1em;
22
+ color: #999;
23
+ }
24
+ .saswp-job-listing-meta {
25
+ list-style: none outside;
26
+ padding: 0;
27
+ margin: 0 0 1.5em;
28
+ overflow: hidden;
29
+ zoom: 1;
30
+ clear: both;
31
+ }
32
+ .saswp-job-listing-wrapper .saswp-job-company {
33
+ position: relative;
34
+ border: 1px solid #eee;
35
+ padding: 1em;
36
+ margin: 0 0 2em;
37
+ display: block;
38
+ clear: both;
39
+ min-height: 3em;
40
+ box-shadow: 0 1px 1px rgba(0,0,0,.1);
41
+ box-sizing: content-box;
42
+ }
43
+ .saswp-job-listing-wrapper .saswp-job-company img {
44
+ width: 3em;
45
+ height: 3em;
46
+ position: absolute;
47
+ left: 1em;
48
+ float: left;
49
+ vertical-align: middle;
50
+ box-shadow: none;
51
+ }
52
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-name {
53
+ margin: 0 0 0 3em;
54
+ padding: 0 0 0 1em;
55
+ line-height: 1.5em;
56
+ }
57
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-name a {
58
+ float: right;
59
+ margin-left: 1em;
60
+ }
61
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-website:before {
62
+
63
+ }
64
+ .saswp-job-listing-wrapper .saswp-job-company .saswp-job-company-twitter:before {
65
+
66
+ }
67
+ .saswp-job-listing-wrapper .saswp-job-application-details {
68
+ clear: both;
69
+ border: 1px solid #eee;
70
+ padding: .75em 1em 0;
71
+ margin: 1em 0;
72
+ line-height: 1.5em;
73
+ display: block;
74
+ position: relative;
75
+ padding-bottom: 10px;
76
+ box-shadow: 0 1px 1px rgba(0,0,0,.1);
77
+ }
modules/gutenberg/includes/class-gutenberg.php CHANGED
@@ -18,32 +18,173 @@ class SASWP_Gutenberg {
18
  * @var type
19
  */
20
  private static $instance;
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * This is class constructer to use all the hooks and filters used in this class
24
  */
25
  private function __construct() {
26
- add_action( 'init', array( $this, 'register_how_to' ) );
27
- add_action( 'init', array( $this, 'register_faq' ) );
 
 
 
 
 
 
 
 
 
28
  add_action( 'enqueue_block_editor_assets', array( $this, 'register_admin_assets' ) );
29
- //add_action( 'enqueue_block_assets', array( $this, 'register_frontend_assets' ) );
30
- add_filter( 'block_categories', array( $this, 'saswp_add_blocks_categories' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
  /**
33
  * Function to enqueue frontend assets for gutenberg blocks
34
  * @Since Version 1.9.7
35
  */
36
  public function register_frontend_assets() {
37
-
38
- if(!is_admin){
39
-
40
- wp_enqueue_style(
41
- 'saswp-gutenberg-css-reg',
42
- SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/style.css',
43
- array()
44
- );
45
-
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
  /**
49
  * Function to enqueue admin assets for gutenberg blocks
@@ -60,76 +201,148 @@ class SASWP_Gutenberg {
60
  SASWP_PLUGIN_URL . 'modules/gutenberg/assets/css/editor.css',
61
  array( 'wp-edit-blocks' )
62
  );
63
-
64
- wp_register_script(
65
- 'saswp-faq-js-reg',
66
- SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/faq.js',
67
- array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-editor' )
68
- );
69
-
70
- $inline_script = array(
71
- 'title' => 'Faq'
72
- );
73
-
74
- wp_localize_script( 'saswp-how-to-js-reg', 'saswpGutenbergFaq', $inline_script );
75
-
76
- wp_enqueue_script( 'saswp-faq-js-reg' );
77
-
78
- wp_register_script(
79
- 'saswp-how-to-js-reg',
80
- SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/how-to.js',
81
- array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-editor' )
82
- );
83
 
84
- $inline_script = array(
85
- 'title' => 'How To'
86
- );
87
-
88
- wp_localize_script( 'saswp-how-to-js-reg', 'saswpGutenbergHowTo', $inline_script );
89
-
90
- wp_enqueue_script( 'saswp-how-to-js-reg' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
  /**
93
  * Register a how to block
94
  * @return type
95
  * @since version 1.9.7
96
  */
97
- public function register_how_to() {
98
 
99
  if ( !function_exists( 'register_block_type' ) ) {
100
  // no Gutenberg, Abort
101
  return;
102
  }
103
 
104
- register_block_type( 'saswp/how-to-block', array(
105
- 'style' => 'saswp-gutenberg-css-reg',
106
- 'editor_style' => 'saswp-gutenberg-css-reg-editor',
107
- 'editor_script' => 'saswp-how-to-js-reg',
108
- 'render_callback' => array( $this, 'render_how_to_data' ),
109
- ) );
110
-
111
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
- /**
114
- * Register a FAQ block
115
- * @return type
116
- * @since version 1.9.7
117
- */
118
- public function register_faq() {
119
 
120
- if ( !function_exists( 'register_block_type' ) ) {
121
- // no Gutenberg, Abort
122
- return;
123
- }
124
-
125
- register_block_type( 'saswp/faq-block', array(
126
- 'style' => 'saswp-gutenberg-css-reg',
127
- 'editor_style' => 'saswp-gutenberg-css-reg-editor',
128
- 'editor_script' => 'saswp-faq-js-reg',
129
- 'render_callback' => array( $this, 'render_faq_data' ),
130
- ) );
131
-
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * Function to render faq block data in frontend post content
135
  * @param type $attributes
@@ -308,7 +521,7 @@ class SASWP_Gutenberg {
308
  * @return array
309
  * @since version 1.9.7
310
  */
311
- public function saswp_add_blocks_categories($categories){
312
 
313
  $categories[] = array(
314
  'slug' => 'saswp-blocks',
18
  * @var type
19
  */
20
  private static $instance;
21
+ private $service;
22
+ private $render;
23
+
24
+ private $blocks = array(
25
+ 'collection' => array(
26
+ 'handler' => 'saswp-collection-js-reg',
27
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/collection.js',
28
+ 'local_var' => 'saswpGutenbergCollection',
29
+ 'block_name' => 'collection-block',
30
+ 'render_func' => 'render_collection_data',
31
+ 'style' => 'saswp-g-collection-css',
32
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
33
+ 'local' => array()
34
+ ),
35
+ 'course' => array(
36
+ 'handler' => 'saswp-course-js-reg',
37
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/course.js',
38
+ 'local_var' => 'saswpGutenbergCourse',
39
+ 'block_name' => 'course-block',
40
+ 'render_func' => 'render_course_data',
41
+ 'style' => 'saswp-g-course-css',
42
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
43
+ 'local' => array()
44
+ ),
45
+ 'event' => array(
46
+ 'handler' => 'saswp-event-js-reg',
47
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/event.js',
48
+ 'local_var' => 'saswpGutenbergEvent',
49
+ 'block_name' => 'event-block',
50
+ 'render_func' => 'render_event_data',
51
+ 'style' => 'saswp-g-event-css',
52
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
53
+ 'local' => array()
54
+ ),
55
+ 'job' => array(
56
+ 'handler' => 'saswp-job-js-reg',
57
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/job.js',
58
+ 'local_var' => 'saswpGutenbergJob',
59
+ 'block_name' => 'job-block',
60
+ 'style' => 'saswp-g-job-css',
61
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
62
+ 'render_func' => 'render_job_data',
63
+ 'local' => array()
64
+ ),
65
+ 'faq' => array(
66
+ 'handler' => 'saswp-faq-js-reg',
67
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/faq.js',
68
+ 'local_var' => 'saswpGutenbergFaq',
69
+ 'block_name' => 'faq-block',
70
+ 'style' => 'saswp-g-faq-css',
71
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
72
+ 'render_func' => 'render_faq_data',
73
+ 'local' => array()
74
+ ),
75
+ 'howto' => array(
76
+ 'handler' => 'saswp-how-to-js-reg',
77
+ 'path' => SASWP_PLUGIN_URL . '/modules/gutenberg/assets/blocks/how-to.js',
78
+ 'block_name' => 'how-to-block',
79
+ 'render_func' => 'render_how_to_data',
80
+ 'style' => 'saswp-g-howto-css',
81
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
82
+ 'local_var' => 'saswpGutenbergHowTo',
83
+ 'local' => array()
84
+ ),
85
+ );
86
+
87
  /**
88
  * This is class constructer to use all the hooks and filters used in this class
89
  */
90
  private function __construct() {
91
+
92
+ if($this->service == null){
93
+ require_once SASWP_DIR_NAME.'/modules/gutenberg/includes/service.php';
94
+ $this->service = new SASWP_Gutenberg_Service();
95
+ }
96
+ if($this->render == null){
97
+ require_once SASWP_DIR_NAME.'/modules/gutenberg/includes/render.php';
98
+ $this->render = new SASWP_Gutenberg_Render();
99
+ }
100
+
101
+ add_action( 'init', array( $this, 'register_saswp_blocks' ) );
102
  add_action( 'enqueue_block_editor_assets', array( $this, 'register_admin_assets' ) );
103
+ add_action( 'enqueue_block_assets', array( $this, 'register_frontend_assets' ) );
104
+ add_filter( 'block_categories', array( $this, 'add_blocks_categories' ) );
105
+ add_action( 'amp_post_template_css', array($this, 'register_frontend_assets_amp'));
106
+ }
107
+
108
+ public function register_frontend_assets_amp(){
109
+
110
+ global $post;
111
+
112
+ if(function_exists('parse_blocks') && is_object($post)){
113
+
114
+ $blocks = parse_blocks($post->post_content);
115
+
116
+ if($blocks){
117
+
118
+ foreach ($blocks as $parse_blocks){
119
+
120
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/event-block'){
121
+ $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/event.css';
122
+ echo @file_get_contents($amp_css);
123
+ }
124
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
125
+ $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/job.css';
126
+ echo @file_get_contents($amp_css);
127
+ }
128
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/course-block'){
129
+ $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/course.css';
130
+ echo @file_get_contents($amp_css);
131
+ }
132
+
133
+ }
134
+
135
+ }
136
+ }
137
+
138
  }
139
  /**
140
  * Function to enqueue frontend assets for gutenberg blocks
141
  * @Since Version 1.9.7
142
  */
143
  public function register_frontend_assets() {
144
+
145
+ global $post;
146
+
147
+ if(function_exists('parse_blocks') && is_object($post)){
148
+
149
+ $blocks = parse_blocks($post->post_content);
150
+
151
+ if($blocks){
152
+
153
+ foreach ($blocks as $parse_blocks){
154
+
155
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/event-block'){
156
+
157
+ wp_enqueue_style(
158
+ 'saswp-g-event-css',
159
+ SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/event.css',
160
+ array()
161
+ );
162
+
163
+ }
164
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
165
+
166
+ wp_enqueue_style(
167
+ 'saswp-g-job-css',
168
+ SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/job.css',
169
+ array()
170
+ );
171
+
172
+ }
173
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/course-block'){
174
+
175
+ wp_enqueue_style(
176
+ 'saswp-g-course-css',
177
+ SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/course.css',
178
+ array()
179
+ );
180
+
181
+ }
182
+
183
+ }
184
+
185
+ }
186
+ }
187
+
188
  }
189
  /**
190
  * Function to enqueue admin assets for gutenberg blocks
201
  SASWP_PLUGIN_URL . 'modules/gutenberg/assets/css/editor.css',
202
  array( 'wp-edit-blocks' )
203
  );
204
+
205
+ if($this->blocks){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
+ foreach($this->blocks as $key => $block){
208
+
209
+ wp_register_script(
210
+ $block['handler'],
211
+ $block['path'],
212
+ array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-editor' )
213
+ );
214
+
215
+
216
+ if($key == 'collection'){
217
+
218
+ $collection = get_posts( array(
219
+ 'posts_per_page' => -1,
220
+ 'post_type' => 'saswp-collections',
221
+ 'post_status' => 'publish',
222
+
223
+ ));
224
+
225
+ if($collection){
226
+
227
+ $col_opt = array();
228
+
229
+ foreach($collection as $col){
230
+
231
+ $col_opt[] = array(
232
+ 'value' => $col->ID,
233
+ 'label' => $col->post_title
234
+ );
235
+
236
+ }
237
+
238
+ $block['local']['collection'] = $col_opt;
239
+
240
+ }else{
241
+ $block['local']['collection_not_found'] = true;
242
+ $block['local']['collection_url'] = wp_nonce_url(admin_url('admin.php?page=collection'), '_wpnonce');
243
+ }
244
+ }
245
+
246
+ wp_localize_script( $block['handler'], $block['local_var'], $block['local'] );
247
+
248
+ wp_enqueue_script( $block['handler'] );
249
+ }
250
+
251
+ }
252
+
253
  }
254
  /**
255
  * Register a how to block
256
  * @return type
257
  * @since version 1.9.7
258
  */
259
+ public function register_saswp_blocks() {
260
 
261
  if ( !function_exists( 'register_block_type' ) ) {
262
  // no Gutenberg, Abort
263
  return;
264
  }
265
 
266
+ if($this->blocks){
 
 
 
 
 
 
267
 
268
+ foreach($this->blocks as $block){
269
+
270
+ register_block_type( 'saswp/'.$block['block_name'], array(
271
+ 'style' => $block['style'],
272
+ 'editor_style' => $block['editor'],
273
+ 'editor_script' => $block['handler'],
274
+ 'render_callback' => array( $this, $block['render_func'] ),
275
+ ) );
276
+
277
+ }
278
+
279
+ }
280
  }
281
+
282
+ public function render_collection_data($attributes){
 
 
 
 
283
 
284
+ ob_start();
285
+
286
+ if ( !isset( $attributes ) ) {
287
+ ob_end_clean();
288
+
289
+ return '';
290
+ }
291
+
292
+ echo $this->render->collection_block_data($attributes);
293
+
294
+ return ob_get_clean();
295
+
296
+ }
297
+
298
+ public function render_course_data($attributes){
299
+
300
+ ob_start();
301
+
302
+ if ( !isset( $attributes ) ) {
303
+ ob_end_clean();
304
+
305
+ return '';
306
+ }
307
+
308
+ echo $this->render->course_block_data($attributes);
309
+
310
+ return ob_get_clean();
311
+
312
+ }
313
+
314
+ public function render_job_data($attributes){
315
+
316
+ ob_start();
317
+
318
+ if ( !isset( $attributes ) ) {
319
+ ob_end_clean();
320
+
321
+ return '';
322
+ }
323
+
324
+ echo $this->render->job_block_data($attributes);
325
+
326
+ return ob_get_clean();
327
+
328
+ }
329
+
330
+ public function render_event_data($attributes){
331
+
332
+ ob_start();
333
+
334
+ if ( !isset( $attributes ) ) {
335
+ ob_end_clean();
336
+
337
+ return '';
338
+ }
339
+
340
+ echo $this->render->event_block_data($attributes);
341
+
342
+ return ob_get_clean();
343
+
344
+ }
345
+
346
  /**
347
  * Function to render faq block data in frontend post content
348
  * @param type $attributes
521
  * @return array
522
  * @since version 1.9.7
523
  */
524
+ public function add_blocks_categories($categories){
525
 
526
  $categories[] = array(
527
  'slug' => 'saswp-blocks',
modules/gutenberg/includes/render.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class SASWP_Gutenberg_Render {
5
+
6
+ public function event_block_data($attributes){
7
+
8
+ $response = '';
9
+ $org_html = '';
10
+ $performer_html = '';
11
+
12
+ if(isset($attributes['organizers']) && !empty($attributes['organizers'])){
13
+
14
+ foreach($attributes['organizers'] as $org){
15
+
16
+ $org_html .= '<div class="saswp-event-organiser"><span>'.esc_html($org['name']).'</span><br>';
17
+ $org_html .= '<strong>'.esc_html__('Phone', 'schema-and-structured-data-for-wp').' : </strong><span>'.esc_html($org['phone']).'</span><br>';
18
+ $org_html .= '<strong>'.esc_html__('Email', 'schema-and-structured-data-for-wp').' : </strong><span>'.esc_html($org['email']).'</span><br>';
19
+ $org_html .= '<strong>'.esc_html__('Website', 'schema-and-structured-data-for-wp').' : </strong> <span>'.esc_html($org['website']).'</span></div>';
20
+
21
+ }
22
+
23
+ }
24
+
25
+ if(isset($attributes['performers']) && !empty($attributes['performers'])){
26
+
27
+ foreach($attributes['performers'] as $org){
28
+
29
+ $performer_html .= '<div class="saswp-event-organiser"><span>'.esc_html($org['name']).'</span><br>';
30
+ $performer_html .= '<strong>'.esc_html__('URL', 'schema-and-structured-data-for-wp').' : </strong><span><a href="'.esc_url($org['url']).'">'.esc_url($org['url']).'</a></span><br>';
31
+ $performer_html .= '<strong>'.esc_html__('Email', 'schema-and-structured-data-for-wp').' : </strong><span>'.esc_html($org['email']).'</span><br>';
32
+
33
+ }
34
+
35
+ }
36
+
37
+ $response .= '<div class="saswp-event-wrapper">'
38
+
39
+ . '<div class="saswp-event-dates">'
40
+ . '<h5>'.esc_html__('Event Details', 'schema-and-structured-data-for-wp').'</h5>'
41
+ . '<strong>'.esc_html__('Start Date', 'schema-and-structured-data-for-wp').' : </strong> <span>'.esc_html($attributes['start_date']).'</span>'
42
+ . (!$attributes['all_day'] ? '<span> ,'.esc_html($attributes['start_time']).'</span><br>' : '<br>')
43
+ . '<strong>'.esc_html__('End Date', 'schema-and-structured-data-for-wp').' : </strong> <span>'.esc_html($attributes['end_date']).'</span>'
44
+ . (!$attributes['all_day'] ? '<span> ,'.esc_html($attributes['end_time']).'</span><br>' : '<br>')
45
+ . ($attributes['website'] ? '<strong>'.esc_html__('Website', 'schema-and-structured-data-for-wp').' : </strong> <span><a href="'.esc_url($attributes['website']).'">'.esc_url($attributes['website']).'</a></span><br>' : '')
46
+ . ($attributes['price'] ? '<strong>'.esc_html__('Price', 'schema-and-structured-data-for-wp').' : </strong> <span>'.esc_html($attributes['price']).' '. ($attributes['currency_code'] ? esc_html($attributes['currency_code']) : 'USD').'</span>' : '')
47
+ . ($attributes['all_day'] ? '<div>'.esc_html__('This event is all day', 'schema-and-structured-data-for-wp').'</div>' : '')
48
+ . '</div>'
49
+
50
+ . '<div class="saswp-event-venue-details">'
51
+ . (($attributes['venue_name'] || $attributes['venue_address']) ? '<h5>'.esc_html__('Venue', 'schema-and-structured-data-for-wp').'</h5>' : '')
52
+ . ($attributes['venue_name'] ? '<span>'.esc_html($attributes['venue_name']).'</span><br><br>' : '')
53
+ . ($attributes['venue_address'] ? '<span>'.esc_html($attributes['venue_address']).'</span>, ': '')
54
+ . ($attributes['venue_city'] ? '<span>'.esc_html($attributes['venue_city']).'</span>, <br>': '')
55
+ . ($attributes['venue_state'] ? '<span>'.esc_html($attributes['venue_state']).'</span> ': '')
56
+ . ($attributes['venue_postal_code'] ? '<span>'.esc_html($attributes['venue_postal_code']).'</span>, ': '')
57
+ . ($attributes['venue_country'] ? '<span>'.esc_html($attributes['venue_country']).'</span><br>': '');
58
+ if($attributes['venue_phone']){
59
+ $response.= '<strong>'.esc_html__('Phone', 'schema-and-structured-data-for-wp').' : </strong><span>'.esc_html($attributes['venue_phone']).'</span>';
60
+ }
61
+ $response.= '</div>'
62
+ . '<div class="saswp-event-organizers-details">'
63
+ . '<h5>'.esc_html__('Organizers', 'schema-and-structured-data-for-wp').'</h5>'
64
+ . $org_html
65
+ . '</div>'
66
+ . '<div class="saswp-event-performers-details">'
67
+ . '<h5>'.esc_html__('Performers', 'schema-and-structured-data-for-wp').'</h5>'
68
+ . $performer_html
69
+ . '</div>'
70
+ . '</div>';
71
+
72
+ return $response;
73
+ }
74
+
75
+ public function job_block_data($attributes){
76
+
77
+ $response = $location = '';
78
+
79
+ if($attributes){
80
+
81
+ if($attributes['location_address']){
82
+ $location .= $attributes['location_address']. ', <br>';
83
+ }
84
+ if($attributes['location_city']){
85
+ $location .= $attributes['location_city']. ', ';
86
+ }
87
+ if($attributes['location_state']){
88
+ $location .= $attributes['location_state']. ', <br>';
89
+ }
90
+ if($attributes['location_country']){
91
+ $location .= $attributes['location_country']. ', ';
92
+ }
93
+ if($attributes['location_postal_code']){
94
+ $location .= $attributes['location_postal_code']. ', ';
95
+ }
96
+
97
+ $response .='<div class="saswp-job-listing-wrapper">'
98
+ . '<ul class="saswp-job-listing-meta">'
99
+ . '<li class="saswp-location"><span class="dashicons dashicons-location"></span><a target="_blank" href="'.esc_url( 'https://maps.google.com/maps?q=' . rawurlencode( wp_strip_all_tags( $location ) ) . '&zoom=14&size=512x512&maptype=roadmap&sensor=false' ).'" class="saswp-google-map-link">'. $location .'</a></li>'
100
+ . '<li class="saswp-date-posted"><span class="dashicons dashicons-calendar-alt"></span> '.get_the_date("Y-m-d").'</li>'
101
+ . '</ul>'
102
+ . '<div class="saswp-job-company">';
103
+ if($attributes['company_logo_url']){
104
+ $response.= '<img src="'.esc_url($attributes['company_logo_url']).'">';
105
+ }
106
+
107
+ $response.= '<p class="saswp-job-company-name">';
108
+
109
+ if($attributes['company_website']){
110
+ $response .= '<a target="_blank" class="saswp-job-company-website" href="'.esc_url($attributes['company_website']).'"><span class="dashicons dashicons-admin-links"></span> '.esc_html__('Website', 'schema-and-structured-data-for-wp').'</a>';
111
+ }
112
+ if($attributes['company_twitter']){
113
+ $response .= '<a target="_blank" class="saswp-job-company-twitter" href="'.esc_url($attributes['company_twitter']).'"><span class="dashicons dashicons-twitter"></span> '.esc_html__('Twitter', 'schema-and-structured-data-for-wp').'</a>';
114
+ }
115
+ if($attributes['company_facebook']){
116
+ $response .= '<a target="_blank" class="saswp-job-company-facebook" href="'.esc_url($attributes['company_facebook']).'"><span class="dashicons dashicons-facebook-alt"></span>'.esc_html__('Facebook', 'schema-and-structured-data-for-wp').'</a>';
117
+ }
118
+
119
+ $response .= '<strong>'.esc_html($attributes['company_name']).'</strong>'
120
+ . '</p>'
121
+ . '<p class="saswp-job-company-tagline">'.esc_html($attributes['company_tagline']).'</p>';
122
+
123
+ if($attributes['base_salary']){
124
+ $response .= '<p><strong>'.esc_html__('Base Salary', 'schema-and-structured-data-for-wp').': </strong> <span>'.esc_html($attributes['base_salary']).' '.esc_html($attributes['currency_code']).' '.esc_html__('per', 'schema-and-structured-data-for-wp').' '.esc_html($attributes['unit_text']).'</span> <p>';
125
+ }
126
+
127
+ $response.= '</div>'
128
+ . '<div class="saswp-job-description">'
129
+ . esc_html($attributes['job_description'])
130
+ . '</div>'
131
+ . '<div class="saswp-job-application">'
132
+ . '<div class="saswp-job-application-details">';
133
+
134
+ if($attributes['app_email_or_website']){
135
+ $response.= esc_html__('To apply for this job', 'schema-and-structured-data-for-wp').' <strong>'.esc_html($attributes['app_email_or_website']).'</strong> '
136
+ . '<a href="mailto:'.esc_attr($attributes['app_email_or_website']).'">'.esc_attr($attributes['app_email_or_website']).'</a>';
137
+ }
138
+
139
+ $response.= '</div>'
140
+ . '</div>'
141
+ . '</div>';
142
+
143
+ }
144
+
145
+ return $response;
146
+ }
147
+
148
+ public function course_block_data($attributes){
149
+
150
+ $response = '';
151
+
152
+ if(isset($attributes['courses'])){
153
+
154
+ foreach($attributes['courses'] as $course){
155
+
156
+ $response .= '<div class="saswp-course-loop">'
157
+ . '<h3 class="saswp-course-detail">'.esc_html__('Course Details', 'schema-and-structured-data-for-wp').'</h3>'
158
+ . '<h5>'.esc_html($course['name']).'</h5>'
159
+ . '<p>';
160
+ if($course['image_url']){
161
+ $response .='<img src="'.esc_url($course['image_url']).'">';
162
+ }
163
+ $response .= ''.esc_html($course['description']).'</p>'
164
+ . '<h5>'.esc_html__('Provider Details', 'schema-and-structured-data-for-wp').'</h5>'
165
+ . '<div><strong>'.esc_html__('Provider Name', 'schema-and-structured-data-for-wp').'</strong> : '. esc_html($course['provider_name']). '</div>'
166
+ . '<div><strong>'.esc_html__('Provider Website', 'schema-and-structured-data-for-wp').'</strong> : '. '<a href="'.esc_url($course['provider_website']).'">'.esc_url($course['provider_website']).'</a></div>'
167
+ . '</div>';
168
+
169
+ }
170
+
171
+ }
172
+
173
+ return $response;
174
+ }
175
+
176
+ public function collection_block_data($attributes){
177
+
178
+ $response = '';
179
+
180
+ if(isset($attributes['id'])){
181
+
182
+ $response = do_shortcode('[saswp-reviews-collection id="'.$attributes['id'].'"]');
183
+
184
+ }
185
+
186
+ return $response;
187
+
188
+ }
189
+
190
+ }
modules/gutenberg/includes/service.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class SASWP_Gutenberg_Service {
5
+
6
+
7
+
8
+ }
modules/rating-box/frontend.php CHANGED
@@ -120,7 +120,7 @@ Class saswp_rating_box_frontend{
120
 
121
  if(!empty($input1)){
122
 
123
- echo '<!-- Schema & Structured Data For WP Review Module v'.esc_attr(SASWP_VERSION).' - -->';
124
  echo "\n";
125
  echo '<script type="application/ld+json" class="saswp-schema-markup-output">';
126
  echo "\n";
@@ -146,17 +146,17 @@ Class saswp_rating_box_frontend{
146
  */
147
  public function saswp_get_review_box_content(){
148
 
149
- $saswp_review_details = array();
150
- $saswp_review_details = get_post_meta(get_the_ID(), 'saswp_review_details', true);
151
  $saswp_review_item_feature = array();
152
  $saswp_review_item_star_rating = array();
153
  $saswp_review_title = '';
154
  $saswp_review_description_title = '';
155
 
156
- $saswp_review_description = get_post_meta( get_the_ID(), 'saswp-review-item-description', true );
157
- $saswp_review_props = get_post_meta( get_the_ID(), 'saswp-review-item-props', true );
158
- $saswp_review_cons = get_post_meta( get_the_ID(), 'saswp-review-item-cons', true );
159
- $saswp_over_all_rating = '';
 
160
 
161
  if(isset($saswp_review_details['saswp-review-item-feature'])){
162
  $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
@@ -208,36 +208,7 @@ Class saswp_rating_box_frontend{
208
  $boxdata.='<tr>
209
  <td>'.esc_attr($saswp_review_item_feature[$i]).'</td>
210
  <td>
211
- <div class="saswp-rvw-str">';
212
- for($j=0; $j<5; $j++){
213
-
214
- if($saswp_review_item_star_rating[$i] >$j){
215
-
216
- $explod = explode('.', $saswp_review_item_star_rating[$i]);
217
-
218
- if(isset($explod[1])){
219
-
220
- if($j <$explod[0]){
221
-
222
- $boxdata.='<span class="str-ic"></span>';
223
-
224
- }else{
225
-
226
- $boxdata.='<span class="half-str"></span>';
227
-
228
- }
229
- }else{
230
-
231
- $boxdata.='<span class="str-ic"></span>';
232
-
233
- }
234
-
235
- } else{
236
- $boxdata.='<span class="df-clr"></span>';
237
- }
238
- }
239
-
240
- $boxdata.='</div>
241
  </td>
242
  </tr>';
243
  }
@@ -251,44 +222,9 @@ Class saswp_rating_box_frontend{
251
  </td>
252
  <td>
253
  <div class="saswp-rvw-ov">
254
- <div class="saswp-rvw-fs">'.isset($saswp_over_all_rating)? esc_attr(number_format((float)$saswp_over_all_rating, 2, '.', '')):''.'</div>';
255
-
256
- if($saswp_over_all_rating !=''){
257
-
258
- $boxdata.='<div class="tvw-fnl-str saswp-rvw-str">';
259
- $explod = explode('.', $saswp_over_all_rating);
260
-
261
- if(!empty($explod)){
262
-
263
- for($x=0;$x<5;$x++) {
264
-
265
- if(isset($explod[1])){
266
-
267
- if($saswp_over_all_rating >$x){
268
-
269
- if($x <$explod[0]){
270
- $boxdata.='<span class="str-ic"></span>';
271
- }else{
272
- $boxdata.='<span class="half-str"></span>';
273
- }
274
-
275
- }else{
276
- $boxdata.='<span class="df-clr"></span>';
277
- }
278
- }else{
279
- if($saswp_over_all_rating >$x){
280
- $boxdata.='<span class="str-ic"></span>';
281
- } else{
282
- $boxdata.='<span class="df-clr"></span>';
283
- }
284
- }
285
- }
286
-
287
- }
288
-
289
- $boxdata.='</div><span class="ovs">'.saswp_label_text('translation-overall-score').'</span>';
290
- }
291
- $boxdata.=' </div>
292
  </td>
293
  <tr>
294
  </tbody>
120
 
121
  if(!empty($input1)){
122
 
123
+ echo '<!-- Schema & Structured Data For WP Rating Module v'.esc_attr(SASWP_VERSION).' - -->';
124
  echo "\n";
125
  echo '<script type="application/ld+json" class="saswp-schema-markup-output">';
126
  echo "\n";
146
  */
147
  public function saswp_get_review_box_content(){
148
 
149
+ $saswp_review_details = array();
 
150
  $saswp_review_item_feature = array();
151
  $saswp_review_item_star_rating = array();
152
  $saswp_review_title = '';
153
  $saswp_review_description_title = '';
154
 
155
+ $saswp_review_details = get_post_meta(get_the_ID(), 'saswp_review_details', true);
156
+ $saswp_review_description = get_post_meta( get_the_ID(), 'saswp-review-item-description', true );
157
+ $saswp_review_props = get_post_meta( get_the_ID(), 'saswp-review-item-props', true );
158
+ $saswp_review_cons = get_post_meta( get_the_ID(), 'saswp-review-item-cons', true );
159
+ $saswp_over_all_rating = '';
160
 
161
  if(isset($saswp_review_details['saswp-review-item-feature'])){
162
  $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
208
  $boxdata.='<tr>
209
  <td>'.esc_attr($saswp_review_item_feature[$i]).'</td>
210
  <td>
211
+ '.saswp_get_rating_html_by_value($saswp_review_item_star_rating[$i]).'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  </td>
213
  </tr>';
214
  }
222
  </td>
223
  <td>
224
  <div class="saswp-rvw-ov">
225
+ <div class="saswp-rvw-fs">'.esc_html(number_format ($saswp_over_all_rating, 1)).'</div>
226
+ '.saswp_get_rating_html_by_value($saswp_over_all_rating).'
227
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  </td>
229
  <tr>
230
  </tbody>
modules/reviews/reviews_admin.php CHANGED
@@ -276,7 +276,7 @@ class saswp_reviews_admin {
276
  return $post_id;
277
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
278
  return $post_id;
279
- if ( !current_user_can( 'manage_options' ) )
280
  return $post_id;
281
 
282
  $post_meta = array();
276
  return $post_id;
277
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
278
  return $post_id;
279
+ if ( !current_user_can( saswp_current_user_can() ) )
280
  return $post_id;
281
 
282
  $post_meta = array();
modules/reviews/reviews_collection.php CHANGED
@@ -57,7 +57,7 @@ class SASWP_Reviews_Collection {
57
  add_submenu_page( 'edit.php?post_type=saswp',
58
  esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
59
  esc_html__( '', 'schema-and-structured-data-for-wp' ),
60
- 'manage_options',
61
  'collection',
62
  array($this, 'saswp_admin_collection_interface_render'));
63
 
@@ -159,7 +159,18 @@ class SASWP_Reviews_Collection {
159
  'show_admin_column' => true,
160
  'rewrite' => false,
161
  );
162
- register_post_type( 'saswp-collections', $collections );
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
  public function saswp_get_collection_platforms(){
@@ -366,7 +377,7 @@ class SASWP_Reviews_Collection {
366
 
367
  public function saswp_admin_collection_interface_render(){
368
 
369
- if ( ! current_user_can( 'manage_options' ) ) return;
370
  if ( !wp_verify_nonce( $_GET['_wpnonce'], '_wpnonce' ) ) return;
371
 
372
  $post_meta = array();
@@ -573,7 +584,7 @@ class SASWP_Reviews_Collection {
573
  public function saswp_save_collection_data(){
574
 
575
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
576
- if ( ! current_user_can( 'manage_options' ) ) return ;
577
  if ( ! isset( $_POST['saswp_collection_nonce'] ) || ! wp_verify_nonce( $_POST['saswp_collection_nonce'], 'saswp_collection_nonce_data' ) ) return;
578
 
579
  if(isset($_POST['saswp_collection_id'])){
57
  add_submenu_page( 'edit.php?post_type=saswp',
58
  esc_html__( 'Structured Data', 'schema-and-structured-data-for-wp' ),
59
  esc_html__( '', 'schema-and-structured-data-for-wp' ),
60
+ saswp_current_user_can(),
61
  'collection',
62
  array($this, 'saswp_admin_collection_interface_render'));
63
 
159
  'show_admin_column' => true,
160
  'rewrite' => false,
161
  );
162
+
163
+ if(saswp_current_user_allowed()){
164
+
165
+ $cap = saswp_post_type_capabilities();
166
+
167
+ if(!empty($cap)){
168
+ $collections['capabilities'] = $cap;
169
+ }
170
+
171
+ register_post_type( 'saswp-collections', $collections );
172
+ }
173
+
174
  }
175
 
176
  public function saswp_get_collection_platforms(){
377
 
378
  public function saswp_admin_collection_interface_render(){
379
 
380
+ if ( ! current_user_can( saswp_current_user_can() ) ) return;
381
  if ( !wp_verify_nonce( $_GET['_wpnonce'], '_wpnonce' ) ) return;
382
 
383
  $post_meta = array();
584
  public function saswp_save_collection_data(){
585
 
586
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
587
+ if ( ! current_user_can( saswp_current_user_can() ) ) return ;
588
  if ( ! isset( $_POST['saswp_collection_nonce'] ) || ! wp_verify_nonce( $_POST['saswp_collection_nonce'], 'saswp_collection_nonce_data' ) ) return;
589
 
590
  if(isset($_POST['saswp_collection_id'])){
modules/reviews/reviews_form.php CHANGED
@@ -28,7 +28,7 @@ class SASWP_Reviews_Form {
28
 
29
  }
30
 
31
- add_shortcode( 'saswp-reviews-form', array($this, 'saswp_reviews_form_render' ));
32
  add_action( 'admin_post_saswp_review_form', array($this, 'saswp_save_review_form_data') );
33
  add_action( 'admin_post_nopriv_saswp_review_form', array($this, 'saswp_save_review_form_data') );
34
 
@@ -39,7 +39,7 @@ class SASWP_Reviews_Form {
39
  add_filter( 'amp_content_sanitizers',array($this, 'saswp_review_form_blacklist_sanitizer'), 99);
40
 
41
  }
42
-
43
  public function saswp_review_form_blacklist_sanitizer($data){
44
 
45
  if(function_exists('ampforwp_is_amp_endpoint')){
@@ -72,8 +72,7 @@ class SASWP_Reviews_Form {
72
 
73
  public function saswp_save_review_form_data(){
74
 
75
- $form_data = $_POST;
76
-
77
  $headers = getallheaders();
78
  $is_amp = false;
79
  $rv_link = $form_data['saswp_review_link'];
@@ -144,8 +143,17 @@ class SASWP_Reviews_Form {
144
  echo @file_get_contents($review_css);
145
 
146
  }
 
 
 
 
 
 
 
 
 
147
  public function saswp_reviews_form_render($attr){
148
-
149
  $is_amp = false;
150
 
151
  if(!saswp_non_amp()){
@@ -174,11 +182,13 @@ class SASWP_Reviews_Form {
174
  if(!$is_amp){
175
 
176
  $rating_html = '<div class="saswp-rating-front-div"></div><input type="hidden" name="saswp_review_rating" value="5">';
177
- $form .= '<form action="'.esc_url( admin_url('admin-post.php') ).'" method="post">';
178
 
179
  }else{
180
 
181
- $form .= '<form action-xhr="'.esc_url( admin_url('admin-post.php') ).'" method="post">';
 
 
182
 
183
  $rating_html = ''
184
  . '<input type="hidden" name="saswp_review_rating" [value]="saswp_review_rating">'
28
 
29
  }
30
 
31
+ add_shortcode( 'saswp-reviews-form', array($this, 'saswp_reviews_form_render' ));
32
  add_action( 'admin_post_saswp_review_form', array($this, 'saswp_save_review_form_data') );
33
  add_action( 'admin_post_nopriv_saswp_review_form', array($this, 'saswp_save_review_form_data') );
34
 
39
  add_filter( 'amp_content_sanitizers',array($this, 'saswp_review_form_blacklist_sanitizer'), 99);
40
 
41
  }
42
+
43
  public function saswp_review_form_blacklist_sanitizer($data){
44
 
45
  if(function_exists('ampforwp_is_amp_endpoint')){
72
 
73
  public function saswp_save_review_form_data(){
74
 
75
+ $form_data = $_POST;
 
76
  $headers = getallheaders();
77
  $is_amp = false;
78
  $rv_link = $form_data['saswp_review_link'];
143
  echo @file_get_contents($review_css);
144
 
145
  }
146
+
147
+ public function saswp_reviews_form_amp_script($data){
148
+
149
+ if ( empty( $data['amp_component_scripts']['amp-form'] ) ) {
150
+ $data['amp_component_scripts']['amp-form'] = "https://cdn.ampproject.org/v0/amp-form-latest.js";
151
+ }
152
+ return $data;
153
+ }
154
+
155
  public function saswp_reviews_form_render($attr){
156
+
157
  $is_amp = false;
158
 
159
  if(!saswp_non_amp()){
182
  if(!$is_amp){
183
 
184
  $rating_html = '<div class="saswp-rating-front-div"></div><input type="hidden" name="saswp_review_rating" value="5">';
185
+ $form .= '<form action="'.esc_url( admin_url('admin-post.php') ).'" method="post" class="saswp-review-submission-form">';
186
 
187
  }else{
188
 
189
+ add_action( 'amp_post_template_data', array($this, 'saswp_reviews_form_amp_script'));
190
+
191
+ $form .= '<form action-xhr="'.esc_url( admin_url('admin-post.php') ).'" method="post" class="saswp-review-submission-form">';
192
 
193
  $rating_html = ''
194
  . '<input type="hidden" name="saswp_review_rating" [value]="saswp_review_rating">'
modules/reviews/reviews_service.php CHANGED
@@ -247,7 +247,7 @@ class saswp_reviews_service {
247
 
248
  public function saswp_fetch_google_reviews(){
249
 
250
- if ( ! current_user_can( 'manage_options' ) ) {
251
  return;
252
  }
253
 
247
 
248
  public function saswp_fetch_google_reviews(){
249
 
250
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
251
  return;
252
  }
253
 
modules/reviews/reviews_setup.php CHANGED
@@ -44,7 +44,17 @@ function saswp_register_saswp_reviews_location() {
44
  'rewrite' => false,
45
  );
46
 
47
- register_post_type( 'saswp_rvs_location', $post_type );
 
 
 
 
 
 
 
 
 
 
48
 
49
  }
50
 
@@ -71,9 +81,18 @@ function saswp_register_saswp_reviews() {
71
  'show_admin_column' => true,
72
  'rewrite' => false,
73
  );
74
-
75
- register_post_type( 'saswp_reviews', $post_type );
76
-
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  function saswp_collection_custom_columns_set( $column, $post_id ) {
44
  'rewrite' => false,
45
  );
46
 
47
+ if(saswp_current_user_allowed()){
48
+
49
+ $cap = saswp_post_type_capabilities();
50
+
51
+ if(!empty($cap)){
52
+ $post_type['capabilities'] = $cap;
53
+ }
54
+
55
+ register_post_type( 'saswp_rvs_location', $post_type );
56
+ }
57
+
58
 
59
  }
60
 
81
  'show_admin_column' => true,
82
  'rewrite' => false,
83
  );
84
+
85
+ if(saswp_current_user_allowed()){
86
+
87
+ $cap = saswp_post_type_capabilities();
88
+
89
+ if(!empty($cap)){
90
+ $post_type['capabilities'] = $cap;
91
+ }
92
+
93
+ register_post_type( 'saswp_reviews', $post_type );
94
+ }
95
+
96
  }
97
 
98
  function saswp_collection_custom_columns_set( $column, $post_id ) {
modules/reviews/reviews_widget.php CHANGED
@@ -49,19 +49,23 @@ class Saswp_Reviews_Widget extends WP_Widget {
49
  public function widget( $args, $instance ) {
50
 
51
  echo html_entity_decode(esc_attr($args['before_widget']));
52
-
53
-
54
  if(saswp_global_option()){
55
 
56
- $attr = array(
57
- 'count' => $instance['g_review']
58
- );
59
-
60
- $response = $this->_serviceClass->saswp_reviews_front_output($attr);
 
 
 
 
 
 
61
 
62
  }
63
-
64
- echo $response;
65
 
66
  echo html_entity_decode(esc_attr($args['after_widget']));
67
  }
49
  public function widget( $args, $instance ) {
50
 
51
  echo html_entity_decode(esc_attr($args['before_widget']));
52
+
53
+
54
  if(saswp_global_option()){
55
 
56
+ $attr = array(
57
+ 'count' => $instance['g_review']
58
+ );
59
+
60
+ $reviews = $this->_serviceClass->saswp_get_reviews_list_by_parameters($attr);
61
+
62
+ if($reviews){
63
+ global $saswp_post_reviews;
64
+ $saswp_post_reviews = array_merge($saswp_post_reviews, $reviews);
65
+ echo $this->_serviceClass->saswp_reviews_html_markup($reviews);
66
+ }
67
 
68
  }
 
 
69
 
70
  echo html_entity_decode(esc_attr($args['after_widget']));
71
  }
output/compatibility.php CHANGED
@@ -52,8 +52,7 @@ class saswp_output_compatibility{
52
 
53
  public function saswp_override_schema_markup(){
54
 
55
- global $sd_data;
56
-
57
  if(!empty($this->_plugins_list)){
58
 
59
  foreach ($this->_plugins_list as $key => $plugins){
@@ -64,7 +63,7 @@ class saswp_output_compatibility{
64
 
65
  $func_name = 'saswp_'.$key.'_override';
66
 
67
- if(method_exists($this, $func_name) && saswp_global_option()){
68
  call_user_func(array($this, $func_name));
69
  }
70
 
@@ -87,7 +86,7 @@ class saswp_output_compatibility{
87
 
88
  $func_name = 'saswp_'.$key.'_override';
89
 
90
- if(method_exists($this, $func_name) && saswp_global_option()){
91
  call_user_func(array($this, $func_name));
92
  }
93
 
@@ -131,14 +130,18 @@ class saswp_output_compatibility{
131
  );
132
 
133
  }
134
-
 
 
 
 
 
135
  public function saswp_wpamp_override(){
136
  add_action('amphtml_template_head', array($this, 'saswp_wpamp_override_full'));
137
  }
138
  public function saswp_wpamp_override_full($data){
139
  $data->metadata = array();
140
- }
141
-
142
  public function saswp_betteramp_override(){
143
 
144
  add_action( 'template_redirect', array($this, 'saswp_betteramp_override_full') ,99);
@@ -149,14 +152,7 @@ class saswp_output_compatibility{
149
  remove_action( 'wp_head', 'BF_Json_LD_Generator::print_output' );
150
  remove_action( 'better-amp/template/head', 'BF_Json_LD_Generator::print_output' );
151
 
152
- }
153
-
154
- public function saswp_strong_testimonials_override(){
155
-
156
- //code to be written
157
-
158
- }
159
-
160
  public function saswp_easy_testimonials_override(){
161
 
162
  add_filter('easy_testimonials_json_ld', '__return_false');
@@ -176,6 +172,8 @@ class saswp_output_compatibility{
176
  update_post_meta(get_the_id(), 'sp_tpro_shortcode_options',$shortcode_opt);
177
  endwhile;
178
 
 
 
179
  }
180
 
181
  }
@@ -406,12 +404,24 @@ class saswp_output_compatibility{
406
  public function wpamp_on_activation(){
407
  $this->saswp_update_option_on_compatibility_activation('saswp-wpamp');
408
  }
 
 
 
409
  public function wordlift_on_activation(){
410
  $this->saswp_update_option_on_compatibility_activation('saswp-wordlift');
411
  }
412
  public function strong_testimonials_on_activation(){
413
  $this->saswp_update_option_on_compatibility_activation('saswp-strong-testimonials');
414
  }
 
 
 
 
 
 
 
 
 
415
  public function saswp_update_option_on_compatibility_activation($opt_name){
416
  $defaults = get_option('sd_data');
417
  $defaults[$opt_name] = 1;
52
 
53
  public function saswp_override_schema_markup(){
54
 
55
+ global $sd_data;
 
56
  if(!empty($this->_plugins_list)){
57
 
58
  foreach ($this->_plugins_list as $key => $plugins){
63
 
64
  $func_name = 'saswp_'.$key.'_override';
65
 
66
+ if(method_exists($this, $func_name)){
67
  call_user_func(array($this, $func_name));
68
  }
69
 
86
 
87
  $func_name = 'saswp_'.$key.'_override';
88
 
89
+ if(method_exists($this, $func_name)){
90
  call_user_func(array($this, $func_name));
91
  }
92
 
130
  );
131
 
132
  }
133
+ public function saswp_ampwp_override(){
134
+ add_action( 'template_redirect', array($this, 'saswp_ampwp_override_full'),99);
135
+ }
136
+ public function saswp_ampwp_override_full(){
137
+ remove_action( 'amp_wp_template_head', 'Amp_WP_Json_Ld_Generator::print_output' );
138
+ }
139
  public function saswp_wpamp_override(){
140
  add_action('amphtml_template_head', array($this, 'saswp_wpamp_override_full'));
141
  }
142
  public function saswp_wpamp_override_full($data){
143
  $data->metadata = array();
144
+ }
 
145
  public function saswp_betteramp_override(){
146
 
147
  add_action( 'template_redirect', array($this, 'saswp_betteramp_override_full') ,99);
152
  remove_action( 'wp_head', 'BF_Json_LD_Generator::print_output' );
153
  remove_action( 'better-amp/template/head', 'BF_Json_LD_Generator::print_output' );
154
 
155
+ }
 
 
 
 
 
 
 
156
  public function saswp_easy_testimonials_override(){
157
 
158
  add_filter('easy_testimonials_json_ld', '__return_false');
172
  update_post_meta(get_the_id(), 'sp_tpro_shortcode_options',$shortcode_opt);
173
  endwhile;
174
 
175
+ wp_reset_postdata();
176
+
177
  }
178
 
179
  }
404
  public function wpamp_on_activation(){
405
  $this->saswp_update_option_on_compatibility_activation('saswp-wpamp');
406
  }
407
+ public function ampwp_on_activation(){
408
+ $this->saswp_update_option_on_compatibility_activation('saswp-ampwp');
409
+ }
410
  public function wordlift_on_activation(){
411
  $this->saswp_update_option_on_compatibility_activation('saswp-wordlift');
412
  }
413
  public function strong_testimonials_on_activation(){
414
  $this->saswp_update_option_on_compatibility_activation('saswp-strong-testimonials');
415
  }
416
+ public function tevolution_events_on_activation(){
417
+ $this->saswp_update_option_on_compatibility_activation('saswp-tevolution-events');
418
+ }
419
+ public function wp_event_aggregator_on_activation(){
420
+ $this->saswp_update_option_on_compatibility_activation('saswp-wp-event-aggregator');
421
+ }
422
+ public function easy_recipe_on_activation(){
423
+ $this->saswp_update_option_on_compatibility_activation('saswp-easy-recipe');
424
+ }
425
  public function saswp_update_option_on_compatibility_activation($opt_name){
426
  $defaults = get_option('sd_data');
427
  $defaults[$opt_name] = 1;
output/function.php CHANGED
@@ -26,6 +26,7 @@ function saswp_schema_markup_hook_on_init() {
26
  add_action( 'amp_post_template_footer' , 'saswp_schema_markup_output' );
27
  add_action( 'better-amp/template/footer', 'saswp_schema_markup_output', 1, 1 );
28
  add_action( 'amphtml_template_footer', 'saswp_schema_markup_output');
 
29
 
30
  }else{
31
 
@@ -33,6 +34,7 @@ function saswp_schema_markup_hook_on_init() {
33
  add_action( 'wp_head', 'saswp_schema_markup_output');
34
  add_action( 'amp_post_template_head' , 'saswp_schema_markup_output' );
35
  add_action( 'amphtml_template_head', 'saswp_schema_markup_output');
 
36
 
37
  }
38
 
@@ -84,8 +86,12 @@ function saswp_schema_markup_output() {
84
  $blog_page = array();
85
 
86
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
87
- $gutenberg_faq = saswp_gutenberg_faq_schema();
 
 
 
88
  $woo_cat_schema = saswp_woocommerce_category_schema();
 
89
  $site_navigation = saswp_site_navigation_output();
90
  $contact_page_output = saswp_contact_page_output();
91
  $about_page_output = saswp_about_page_output();
@@ -98,12 +104,12 @@ function saswp_schema_markup_output() {
98
  $item_list = $archive_output[0];
99
  }
100
 
101
- $collection_page = $archive_output[1];
102
- $blog_page = $archive_output[2];
103
  }
104
 
105
  $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
106
- $kb_website_output = saswp_kb_website_output();
107
 
108
  if((is_home() || is_front_page() || ( function_exists('ampforwp_is_home') && ampforwp_is_home())) || isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1 ){
109
  $kb_schema_output = saswp_kb_schema_output();
@@ -151,6 +157,18 @@ function saswp_schema_markup_output() {
151
  $output .= ",";
152
  $output .= "\n\n";
153
  }
 
 
 
 
 
 
 
 
 
 
 
 
154
  if(!empty($item_list)){
155
 
156
  $output .= saswp_json_print_format($item_list);
@@ -175,6 +193,24 @@ function saswp_schema_markup_output() {
175
  $output .= ",";
176
  $output .= "\n\n";
177
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  if(!empty($blog_page)){
179
 
180
  $output .= saswp_json_print_format($blog_page);
@@ -203,10 +239,20 @@ function saswp_schema_markup_output() {
203
  unset($schema_breadcrumb_output['@context']);
204
  unset($webpage['mainEntity']);
205
  unset($kb_schema_output['@context']);
206
- unset($kb_website_output['@context']);
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
- $kb_schema_output['@type'] = 'Organization';
209
-
210
  if($webpage){
211
 
212
  $soutput['isPartOf'] = array(
@@ -245,13 +291,16 @@ function saswp_schema_markup_output() {
245
  if($kb_website_output){
246
 
247
  $kb_website_output['publisher'] = array(
248
- '@id' => $kb_schema_output['@id']
249
  );
250
  }
251
-
252
- $soutput['publisher'] = array(
253
- '@id' => $kb_schema_output['@id']
254
- );
 
 
 
255
 
256
  }
257
 
@@ -261,8 +310,10 @@ function saswp_schema_markup_output() {
261
  $final_output['@graph'][] = $kb_website_output;
262
 
263
  $final_output['@graph'][] = $webpage;
264
-
265
- $final_output['@graph'][] = $schema_breadcrumb_output;
 
 
266
 
267
  $final_output['@graph'][] = $soutput;
268
 
@@ -344,27 +395,34 @@ function saswp_schema_markup_output() {
344
 
345
  }
346
 
347
- if($custom_markup){
348
- $result = json_decode($custom_markup);
349
-
350
- if($result != false){
 
 
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  echo "\n";
353
  echo '<!-- Schema & Structured Data For WP Custom Markup v'.esc_attr(SASWP_VERSION).' - -->';
354
  echo "\n";
355
- echo '<script type="application/ld+json" class="saswp-schema-markup-output">';
356
- echo "\n";
357
- echo $custom_markup;
358
- echo "\n";
359
- echo '</script>';
360
  echo "\n\n";
361
-
362
- }
363
-
364
-
365
  }
366
-
367
-
368
  }
369
 
370
  if($output){
@@ -597,36 +655,55 @@ function saswp_extract_wp_post_ratings(){
597
  */
598
  function saswp_get_comments($post_id){
599
 
600
- $comment_count = get_comments_number( $post_id );
601
 
602
- if ( $comment_count < 1 ) {
603
- return array();
604
- }
605
  $comments = array();
606
-
607
- $count = apply_filters( 'saswp_do_comments', '10'); // default = 10
608
-
609
- $post_comments = get_comments( array(
610
- 'post_id' => $post_id,
611
- 'number' => $count,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  'status' => 'approve',
613
  'type' => 'comment'
614
  )
615
- );
616
-
 
 
617
  if ( count( $post_comments ) ) {
618
 
619
  foreach ( $post_comments as $comment ) {
620
 
621
  $comments[] = array (
622
  '@type' => 'Comment',
623
- 'dateCreated' => esc_html($comment->comment_date),
624
- 'description' => esc_attr($comment->comment_content),
625
  'author' => array (
626
  '@type' => 'Person',
627
  'name' => esc_attr($comment->comment_author),
628
- 'url' => esc_url($comment->comment_author_url),
629
- ),
630
  );
631
  }
632
 
@@ -1258,6 +1335,54 @@ function saswp_get_testimonial_pro_data($shortcode_data, $testimo_str){
1258
 
1259
  }
1260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1261
  function saswp_get_bne_testimonials_data($atts, $testimo_str){
1262
 
1263
  $reviews = array();
@@ -1316,6 +1441,82 @@ function saswp_get_bne_testimonials_data($atts, $testimo_str){
1316
 
1317
  function saswp_get_strong_testimonials(){
1318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1319
  //tomorrow will do it
1320
 
1321
  }
@@ -1641,3 +1842,26 @@ function saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $sche
1641
  return $input1;
1642
 
1643
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  add_action( 'amp_post_template_footer' , 'saswp_schema_markup_output' );
27
  add_action( 'better-amp/template/footer', 'saswp_schema_markup_output', 1, 1 );
28
  add_action( 'amphtml_template_footer', 'saswp_schema_markup_output');
29
+ add_action( 'amp_wp_template_footer', 'saswp_schema_markup_output');
30
 
31
  }else{
32
 
34
  add_action( 'wp_head', 'saswp_schema_markup_output');
35
  add_action( 'amp_post_template_head' , 'saswp_schema_markup_output' );
36
  add_action( 'amphtml_template_head', 'saswp_schema_markup_output');
37
+ add_action( 'amp_wp_template_head', 'saswp_schema_markup_output');
38
 
39
  }
40
 
86
  $blog_page = array();
87
 
88
  $gutenberg_how_to = saswp_gutenberg_how_to_schema();
89
+ $gutenberg_faq = saswp_gutenberg_faq_schema();
90
+ $gutenberg_event = saswp_gutenberg_event_schema();
91
+ $gutenberg_job = saswp_gutenberg_job_schema();
92
+ $gutenberg_course = saswp_gutenberg_course_schema();
93
  $woo_cat_schema = saswp_woocommerce_category_schema();
94
+ $woo_shop_page = saswp_woocommerce_shop_page();
95
  $site_navigation = saswp_site_navigation_output();
96
  $contact_page_output = saswp_contact_page_output();
97
  $about_page_output = saswp_about_page_output();
104
  $item_list = $archive_output[0];
105
  }
106
 
107
+ $collection_page = isset($archive_output[1]) ? $archive_output[1]: array();
108
+ $blog_page = isset($archive_output[1]) ? $archive_output[2]: array();
109
  }
110
 
111
  $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
112
+ $kb_website_output = saswp_kb_website_output();
113
 
114
  if((is_home() || is_front_page() || ( function_exists('ampforwp_is_home') && ampforwp_is_home())) || isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1 ){
115
  $kb_schema_output = saswp_kb_schema_output();
157
  $output .= ",";
158
  $output .= "\n\n";
159
  }
160
+ if(!empty($woo_shop_page['itemlist'])){
161
+
162
+ $output .= saswp_json_print_format($woo_shop_page['itemlist']);
163
+ $output .= ",";
164
+ $output .= "\n\n";
165
+ }
166
+ if(!empty($woo_shop_page['collection'])){
167
+
168
+ $output .= saswp_json_print_format($woo_shop_page['collection']);
169
+ $output .= ",";
170
+ $output .= "\n\n";
171
+ }
172
  if(!empty($item_list)){
173
 
174
  $output .= saswp_json_print_format($item_list);
193
  $output .= ",";
194
  $output .= "\n\n";
195
  }
196
+ if(!empty($gutenberg_course)){
197
+
198
+ $output .= saswp_json_print_format($gutenberg_course);
199
+ $output .= ",";
200
+ $output .= "\n\n";
201
+ }
202
+ if(!empty($gutenberg_event)){
203
+
204
+ $output .= saswp_json_print_format($gutenberg_event);
205
+ $output .= ",";
206
+ $output .= "\n\n";
207
+ }
208
+ if(!empty($gutenberg_job)){
209
+
210
+ $output .= saswp_json_print_format($gutenberg_job);
211
+ $output .= ",";
212
+ $output .= "\n\n";
213
+ }
214
  if(!empty($blog_page)){
215
 
216
  $output .= saswp_json_print_format($blog_page);
239
  unset($schema_breadcrumb_output['@context']);
240
  unset($webpage['mainEntity']);
241
  unset($kb_schema_output['@context']);
242
+ unset($kb_website_output['@context']);
243
+
244
+ if(isset($sd_data['saswp_kb_type'])){
245
+
246
+ $kb_schema_output['@type'] = $sd_data['saswp_kb_type'];
247
+
248
+ if($sd_data['saswp_kb_type'] == 'Organization'){
249
+ $kb_schema_output['@type'] = isset($sd_data['saswp_organization_type']) ? $sd_data['saswp_organization_type'] : 'Organization';
250
+ }
251
+
252
+ }else{
253
+ $kb_schema_output['@type'] = 'Organization';
254
+ }
255
 
 
 
256
  if($webpage){
257
 
258
  $soutput['isPartOf'] = array(
291
  if($kb_website_output){
292
 
293
  $kb_website_output['publisher'] = array(
294
+ '@id' => isset($kb_schema_output['@id']) ? $kb_schema_output['@id'] : ''
295
  );
296
  }
297
+ if($sd_data['saswp_kb_type'] == 'Organization'){
298
+
299
+ $soutput['publisher'] = array(
300
+ '@id' => isset($kb_schema_output['@id']) ? $kb_schema_output['@id'] : ''
301
+ );
302
+
303
+ }
304
 
305
  }
306
 
310
  $final_output['@graph'][] = $kb_website_output;
311
 
312
  $final_output['@graph'][] = $webpage;
313
+
314
+ if($schema_breadcrumb_output){
315
+ $final_output['@graph'][] = $schema_breadcrumb_output;
316
+ }
317
 
318
  $final_output['@graph'][] = $soutput;
319
 
395
 
396
  }
397
 
398
+ if($custom_markup){
399
+
400
+ $custom_output = '';
401
+
402
+ $cus_regex = '/\<script type\=\"application\/ld\+json\"\>/';
403
+ preg_match( $cus_regex, $custom_markup, $match );
404
 
405
+ if(empty($match)){
406
+
407
+ $custom_output .= '<script type="application/ld+json" class="saswp-schema-markup-output">';
408
+ $custom_output .= $custom_markup;
409
+ $custom_output .= '</script>';
410
+
411
+ }else{
412
+
413
+ $custom_output = $custom_markup;
414
+ $custom_output = preg_replace($cus_regex, '<script type="application/ld+json" class="saswp-schema-markup-output">', $custom_output);
415
+
416
+ }
417
+
418
  echo "\n";
419
  echo '<!-- Schema & Structured Data For WP Custom Markup v'.esc_attr(SASWP_VERSION).' - -->';
420
  echo "\n";
421
+ echo $custom_output;
 
 
 
 
422
  echo "\n\n";
423
+
 
 
 
424
  }
425
+
 
426
  }
427
 
428
  if($output){
655
  */
656
  function saswp_get_comments($post_id){
657
 
658
+ global $sd_data;
659
 
 
 
 
660
  $comments = array();
661
+ $post_comments = array();
662
+
663
+ if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && get_post_type($post_id) == 'topic'){
664
+
665
+ $replies_query = array(
666
+ 'post_type' => 'reply',
667
+ );
668
+
669
+ if ( bbp_has_replies( $replies_query ) ) :
670
+
671
+ while ( bbp_replies() ) : bbp_the_reply();
672
+
673
+ $post_comments[] = (object) array(
674
+ 'comment_date' => bbp_get_reply_post_date(bbp_get_reply_id(),'c'),
675
+ 'comment_content' => bbp_get_reply_content(),
676
+ 'comment_author' => bbp_get_reply_author(),
677
+ 'comment_author_url' => bbp_get_reply_author_url(),
678
+ );
679
+
680
+ endwhile;
681
+ wp_reset_postdata();
682
+ endif;
683
+
684
+ }else{
685
+ $post_comments = get_comments( array(
686
+ 'post_id' => $post_id,
687
  'status' => 'approve',
688
  'type' => 'comment'
689
  )
690
+ );
691
+
692
+ }
693
+
694
  if ( count( $post_comments ) ) {
695
 
696
  foreach ( $post_comments as $comment ) {
697
 
698
  $comments[] = array (
699
  '@type' => 'Comment',
700
+ 'dateCreated' => saswp_format_date_time($comment->comment_date),
701
+ 'description' => strip_tags($comment->comment_content),
702
  'author' => array (
703
  '@type' => 'Person',
704
  'name' => esc_attr($comment->comment_author),
705
+ 'url' => isset($comment->comment_author_url) ? esc_url($comment->comment_author_url): '',
706
+ ),
707
  );
708
  }
709
 
1335
 
1336
  }
1337
 
1338
+ function saswp_get_strong_testimonials_data($testimonial){
1339
+
1340
+ $reviews = array();
1341
+ $ratings = array();
1342
+
1343
+ if(!empty($testimonial)){
1344
+
1345
+ $sumofrating = 0;
1346
+ $avg_rating = 1;
1347
+
1348
+ foreach ($testimonial as $value){
1349
+
1350
+ $rating = 5;
1351
+ $author = get_post_meta($value->ID, $key='client_name', true);
1352
+
1353
+ $sumofrating += $rating;
1354
+
1355
+ $reviews[] = array(
1356
+ '@type' => 'Review',
1357
+ 'author' => $author,
1358
+ 'datePublished' => saswp_format_date_time($value->post_date),
1359
+ 'description' => $value->post_content,
1360
+ 'reviewRating' => array(
1361
+ '@type' => 'Rating',
1362
+ 'bestRating' => '5',
1363
+ 'ratingValue' => $rating,
1364
+ 'worstRating' => '1',
1365
+ )
1366
+ );
1367
+
1368
+ }
1369
+
1370
+ if($sumofrating> 0){
1371
+ $avg_rating = $sumofrating / count($reviews);
1372
+ }
1373
+
1374
+ $ratings['aggregateRating'] = array(
1375
+ '@type' => 'AggregateRating',
1376
+ 'ratingValue' => $avg_rating,
1377
+ 'reviewCount' => count($testimonial)
1378
+ );
1379
+
1380
+ }
1381
+
1382
+ return array('reviews' => $reviews, 'rating' => $ratings);
1383
+
1384
+ }
1385
+
1386
  function saswp_get_bne_testimonials_data($atts, $testimo_str){
1387
 
1388
  $reviews = array();
1441
 
1442
  function saswp_get_strong_testimonials(){
1443
 
1444
+ $testimonial = array();
1445
+
1446
+ global $post, $sd_data;
1447
+
1448
+ if(isset($sd_data['saswp-strong-testimonials']) && $sd_data['saswp-strong-testimonials'] == 1){
1449
+
1450
+ if(is_object($post)){
1451
+
1452
+ $pattern = get_shortcode_regex();
1453
+
1454
+ if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
1455
+ && array_key_exists( 2, $matches ) )
1456
+ {
1457
+
1458
+ $testimo_str = '';
1459
+
1460
+ if(in_array( 'testimonial_view', $matches[2] )){
1461
+ $testimo_str = 'testimonial_view';
1462
+ }
1463
+
1464
+ if($testimo_str){
1465
+
1466
+ foreach ($matches[0] as $matche){
1467
+
1468
+ $mached = rtrim($matche, ']');
1469
+ $mached = ltrim($mached, '[');
1470
+ $mached = trim($mached);
1471
+
1472
+ $atts = shortcode_parse_atts('['.$mached.' ]');
1473
+ $atts = array('id' => $atts['id']);
1474
+
1475
+
1476
+ $out = shortcode_atts(
1477
+ array(),
1478
+ $atts,
1479
+ 'testimonial_view'
1480
+ );
1481
+
1482
+ if(class_exists('Strong_View_Form') && class_exists('Strong_View_Slideshow') && class_exists('Strong_View_Display')){
1483
+
1484
+ switch ( $out['mode'] ) {
1485
+ case 'form' :
1486
+ $view = new Strong_View_Form( $out );
1487
+ if ( isset( $_GET['success'] ) ) {
1488
+ $view->success();
1489
+ } else {
1490
+ $view->build();
1491
+ }
1492
+ break;
1493
+ case 'slideshow' :
1494
+ $view = new Strong_View_Slideshow( $out );
1495
+ $view->build();
1496
+ break;
1497
+ default :
1498
+ $view = new Strong_View_Display( $out );
1499
+ $view->build();
1500
+ }
1501
+ if(is_object($view)){
1502
+ $testimonial = saswp_get_strong_testimonials_data($view->query->posts);
1503
+ }
1504
+
1505
+ }
1506
+
1507
+ break;
1508
+ }
1509
+
1510
+ }
1511
+
1512
+ }
1513
+
1514
+ }
1515
+
1516
+ }
1517
+
1518
+ return $testimonial;
1519
+
1520
  //tomorrow will do it
1521
 
1522
  }
1842
  return $input1;
1843
 
1844
  }
1845
+
1846
+ function saswp_explod_by_semicolon($data){
1847
+
1848
+ $response = array();
1849
+
1850
+ if($data){
1851
+
1852
+ $explod = explode(';', $data);
1853
+
1854
+ if($explod){
1855
+
1856
+ foreach ($explod as $val){
1857
+
1858
+ $response[] = $val;
1859
+
1860
+ }
1861
+
1862
+ }
1863
+ }
1864
+
1865
+ return $response;
1866
+
1867
+ }
output/gutenberg.php ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Output Page
4
+ *
5
+ * @author Magazine3
6
+ * @category Frontend
7
+ * @path output_post_specific/output_post_specific
8
+ * @version 1.0
9
+ */
10
+ if (! defined('ABSPATH') ) exit;
11
+
12
+ function saswp_get_gutenberg_block_data($block){
13
+
14
+ global $post;
15
+
16
+ $block_list = array();
17
+ $block_data = array();
18
+ $response = array();
19
+
20
+ if(function_exists('parse_blocks') && is_object($post)){
21
+
22
+ $blocks = parse_blocks($post->post_content);
23
+
24
+ if($blocks){
25
+
26
+ foreach ($blocks as $parse_blocks){
27
+ $block_list[] = $parse_blocks['blockName'];
28
+ $block_data[$parse_blocks['blockName']] = $parse_blocks;
29
+ }
30
+
31
+ }
32
+ }
33
+
34
+ if($block_list){
35
+
36
+ if(in_array($block, $block_list)){
37
+ $response = $block_data[$block];
38
+ }
39
+
40
+ }
41
+
42
+ return $response;
43
+
44
+ }
45
+
46
+ function saswp_gutenberg_how_to_schema(){
47
+
48
+ global $post;
49
+ $input1 = array();
50
+
51
+ $parse_blocks = saswp_get_gutenberg_block_data('saswp/how-to-block');
52
+
53
+ if(isset($parse_blocks['attrs'])){
54
+
55
+ $service_object = new saswp_output_service();
56
+ $feature_image = $service_object->saswp_get_fetaure_image();
57
+
58
+ $input1['@context'] = saswp_context_url();
59
+ $input1['@type'] = 'HowTo';
60
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#HowTo';
61
+ $input1['name'] = saswp_get_the_title();
62
+ $input1['datePublished'] = get_the_date("c");
63
+ $input1['dateModified'] = get_the_modified_date("c");
64
+
65
+ if(!empty($feature_image)){
66
+
67
+ $input1 = array_merge($input1, $feature_image);
68
+
69
+ }
70
+
71
+ if(array_key_exists('description', $parse_blocks['attrs'])){
72
+ $input1['description'] = $parse_blocks['attrs']['description'];
73
+ }
74
+
75
+ $supply = array();
76
+ $supply_arr = array();
77
+
78
+ if(array_key_exists('materials', $parse_blocks['attrs'])){
79
+ $supply = $parse_blocks['attrs']['materials'];
80
+ }
81
+
82
+ if(!empty($supply)){
83
+
84
+ foreach($supply as $val){
85
+
86
+ $supply_data = array();
87
+
88
+ if($val['name']){
89
+ $supply_data['@type'] = 'HowToSupply';
90
+ $supply_data['name'] = $val['name'];
91
+ }
92
+
93
+ $supply_arr[] = $supply_data;
94
+ }
95
+ $input1['supply'] = $supply_arr;
96
+ }
97
+
98
+ $tool = array();
99
+ $tool_arr = array();
100
+
101
+ if(array_key_exists('tools', $parse_blocks['attrs'])){
102
+ $tool = $parse_blocks['attrs']['tools'];
103
+ }
104
+
105
+ if(!empty($tool)){
106
+
107
+ foreach($tool as $val){
108
+
109
+ $supply_data = array();
110
+
111
+ if($val['name']){
112
+ $supply_data['@type'] = 'HowToTool';
113
+ $supply_data['name'] = $val['name'];
114
+ }
115
+
116
+ $tool_arr[] = $supply_data;
117
+ }
118
+ $input1['tool'] = $tool_arr;
119
+ }
120
+
121
+ $step = array();
122
+ $step_arr = array();
123
+
124
+ if(array_key_exists('items', $parse_blocks['attrs'])){
125
+ $step = $parse_blocks['attrs']['items'];
126
+ }
127
+ if(!empty($step)){
128
+
129
+ foreach($step as $key => $val){
130
+
131
+ $supply_data = array();
132
+ $direction = array();
133
+ $tip = array();
134
+
135
+ if($val['title'] || $val['description']){
136
+
137
+ if($val['title']){
138
+ $direction['@type'] = 'HowToDirection';
139
+ $direction['text'] = $val['title'];
140
+ }
141
+
142
+ if($val['description']){
143
+
144
+ $tip['@type'] = 'HowToTip';
145
+ $tip['text'] = $val['description'];
146
+
147
+ }
148
+
149
+ $supply_data['@type'] = 'HowToStep';
150
+ $supply_data['url'] = trailingslashit(saswp_get_permalink()).'#step'.++$key;
151
+ $supply_data['name'] = $val['title'];
152
+
153
+ if(isset($direction['text']) || isset($tip['text'])){
154
+ $supply_data['itemListElement'] = array($direction, $tip);
155
+ }
156
+
157
+ if(isset($val['imageId']) && $val['imageId'] !=''){
158
+
159
+ $image_details = saswp_get_image_by_id($val['imageId']);
160
+
161
+ if($image_details){
162
+ $supply_data['image'] = $image_details;
163
+ }
164
+
165
+ }
166
+
167
+ $step_arr[] = $supply_data;
168
+
169
+ }
170
+
171
+ }
172
+
173
+ $input1['step'] = $step_arr;
174
+
175
+ }
176
+
177
+ if(isset($parse_blocks['attrs']['days']) || $parse_blocks['attrs']['hours'] || $parse_blocks['attrs']['minutes']){
178
+
179
+ $input1['totalTime'] = 'P'.
180
+ ((isset($parse_blocks['attrs']['days']) && $parse_blocks['attrs']['days'] !='') ? esc_attr($parse_blocks['attrs']['days']).'DT':'').
181
+ ((isset($parse_blocks['attrs']['hours']) && $parse_blocks['attrs']['hours'] !='') ? esc_attr($parse_blocks['attrs']['hours']).'H':'').
182
+ ((isset($parse_blocks['attrs']['minutes']) && $parse_blocks['attrs']['minutes'] !='') ? esc_attr($parse_blocks['attrs']['minutes']).'M':'');
183
+
184
+ }
185
+
186
+ }
187
+
188
+ return $input1;
189
+
190
+ }
191
+
192
+ function saswp_gutenberg_faq_schema(){
193
+
194
+ global $post;
195
+ $input1 = array();
196
+
197
+ $attributes = saswp_get_gutenberg_block_data('saswp/faq-block');
198
+
199
+ if(isset($attributes['attrs'])){
200
+
201
+ $input1['@context'] = saswp_context_url();
202
+ $input1['@type'] = 'FAQPage';
203
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#FAQPage';
204
+
205
+ $faq_question_arr = array();
206
+
207
+ if(!empty($attributes['attrs']['items'])){
208
+
209
+ foreach($attributes['attrs']['items'] as $val){
210
+
211
+ $supply_data = array();
212
+ $supply_data['@type'] = 'Question';
213
+ $supply_data['name'] = $val['title'];
214
+ $supply_data['acceptedAnswer']['@type'] = 'Answer';
215
+ $supply_data['acceptedAnswer']['text'] = $val['description'];
216
+
217
+ if(isset($val['imageId']) && $val['imageId'] !=''){
218
+
219
+ $image_details = saswp_get_image_by_id($val['imageId']);
220
+
221
+ if($image_details){
222
+ $supply_data['image'] = $image_details;
223
+ }
224
+
225
+ }
226
+
227
+ $faq_question_arr[] = $supply_data;
228
+ }
229
+ $input1['mainEntity'] = $faq_question_arr;
230
+ }
231
+
232
+ }
233
+
234
+ return $input1;
235
+
236
+ }
237
+
238
+ function saswp_gutenberg_event_schema(){
239
+
240
+ $input1 = array();
241
+
242
+ $attributes = saswp_get_gutenberg_block_data('saswp/event-block');
243
+
244
+ if(isset($attributes['attrs'])){
245
+
246
+ $data = $attributes['attrs'];
247
+
248
+ $input1['@context'] = saswp_context_url();
249
+ $input1['@type'] = 'Event';
250
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Event';
251
+ $input1['name'] = saswp_get_the_title();
252
+ $input1['description'] = saswp_get_the_excerpt();
253
+ $input1['startDate'] = saswp_format_date_time($data['start_date'], $data['start_time']);
254
+ $input1['endDate'] = saswp_format_date_time($data['end_date'], $data['end_time']);
255
+
256
+ if(isset($data['venue_address']) || isset($data['venue_name'])){
257
+
258
+ $input1['location']['@type'] = 'Place';
259
+ $input1['location']['name'] = $data['venue_address'];
260
+ $input1['location']['address']['@type'] = 'PostalAddress';
261
+ $input1['location']['address']['streetAddress'] = $data['venue_address'];
262
+ $input1['location']['address']['addressLocality'] = $data['venue_city'];
263
+ $input1['location']['address']['postalCode'] = $data['venue_postal_code'];
264
+ $input1['location']['address']['addressRegion'] = $data['venue_state'];
265
+ $input1['location']['address']['addressCountry'] = $data['venue_country'];
266
+
267
+ }
268
+ if(isset($data['price'])){
269
+
270
+ $input1['offers']['@type'] = 'Offer';
271
+ $input1['offers']['url'] = saswp_get_permalink();
272
+ $input1['offers']['price'] = $data['price'];
273
+ $input1['offers']['priceCurrency'] = $data['currency'] ? $data['currency'] : 'USD';
274
+ $input1['offers']['availability'] = 'InStock';
275
+ $input1['offers']['validFrom'] = saswp_format_date_time($data['start_date'], $data['start_time']);
276
+
277
+ }
278
+
279
+ if(!empty($data['organizers'])){
280
+
281
+ foreach($data['organizers'] as $org){
282
+
283
+ $input1['organizer'][] = array(
284
+ '@type' => 'Organization',
285
+ 'name' => $org['name'],
286
+ 'url' => $org['phone'],
287
+ 'email' => $org['email'],
288
+ 'telephone' => $org['phone'],
289
+ );
290
+
291
+ }
292
+
293
+ }
294
+
295
+ $performer_arr = array();
296
+
297
+ if(!empty($data['performers'])){
298
+
299
+ foreach($data['performers'] as $val){
300
+
301
+ $supply_data = array();
302
+ $supply_data['@type'] = 'Person';
303
+ $supply_data['name'] = $val['name'];
304
+ $supply_data['url'] = $val['url'];
305
+ $supply_data['email'] = $val['email'];
306
+
307
+ $performer_arr[] = $supply_data;
308
+ }
309
+
310
+ $input1['performer'] = $performer_arr;
311
+
312
+ }
313
+
314
+ if( !empty($input1) && !isset($input1['image'])){
315
+
316
+ $service_object = new saswp_output_service();
317
+ $input2 = $service_object->saswp_get_fetaure_image();
318
+
319
+ if(!empty($input2)){
320
+
321
+ $input1 = array_merge($input1,$input2);
322
+
323
+ }
324
+ }
325
+
326
+ }
327
+
328
+ return $input1;
329
+
330
+ }
331
+
332
+ function saswp_gutenberg_job_schema(){
333
+
334
+ $input1 = array();
335
+
336
+ $attributes = saswp_get_gutenberg_block_data('saswp/job-block');
337
+
338
+ if(isset($attributes['attrs'])){
339
+
340
+ $data = $attributes['attrs'];
341
+
342
+ $input1['@context'] = saswp_context_url();
343
+ $input1['@type'] = 'JobPosting';
344
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#JobPosting';
345
+ $input1['title'] = saswp_get_the_title();
346
+ $input1['description'] = $data['job_description'] ? wp_strip_all_tags($data['job_description']) : saswp_get_the_excerpt();
347
+ $input1['datePosted'] = get_the_date("c");
348
+ $input1['validThrough'] = saswp_format_date_time($data['listing_expire_date']);
349
+ $input1['employmentType'] = $data['job_types'];
350
+
351
+ if(isset($data['location_address'])){
352
+
353
+ $input1['jobLocation']['@type'] = 'Place';
354
+ $input1['jobLocation']['address']['@type'] = 'PostalAddress';
355
+ $input1['jobLocation']['address']['streetAddress'] = $data['location_address'];
356
+ $input1['jobLocation']['address']['addressLocality'] = $data['location_city'];
357
+ $input1['jobLocation']['address']['postalCode'] = $data['location_postal_code'];
358
+ $input1['jobLocation']['address']['addressRegion'] = $data['location_state'];
359
+ $input1['jobLocation']['address']['addressCountry'] = $data['location_country'];
360
+
361
+ }
362
+ if(isset($data['base_salary'])){
363
+
364
+ $input1['baseSalary']['@type'] = 'MonetaryAmount';
365
+ $input1['baseSalary']['currency'] = $data['currency_code'];
366
+ $input1['baseSalary']['value']['@type'] = 'QuantitativeValue';
367
+ $input1['baseSalary']['value']['value'] = $data['base_salary'];
368
+ $input1['baseSalary']['value']['unitText'] = $data['unit_text'];
369
+ }
370
+
371
+ if(isset($data['company_name']) || isset($data['company_website'])){
372
+
373
+ $input1['hiringOrganization']['@type'] = 'Organization';
374
+ $input1['hiringOrganization']['name'] = $data['company_name'];
375
+ $input1['hiringOrganization']['description'] = $data['company_tagline'];
376
+ $input1['hiringOrganization']['logo'] = $data['company_logo_url'];
377
+ $input1['hiringOrganization']['sameAs'] = array(
378
+ $data['company_website'],
379
+ $data['company_twitter'],
380
+ $data['company_facebook']
381
+ );
382
+
383
+ }
384
+
385
+ if( !empty($input1) && !isset($input1['image'])){
386
+
387
+ $service_object = new saswp_output_service();
388
+ $input2 = $service_object->saswp_get_fetaure_image();
389
+
390
+ if(!empty($input2)){
391
+
392
+ $input1 = array_merge($input1,$input2);
393
+
394
+ }
395
+ }
396
+
397
+ }
398
+
399
+ return $input1;
400
+
401
+ }
402
+
403
+ function saswp_gutenberg_course_schema(){
404
+
405
+ $input1 = array();
406
+
407
+ $attributes = saswp_get_gutenberg_block_data('saswp/course-block');
408
+
409
+ if(isset($attributes['attrs'])){
410
+
411
+ $loop_markup = array();
412
+ $item_list = array();
413
+ $course_count = count($attributes['attrs']['courses']);
414
+ $i = 1;
415
+ foreach($attributes['attrs']['courses'] as $course){
416
+
417
+ $markup = array();
418
+
419
+ $markup['@context'] = saswp_context_url();
420
+ $markup['@type'] = 'Course';
421
+ $markup['url'] = ($course_count > 1 ? saswp_get_permalink().'#course_'.$i : saswp_get_permalink());
422
+ $markup['@id'] = trailingslashit(saswp_get_permalink()).'#Course';
423
+ $markup['name'] = $course['name'];
424
+ $markup['description'] = $course['description'];
425
+
426
+ $image = saswp_get_image_by_id($course['image_id']);
427
+
428
+ if($image){
429
+ $markup['image'] = $image;
430
+ }
431
+
432
+ $markup['provider']['@type'] = 'Organization';
433
+ $markup['provider']['name'] = $course['provider_name'];
434
+ $markup['provider']['sameAs'] = array($course['provider_website']);
435
+
436
+ $loop_markup[] = $markup;
437
+
438
+ unset($markup['@context'],$markup['@id']);
439
+
440
+ $item_list[] = array(
441
+ '@type' => 'ListItem',
442
+ 'position' => $i,
443
+ 'item' => $markup,
444
+ );
445
+
446
+ $i++;
447
+ }
448
+
449
+ if($course_count > 1){
450
+
451
+ $input1['@context'] = saswp_context_url();
452
+ $input1['@type'] = 'ItemList';
453
+ $input1['itemListElement'] = $item_list;
454
+
455
+ }else{
456
+ $input1 = $loop_markup[0];
457
+ }
458
+
459
+ }
460
+
461
+ return $input1;
462
+
463
+ }
output/markup.php CHANGED
@@ -64,6 +64,70 @@ function saswp_book_schema_markup($schema_id, $schema_post_id, $all_post_meta){
64
  return $input1;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
68
 
69
  $input1 = array();
@@ -75,10 +139,10 @@ function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
75
 
76
  $input1['@context'] = saswp_context_url();
77
  $input1['@type'] = 'HowTo';
78
- $input1['@id'] = trailingslashit(get_permalink()).'#HowTo';
79
  $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_name_'.$schema_id, 'saswp_array');
80
- $input1['datePublished'] = isset($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id][0])):'';
81
- $input1['dateModified'] = isset($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id][0])):'';
82
  $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_description_'.$schema_id, 'saswp_array');
83
 
84
  if(!(empty($howto_image))){
@@ -111,19 +175,14 @@ function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
111
  $supply_data['url'] = $val['saswp_howto_supply_url'];
112
  }
113
 
114
-
115
-
116
  if(isset($val['saswp_howto_supply_image_id']) && $val['saswp_howto_supply_image_id'] !=''){
117
 
118
- $image_details = wp_get_attachment_image_src($val['saswp_howto_supply_image_id']);
119
-
120
- $supply_data['image']['@type'] = 'ImageObject';
121
- $supply_data['image']['url'] = esc_url($image_details[0]);
122
- $supply_data['image']['width'] = esc_attr($image_details[1]);
123
- $supply_data['image']['height'] = esc_attr($image_details[2]);
124
-
125
-
126
 
 
 
 
 
127
  }
128
  $supply_arr[] = $supply_data;
129
  }
@@ -145,14 +204,11 @@ function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
145
 
146
  if(isset($val['saswp_howto_tool_image_id']) && $val['saswp_howto_tool_image_id'] !=''){
147
 
148
- $image_details = wp_get_attachment_image_src($val['saswp_howto_tool_image_id']);
149
-
150
- $supply_data['image']['@type'] = 'ImageObject';
151
- $supply_data['image']['url'] = esc_url($image_details[0]);
152
- $supply_data['image']['width'] = esc_attr($image_details[1]);
153
- $supply_data['image']['height'] = esc_attr($image_details[2]);
154
-
155
-
156
 
157
  }
158
  $tool_arr[] = $supply_data;
@@ -193,12 +249,12 @@ function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
193
 
194
  if(isset($val['saswp_howto_step_image_id']) && $val['saswp_howto_step_image_id'] !=''){
195
 
196
- $image_details = wp_get_attachment_image_src($val['saswp_howto_step_image_id']);
197
- $supply_data['image']['@type'] = 'ImageObject';
198
- $supply_data['image']['url'] = esc_url($image_details[0]);
199
- $supply_data['image']['width'] = esc_attr($image_details[1]);
200
- $supply_data['image']['height'] = esc_attr($image_details[2]);
201
-
202
  }
203
 
204
  $step_arr[] = $supply_data;
@@ -321,8 +377,8 @@ function saswp_course_schema_markup($schema_id, $schema_post_id, $all_post_meta)
321
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
322
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
323
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
324
- 'datePublished' => isset($all_post_meta['saswp_course_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_course_date_published_'.$schema_id][0])):'',
325
- 'dateModified' => isset($all_post_meta['saswp_course_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_course_date_modified_'.$schema_id][0])):'',
326
  'provider' => array(
327
  '@type' => 'Organization',
328
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
@@ -352,8 +408,8 @@ function saswp_software_app_schema_markup($schema_id, $schema_post_id, $all_post
352
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
353
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
354
  ),
355
- 'datePublished' => isset($all_post_meta['saswp_software_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_software_schema_date_published_'.$schema_id][0])):'',
356
- 'dateModified' => isset($all_post_meta['saswp_software_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_software_schema_date_modified_'.$schema_id][0])):'',
357
 
358
  );
359
 
@@ -394,40 +450,21 @@ function saswp_recipe_schema_markup($schema_id, $schema_post_id, $all_post_meta)
394
  $instruction = array();
395
 
396
  if(isset($all_post_meta['saswp_recipe_ingredient_'.$schema_id])){
397
-
398
- $explod = explode(';', $all_post_meta['saswp_recipe_ingredient_'.$schema_id][0]);
399
-
400
- if($explod){
401
-
402
- foreach ($explod as $val){
403
-
404
- $ingredient[] = $val;
405
-
406
- }
407
-
408
- }
409
-
410
-
411
-
412
  }
413
 
414
  if(isset($all_post_meta['saswp_recipe_instructions_'.$schema_id])){
415
 
416
- $explod = explode(';', $all_post_meta['saswp_recipe_instructions_'.$schema_id][0]);
417
-
418
- if($explod){
419
-
420
- foreach ($explod as $val){
421
 
422
  $instruction[] = array(
423
  '@type' => "HowToStep",
424
  'text' => $val,
425
  );
426
 
427
- }
428
-
429
- }
430
-
431
  }
432
 
433
  $input1 = array(
@@ -776,6 +813,45 @@ function saswp_local_business_schema_markup($schema_id, $schema_post_id, $all_po
776
  return $input1;
777
  }
778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  function saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta){
780
 
781
  $input1 = array();
@@ -866,6 +942,62 @@ function saswp_music_playlist_schema_markup($schema_id, $schema_post_id, $all_po
866
  return $input1;
867
  }
868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869
  function saswp_person_schema_markup($schema_id, $schema_post_id, $all_post_meta){
870
 
871
  $input1 = array();
@@ -1759,8 +1891,8 @@ function saswp_blogposting_schema_markup($schema_id, $schema_post_id, $all_post_
1759
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_keywords_'.$schema_id, 'saswp_array'),
1760
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1761
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1762
- 'datePublished' => isset($all_post_meta['saswp_blogposting_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_blogposting_date_published_'.$schema_id][0])):'',
1763
- 'dateModified' => isset($all_post_meta['saswp_blogposting_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_blogposting_date_modified_'.$schema_id][0])):'',
1764
  'author' => array(
1765
  '@type' => 'Person',
1766
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array'),
@@ -1773,7 +1905,7 @@ function saswp_blogposting_schema_markup($schema_id, $schema_post_id, $all_post_
1773
  '@type' => 'ImageObject',
1774
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_logo_'.$schema_id, 'saswp_array'),
1775
  'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
1776
- 'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
1777
  ),
1778
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
1779
  ),
@@ -1831,8 +1963,8 @@ function saswp_audio_object_schema_markup($schema_id, $schema_post_id, $all_post
1831
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1832
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1833
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1834
- 'datePublished' => isset($all_post_meta['saswp_audio_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_audio_schema_date_published_'.$schema_id][0])):'',
1835
- 'dateModified' => isset($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id][0])):'',
1836
  'author' => array(
1837
  '@type' => 'Person',
1838
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array'),
@@ -1866,8 +1998,8 @@ function saswp_webpage_schema_markup($schema_id, $schema_post_id, $all_post_meta
1866
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1867
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1868
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_keywords_'.$schema_id, 'saswp_array'),
1869
- 'datePublished' => isset($all_post_meta['saswp_webpage_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_webpage_date_published_'.$schema_id][0])):'',
1870
- 'dateModified' => isset($all_post_meta['saswp_webpage_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_webpage_date_modified_'.$schema_id][0])):'',
1871
  'author' => array(
1872
  '@type' => 'Person',
1873
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'),
@@ -1906,7 +2038,7 @@ function saswp_webpage_schema_markup($schema_id, $schema_post_id, $all_post_meta
1906
 
1907
  function saswp_article_schema_markup($schema_id, $schema_post_id, $all_post_meta){
1908
 
1909
- $input1 = array();
1910
 
1911
  $slogo = get_post_meta( get_the_ID(), 'saswp_article_organization_logo_'.$schema_id.'_detail',true);
1912
 
@@ -1919,9 +2051,9 @@ function saswp_article_schema_markup($schema_id, $schema_post_id, $all_post_meta
1919
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
1920
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
1921
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
1922
- 'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_article_keywords_'.$schema_id, 'saswp_array'),
1923
- 'datePublished' => isset($all_post_meta['saswp_article_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_article_date_published_'.$schema_id][0])):'',
1924
- 'dateModified' => isset($all_post_meta['saswp_article_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_article_date_modified_'.$schema_id][0])):'',
1925
  'author' => array(
1926
  '@type' => 'Person',
1927
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array'),
@@ -1988,8 +2120,8 @@ function saswp_tech_article_schema_markup($schema_id, $schema_post_id, $all_post
1988
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
1989
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
1990
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_keywords_'.$schema_id, 'saswp_array'),
1991
- 'datePublished' => isset($all_post_meta['saswp_tech_article_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_tech_article_date_published_'.$schema_id][0])):'',
1992
- 'dateModified' => isset($all_post_meta['saswp_tech_article_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_tech_article_date_modified_'.$schema_id][0])):'',
1993
  'author' => array(
1994
  '@type' => 'Person',
1995
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array'),
@@ -2055,8 +2187,8 @@ function saswp_news_article_schema_markup($schema_id, $schema_post_id, $all_post
2055
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
2056
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_image_'.$schema_id, 'saswp_array'),
2057
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
2058
- 'datePublished' => isset($all_post_meta['saswp_newsarticle_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_newsarticle_date_published_'.$schema_id][0])):'',
2059
- 'dateModified' => isset($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id][0])):'',
2060
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
2061
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_keywords_'.$schema_id, 'saswp_array'),
2062
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
@@ -2138,8 +2270,8 @@ function saswp_video_object_schema_markup($schema_id, $schema_post_id, $all_post
2138
  '@id' => trailingslashit(get_permalink()).'#videoobject',
2139
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2140
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2141
- 'datePublished' => isset($all_post_meta['saswp_video_object_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_date_published_'.$schema_id][0])):'',
2142
- 'dateModified' => isset($all_post_meta['saswp_video_object_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_date_modified_'.$schema_id][0])):'',
2143
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2144
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2145
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
@@ -2191,8 +2323,8 @@ function saswp_image_object_schema_markup($schema_id, $schema_post_id, $all_post
2191
  '@type' => 'ImageObject',
2192
  '@id' => trailingslashit(get_permalink()).'#imageobject',
2193
  'url' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_url_'.$schema_id, 'saswp_array'),
2194
- 'datePublished' => isset($all_post_meta['saswpimage_object_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswpimage_object_date_published_'.$schema_id][0])):'',
2195
- 'dateModified' => isset($all_post_meta['saswpimage_object_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswpimage_object_date_modified_'.$schema_id][0])):'',
2196
  'description' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_description_'.$schema_id, 'saswp_array'),
2197
  'name' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_name_'.$schema_id, 'saswp_array'),
2198
  'uploadDate' => isset($all_post_meta['saswpimage_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswpimage_object_upload_date_'.$schema_id][0])):'',
@@ -2318,7 +2450,7 @@ function saswp_review_schema_markup($schema_id, $schema_post_id, $all_post_meta)
2318
  $input1['@id'] = trailingslashit(get_permalink()).'#review';
2319
  $input1['name'] = $all_post_meta['saswp_review_name_'.$schema_id][0];
2320
  $input1['url'] = $all_post_meta['saswp_review_url_'.$schema_id][0];
2321
- $input1['datePublished'] = isset($all_post_meta['saswp_review_date_published_'.$schema_id][0])&& $all_post_meta['saswp_review_date_published_'.$schema_id][0] !='' ? date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_review_date_published_'.$schema_id][0])):'';
2322
 
2323
  if(isset($all_post_meta['saswp_review_publisher_'.$schema_id][0])){
2324
  $input1['publisher']['@type'] = 'Organization';
@@ -2410,6 +2542,18 @@ function saswp_review_schema_markup($schema_id, $schema_post_id, $all_post_meta)
2410
  $item_schema = saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2411
 
2412
  break;
 
 
 
 
 
 
 
 
 
 
 
 
2413
 
2414
  default:
2415
  break;
64
  return $input1;
65
  }
66
 
67
+ function saswp_movie_schema_markup($schema_id, $schema_post_id, $all_post_meta){
68
+
69
+ $input1 = array();
70
+
71
+ $howto_image = get_post_meta($schema_post_id, 'saswp_movie_image_'.$schema_id.'_detail',true);
72
+
73
+ $tool = get_post_meta($schema_post_id, 'movie_actor_'.$schema_id, true);
74
+
75
+ $input1['@context'] = saswp_context_url();
76
+ $input1['@type'] = 'Movie';
77
+ $input1['@id'] = ((isset($all_post_meta['saswp_howto_schema_id_'.$schema_id][0]) && $all_post_meta['saswp_howto_schema_id_'.$schema_id][0] !='') ? $all_post_meta['saswp_howto_schema_id_'.$schema_id][0] : trailingslashit(get_permalink()).'#Movie');
78
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_movie_name_'.$schema_id, 'saswp_array');
79
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_movie_url_'.$schema_id, 'saswp_array');
80
+ $input1['sameAs'] = saswp_remove_warnings($all_post_meta, 'saswp_movie_url_'.$schema_id, 'saswp_array');
81
+ $input1['dateCreated'] = isset($all_post_meta['saswp_movie_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_movie_date_created_'.$schema_id][0])):'';
82
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_movie_description_'.$schema_id, 'saswp_array');
83
+
84
+ if(!(empty($howto_image))){
85
+
86
+ $input1['image']['@type'] = 'ImageObject';
87
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
88
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
89
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
90
+
91
+ }
92
+
93
+ if(isset($all_post_meta['saswp_movie_director_'.$schema_id][0])){
94
+
95
+ $input1['director']['@type'] = 'Person';
96
+ $input1['director']['name'] = $all_post_meta['saswp_movie_director_'.$schema_id][0];
97
+
98
+ }
99
+
100
+ if(saswp_remove_warnings($all_post_meta, 'saswp_movie_enable_rating_'.$schema_id, 'saswp_array') == 1 && saswp_remove_warnings($all_post_meta, 'saswp_movie_rating_value_'.$schema_id, 'saswp_array') && saswp_remove_warnings($all_post_meta, 'saswp_movie_rating_count_'.$schema_id, 'saswp_array')){
101
+
102
+ $input1['aggregateRating'] = array(
103
+ "@type" => "AggregateRating",
104
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_movie_rating_value_'.$schema_id, 'saswp_array'),
105
+ "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_movie_rating_count_'.$schema_id, 'saswp_array')
106
+ );
107
+ }
108
+
109
+ $supply_arr = array();
110
+
111
+ if(!empty($tool)){
112
+
113
+ foreach($tool as $val){
114
+
115
+ $supply_data = array();
116
+
117
+ if($val['saswp_movie_actor_name']){
118
+ $supply_data['@type'] = 'Person';
119
+ $supply_data['name'] = $val['saswp_movie_actor_name'];
120
+ $supply_data['url'] = $val['saswp_movie_actor_url'];
121
+ }
122
+
123
+ $supply_arr[] = $supply_data;
124
+ }
125
+ $input1['actor'] = $supply_arr;
126
+ }
127
+
128
+ return $input1;
129
+ }
130
+
131
  function saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta){
132
 
133
  $input1 = array();
139
 
140
  $input1['@context'] = saswp_context_url();
141
  $input1['@type'] = 'HowTo';
142
+ $input1['@id'] = ((isset($all_post_meta['saswp_howto_schema_id_'.$schema_id][0]) && $all_post_meta['saswp_howto_schema_id_'.$schema_id][0] !='') ? $all_post_meta['saswp_howto_schema_id_'.$schema_id][0] : trailingslashit(get_permalink()).'#HowTo');
143
  $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_name_'.$schema_id, 'saswp_array');
144
+ $input1['datePublished'] = isset($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id][0], get_post_time('h:i:s')) : '';
145
+ $input1['dateModified'] = isset($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) : '';
146
  $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_description_'.$schema_id, 'saswp_array');
147
 
148
  if(!(empty($howto_image))){
175
  $supply_data['url'] = $val['saswp_howto_supply_url'];
176
  }
177
 
 
 
178
  if(isset($val['saswp_howto_supply_image_id']) && $val['saswp_howto_supply_image_id'] !=''){
179
 
180
+ $image_details = saswp_get_image_by_id($val['saswp_howto_supply_image_id']);
 
 
 
 
 
 
 
181
 
182
+ if($image_details){
183
+ $supply_data['image'] = $image_details;
184
+ }
185
+
186
  }
187
  $supply_arr[] = $supply_data;
188
  }
204
 
205
  if(isset($val['saswp_howto_tool_image_id']) && $val['saswp_howto_tool_image_id'] !=''){
206
 
207
+ $image_details = saswp_get_image_by_id($val['saswp_howto_tool_image_id']);
208
+
209
+ if($image_details){
210
+ $supply_data['image'] = $image_details;
211
+ }
 
 
 
212
 
213
  }
214
  $tool_arr[] = $supply_data;
249
 
250
  if(isset($val['saswp_howto_step_image_id']) && $val['saswp_howto_step_image_id'] !=''){
251
 
252
+ $image_details = saswp_get_image_by_id($val['saswp_howto_step_image_id']);
253
+
254
+ if($image_details){
255
+ $supply_data['image'] = $image_details;
256
+ }
257
+
258
  }
259
 
260
  $step_arr[] = $supply_data;
377
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
378
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
379
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
380
+ 'datePublished' => isset($all_post_meta['saswp_course_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_course_date_published_'.$schema_id][0], get_post_time('h:i:s')) : '',
381
+ 'dateModified' => isset($all_post_meta['saswp_course_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_course_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) : '',
382
  'provider' => array(
383
  '@type' => 'Organization',
384
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
408
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
409
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
410
  ),
411
+ 'datePublished' => isset($all_post_meta['saswp_software_schema_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_software_schema_date_published_'.$schema_id][0], get_post_time('h:i:s')) : '',
412
+ 'dateModified' => isset($all_post_meta['saswp_software_schema_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_software_schema_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) : '',
413
 
414
  );
415
 
450
  $instruction = array();
451
 
452
  if(isset($all_post_meta['saswp_recipe_ingredient_'.$schema_id])){
453
+ $ingredient = saswp_explod_by_semicolon($all_post_meta['saswp_recipe_ingredient_'.$schema_id][0]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  }
455
 
456
  if(isset($all_post_meta['saswp_recipe_instructions_'.$schema_id])){
457
 
458
+ $explod = saswp_explod_by_semicolon($all_post_meta['saswp_recipe_instructions_'.$schema_id][0]);
459
+
460
+ foreach ($explod as $val){
 
 
461
 
462
  $instruction[] = array(
463
  '@type' => "HowToStep",
464
  'text' => $val,
465
  );
466
 
467
+ }
 
 
 
468
  }
469
 
470
  $input1 = array(
813
  return $input1;
814
  }
815
 
816
+ function saswp_organization_schema_markup($schema_id, $schema_post_id, $all_post_meta){
817
+
818
+ $input1 = array();
819
+
820
+ $input1['@context'] = saswp_context_url();
821
+ $input1['@type'] = 'Organization';
822
+ $input1['@id'] = trailingslashit(get_permalink()).'#Organization';
823
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_name_'.$schema_id, 'saswp_array');
824
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_url_'.$schema_id, 'saswp_array');
825
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_description_'.$schema_id, 'saswp_array');
826
+
827
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_organization_logo_'.$schema_id.'_detail',true);
828
+
829
+ if(!(empty($howto_image))){
830
+
831
+ $input1['logo']['@type'] = 'ImageObject';
832
+ $input1['logo']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
833
+ $input1['logo']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
834
+ $input1['logo']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
835
+
836
+ }
837
+
838
+ $input1['address']['@type'] = 'PostalAddress';
839
+ $input1['address']['streetAddress'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_street_address_'.$schema_id, 'saswp_array');
840
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_country_'.$schema_id, 'saswp_array');
841
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_city_'.$schema_id, 'saswp_array');
842
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_state_'.$schema_id, 'saswp_array');
843
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_postal_code_'.$schema_id, 'saswp_array');
844
+ $input1['telephone'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_telephone_'.$schema_id, 'saswp_array');
845
+
846
+ if(isset($all_post_meta['saswp_organization_enable_rating_'.$schema_id]) && isset($all_post_meta['saswp_organization_rating_value_'.$schema_id]) && isset($all_post_meta['saswp_organization_rating_count_'.$schema_id])){
847
+ $input1['aggregateRating']['@type'] = 'aggregateRating';
848
+ $input1['aggregateRating']['ratingValue'] = $all_post_meta['saswp_organization_rating_value_'.$schema_id];
849
+ $input1['aggregateRating']['ratingCount'] = $all_post_meta['saswp_organization_rating_count_'.$schema_id];
850
+ }
851
+
852
+ return $input1;
853
+ }
854
+
855
  function saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta){
856
 
857
  $input1 = array();
942
  return $input1;
943
  }
944
 
945
+ function saswp_music_composition_schema_markup($schema_id, $schema_post_id, $all_post_meta){
946
+
947
+ $input1 = array();
948
+
949
+ $input1['@context'] = saswp_context_url();
950
+ $input1['@type'] = 'MusicComposition';
951
+ $input1['@id'] = trailingslashit(get_permalink()).'#MusicComposition';
952
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_music_composition_url_'.$schema_id, 'saswp_array');
953
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_music_composition_name_'.$schema_id, 'saswp_array');
954
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_music_composition_description_'.$schema_id, 'saswp_array');
955
+ $input1['iswcCode'] = saswp_remove_warnings($all_post_meta, 'saswp_music_composition_iswccode_'.$schema_id, 'saswp_array');
956
+ $input1['inLanguage'] = saswp_remove_warnings($all_post_meta, 'saswp_music_composition_inlanguage_'.$schema_id, 'saswp_array');
957
+ $input1['datePublished'] = isset($all_post_meta['saswp_music_composition_date_published_'.$schema_id][0])&& $all_post_meta['saswp_music_composition_date_published_'.$schema_id][0] !='' ? date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_music_composition_date_published_'.$schema_id][0])):'';
958
+
959
+ if(isset($all_post_meta['saswp_music_composition_lyrics_'.$schema_id][0])){
960
+ $input1['lyrics']['@type'] = 'CreativeWork';
961
+ $input1['lyrics']['text'] = $all_post_meta['saswp_music_composition_lyrics_'.$schema_id][0];
962
+ }
963
+
964
+ if(isset($all_post_meta['saswp_music_composition_publisher_'.$schema_id][0])){
965
+ $input1['publisher']['@type'] = 'Organization';
966
+ $input1['publisher']['name'] = $all_post_meta['saswp_music_composition_publisher_'.$schema_id][0];
967
+ }
968
+
969
+ $image = get_post_meta( get_the_ID(), 'saswp_music_composition_image_'.$schema_id.'_detail',true);
970
+
971
+ if(!(empty($image))){
972
+
973
+ $input1['image']['@type'] = 'ImageObject';
974
+ $input1['image']['url'] = isset($image['thumbnail']) ? esc_url($image['thumbnail']):'';
975
+ $input1['image']['height'] = isset($image['width']) ? esc_attr($image['width']) :'';
976
+ $input1['image']['width'] = isset($image['height']) ? esc_attr($image['height']) :'';
977
+
978
+ }
979
+
980
+ $faq_question = get_post_meta($schema_post_id, 'music_composer_'.$schema_id, true);
981
+
982
+ $faq_question_arr = array();
983
+
984
+ if(!empty($faq_question)){
985
+
986
+ foreach($faq_question as $val){
987
+
988
+ $supply_data = array();
989
+ $supply_data['@type'] = 'Person';
990
+ $supply_data['name'] = $val['saswp_music_composition_composer_name'];
991
+ $supply_data['url'] = $val['saswp_music_composition_composer_url'];
992
+
993
+ $faq_question_arr[] = $supply_data;
994
+ }
995
+ $input1['composer'] = $faq_question_arr;
996
+ }
997
+
998
+ return $input1;
999
+ }
1000
+
1001
  function saswp_person_schema_markup($schema_id, $schema_post_id, $all_post_meta){
1002
 
1003
  $input1 = array();
1891
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_keywords_'.$schema_id, 'saswp_array'),
1892
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1893
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1894
+ 'datePublished' => isset($all_post_meta['saswp_blogposting_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_blogposting_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
1895
+ 'dateModified' => isset($all_post_meta['saswp_blogposting_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_blogposting_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
1896
  'author' => array(
1897
  '@type' => 'Person',
1898
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array'),
1905
  '@type' => 'ImageObject',
1906
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_logo_'.$schema_id, 'saswp_array'),
1907
  'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
1908
+ 'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
1909
  ),
1910
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
1911
  ),
1963
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1964
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1965
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1966
+ 'datePublished' => isset($all_post_meta['saswp_audio_schema_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_audio_schema_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
1967
+ 'dateModified' => isset($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
1968
  'author' => array(
1969
  '@type' => 'Person',
1970
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array'),
1998
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1999
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
2000
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_keywords_'.$schema_id, 'saswp_array'),
2001
+ 'datePublished' => isset($all_post_meta['saswp_webpage_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2002
+ 'dateModified' => isset($all_post_meta['saswp_webpage_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_webpage_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2003
  'author' => array(
2004
  '@type' => 'Person',
2005
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'),
2038
 
2039
  function saswp_article_schema_markup($schema_id, $schema_post_id, $all_post_meta){
2040
 
2041
+ $input1 = array();
2042
 
2043
  $slogo = get_post_meta( get_the_ID(), 'saswp_article_organization_logo_'.$schema_id.'_detail',true);
2044
 
2051
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
2052
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
2053
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
2054
+ 'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_article_keywords_'.$schema_id, 'saswp_array'),
2055
+ 'datePublished' => isset($all_post_meta['saswp_article_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_published_'.$schema_id][0], get_post_time('h:i:s')):'',
2056
+ 'dateModified' => isset($all_post_meta['saswp_article_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')):'',
2057
  'author' => array(
2058
  '@type' => 'Person',
2059
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array'),
2120
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
2121
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
2122
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_keywords_'.$schema_id, 'saswp_array'),
2123
+ 'datePublished' => isset($all_post_meta['saswp_tech_article_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_tech_article_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2124
+ 'dateModified' => isset($all_post_meta['saswp_tech_article_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_tech_article_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2125
  'author' => array(
2126
  '@type' => 'Person',
2127
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array'),
2187
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
2188
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_image_'.$schema_id, 'saswp_array'),
2189
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
2190
+ 'datePublished' => isset($all_post_meta['saswp_newsarticle_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_newsarticle_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2191
+ 'dateModified' => isset($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2192
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
2193
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_keywords_'.$schema_id, 'saswp_array'),
2194
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
2270
  '@id' => trailingslashit(get_permalink()).'#videoobject',
2271
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2272
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2273
+ 'datePublished' => isset($all_post_meta['saswp_video_object_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_published_'.$schema_id][0], get_post_time('h:i:s')) :'',
2274
+ 'dateModified' => isset($all_post_meta['saswp_video_object_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswp_video_object_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) :'',
2275
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2276
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2277
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2323
  '@type' => 'ImageObject',
2324
  '@id' => trailingslashit(get_permalink()).'#imageobject',
2325
  'url' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_url_'.$schema_id, 'saswp_array'),
2326
+ 'datePublished' => isset($all_post_meta['saswpimage_object_date_published_'.$schema_id])? saswp_format_date_time($all_post_meta['saswpimage_object_date_published_'.$schema_id][0], get_post_time('h:i:s')) : '',
2327
+ 'dateModified' => isset($all_post_meta['saswpimage_object_date_modified_'.$schema_id])? saswp_format_date_time($all_post_meta['saswpimage_object_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')) : '',
2328
  'description' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_description_'.$schema_id, 'saswp_array'),
2329
  'name' => saswp_remove_warnings($all_post_meta, 'saswpimage_object_name_'.$schema_id, 'saswp_array'),
2330
  'uploadDate' => isset($all_post_meta['saswpimage_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswpimage_object_upload_date_'.$schema_id][0])):'',
2450
  $input1['@id'] = trailingslashit(get_permalink()).'#review';
2451
  $input1['name'] = $all_post_meta['saswp_review_name_'.$schema_id][0];
2452
  $input1['url'] = $all_post_meta['saswp_review_url_'.$schema_id][0];
2453
+ $input1['datePublished'] = isset($all_post_meta['saswp_review_date_published_'.$schema_id][0])&& $all_post_meta['saswp_review_date_published_'.$schema_id][0] !='' ? saswp_format_date_time($all_post_meta['saswp_review_date_published_'.$schema_id][0], get_post_time('h:i:s')) : '';
2454
 
2455
  if(isset($all_post_meta['saswp_review_publisher_'.$schema_id][0])){
2456
  $input1['publisher']['@type'] = 'Organization';
2542
  $item_schema = saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2543
 
2544
  break;
2545
+
2546
+ case 'Organization':
2547
+
2548
+ $item_schema = saswp_organization_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2549
+
2550
+ break;
2551
+
2552
+ case 'Movie':
2553
+
2554
+ $item_schema = saswp_movie_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2555
+
2556
+ break;
2557
 
2558
  default:
2559
  break;
output/output.php CHANGED
@@ -144,8 +144,11 @@ function saswp_kb_schema_output() {
144
  $input = array(
145
  '@context' => saswp_context_url(),
146
  '@type' => esc_attr($sd_data['saswp_kb_type']),
 
147
  'name' => esc_attr($sd_data['sd-person-name']),
 
148
  'url' => esc_url($sd_data['sd-person-url']),
 
149
  'image' => array(
150
  '@type' => 'ImageObject',
151
  'url' => esc_url($image),
@@ -179,39 +182,38 @@ function saswp_schema_output() {
179
 
180
  foreach($Conditionals as $schemaConditionals){
181
 
182
- $schema_options = array();
183
-
184
- if(isset($schemaConditionals['schema_options'])){
185
- $schema_options = $schemaConditionals['schema_options'];
186
- }
187
-
188
- $schema_type = saswp_remove_warnings($schemaConditionals, 'schema_type', 'saswp_string');
189
- $schema_post_id = saswp_remove_warnings($schemaConditionals, 'post_id', 'saswp_string');
190
-
191
- $input1 = array();
192
- $logo = '';
193
- $height = '';
194
- $width = '';
195
- $site_name = get_bloginfo();
196
-
197
- $service_object = new saswp_output_service();
198
- $default_logo = $service_object->saswp_get_publisher(true);
199
- $publisher = $service_object->saswp_get_publisher();
200
-
201
- if(!empty($default_logo)){
202
-
203
- $logo = $default_logo['url'];
204
- $height = $default_logo['height'];
205
- $width = $default_logo['width'];
206
-
207
- }
208
-
209
- if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
210
- $site_name = $sd_data['sd_name'];
211
- }
212
 
213
- $image_id = get_post_thumbnail_id();
214
- $image_details = wp_get_attachment_image_src($image_id, 'full');
215
  $date = get_the_date("c");
216
  $modified_date = get_the_modified_date("c");
217
  $author_name = get_the_author();
@@ -326,6 +328,20 @@ function saswp_schema_output() {
326
 
327
  }
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  if( 'HowTo' === $schema_type){
330
 
331
  $input1['@context'] = saswp_context_url();
@@ -406,6 +422,22 @@ function saswp_schema_output() {
406
 
407
  }
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  if( 'Book' === $schema_type){
410
 
411
  $input1['@context'] = saswp_context_url();
@@ -593,6 +625,11 @@ function saswp_schema_output() {
593
  if( 'DiscussionForumPosting' === $schema_type){
594
 
595
  if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
 
 
 
 
 
596
  $input1 = array(
597
  '@context' => saswp_context_url(),
598
  '@type' => 'DiscussionForumPosting' ,
@@ -603,7 +640,7 @@ function saswp_schema_output() {
603
  "articleSection" => bbp_get_forum_title(),
604
  "articleBody" => saswp_get_the_content(),
605
  'url' => bbp_get_topic_permalink(),
606
- 'datePublished' => bbp_get_topic_post_date(),
607
  'dateModified' => esc_html($modified_date),
608
  'author' => saswp_get_author_details(),
609
  'interactionStatistic' => array(
@@ -742,11 +779,7 @@ function saswp_schema_output() {
742
  }
743
  if(!empty($extra_theme_review)){
744
  $input1 = array_merge($input1, $extra_theme_review);
745
- }
746
- if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
747
- $input1['comment'] = saswp_get_comments(get_the_ID());
748
- }
749
-
750
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
751
 
752
  $input1 = apply_filters('saswp_modify_event_schema_output', $input1 );
@@ -878,11 +911,7 @@ function saswp_schema_output() {
878
 
879
 
880
  }else{
881
-
882
- if(empty($image_details[0]) || $image_details[0] === NULL ){
883
- $image_details[0] = $sd_data['sd_logo']['url'];
884
- }
885
-
886
  $input1 = array(
887
  '@context' => saswp_context_url(),
888
  '@type' => $schema_type ,
@@ -949,7 +978,9 @@ function saswp_schema_output() {
949
  $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
950
  }
951
 
952
- if( 'NewsArticle' === $schema_type ){
 
 
953
 
954
  $category_detail = get_the_category(get_the_ID());//$post->ID
955
  $article_section = '';
@@ -1046,7 +1077,7 @@ function saswp_schema_output() {
1046
  $input1['@context'] = saswp_context_url();
1047
  $input1['@type'] = 'Review';
1048
  $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Review';
1049
- $input1['itemReviewed']['@type'] = $item_reviewed;
1050
 
1051
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
1052
 
@@ -1066,7 +1097,16 @@ function saswp_schema_output() {
1066
 
1067
  }
1068
  }
1069
-
 
 
 
 
 
 
 
 
 
1070
  if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 && (is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah') ){
1071
 
1072
  remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
@@ -1118,13 +1158,8 @@ function saswp_schema_output() {
1118
 
1119
  if( 'VideoObject' === $schema_type){
1120
 
1121
- if(empty($image_details[0]) || $image_details[0] === NULL ){
1122
-
1123
- if(isset($sd_data['sd_logo'])){
1124
- $image_details[0] = $sd_data['sd_logo']['url'];
1125
- }
1126
-
1127
- }
1128
  $description = saswp_get_the_excerpt();
1129
 
1130
  if(!$description){
@@ -1530,6 +1565,9 @@ function saswp_woocommerce_category_schema(){
1530
  $category_posts['position'] = $i;
1531
  $category_posts['item'] = $service->saswp_schema_markup_generator('Product');
1532
 
 
 
 
1533
  if(saswp_has_slash($current_url)){
1534
  $category_posts['item']['url'] = trailingslashit(saswp_get_category_link($term->term_id)). "#product_".$i;
1535
  }else{
@@ -1562,6 +1600,82 @@ function saswp_woocommerce_category_schema(){
1562
 
1563
  }
1564
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1565
  /**
1566
  * Function generates archive page schema markup in the form of CollectionPage schema type
1567
  * @global type $query_string
@@ -1598,18 +1712,10 @@ function saswp_archive_output(){
1598
  if ( $category_loop->have_posts() ):
1599
  while( $category_loop->have_posts() ): $category_loop->the_post();
1600
  $image_id = get_post_thumbnail_id();
 
 
1601
 
1602
- $archive_image = array();
1603
- $image_details = wp_get_attachment_image_src($image_id, 'full');
1604
-
1605
- if(!empty($image_details)){
1606
-
1607
- $archive_image['@type'] = 'ImageObject';
1608
- $archive_image['url'] = esc_url($image_details[0]);
1609
- $archive_image['width'] = esc_attr($image_details[1]);
1610
- $archive_image['height'] = esc_attr($image_details[2]);
1611
-
1612
- }else{
1613
 
1614
  if(isset($sd_data['sd_default_image'])){
1615
 
@@ -1903,221 +2009,4 @@ function saswp_site_navigation_output(){
1903
  }
1904
 
1905
  return apply_filters('saswp_modify_sitenavigation_output', $input);
1906
- }
1907
-
1908
- function saswp_gutenberg_how_to_schema(){
1909
-
1910
- global $post;
1911
- $input1 = array();
1912
-
1913
- if(function_exists('parse_blocks') && is_object($post)){
1914
-
1915
-
1916
- $blocks = parse_blocks($post->post_content);
1917
-
1918
- if($blocks){
1919
-
1920
- foreach ($blocks as $parse_blocks){
1921
-
1922
- if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/how-to-block'){
1923
-
1924
- $service_object = new saswp_output_service();
1925
- $feature_image = $service_object->saswp_get_fetaure_image();
1926
-
1927
- $input1['@context'] = saswp_context_url();
1928
- $input1['@type'] = 'HowTo';
1929
- $input1['@id'] = trailingslashit(get_permalink()).'#HowTo';
1930
- $input1['name'] = saswp_get_the_title();
1931
- $input1['datePublished'] = get_the_date("c");
1932
- $input1['dateModified'] = get_the_modified_date("c");
1933
-
1934
- if(!empty($feature_image)){
1935
-
1936
- $input1 = array_merge($input1, $feature_image);
1937
-
1938
- }
1939
-
1940
- if(array_key_exists('description', $parse_blocks['attrs'])){
1941
- $input1['description'] = $parse_blocks['attrs']['description'];
1942
- }
1943
-
1944
- $supply = array();
1945
- $supply_arr = array();
1946
-
1947
- if(array_key_exists('materials', $parse_blocks['attrs'])){
1948
- $supply = $parse_blocks['attrs']['materials'];
1949
- }
1950
-
1951
- if(!empty($supply)){
1952
-
1953
- foreach($supply as $val){
1954
-
1955
- $supply_data = array();
1956
-
1957
- if($val['name']){
1958
- $supply_data['@type'] = 'HowToSupply';
1959
- $supply_data['name'] = $val['name'];
1960
- }
1961
-
1962
- $supply_arr[] = $supply_data;
1963
- }
1964
- $input1['supply'] = $supply_arr;
1965
- }
1966
-
1967
- $tool = array();
1968
- $tool_arr = array();
1969
-
1970
- if(array_key_exists('tools', $parse_blocks['attrs'])){
1971
- $tool = $parse_blocks['attrs']['tools'];
1972
- }
1973
-
1974
- if(!empty($tool)){
1975
-
1976
- foreach($tool as $val){
1977
-
1978
- $supply_data = array();
1979
-
1980
- if($val['name']){
1981
- $supply_data['@type'] = 'HowToTool';
1982
- $supply_data['name'] = $val['name'];
1983
- }
1984
-
1985
- $tool_arr[] = $supply_data;
1986
- }
1987
- $input1['tool'] = $tool_arr;
1988
- }
1989
-
1990
- $step = array();
1991
- $step_arr = array();
1992
-
1993
- if(array_key_exists('items', $parse_blocks['attrs'])){
1994
- $step = $parse_blocks['attrs']['items'];
1995
- }
1996
- if(!empty($step)){
1997
-
1998
- foreach($step as $key => $val){
1999
-
2000
- $supply_data = array();
2001
- $direction = array();
2002
- $tip = array();
2003
-
2004
- if($val['title'] || $val['description']){
2005
-
2006
- if($val['title']){
2007
- $direction['@type'] = 'HowToDirection';
2008
- $direction['text'] = $val['title'];
2009
- }
2010
-
2011
- if($val['description']){
2012
-
2013
- $tip['@type'] = 'HowToTip';
2014
- $tip['text'] = $val['description'];
2015
-
2016
- }
2017
-
2018
- $supply_data['@type'] = 'HowToStep';
2019
- $supply_data['url'] = trailingslashit(get_permalink()).'#step'.++$key;
2020
- $supply_data['name'] = $val['title'];
2021
-
2022
- if(isset($direction['text']) || isset($tip['text'])){
2023
- $supply_data['itemListElement'] = array($direction, $tip);
2024
- }
2025
-
2026
- if(isset($val['imageId']) && $val['imageId'] !=''){
2027
-
2028
- $image_details = wp_get_attachment_image_src($val['imageId']);
2029
- $supply_data['image']['@type'] = 'ImageObject';
2030
- $supply_data['image']['url'] = esc_url($image_details[0]);
2031
- $supply_data['image']['width'] = esc_attr($image_details[1]);
2032
- $supply_data['image']['height'] = esc_attr($image_details[2]);
2033
-
2034
- }
2035
-
2036
- $step_arr[] = $supply_data;
2037
-
2038
- }
2039
-
2040
- }
2041
-
2042
- $input1['step'] = $step_arr;
2043
-
2044
- }
2045
-
2046
- if(isset($parse_blocks['attrs']['days']) || $parse_blocks['attrs']['hours'] || $parse_blocks['attrs']['minutes']){
2047
-
2048
- $input1['totalTime'] = 'P'.
2049
- ((isset($parse_blocks['attrs']['days']) && $parse_blocks['attrs']['days'] !='') ? esc_attr($parse_blocks['attrs']['days']).'DT':'').
2050
- ((isset($parse_blocks['attrs']['hours']) && $parse_blocks['attrs']['hours'] !='') ? esc_attr($parse_blocks['attrs']['hours']).'H':'').
2051
- ((isset($parse_blocks['attrs']['minutes']) && $parse_blocks['attrs']['minutes'] !='') ? esc_attr($parse_blocks['attrs']['minutes']).'M':'');
2052
-
2053
- }
2054
-
2055
- }
2056
-
2057
- }
2058
-
2059
- }
2060
-
2061
- }
2062
- return $input1;
2063
-
2064
- }
2065
-
2066
-
2067
- function saswp_gutenberg_faq_schema(){
2068
-
2069
- global $post;
2070
- $input1 = array();
2071
-
2072
- if(function_exists('parse_blocks') && is_object($post)){
2073
-
2074
- $blocks = parse_blocks($post->post_content);
2075
-
2076
- if($blocks){
2077
-
2078
- foreach ($blocks as $parse_blocks){
2079
-
2080
- if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/faq-block'){
2081
-
2082
- $input1['@context'] = saswp_context_url();
2083
- $input1['@type'] = 'FAQPage';
2084
- $input1['@id'] = trailingslashit(get_permalink()).'#FAQPage';
2085
-
2086
- $faq_question_arr = array();
2087
-
2088
- if(!empty($parse_blocks['attrs']['items'])){
2089
-
2090
- foreach($parse_blocks['attrs']['items'] as $val){
2091
-
2092
- $supply_data = array();
2093
- $supply_data['@type'] = 'Question';
2094
- $supply_data['name'] = $val['title'];
2095
- $supply_data['acceptedAnswer']['@type'] = 'Answer';
2096
- $supply_data['acceptedAnswer']['text'] = $val['description'];
2097
-
2098
- if(isset($val['imageId']) && $val['imageId'] !=''){
2099
-
2100
- $image_details = wp_get_attachment_image_src($val['imageId']);
2101
- $supply_data['image']['@type'] = 'ImageObject';
2102
- $supply_data['image']['url'] = esc_url($image_details[0]);
2103
- $supply_data['image']['width'] = esc_attr($image_details[1]);
2104
- $supply_data['image']['height'] = esc_attr($image_details[2]);
2105
-
2106
- }
2107
-
2108
- $faq_question_arr[] = $supply_data;
2109
- }
2110
- $input1['mainEntity'] = $faq_question_arr;
2111
- }
2112
-
2113
- }
2114
-
2115
- }
2116
-
2117
- }
2118
-
2119
- }
2120
-
2121
- return $input1;
2122
-
2123
- }
144
  $input = array(
145
  '@context' => saswp_context_url(),
146
  '@type' => esc_attr($sd_data['saswp_kb_type']),
147
+ '@id' => $site_url.'#Person',
148
  'name' => esc_attr($sd_data['sd-person-name']),
149
+ 'jobTitle' => esc_attr($sd_data['sd-person-job-title']),
150
  'url' => esc_url($sd_data['sd-person-url']),
151
+ 'sameAs' => isset($sd_data['saswp_social_links']) ? $sd_data['saswp_social_links'] : array(),
152
  'image' => array(
153
  '@type' => 'ImageObject',
154
  'url' => esc_url($image),
182
 
183
  foreach($Conditionals as $schemaConditionals){
184
 
185
+ $schema_options = array();
186
+
187
+ if(isset($schemaConditionals['schema_options'])){
188
+ $schema_options = $schemaConditionals['schema_options'];
189
+ }
190
+
191
+ $schema_type = saswp_remove_warnings($schemaConditionals, 'schema_type', 'saswp_string');
192
+ $schema_post_id = saswp_remove_warnings($schemaConditionals, 'post_id', 'saswp_string');
193
+
194
+ $input1 = array();
195
+ $logo = '';
196
+ $height = '';
197
+ $width = '';
198
+ $site_name = get_bloginfo();
199
+
200
+ $service_object = new saswp_output_service();
201
+ $default_logo = $service_object->saswp_get_publisher(true);
202
+ $publisher = $service_object->saswp_get_publisher();
203
+
204
+ if(!empty($default_logo)){
205
+
206
+ $logo = $default_logo['url'];
207
+ $height = $default_logo['height'];
208
+ $width = $default_logo['width'];
209
+
210
+ }
211
+
212
+ if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
213
+ $site_name = $sd_data['sd_name'];
214
+ }
215
 
216
+ $image_id = get_post_thumbnail_id();
 
217
  $date = get_the_date("c");
218
  $modified_date = get_the_modified_date("c");
219
  $author_name = get_the_author();
328
 
329
  }
330
 
331
+ if( 'Movie' === $schema_type){
332
+
333
+ $input1['@context'] = saswp_context_url();
334
+ $input1['@type'] = 'Movie';
335
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Movie';
336
+
337
+ $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
338
+
339
+ $input1 = apply_filters('saswp_modify_movie_schema_output', $input1 );
340
+
341
+ $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
342
+
343
+ }
344
+
345
  if( 'HowTo' === $schema_type){
346
 
347
  $input1['@context'] = saswp_context_url();
422
 
423
  }
424
 
425
+ if( 'MusicComposition' === $schema_type){
426
+
427
+ $input1['@context'] = saswp_context_url();
428
+ $input1['@type'] = 'MusicComposition';
429
+ $input1['@id'] = trailingslashit(get_permalink()).'#MusicComposition';
430
+ $input1['inLanguage'] = get_bloginfo('language');
431
+ $input1['datePublished'] = esc_html($date);
432
+
433
+ $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
434
+
435
+ $input1 = apply_filters('saswp_modify_music_composition_schema_output', $input1 );
436
+
437
+ $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
438
+
439
+ }
440
+
441
  if( 'Book' === $schema_type){
442
 
443
  $input1['@context'] = saswp_context_url();
625
  if( 'DiscussionForumPosting' === $schema_type){
626
 
627
  if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
628
+
629
+
630
+ $bbp_date = get_post_time( get_option( 'date_format' ), get_the_ID(), true );
631
+ $bbp_time = get_post_time( get_option( 'time_format' ), get_the_ID(), true );
632
+
633
  $input1 = array(
634
  '@context' => saswp_context_url(),
635
  '@type' => 'DiscussionForumPosting' ,
640
  "articleSection" => bbp_get_forum_title(),
641
  "articleBody" => saswp_get_the_content(),
642
  'url' => bbp_get_topic_permalink(),
643
+ 'datePublished' => saswp_format_date_time($bbp_date, $bbp_time),
644
  'dateModified' => esc_html($modified_date),
645
  'author' => saswp_get_author_details(),
646
  'interactionStatistic' => array(
779
  }
780
  if(!empty($extra_theme_review)){
781
  $input1 = array_merge($input1, $extra_theme_review);
782
+ }
 
 
 
 
783
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
784
 
785
  $input1 = apply_filters('saswp_modify_event_schema_output', $input1 );
911
 
912
 
913
  }else{
914
+
 
 
 
 
915
  $input1 = array(
916
  '@context' => saswp_context_url(),
917
  '@type' => $schema_type ,
978
  $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
979
  }
980
 
981
+ if( 'NewsArticle' === $schema_type ){
982
+
983
+ $image_details = wp_get_attachment_image_src($image_id);
984
 
985
  $category_detail = get_the_category(get_the_ID());//$post->ID
986
  $article_section = '';
1077
  $input1['@context'] = saswp_context_url();
1078
  $input1['@type'] = 'Review';
1079
  $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Review';
1080
+ $input1['itemReviewed']['@type'] = $item_reviewed;
1081
 
1082
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
1083
 
1097
 
1098
  }
1099
  }
1100
+
1101
+ $added_reviews = saswp_append_fetched_reviews($input1, $schema_post_id);
1102
+
1103
+ if(isset($added_reviews['review'])){
1104
+
1105
+ $input1['itemReviewed']['review'] = $added_reviews['review'];
1106
+ $input1['itemReviewed']['aggregateRating'] = $added_reviews['aggregateRating'];
1107
+
1108
+ }
1109
+
1110
  if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 && (is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah') ){
1111
 
1112
  remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
1158
 
1159
  if( 'VideoObject' === $schema_type){
1160
 
1161
+ $image_details = wp_get_attachment_image_src($image_id);
1162
+
 
 
 
 
 
1163
  $description = saswp_get_the_excerpt();
1164
 
1165
  if(!$description){
1565
  $category_posts['position'] = $i;
1566
  $category_posts['item'] = $service->saswp_schema_markup_generator('Product');
1567
 
1568
+ $feature_image = $service->saswp_get_fetaure_image();
1569
+ $category_posts['item'] = array_merge( $category_posts['item'], $feature_image);
1570
+
1571
  if(saswp_has_slash($current_url)){
1572
  $category_posts['item']['url'] = trailingslashit(saswp_get_category_link($term->term_id)). "#product_".$i;
1573
  }else{
1600
 
1601
  }
1602
 
1603
+ function saswp_woocommerce_shop_page(){
1604
+
1605
+ $collection = array();
1606
+ $itemlist_arr = array();
1607
+
1608
+ if(function_exists('is_shop') && function_exists('woocommerce_get_loop_display_mode') && is_shop()){
1609
+
1610
+ $display_type = woocommerce_get_loop_display_mode();
1611
+ $parent_id = is_product_category() ? get_queried_object_id() : 0;
1612
+
1613
+ if($display_type == 'subcategories' || $display_type == 'both'){
1614
+
1615
+ $list = array();
1616
+
1617
+ $product_categories = woocommerce_get_product_subcategories( $parent_id );
1618
+
1619
+ if($product_categories){
1620
+
1621
+ foreach($product_categories as $cat){
1622
+
1623
+ $list[] = array(
1624
+ '@type' => 'ItemPage',
1625
+ 'url' => saswp_get_category_link($cat->term_id),
1626
+ );
1627
+
1628
+ }
1629
+
1630
+ }
1631
+
1632
+ if($list){
1633
+
1634
+ $collection['@context'] = saswp_context_url();
1635
+ $collection['@type'] = 'CollectionPage';
1636
+ $collection['mainEntity']['@type'] = 'ItemList';
1637
+ $collection['mainEntity']['itemListElement'] = $list;
1638
+
1639
+ }
1640
+
1641
+ }
1642
+
1643
+ if($display_type == 'products' || $display_type == 'both'){
1644
+
1645
+ $item_list = array();
1646
+
1647
+ woocommerce_product_loop_start();
1648
+ $i = 1;
1649
+ if ( have_posts() ) :
1650
+ while ( have_posts() ) :
1651
+ the_post();
1652
+
1653
+ $item_list[] = array(
1654
+ '@type' => 'ListItem',
1655
+ 'position' => $i,
1656
+ 'url' => get_the_permalink()
1657
+ );
1658
+ $i++;
1659
+ endwhile;
1660
+ endif;
1661
+
1662
+ woocommerce_product_loop_end();
1663
+
1664
+ if($item_list){
1665
+ $item_list_res['@context'] = saswp_context_url();
1666
+ $item_list_res['@type'] = 'ItemList';
1667
+ $item_list_res['itemListElement'] = $item_list;
1668
+ $itemlist_arr = $item_list_res;
1669
+ }
1670
+
1671
+ }
1672
+
1673
+ }
1674
+
1675
+ return array('itemlist' => $itemlist_arr, 'collection' => $collection);
1676
+
1677
+ }
1678
+
1679
  /**
1680
  * Function generates archive page schema markup in the form of CollectionPage schema type
1681
  * @global type $query_string
1712
  if ( $category_loop->have_posts() ):
1713
  while( $category_loop->have_posts() ): $category_loop->the_post();
1714
  $image_id = get_post_thumbnail_id();
1715
+
1716
+ $archive_image = saswp_get_image_by_id($image_id);
1717
 
1718
+ if(!empty($archive_image)){
 
 
 
 
 
 
 
 
 
 
1719
 
1720
  if(isset($sd_data['sd_default_image'])){
1721
 
2009
  }
2010
 
2011
  return apply_filters('saswp_modify_sitenavigation_output', $input);
2012
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
output/service.php CHANGED
@@ -252,7 +252,7 @@ Class saswp_output_service{
252
 
253
  case 'custom_field':
254
 
255
- $cus_field = get_post_meta($schema_post_id, 'saswp_custom_meta_field', true);
256
  $response = get_post_meta($post->ID, $cus_field[$key], true);
257
 
258
  break;
@@ -267,11 +267,7 @@ Class saswp_output_service{
267
 
268
  case 'featured_img':
269
  $image_id = get_post_thumbnail_id();
270
- $image_details = wp_get_attachment_image_src($image_id, 'full');
271
- $response['@type'] = 'ImageObject';
272
- $response['url'] = $image_details[0];
273
- $response['width'] = $image_details[1];
274
- $response['height'] = $image_details[2];
275
 
276
  break;
277
  case 'author_image':
@@ -313,8 +309,28 @@ Class saswp_output_service{
313
  }
314
 
315
  default:
 
 
 
316
 
317
- $response = get_post_meta($post->ID, $field, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
  break;
320
  }
@@ -447,8 +463,110 @@ Class saswp_output_service{
447
  if(isset($custom_fields['saswp_music_playlist_url'])){
448
  $input1['url'] = $custom_fields['saswp_music_playlist_url'];
449
  }
450
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
 
453
  case 'MusicAlbum':
454
 
@@ -522,8 +640,10 @@ Class saswp_output_service{
522
  }
523
  break;
524
 
525
- case 'HowTo':
526
-
 
 
527
  if(isset($custom_fields['saswp_howto_schema_name'])){
528
  $input1['name'] = $custom_fields['saswp_howto_schema_name'];
529
  }
@@ -1117,11 +1237,11 @@ Class saswp_output_service{
1117
  $input1['nutrition']['calories'] = $custom_fields['saswp_recipe_nutrition'];
1118
  }
1119
 
1120
- if(isset($custom_fields['saswp_recipe_ingredient'])){
1121
- $input1['recipeIngredient'] = $custom_fields['saswp_recipe_ingredient'];
1122
  }
1123
- if(isset($custom_fields['saswp_recipe_instructions'])){
1124
- $input1['recipeInstructions'] = $custom_fields['saswp_recipe_instructions'];
1125
  }
1126
  if(isset($custom_fields['saswp_recipe_video_name'])){
1127
  $input1['video']['name'] = $custom_fields['saswp_recipe_video_name'];
@@ -2900,37 +3020,35 @@ Class saswp_output_service{
2900
  global $post;
2901
  $input2 = array();
2902
  $image_id = get_post_thumbnail_id();
2903
- $image_details = wp_get_attachment_image_src($image_id, 'full');
2904
 
2905
  if( is_array($image_details) ){
2906
 
2907
  if(isset($image_details[1]) && ($image_details[1] < 1200) && function_exists('saswp_aq_resize')){
2908
-
 
 
 
2909
  $width = array(1200, 1200, 1200);
2910
- $height = array(1200, 900, 675);
2911
 
2912
  for($i = 0; $i<3; $i++){
2913
 
2914
  $resize_image = saswp_aq_resize( $image_details[0], $width[$i], $height[$i], true, false, true );
2915
 
2916
  if(isset($resize_image[0]) && isset($resize_image[1]) && isset($resize_image[2]) ){
2917
-
2918
-
2919
  $input2['image'][$i]['@type'] = 'ImageObject';
2920
 
2921
- if($i == 0){
2922
-
2923
- $input2['image'][$i]['@id'] = saswp_get_permalink().'#primaryimage';
2924
-
2925
  }
2926
 
2927
  $input2['image'][$i]['url'] = esc_url($resize_image[0]);
2928
  $input2['image'][$i]['width'] = esc_attr($resize_image[1]);
2929
  $input2['image'][$i]['height'] = esc_attr($resize_image[2]);
2930
 
2931
- }
2932
-
2933
-
2934
  }
2935
 
2936
  if(!empty($input2)){
@@ -2940,14 +3058,15 @@ Class saswp_output_service{
2940
  }
2941
 
2942
  }else{
2943
-
2944
- $size_array = array('full', 'large', 'medium', 'thumbnail');
 
2945
 
2946
- for($i =0; $i< count($size_array); $i++){
2947
 
2948
- $image_details = wp_get_attachment_image_src($image_id, $size_array[$i]);
2949
 
2950
- if(!empty($image_details)){
2951
 
2952
  $input2['image'][$i]['@type'] = 'ImageObject';
2953
 
@@ -2957,13 +3076,12 @@ Class saswp_output_service{
2957
 
2958
  }
2959
 
2960
- $input2['image'][$i]['url'] = esc_url($image_details[0]);
2961
- $input2['image'][$i]['width'] = esc_attr($image_details[1]);
2962
- $input2['image'][$i]['height'] = esc_attr($image_details[2]);
2963
 
2964
  }
2965
-
2966
-
2967
  }
2968
 
2969
  }
@@ -2977,8 +3095,7 @@ Class saswp_output_service{
2977
  $input2['image']['height'] = esc_attr($image_details[2]);
2978
 
2979
  }
2980
-
2981
-
2982
  }
2983
 
2984
  //Get All the images available on post
@@ -3068,8 +3185,7 @@ Class saswp_output_service{
3068
  $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
3069
 
3070
  }
3071
-
3072
-
3073
  }
3074
 
3075
  return $input2;
252
 
253
  case 'custom_field':
254
 
255
+ $cus_field = get_post_meta($schema_post_id, 'saswp_custom_meta_field', true);
256
  $response = get_post_meta($post->ID, $cus_field[$key], true);
257
 
258
  break;
267
 
268
  case 'featured_img':
269
  $image_id = get_post_thumbnail_id();
270
+ $response = saswp_get_image_by_id($image_id);
 
 
 
 
271
 
272
  break;
273
  case 'author_image':
309
  }
310
 
311
  default:
312
+ if(function_exists('get_field_object')){
313
+
314
+ $acf_obj = get_field_object($field);
315
 
316
+ if($acf_obj){
317
+
318
+ if($acf_obj['type'] == 'image'){
319
+
320
+ $image_id = get_post_meta($post->ID, $field, true );
321
+ $response = saswp_get_image_by_id($image_id);
322
+
323
+ }else{
324
+ $response = get_post_meta($post->ID, $field, true );
325
+ }
326
+
327
+ }else{
328
+ $response = get_post_meta($post->ID, $field, true );
329
+ }
330
+
331
+ }else{
332
+ $response = get_post_meta($post->ID, $field, true );
333
+ }
334
 
335
  break;
336
  }
463
  if(isset($custom_fields['saswp_music_playlist_url'])){
464
  $input1['url'] = $custom_fields['saswp_music_playlist_url'];
465
  }
466
+
467
+ break;
468
+
469
+ case 'Movie':
470
+
471
+ if(isset($custom_fields['saswp_movie_name'])){
472
+ $input1['name'] = $custom_fields['saswp_movie_name'];
473
+ }
474
+ if(isset($custom_fields['saswp_movie_description'])){
475
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_movie_description'] )) ;
476
+ }
477
+ if(isset($custom_fields['saswp_movie_url'])){
478
+ $input1['url'] = $custom_fields['saswp_movie_url'];
479
+ $input1['sameAs'] = $custom_fields['saswp_movie_url'];
480
+ }
481
+ if(isset($custom_fields['saswp_movie_image'])){
482
+ $input1['image'] = $custom_fields['saswp_movie_image'];
483
+ }
484
+ if(isset($custom_fields['saswp_movie_date_created'])){
485
+ $input1['dateCreated'] = $custom_fields['saswp_movie_date_created'];
486
+ }
487
+ if(isset($custom_fields['saswp_movie_director'])){
488
+ $input1['director']['@type'] = 'Person';
489
+ $input1['director']['name'] = $custom_fields['saswp_movie_director'];
490
+ }
491
+ if(isset($custom_fields['saswp_movie_rating_value']) && isset($custom_fields['saswp_movie_rating_count'])){
492
+ $input1['aggregateRating']['@type'] = 'aggregateRating';
493
+ $input1['aggregateRating']['ratingValue'] = $custom_fields['saswp_movie_rating_value'];
494
+ $input1['aggregateRating']['reviewCount'] = $custom_fields['saswp_movie_rating_count'];
495
+ }
496
+
497
+ break;
498
+
499
+ case 'MusicComposition':
500
+
501
+ if(isset($custom_fields['saswp_music_composition_name'])){
502
+ $input1['name'] = $custom_fields['saswp_music_composition_name'];
503
+ }
504
+ if(isset($custom_fields['saswp_music_composition_description'])){
505
+ $input1['description'] = wp_strip_all_tags(strip_shortcodes( $custom_fields['saswp_music_composition_description'] )) ;
506
+ }
507
+ if(isset($custom_fields['saswp_music_composition_url'])){
508
+ $input1['url'] = $custom_fields['saswp_music_composition_url'];
509
+ }
510
+ if(isset($custom_fields['saswp_music_composition_inlanguage'])){
511
+ $input1['inLanguage'] = $custom_fields['saswp_music_composition_inlanguage'];
512
+ }
513
+ if(isset($custom_fields['saswp_music_composition_iswccode'])){
514
+ $input1['iswcCode'] = $custom_fields['saswp_music_composition_iswccode'];
515
+ }
516
+ if(isset($custom_fields['saswp_music_composition_image'])){
517
+ $input1['image'] = $custom_fields['saswp_music_composition_image'];
518
+ }
519
+ if(isset($custom_fields['saswp_music_composition_lyrics'])){
520
+ $input1['lyrics']['@type'] = 'CreativeWork';
521
+ $input1['lyrics']['text'] = $custom_fields['saswp_music_composition_lyrics'];
522
+ }
523
+ if(isset($custom_fields['saswp_music_composition_publisher'])){
524
+ $input1['publisher']['@type'] = 'Organization';
525
+ $input1['publisher']['name'] = $custom_fields['saswp_music_composition_publisher'];
526
+ }
527
+
528
  break;
529
+ case 'Organization':
530
+
531
+ if(isset($custom_fields['saswp_organization_name'])){
532
+ $input1['name'] = $custom_fields['saswp_organization_name'];
533
+ }
534
+ if(isset($custom_fields['saswp_organization_description'])){
535
+ $input1['description'] = $custom_fields['saswp_organization_description'];
536
+ }
537
+ if(isset($custom_fields['saswp_organization_url'])){
538
+ $input1['url'] = $custom_fields['saswp_organization_url'];
539
+ }
540
+ if(isset($custom_fields['saswp_organization_street_address'])){
541
+ $input1['address']['streetAddress'] = $custom_fields['saswp_organization_street_address'];
542
+ }
543
+ if(isset($custom_fields['saswp_organization_city'])){
544
+ $input1['address']['addressLocality'] = $custom_fields['saswp_organization_city'];
545
+ }
546
+ if(isset($custom_fields['saswp_organization_state'])){
547
+ $input1['address']['addressRegion'] = $custom_fields['saswp_organization_state'];
548
+ }
549
+ if(isset($custom_fields['saswp_organization_country'])){
550
+ $input1['address']['addressCountry'] = $custom_fields['saswp_organization_country'];
551
+ }
552
+ if(isset($custom_fields['saswp_organization_postal_code'])){
553
+ $input1['address']['postalCode'] = $custom_fields['saswp_organization_postal_code'];
554
+ }
555
+ if(isset($custom_fields['saswp_organization_telephone'])){
556
+ $input1['address']['telephone'] = $custom_fields['saswp_organization_telephone'];
557
+ }
558
+ if(isset($custom_fields['saswp_organization_logo'])){
559
+ $input1['logo'] = $custom_fields['saswp_organization_logo'];
560
+ }
561
+ if(isset($custom_fields['saswp_organization_rating_value']) && isset($custom_fields['saswp_organization_rating_count'])){
562
+ $input1['aggregateRating']['@type'] = 'AggregateRating';
563
+ $input1['aggregateRating']['worstRating'] = 0;
564
+ $input1['aggregateRating']['bestRating'] = 5;
565
+ $input1['aggregateRating']['ratingValue'] = $custom_fields['saswp_organization_rating_value'];
566
+ $input1['aggregateRating']['ratingCount'] = $custom_fields['saswp_organization_rating_count'];
567
+ }
568
+
569
+ break;
570
 
571
  case 'MusicAlbum':
572
 
640
  }
641
  break;
642
 
643
+ case 'HowTo':
644
+ if(isset($custom_fields['saswp_howto_schema_id'])){
645
+ $input1['@id'] = $custom_fields['saswp_howto_schema_id'];
646
+ }
647
  if(isset($custom_fields['saswp_howto_schema_name'])){
648
  $input1['name'] = $custom_fields['saswp_howto_schema_name'];
649
  }
1237
  $input1['nutrition']['calories'] = $custom_fields['saswp_recipe_nutrition'];
1238
  }
1239
 
1240
+ if(isset($custom_fields['saswp_recipe_ingredient'])){
1241
+ $input1['recipeIngredient'] = saswp_explod_by_semicolon($custom_fields['saswp_recipe_ingredient']);
1242
  }
1243
+ if(isset($custom_fields['saswp_recipe_instructions'])){
1244
+ $input1['recipeInstructions'] = saswp_explod_by_semicolon($custom_fields['saswp_recipe_instructions']);
1245
  }
1246
  if(isset($custom_fields['saswp_recipe_video_name'])){
1247
  $input1['video']['name'] = $custom_fields['saswp_recipe_video_name'];
3020
  global $post;
3021
  $input2 = array();
3022
  $image_id = get_post_thumbnail_id();
3023
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
3024
 
3025
  if( is_array($image_details) ){
3026
 
3027
  if(isset($image_details[1]) && ($image_details[1] < 1200) && function_exists('saswp_aq_resize')){
3028
+
3029
+ $img_ratio = $image_details[1] / $image_details[2];
3030
+ $targetHeight = 1200 / $img_ratio;
3031
+
3032
  $width = array(1200, 1200, 1200);
3033
+ $height = array($targetHeight, 900, 675);
3034
 
3035
  for($i = 0; $i<3; $i++){
3036
 
3037
  $resize_image = saswp_aq_resize( $image_details[0], $width[$i], $height[$i], true, false, true );
3038
 
3039
  if(isset($resize_image[0]) && isset($resize_image[1]) && isset($resize_image[2]) ){
3040
+
 
3041
  $input2['image'][$i]['@type'] = 'ImageObject';
3042
 
3043
+ if($i == 0){
3044
+ $input2['image'][$i]['@id'] = saswp_get_permalink().'#primaryimage';
 
 
3045
  }
3046
 
3047
  $input2['image'][$i]['url'] = esc_url($resize_image[0]);
3048
  $input2['image'][$i]['width'] = esc_attr($resize_image[1]);
3049
  $input2['image'][$i]['height'] = esc_attr($resize_image[2]);
3050
 
3051
+ }
 
 
3052
  }
3053
 
3054
  if(!empty($input2)){
3058
  }
3059
 
3060
  }else{
3061
+
3062
+ $width = array($image_details[1], 1200, 1200);
3063
+ $height = array($image_details[2], 900, 675);
3064
 
3065
+ for($i = 0; $i<3; $i++){
3066
 
3067
+ $resize_image = saswp_aq_resize( $image_details[0], $width[$i], $height[$i], true, false, true );
3068
 
3069
+ if(isset($resize_image[0]) && isset($resize_image[1]) && isset($resize_image[2]) ){
3070
 
3071
  $input2['image'][$i]['@type'] = 'ImageObject';
3072
 
3076
 
3077
  }
3078
 
3079
+ $input2['image'][$i]['url'] = esc_url($resize_image[0]);
3080
+ $input2['image'][$i]['width'] = esc_attr($resize_image[1]);
3081
+ $input2['image'][$i]['height'] = esc_attr($resize_image[2]);
3082
 
3083
  }
3084
+
 
3085
  }
3086
 
3087
  }
3095
  $input2['image']['height'] = esc_attr($image_details[2]);
3096
 
3097
  }
3098
+
 
3099
  }
3100
 
3101
  //Get All the images available on post
3185
  $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
3186
 
3187
  }
3188
+
 
3189
  }
3190
 
3191
  return $input2;
output/single.php CHANGED
@@ -124,7 +124,14 @@ function saswp_post_specific_schema_output() {
124
 
125
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
126
 
127
- }
 
 
 
 
 
 
 
128
 
129
  if( 'MusicAlbum' === $schema_type){
130
 
@@ -201,14 +208,22 @@ function saswp_post_specific_schema_output() {
201
  $input1 = saswp_single_family_residence_schema_markup($schema_id, $schema_post_id, $all_post_meta);
202
 
203
  }
204
-
 
 
 
 
 
 
 
 
205
  if( 'HowTo' === $schema_type){
206
 
207
  $input1 = saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta);
208
 
209
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
210
 
211
- }
212
 
213
  if( 'TVSeries' === $schema_type){
214
 
@@ -560,8 +575,22 @@ function saswp_post_specific_schema_output() {
560
  }
561
 
562
  }
563
-
564
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  }
566
 
567
  if( !empty($input1) && !isset($input1['image'])){
124
 
125
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
126
 
127
+ }
128
+ if( 'MusicComposition' === $schema_type){
129
+
130
+ $input1 = saswp_music_composition_schema_markup($schema_id, $schema_post_id, $all_post_meta);
131
+
132
+ $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
133
+
134
+ }
135
 
136
  if( 'MusicAlbum' === $schema_type){
137
 
208
  $input1 = saswp_single_family_residence_schema_markup($schema_id, $schema_post_id, $all_post_meta);
209
 
210
  }
211
+
212
+ if( 'Movie' === $schema_type){
213
+
214
+ $input1 = saswp_movie_schema_markup($schema_id, $schema_post_id, $all_post_meta);
215
+
216
+ $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
217
+
218
+ }
219
+
220
  if( 'HowTo' === $schema_type){
221
 
222
  $input1 = saswp_howto_schema_markup($schema_id, $schema_post_id, $all_post_meta);
223
 
224
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
225
 
226
+ }
227
 
228
  if( 'TVSeries' === $schema_type){
229
 
575
  }
576
 
577
  }
578
+
579
+ // Testomonial Pro
580
+ $strong_testimonials = saswp_get_strong_testimonials();
581
+
582
+ if($strong_testimonials){
583
+
584
+ $input1 = array_merge($input1,$strong_testimonials['rating']);
585
+
586
+ if(isset($input1['review'])){
587
+ $input1 = array_merge($input1['review'],$strong_testimonials['reviews']);
588
+ }else{
589
+ $input1['review'] = $strong_testimonials['reviews'];
590
+ }
591
+
592
+ }
593
+
594
  }
595
 
596
  if( !empty($input1) && !isset($input1['image'])){
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: magazine3
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
- Stable tag: 1.9.19
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -118,6 +118,47 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  = 1.9.19 (18 Dec 2019) =
122
 
123
  * Fixed: Author URL is missing #665
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.3
6
+ Stable tag: 1.9.21
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
118
 
119
  == Changelog ==
120
 
121
+ = 1.9.21 (06 Jan 2020) =
122
+
123
+ * Added: Schema Blocks (Event, Job, Course, Review/Collection ) #436
124
+ * Added: Data tracking and deactivate question #12
125
+ * Added: MusicComposition schema type #688
126
+ * Added: Movie schema type #688
127
+ * Added: Movie as a Item Reviewed Type in Review schema #684
128
+ * Added: Support For Plugin AMP WP ( https://wordpress.org/plugins/amp-wp ) #674
129
+ * Added: Collection schema for shop page. #687
130
+ * Added: id property in HowTo Schema #677
131
+ * Added: Show time field in schema markup if user is using modify schema option #682
132
+ * Fixed: Custom schema option enhancement #701
133
+ * Fixed: Organization type entered in Knowledge Graph is not displayed same in the markup. #690
134
+ * Fixed: Review/Ratings problem in display. #693
135
+ * Fixed: Images are not displaying when user adding through the Advanced custom field. #705
136
+ * Fixed: DiscussionForumPosting is always 1970-01-01T00:00:00+00:00 when bbpress support is on #702
137
+ * Fixed: The “name” of _guest_ users is empty (registered users are OK) #706
138
+ * Fixed: When BBPress compatibility is on. Coment author name appears on front html multiple time #707
139
+ * Fixed: Conflict with NT Conversi Shortcodes plugin #704
140
+ * Fixed: #primaryimage size should be 1200*(maintain aspect ratio) size so that the image should display perfectly in rich result preview. #692
141
+ * Fixed: Article schema:- Website Markup is showing description meta of post and not of the website. #691
142
+
143
+
144
+ = 1.9.20 (27 Dec 2019) =
145
+
146
+ * Added: Role Based Access feature #631
147
+ * Added: comment property in DiscussionForumPosting schema type using bbPress compatiblity. #649
148
+ * Added: itemReviewed type organization in Review schema #662
149
+ * Added: Compatibility with Strong testimonials plugin #664
150
+ * Fixed: Change Internal Links to AMP Option is not working from SASWP v1.9.18 #686
151
+ * Fixed: Notice: is_amp_endpoint was called incorrectly. #681
152
+ * Fixed: By default there are 10 comments showing in markup need to set this as per users site. #668
153
+ * Fixed: Invalid schema output when using ACF fields with recipe ingredients #659
154
+ * Fixed: In Review schema if Item Reviewed Type selected then show Add Reviews checkbox #667
155
+ * Fixed: How to show reviews on the website shows 404 page not found. #676
156
+ * Fixed: Fatal error: called to undefined function "saswp_reviews_front_output" #685
157
+ * Fixed: If image size greater than 1200px, Image croping based on image ratio is not working correct #683
158
+ * Fixed: Form ( Which should not be displayed on amp) is being displayed when SASWP is active. #679
159
+ * Fixed: Wrong data type appears ( If data type is set as 'Person' then 'Organization' appears as data type on the Post when 'Defragment Schema Markup' is enabled) #636
160
+
161
+
162
  = 1.9.19 (18 Dec 2019) =
163
 
164
  * Fixed: Author URL is missing #665
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
- Version: 1.9.19
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.9.19');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
@@ -33,6 +33,7 @@ define('SASWP_ENVIRONMENT', 'production');
33
  require_once SASWP_DIR_NAME .'/output/function.php';
34
  require_once SASWP_DIR_NAME .'/output/output.php';
35
  require_once SASWP_DIR_NAME .'/output/markup.php';
 
36
  require_once SASWP_DIR_NAME .'/output/single.php';
37
 
38
  if ( ! function_exists( 'is_plugin_active' ) )
@@ -63,7 +64,11 @@ if ( ! function_exists('saswp_non_amp') ){
63
  if(function_exists('is_better_amp')){
64
 
65
  $non_amp = false;
66
- }
 
 
 
 
67
  return $non_amp;
68
 
69
  }
@@ -120,4 +125,22 @@ function saswp_add_plugin_meta_links($meta_fields, $file) {
120
 
121
  return $meta_fields;
122
 
123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
+ Version: 1.9.21
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.9.21');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
33
  require_once SASWP_DIR_NAME .'/output/function.php';
34
  require_once SASWP_DIR_NAME .'/output/output.php';
35
  require_once SASWP_DIR_NAME .'/output/markup.php';
36
+ require_once SASWP_DIR_NAME .'/output/gutenberg.php';
37
  require_once SASWP_DIR_NAME .'/output/single.php';
38
 
39
  if ( ! function_exists( 'is_plugin_active' ) )
64
  if(function_exists('is_better_amp')){
65
 
66
  $non_amp = false;
67
+ }
68
+ if(function_exists('is_amp_wp') && is_amp_wp()){
69
+ $non_amp = false;
70
+ }
71
+
72
  return $non_amp;
73
 
74
  }
125
 
126
  return $meta_fields;
127
 
128
+ }
129
+
130
+ if( ! class_exists( 'SASWP_Plugin_Usage_Tracker') ) {
131
+ require_once SASWP_DIR_NAME. '/admin_section/tracking/class-saswp-plugin-usage-tracker.php';
132
+ }
133
+ if( ! function_exists( 'saswp_start_plugin_tracking' ) ) {
134
+ function saswp_start_plugin_tracking() {
135
+ $settings = get_option( 'sd_data');
136
+ $wisdom = new SASWP_Plugin_Usage_Tracker(
137
+ __FILE__,
138
+ 'http://data.ampforwp.com/ssdw',
139
+ (array) $settings,
140
+ true,
141
+ true,
142
+ 0
143
+ );
144
+ }
145
+ saswp_start_plugin_tracking();
146
+ }
view/common.php CHANGED
@@ -207,17 +207,6 @@ class saswp_view_common_class {
207
 
208
  global $sd_data;
209
 
210
- $image_id = get_post_thumbnail_id();
211
- $image_details = wp_get_attachment_image_src($image_id, 'full');
212
-
213
- if(empty($image_details[0]) || $image_details[0] === NULL ){
214
-
215
- if(isset($sd_data['sd_logo']['url'])){
216
- $image_details[0] = $sd_data['sd_logo']['url'];
217
- }
218
-
219
- }
220
-
221
  $current_user = wp_get_current_user();
222
  $author_details = array();
223
 
207
 
208
  global $sd_data;
209
 
 
 
 
 
 
 
 
 
 
 
 
210
  $current_user = wp_get_current_user();
211
  $author_details = array();
212
 
view/post_specific.php CHANGED
@@ -171,7 +171,9 @@ class saswp_post_specific {
171
 
172
  foreach ( $this->screen as $single_screen ) {
173
 
174
- add_meta_box(
 
 
175
  'post_specific',
176
  esc_html__( 'Post Specific Schema', 'schema-and-structured-data-for-wp' ),
177
  array( $this, 'saswp_post_meta_box_callback' ),
@@ -179,7 +181,8 @@ class saswp_post_specific {
179
  'advanced',
180
  'default'
181
  );
182
-
 
183
  }
184
  }
185
 
@@ -311,10 +314,7 @@ class saswp_post_specific {
311
  $response_html .= '<textarea style="margin-left:5px;" placeholder="{ Json Markup }" id="saswp_custom_schema_field" name="saswp_custom_schema_field" rows="5" cols="100">'
312
  . $custom_markup
313
  . '</textarea>';
314
-
315
- if(json_decode($custom_markup) == false){
316
- $response_html .= '<p style="text-align:center;color:red;margin-top:0px;">'.esc_html__( 'Not a valid json', 'schema-and-structured-data-for-wp' ).'</p>';
317
- }
318
  $response_html .= '</div>';
319
  $response_html .= '</div>';
320
 
@@ -382,10 +382,7 @@ class saswp_post_specific {
382
  $response_html .= '<a class="button saswp-delete-custom-schema">'.esc_html__( 'Delete Custom Schema', 'schema-and-structured-data-for-wp' ).'</a>';
383
  $response_html .= '<textarea style="margin-left:5px;" placeholder="{ Json Markup }" id="saswp_custom_schema_field" name="saswp_custom_schema_field" rows="5" cols="100">'
384
  . $custom_markup
385
- . '</textarea>';
386
- if(json_decode($custom_markup) == false){
387
- $response_html .= '<p style="text-align:center;color:red;margin-top:0px;">'.esc_html__( 'Not a valid json', 'schema-and-structured-data-for-wp' ).'</p>';
388
- }
389
  $response_html .= '</div>';
390
  $response_html .= '</div>';
391
 
@@ -491,8 +488,10 @@ class saswp_post_specific {
491
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id;
492
  if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id;
493
 
494
- $option = get_option('modify_schema_post_enable_'.$post_id);
495
- $custom_schema = wp_unslash($_POST['saswp_custom_schema_field']);
 
 
496
  update_post_meta( $post_id, 'saswp_custom_schema_field', $custom_schema );
497
 
498
  if($option != 'enable'){
171
 
172
  foreach ( $this->screen as $single_screen ) {
173
 
174
+ if(saswp_current_user_allowed()){
175
+
176
+ add_meta_box(
177
  'post_specific',
178
  esc_html__( 'Post Specific Schema', 'schema-and-structured-data-for-wp' ),
179
  array( $this, 'saswp_post_meta_box_callback' ),
181
  'advanced',
182
  'default'
183
  );
184
+
185
+ }
186
  }
187
  }
188
 
314
  $response_html .= '<textarea style="margin-left:5px;" placeholder="{ Json Markup }" id="saswp_custom_schema_field" name="saswp_custom_schema_field" rows="5" cols="100">'
315
  . $custom_markup
316
  . '</textarea>';
317
+
 
 
 
318
  $response_html .= '</div>';
319
  $response_html .= '</div>';
320
 
382
  $response_html .= '<a class="button saswp-delete-custom-schema">'.esc_html__( 'Delete Custom Schema', 'schema-and-structured-data-for-wp' ).'</a>';
383
  $response_html .= '<textarea style="margin-left:5px;" placeholder="{ Json Markup }" id="saswp_custom_schema_field" name="saswp_custom_schema_field" rows="5" cols="100">'
384
  . $custom_markup
385
+ . '</textarea>';
 
 
 
386
  $response_html .= '</div>';
387
  $response_html .= '</div>';
388
 
488
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id;
489
  if ( ! current_user_can( 'edit_post', $post_id ) ) return $post_id;
490
 
491
+ $allowed_html = saswp_expanded_allowed_tags();
492
+
493
+ $option = get_option('modify_schema_post_enable_'.$post_id);
494
+ $custom_schema = wp_kses(wp_unslash($_POST['saswp_custom_schema_field']), $allowed_html);
495
  update_post_meta( $post_id, 'saswp_custom_schema_field', $custom_schema );
496
 
497
  if($option != 'enable'){
view/schema_type.php CHANGED
@@ -32,7 +32,7 @@ function saswp_add_all_meta_boxes() {
32
  esc_html__( 'Schema Type', 'schema-and-structured-data-for-wp' ),
33
  'saswp_schema_type_meta_box_callback',
34
  'saswp',
35
- 'advanced',
36
  'high'
37
  );
38
 
@@ -124,8 +124,7 @@ function saswp_schema_type_meta_box_callback( $post) {
124
  $style_review_name = '';
125
  $business_name = '';
126
  $schema_type = '';
127
- $business_type = '';
128
- $custom_logo_id = '';
129
  $speakable = '';
130
  $item_list_enable = '';
131
  $item_list_tags = '';
@@ -150,15 +149,7 @@ function saswp_schema_type_meta_box_callback( $post) {
150
  $item_list_custom = get_post_meta($post->ID, 'saswp_item_list_custom', true);
151
  $business_type = get_post_meta($post->ID, 'saswp_business_type', true);
152
  $business_name = get_post_meta($post->ID, 'saswp_business_name', true);
153
-
154
- $custom_logo_id = get_theme_mod( 'custom_logo' );
155
-
156
- if($custom_logo_id){
157
-
158
- $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
159
-
160
- }
161
-
162
  if($schema_type != 'local_business'){
163
 
164
  $style_business_type = 'style="display:none"';
@@ -172,7 +163,9 @@ function saswp_schema_type_meta_box_callback( $post) {
172
  'Event' => 'Event',
173
  'HowTo' => 'HowTo',
174
  'local_business' => 'LocalBusiness',
175
- 'MusicPlaylist' => 'Music Playlist',
 
 
176
  'Product' => 'Product',
177
  'Recipe' => 'Recipe',
178
  'SoftwareApplication' => 'SoftwareApplication',
32
  esc_html__( 'Schema Type', 'schema-and-structured-data-for-wp' ),
33
  'saswp_schema_type_meta_box_callback',
34
  'saswp',
35
+ 'normal',
36
  'high'
37
  );
38
 
124
  $style_review_name = '';
125
  $business_name = '';
126
  $schema_type = '';
127
+ $business_type = '';
 
128
  $speakable = '';
129
  $item_list_enable = '';
130
  $item_list_tags = '';
149
  $item_list_custom = get_post_meta($post->ID, 'saswp_item_list_custom', true);
150
  $business_type = get_post_meta($post->ID, 'saswp_business_type', true);
151
  $business_name = get_post_meta($post->ID, 'saswp_business_name', true);
152
+
 
 
 
 
 
 
 
 
153
  if($schema_type != 'local_business'){
154
 
155
  $style_business_type = 'style="display:none"';
163
  'Event' => 'Event',
164
  'HowTo' => 'HowTo',
165
  'local_business' => 'LocalBusiness',
166
+ 'MusicPlaylist' => 'Music Playlist',
167
+ 'Movie' => 'Movie',
168
+ 'Organization' => 'Organization',
169
  'Product' => 'Product',
170
  'Recipe' => 'Recipe',
171
  'SoftwareApplication' => 'SoftwareApplication',