Schema & Structured Data for WP & AMP - Version 1.9.20

Version Description

(27 Dec 2019) =

  • Added: Role Based Access feature #631
  • Added: comment property in DiscussionForumPosting schema type using bbPress compatiblity. #649
  • Added: itemReviewed type organization in Review schema #662
  • Added: Compatibility with Strong testimonials plugin #664
  • Fixed: Change Internal Links to AMP Option is not working from SASWP v1.9.18 #686
  • Fixed: Notice: is_amp_endpoint was called incorrectly. #681
  • Fixed: By default there are 10 comments showing in markup need to set this as per users site. #668
  • Fixed: Invalid schema output when using ACF fields with recipe ingredients #659
  • Fixed: In Review schema if Item Reviewed Type selected then show Add Reviews checkbox #667
  • Fixed: How to show reviews on the website shows 404 page not found. #676
  • Fixed: Fatal error: called to undefined function "saswp_reviews_front_output" #685
  • Fixed: If image size greater than 1200px, Image croping based on image ratio is not working correct #683
  • Fixed: Form ( Which should not be displayed on amp) is being displayed when SASWP is active. #679
  • 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
Download this release

Release Info

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

Code changes from version 1.9.18 to 1.9.20

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
@@ -347,7 +347,7 @@ function saswp_create_ajax_select_taxonomy($selectedParentValue = '',$selectedVa
347
 
348
  $is_ajax = true;
349
 
350
- if(! current_user_can( 'manage_options' ) ) {
351
  exit;
352
  }
353
 
347
 
348
  $is_ajax = true;
349
 
350
+ if(! current_user_can( saswp_current_user_can() ) ) {
351
  exit;
352
  }
353
 
admin_section/common-function.php CHANGED
@@ -14,11 +14,11 @@ if ( ! defined('ABSPATH') ) exit;
14
  /**
15
  * List of hooks used in this context
16
  */
17
- add_action('admin_init', 'saswp_import_all_settings_and_schema',9);
18
  add_action( 'wp_ajax_saswp_export_all_settings_and_schema', 'saswp_export_all_settings_and_schema');
19
- add_action('plugins_loaded', 'saswp_defaultSettings' );
20
  add_action( 'wp_enqueue_scripts', 'saswp_frontend_enqueue' );
21
- add_action('amp_post_template_css','saswp_enqueue_amp_script');
22
 
23
 
24
  //global variable to store List of labels starts here
@@ -63,13 +63,13 @@ 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
 
70
  global $wpdb;
71
 
72
- $result = '';
73
  $errorDesc = array();
74
  $all_schema_post = array();
75
 
@@ -77,80 +77,107 @@ if ( ! defined('ABSPATH') ) exit;
77
 
78
  if($url){
79
 
80
- $json_data = file_get_contents($url);
81
 
82
  if($json_data){
83
 
84
- $json_array = json_decode($json_data, true);
85
- if(array_key_exists('posts', $json_array)){
86
 
87
- $all_schema_post = $json_array['posts'];
88
-
89
- }
 
 
 
 
90
 
91
- $schema_post = array();
92
 
93
  if($all_schema_post && is_array($all_schema_post)){
94
  // begin transaction
95
  $wpdb->query('START TRANSACTION');
96
 
97
  foreach($all_schema_post as $schema_post){
 
 
98
 
99
- $post_id = wp_insert_post($schema_post['post']);
100
- $result = $post_id;
101
- $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
102
- $wpdb->query("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
103
-
104
- if ( isset( $schema_post['schema_type'] ) ){
105
- update_post_meta( $post_id, 'schema_type', sanitize_text_field($schema_post['schema_type']) );
106
- }
107
-
108
- if ( isset( $schema_post['saswp_business_type'] ) ){
109
- update_post_meta( $post_id, 'saswp_business_type', sanitize_text_field($schema_post['saswp_business_type']) );
110
- }
111
-
112
- if ( isset( $schema_post['saswp_business_name'] ) ){
113
- update_post_meta( $post_id, 'saswp_business_name', sanitize_text_field($schema_post['saswp_business_name']) );
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
-
116
- if ( isset( $schema_post['saswp_local_business_details'] ) ){
117
 
118
- $local_data = $schema_post['saswp_local_business_details'];
 
 
119
 
120
- if($local_data){
121
-
122
- foreach($local_data as $key => $local){
123
-
124
- if($key == 'local_business_logo'){
125
-
126
- $local_data[$key] = array_map('sanitize_text_field', $local);
127
- }else{
128
- $local_data[$key] = sanitize_text_field($local);
129
- }
130
-
131
- }
132
- }
133
-
134
- update_post_meta( $post_id, 'saswp_local_business_details', $local_data );
135
  }
136
-
137
- if ( isset( $schema_post['data_group_array'] ) ){
138
- $data_array = saswp_sanitize_multi_array($schema_post['data_group_array'], 'data_array');
139
- update_post_meta( $post_id, 'data_group_array', $data_array );
140
- }
141
- if(is_wp_error($result)){
142
  $errorDesc[] = $result->get_error_message();
143
  }
144
  }
145
 
146
- }
147
-
 
 
 
 
148
  if(array_key_exists('sd_data', $json_array)){
 
 
 
 
 
 
 
 
 
 
149
 
150
- $sd_data = array_map( 'sanitize_text_field' ,$json_array['sd_data']);
151
- update_option('sd_data', $sd_data);
 
 
 
 
 
152
  }
153
-
154
  update_option('saswp-file-upload_url','');
155
 
156
  }
@@ -173,100 +200,73 @@ if ( ! defined('ABSPATH') ) exit;
173
  */
174
  function saswp_export_all_settings_and_schema(){
175
 
176
- if ( ! current_user_can( 'manage_options' ) ) {
177
- return;
178
- }
179
- if ( ! isset( $_GET['_wpnonce'] ) ){
180
- return;
181
- }
182
-
183
- if ( !wp_verify_nonce( $_GET['_wpnonce'], '_wpnonce' ) ){
184
- return;
185
- }
186
-
187
- $export_data = array();
188
- $export_data_all = array();
189
- $schema_post = array();
190
- $user_id = get_current_user_id();
191
-
192
- $all_schema_post = get_posts(
193
-
194
- array(
195
- 'post_type' => 'saswp',
196
- 'posts_per_page' => -1,
197
- 'post_status' => 'any',
198
- )
199
-
200
- );
201
-
202
- $get_sd_data = get_option('sd_data');
203
 
204
- if($all_schema_post || $get_sd_data){
205
-
206
- foreach($all_schema_post as $schema){
207
 
208
- $schema_post = array(
209
 
210
- 'post_author' => $user_id,
211
- 'post_date' => $schema->post_date,
212
- 'post_date_gmt' => $schema->post_date_gmt,
213
- 'post_content' => $schema->post_content,
214
- 'post_title' => $schema->post_title,
215
- 'post_excerpt' => $schema->post_excerpt,
216
- 'post_status' => $schema->post_status,
217
- 'comment_status' => $schema->comment_status,
218
- 'ping_status' => $schema->ping_status,
219
- 'post_password' => $schema->post_password,
220
- 'post_name' => $schema->post_name,
221
- 'to_ping' => $schema->to_ping,
222
- 'pinged' => $schema->pinged,
223
- 'post_modified' => $schema->post_modified,
224
- 'post_modified_gmt' => $schema->post_modified_gmt,
225
- 'post_content_filtered' => $schema->post_content_filtered,
226
- 'post_parent' => $schema->post_parent,
227
- 'menu_order' => $schema->menu_order,
228
- 'post_type' => 'saswp',
229
- 'post_mime_type' => $schema->post_mime_type,
230
- 'comment_count' => $schema->comment_count,
231
- 'filter' => $schema->filter,
232
 
233
- );
234
-
235
- $export_data[$schema->ID]['post'] = $schema_post;
236
-
237
- $post_meta = get_post_meta($schema->ID, $key='', true );
238
-
239
- $schema_type = saswp_remove_warnings($post_meta, 'schema_type', 'saswp_array');
240
- $local_business_type = saswp_remove_warnings($post_meta, 'saswp_business_type', 'saswp_array');
241
- $local_business_sub_type = saswp_remove_warnings($post_meta, 'saswp_business_name', 'saswp_array');
242
-
243
-
244
- $data_group_array = get_post_meta($schema->ID, $key='data_group_array', true );
245
- $local_business_details = get_post_meta($schema->ID, $key='saswp_local_business_details', true );
246
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
 
248
- $export_data[$schema->ID]['schema_type'] = $schema_type;
249
- $export_data[$schema->ID]['saswp_business_type'] = $local_business_type;
250
- $export_data[$schema->ID]['saswp_business_name'] = $local_business_sub_type;
251
- $export_data[$schema->ID]['data_group_array'] = $data_group_array;
252
- $export_data[$schema->ID]['saswp_local_business_details'] = $local_business_details;
253
- }
254
-
255
- $export_data_all['posts'] = $export_data;
256
- $export_data_all['sd_data'] = $get_sd_data;
257
 
258
  header('Content-type: application/json');
259
  header('Content-disposition: attachment; filename=structuredatabackup.json');
260
  echo json_encode($export_data_all);
261
-
262
- }else{
263
-
264
- header('Content-type: application/json');
265
- header('Content-disposition: attachment; filename=structuredatabackup.json');
266
- echo json_encode(array('message'=> 'Data is not available'));
267
-
268
- }
269
- wp_die();
270
  }
271
  /**
272
  * We are here fetching all schema and its settings from schema plugin
@@ -1600,11 +1600,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 +1619,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(
@@ -1783,337 +1785,61 @@ if ( ! defined('ABSPATH') ) exit;
1783
  */
1784
  function saswp_enqueue_amp_script(){
1785
 
1786
- global $sd_data;
 
1787
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
1788
 
1789
- $saswp_review_item_enable = 0;
1790
 
1791
  if(isset($saswp_review_details['saswp-review-item-enable'])){
1792
 
1793
- $saswp_review_item_enable = $saswp_review_details['saswp-review-item-enable'];
1794
 
1795
  }
1796
 
1797
- if($sd_data['saswp-review-module']== 1 && $saswp_review_item_enable == 1){
1798
- ?>
1799
- .saswp-pc-wrap{
1800
- background-color: #004f74;
1801
- padding: 15px;
1802
- color: #fff;
1803
- display: flex;
1804
- width:auto;
1805
- flex-wrap: wrap;
1806
- margin-bottom: 20px;
1807
- }
1808
- .saswp-pc-wrap .saswp-lst span{
1809
- font-size: 18px;
1810
- font-weight: 500;
1811
- margin-bottom: 10px;
1812
- display: inline-block;
1813
- line-height: 1.3;
1814
- }
1815
- .saswp-pc-wrap .saswp-lst{
1816
- flex:1 0 42%;
1817
- }
1818
- .saswp-pc-wrap .saswp-lst ul{
1819
- margin:0;
1820
- }
1821
- .saswp-pc-wrap .saswp-lst p{
1822
- list-style-type: none;
1823
- font-size: 15px;
1824
- font-weight: lighter;
1825
- line-height: 1.2;
1826
- margin-bottom: 10px;
1827
- position: relative;
1828
- padding-left: 20px;
1829
- color:#eee;
1830
- }
1831
- .saswp-pc-wrap .saswp-lst p:before{
1832
- content: '';
1833
- position: absolute;
1834
- width: 8px;
1835
- height: 8px;
1836
- background-color: #ccc;
1837
- left: 0px;
1838
- top: 6px;
1839
- border-radius: 10px;
1840
- }
1841
- .sgl .saswp-rvw {
1842
- width: 100%;
1843
- margin-bottom: 34px;
1844
- font-size: 13px;
1845
- border-bottom: 1px solid #ededed;
1846
- }
1847
- .saswp-rvw-hd span {
1848
- background-color: #222;
1849
- color: #fff;
1850
- display: inline-block;
1851
- font-size: 15px;
1852
- line-height: 1.4;
1853
- padding: 8px 12px 6px;
1854
- margin: 26px 0px;
1855
- }
1856
- .saswp-rvw tbody{
1857
- width:100%;
1858
- display:inline-block;
1859
- }
1860
- .saswp-rvw td {
1861
- padding: 7px 14px;
1862
- }
1863
- .sgl table td, .saswp-rvw td {
1864
- border: 1px solid #ededed;
1865
- }
1866
- .saswp-rvw-sm span{
1867
- background-color: #222;
1868
- color: #fff;
1869
- display: inline-block;
1870
- padding: 8px 12px 6px;
1871
- margin-bottom: 13px;
1872
- position: relative;
1873
- font-size: 15px;
1874
- line-height: 1.2;
1875
- }
1876
- .saswp-rvw-fs {
1877
- line-height: 1.5;
1878
- font-size: 48px;
1879
- font-weight: 600;
1880
- margin-bottom: 5px;
1881
- }
1882
- .saswp-rvw-ov .ovs {
1883
- font-size: 11px;
1884
- font-weight:600;
1885
- }
1886
- .sgl .saswp-rvw tr td{
1887
- background:#fff;
1888
- width:100%;
1889
- }
1890
- .sgl .saswp-rvw tr:hover td {
1891
- background-color: #fcfcfc;
1892
- }
1893
- .saswp-rvw .saswp-rvw-sm {
1894
- padding: 21px 14px;
1895
- }
1896
- .str-ic{
1897
- font-size: 18px;
1898
- line-height: 1.2;
1899
- }
1900
- .saswp-rvw-str{
1901
- display: inline-flex;
1902
- width: 100%;
1903
- }
1904
- .saswp-rvw-ov{
1905
- text-align:center;
1906
- }
1907
  .saswp-rvw-str .half-str{
1908
- display:inline-block;
1909
- width: 20px;
1910
- height: 16px;
1911
- background-repeat: no-repeat;
1912
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/half_star.png'); ?>);
1913
  }
1914
  .saswp-rvw-str .str-ic{
1915
- display:inline-block;
1916
- width: 20px;
1917
- height: 16px;
1918
- background-repeat: no-repeat;
1919
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/full_star.png'); ?>);
1920
  }
1921
  .saswp-rvw-str .df-clr{
1922
- display:inline-block;
1923
- width: 20px;
1924
- height: 16px;
1925
- background-repeat: no-repeat;
1926
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/blank_star.png'); ?>);
1927
  }
1928
- @media(max-width:500px){
1929
- .saswp-pc-wrap{
1930
- display:block;
1931
- }
1932
- .saswp-pc-wrap .saswp-lst{
1933
- margin-bottom:20px;
1934
- }
1935
- }
1936
-
1937
- <?php
1938
  }
1939
 
1940
  if((has_shortcode( @get_the_content(), 'saswp-reviews')) || is_active_widget( false, false, 'saswp_google_review_widget',true ) || (isset($sd_data['saswp-review-module']) && $sd_data['saswp-review-module'] == 1) ){
1941
  ?>
1942
 
1943
- /*** Review Design CSS ****/
1944
- .saswp-g-review-header{
1945
- margin-top: 50px;
1946
- }
1947
- .saswp-g-review-body{
1948
- display:inline-grid;
1949
- grid-template-columns: 1fr 300px;
1950
- grid-gap:30px;
1951
- margin-top:30px;
1952
- width:100%;
1953
- }
1954
- .saswp-review-list{}
1955
- .saswp-channel-list{
1956
- margin-right: 15px;
1957
- }
1958
- .saswp-input-fields{
1959
- display: inline-flex;
1960
- align-items: center;
1961
- margin-bottom: 8px;
1962
- width: 100%;
1963
- }
1964
- .saswp-input-fields label{
1965
- width: 130px;
1966
- }
1967
- .saswp-panel h3{
1968
- font-size: 20px;
1969
- line-height: 1.4;
1970
- color: #222;
1971
- text-align: center;
1972
- margin: 10px 0px 20px 0px;
1973
- }
1974
- .saswp-input-fields a.button-primary{
1975
- margin-top:10px;
1976
- }
1977
- .saswp-glg-review-body{
1978
- display: grid;
1979
- grid-template-columns: 100px 1fr;
1980
- grid-gap: 20px;
1981
- background: #fff;
1982
- padding: 20px;
1983
- box-shadow: 0px 0px 20px 1px #d2cccc;
1984
- margin-bottom: 30px;
1985
- }
1986
- .saswp-g-plus{
1987
- float: right;
1988
- font-size: 15px;
1989
- width: 20px;
1990
- height: 20px;
1991
- position: absolute;
1992
- right: 0;
1993
- top:4px;
1994
- }
1995
- .saswp-g-plus amp-img{
1996
- width:100%;
1997
- }
1998
- .saswp-rtng{
1999
- padding-left: 5px;
2000
- font-size: 14px;
2001
- }
2002
- .saswp-pt-dt {
2003
- font-size: 12px;
2004
- color: #999;
2005
- font-weight: 600;
2006
- margin-top: 5px;
2007
- display: inline-block;
2008
- }
2009
- .saswp-athr{
2010
- font-size: 15px;
2011
- line-height: 1.4;
2012
- color: #000;
2013
- font-weight: bold;
2014
- display: inline-block;
2015
- vertical-align: middle;
2016
- }
2017
- .saswp-str-rtng .saswp-rvw-str{
2018
- display: inline-block;
2019
- vertical-align: middle;
2020
- padding-left: 10px;
2021
- width: auto;
2022
- }
2023
- .amp-sidebar .saswp-str-rtng .saswp-rvw-str{padding:5px 0px 0px 0px;}
2024
- .saswp-rv-cnt p{
2025
- font-size: 16px;
2026
- line-height: 1.6;
2027
- color: #000;
2028
- margin: 10px 0px 0px 0px;
2029
- }
2030
- .amp-sidebar .saswp-rv-img amp-img{max-width:50px;}
2031
- .amp-sidebar .saswp-glg-review-body {
2032
- display: inline-block;
2033
- width:100%;
2034
- }
2035
- .amp-sidebar .saswp-rv-img{
2036
- width:60px;
2037
- float:left;
2038
- }
2039
- .amp-sidebar .saswp-rtng{display:block;}
2040
-
2041
- .saswp-rvw-str .half-str{
2042
- display:inline-block;
2043
- width: 20px;
2044
- height: 16px;
2045
- background-repeat: no-repeat;
2046
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/half_star.png'); ?>);
2047
  }
2048
- .saswp-rvw-str .str-ic{
2049
- display:inline-block;
2050
- width: 20px;
2051
- height: 16px;
2052
- background-repeat: no-repeat;
2053
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/full_star.png'); ?>);
2054
  }
2055
- .saswp-rvw-str .df-clr{
2056
- display:inline-block;
2057
- width: 20px;
2058
- height: 16px;
2059
- background-repeat: no-repeat;
2060
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/blank_star.png'); ?>);
2061
  }
2062
-
2063
- @media(max-width:767px){
2064
- .saswp-glg-review-body {
2065
- grid-template-columns: 50px 1fr;
2066
- }
2067
- .saswp-rv-img img{
2068
- max-width:50px;
2069
- }
2070
- }
2071
- .widget .saswp-glg-review-body{
2072
- display: inline-block;
2073
- width: 100%;
2074
- }
2075
- .widget .saswp-rv-img{
2076
- margin-bottom:12px;
2077
- }
2078
- .widget .saswp-rv-img img {
2079
- max-width: 50px;
2080
- }
2081
-
2082
- .saswp-rv-txt{
2083
- position: static;
2084
- height: 80px;
2085
- overflow-y: auto;
2086
- font-size: 14px;
2087
- line-height:1.6;
2088
- text-align: left;
2089
- padding: 0 2px 0 0;
2090
- margin: 10px 0 0;
2091
- }
2092
- .saswp-rv-txt p{
2093
- margin:0;
2094
- }
2095
- .saswp-rv-cnt::-webkit-scrollbar {
2096
- width: 4px ;
2097
- display:inline-block;
2098
- }
2099
- .saswp-rv-cnt::-webkit-scrollbar-thumb {
2100
- -webkit-border-radius: 10px ;
2101
- border-radius: 10px ;
2102
- background: #ccc ;
2103
- -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5) ;
2104
- }
2105
- .saswp-rv-cnt::-webkit-scrollbar-track {
2106
- -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
2107
- -webkit-border-radius: 4px;
2108
- }
2109
- .saswp-r5-rng{
2110
- position: relative;
2111
- }
2112
-
2113
  <?php
 
 
 
 
2114
  }
2115
-
2116
-
2117
  }
2118
  /**
2119
  * Function to get author name
@@ -2498,12 +2224,12 @@ if ( ! defined('ABSPATH') ) exit;
2498
  $author_desc = get_the_author_meta( 'user_description' );
2499
 
2500
  if(!$author_name && is_object($post)){
2501
-
2502
- $author_id = get_post_field ('post_author', $post->ID);
2503
- $author_name = get_the_author_meta( 'display_name' , $author_id );
2504
-
2505
  }
2506
 
 
 
2507
  $author_image = array();
2508
 
2509
  if(function_exists('get_avatar_data')){
@@ -2512,7 +2238,8 @@ if ( ! defined('ABSPATH') ) exit;
2512
 
2513
  $author_details['@type'] = 'Person';
2514
  $author_details['name'] = esc_attr($author_name);
2515
- $author_details['description'] = esc_attr($author_desc);
 
2516
 
2517
  if(isset($author_image['url']) && isset($author_image['height']) && isset($author_image['width'])){
2518
 
@@ -2736,7 +2463,7 @@ function saswp_get_permalink(){
2736
  }
2737
  function saswp_get_taxonomy_term_list(){
2738
 
2739
- if ( ! current_user_can( 'manage_options' ) ) {
2740
  return;
2741
  }
2742
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -2977,4 +2704,224 @@ function saswp_remove_anonymous_object_filter_or_action( $tag, $class, $method,
2977
  }
2978
  }
2979
  }
2980
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * List of hooks used in this context
16
  */
17
+ add_action( 'admin_init', 'saswp_import_all_settings_and_schema',9);
18
  add_action( 'wp_ajax_saswp_export_all_settings_and_schema', 'saswp_export_all_settings_and_schema');
19
+ add_action( 'plugins_loaded', 'saswp_defaultSettings' );
20
  add_action( 'wp_enqueue_scripts', 'saswp_frontend_enqueue' );
21
+ add_action( 'amp_post_template_css','saswp_enqueue_amp_script');
22
 
23
 
24
  //global variable to store List of labels starts here
63
  */
64
  function saswp_import_all_settings_and_schema(){
65
 
66
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
67
  return;
68
  }
69
 
70
  global $wpdb;
71
 
72
+ $result = null;
73
  $errorDesc = array();
74
  $all_schema_post = array();
75
 
77
 
78
  if($url){
79
 
80
+ $json_data = @file_get_contents($url);
81
 
82
  if($json_data){
83
 
84
+ $json_array = json_decode($json_data, true);
 
85
 
86
+ $posts_data = $json_array['posts'];
87
+
88
+ if($posts_data){
89
+
90
+ foreach($posts_data as $data){
91
+
92
+ $all_schema_post = $data;
93
 
94
+ $schema_post = array();
95
 
96
  if($all_schema_post && is_array($all_schema_post)){
97
  // begin transaction
98
  $wpdb->query('START TRANSACTION');
99
 
100
  foreach($all_schema_post as $schema_post){
101
+
102
+ $post_meta = $schema_post['post_meta'];
103
 
104
+ if(saswp_post_exists($schema_post['post']['ID'])){
105
+
106
+ $post_id = wp_update_post($schema_post['post']);
107
+
108
+ }else{
109
+
110
+ unset($schema_post['post']['ID']);
111
+
112
+ $post_id = wp_insert_post($schema_post['post']);
113
+
114
+ if($post_meta){
115
+
116
+ foreach($post_meta as $key => $val){
117
+
118
+ $explod_key = explode("_",$key);
119
+
120
+ $exp_count = count($explod_key);
121
+
122
+ $explod_key[($exp_count-1)] = $post_id;
123
+
124
+ $explod_key = implode("_", $explod_key);
125
+
126
+ $post_meta[$explod_key] = $val;
127
+
128
+ }
129
+
130
+ }
131
+
132
  }
133
+
134
+ foreach($post_meta as $key => $meta){
135
 
136
+ $meta = wp_unslash($meta);
137
+
138
+ if(is_array($meta)){
139
 
140
+ $meta = wp_unslash($meta);
141
+ update_post_meta($post_id, $key, $meta);
142
+
143
+ }else{
144
+ update_post_meta($post_id, $key, sanitize_text_field($meta));
145
+ }
146
+
 
 
 
 
 
 
 
 
147
  }
148
+
149
+ if(is_wp_error($post_id)){
 
 
 
 
150
  $errorDesc[] = $result->get_error_message();
151
  }
152
  }
153
 
154
+ }
155
+
156
+ }
157
+
158
+ }
159
+ //Saving settings data starts here
160
  if(array_key_exists('sd_data', $json_array)){
161
+
162
+ $saswp_sd_data = $json_array['sd_data'];
163
+
164
+ foreach($saswp_sd_data as $key => $val){
165
+
166
+ if(is_array($val)){
167
+
168
+ $saswp_sd_data[$key] = $meta = array_map( 'sanitize_text_field' ,$val);
169
+
170
+ }else{
171
 
172
+ $saswp_sd_data[$key] = sanitize_text_field($val);
173
+
174
+ }
175
+
176
+ }
177
+
178
+ update_option('sd_data', $saswp_sd_data);
179
  }
180
+ //Saving settings data ends here
181
  update_option('saswp-file-upload_url','');
182
 
183
  }
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'] ) ){
207
+ return;
208
+ }
209
+
210
+ if ( !wp_verify_nonce( $_GET['_wpnonce'], '_wpnonce' ) ){
211
+ return;
212
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
+ $post_type = array('saswp_reviews', 'saswp', 'saswp-collections');
215
+ $export_data_all = array();
 
216
 
217
+ foreach($post_type as $type){
218
 
219
+ $export_data = array();
220
+
221
+ $all_schema_post = get_posts(
222
+
223
+ array(
224
+ 'post_type' => $type,
225
+ 'posts_per_page' => -1,
226
+ 'post_status' => 'any',
227
+ )
228
+
229
+ );
230
+
231
+ if($all_schema_post){
 
 
 
 
 
 
 
 
 
232
 
233
+ foreach($all_schema_post as $schema){
234
+
235
+ $export_data[$schema->ID]['post'] = (array)$schema;
236
+ $post_meta = get_post_meta($schema->ID, $key='', true );
237
+
238
+ if($post_meta){
239
+
240
+ foreach ($post_meta as $key => $meta){
241
+
242
+ if(@unserialize($meta[0]) !== false){
243
+ $post_meta[$key] = @unserialize($meta[0]);
244
+ }else{
245
+ $post_meta[$key] = $meta[0];
246
+ }
247
+
248
+ }
249
+
250
+ }
251
+
252
+ $export_data[$schema->ID]['post_meta'] = $post_meta;
253
+
254
+ }
255
+
256
+ $export_data_all['posts'][$type] = $export_data;
257
+
258
+ }
259
+
260
+
261
+ }
262
 
263
+ $export_data_all['sd_data'] = get_option('sd_data');
 
 
 
 
 
 
 
 
264
 
265
  header('Content-type: application/json');
266
  header('Content-disposition: attachment; filename=structuredatabackup.json');
267
  echo json_encode($export_data_all);
268
+
269
+ wp_die();
 
 
 
 
 
 
 
270
  }
271
  /**
272
  * We are here fetching all schema and its settings from schema plugin
1600
  );
1601
  // select
1602
  $my_allowed['select'] = array(
1603
+ 'class' => array(),
1604
+ 'multiple' => array(),
1605
+ 'id' => array(),
1606
+ 'name' => array(),
1607
+ 'value' => array(),
1608
+ 'type' => array(),
1609
  );
1610
  // checkbox
1611
  $my_allowed['checkbox'] = array(
1619
  // options
1620
  $my_allowed['option'] = array(
1621
  'selected' => array(),
1622
+ 'value' => array(),
1623
+ 'disabled' => array(),
1624
  );
1625
  // style
1626
  $my_allowed['style'] = array(
1785
  */
1786
  function saswp_enqueue_amp_script(){
1787
 
1788
+ global $sd_data;
1789
+
1790
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
1791
 
1792
+ $saswp_rv_item_enable = 0;
1793
 
1794
  if(isset($saswp_review_details['saswp-review-item-enable'])){
1795
 
1796
+ $saswp_rv_item_enable = $saswp_review_details['saswp-review-item-enable'];
1797
 
1798
  }
1799
 
1800
+ if($sd_data['saswp-review-module']== 1 && $saswp_rv_item_enable == 1){
1801
+
1802
+ $rating_module_css = SASWP_PLUGIN_DIR_PATH . 'admin_section/css/amp/rating-module.css';
1803
+ echo @file_get_contents($rating_module_css);
1804
+
1805
+ ?>
1806
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1807
  .saswp-rvw-str .half-str{
1808
+
 
 
 
1809
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/half_star.png'); ?>);
1810
  }
1811
  .saswp-rvw-str .str-ic{
1812
+
 
 
 
1813
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/full_star.png'); ?>);
1814
  }
1815
  .saswp-rvw-str .df-clr{
1816
+
 
 
 
1817
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/blank_star.png'); ?>);
1818
  }
1819
+
1820
+ <?php
 
 
 
 
 
 
 
 
1821
  }
1822
 
1823
  if((has_shortcode( @get_the_content(), 'saswp-reviews')) || is_active_widget( false, false, 'saswp_google_review_widget',true ) || (isset($sd_data['saswp-review-module']) && $sd_data['saswp-review-module'] == 1) ){
1824
  ?>
1825
 
1826
+ .saswp-rvw-str .half-str{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1827
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/half_star.png'); ?>);
1828
  }
1829
+ .saswp-rvw-str .str-ic{
 
 
 
 
1830
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/full_star.png'); ?>);
1831
  }
1832
+ .saswp-rvw-str .df-clr{
 
 
 
 
1833
  background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/blank_star.png'); ?>);
1834
  }
1835
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1836
  <?php
1837
+
1838
+ $rating_module_front_css = SASWP_PLUGIN_DIR_PATH . 'admin_section/css/amp/rating-module-front.css';
1839
+ echo @file_get_contents($rating_module_front_css);
1840
+
1841
  }
1842
+
 
1843
  }
1844
  /**
1845
  * Function to get author name
2224
  $author_desc = get_the_author_meta( 'user_description' );
2225
 
2226
  if(!$author_name && is_object($post)){
2227
+ $author_id = get_post_field ( 'post_author', $post->ID);
2228
+ $author_name = get_the_author_meta( 'display_name' , $author_id );
 
 
2229
  }
2230
 
2231
+ $author_url = get_the_author_meta( 'url' , $author_id );
2232
+
2233
  $author_image = array();
2234
 
2235
  if(function_exists('get_avatar_data')){
2238
 
2239
  $author_details['@type'] = 'Person';
2240
  $author_details['name'] = esc_attr($author_name);
2241
+ $author_details['description'] = wp_strip_all_tags(strip_shortcodes($author_desc));
2242
+ $author_details['url'] = esc_url($author_url);
2243
 
2244
  if(isset($author_image['url']) && isset($author_image['height']) && isset($author_image['width'])){
2245
 
2463
  }
2464
  function saswp_get_taxonomy_term_list(){
2465
 
2466
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
2467
  return;
2468
  }
2469
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
2704
  }
2705
  }
2706
  }
2707
+ }
2708
+
2709
+ function saswp_get_field_note($pname){
2710
+
2711
+ $notes = array(
2712
+ 'easy_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easyrecipe/">EasyRecipe</a>',
2713
+ 'strong_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/strong-testimonials">Strong Testimonials</a>',
2714
+ '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>',
2715
+ 'wordlift' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wordlift/">WordLift</a>',
2716
+ '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>',
2717
+ 'ampbyautomatic' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/amp/">AMP</a>',
2718
+ 'betteramp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">Better AMP</a>',
2719
+ '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>',
2720
+ '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>',
2721
+ '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>',
2722
+ 'bb_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bbpress/">bbPress</a>',
2723
+ 'woocommerce' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce</a>',
2724
+ 'cooked' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/cooked/">Cooked</a>',
2725
+ 'the_events_calendar' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/the-events-calendar/">The Events Calendar</a>',
2726
+ 'yoast_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a>',
2727
+ 'rank_math' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/seo-by-rank-math/">WordPress SEO Plugin – Rank Math</a>',
2728
+ 'dw_qna' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">DW Question Answer</a>',
2729
+ 'smart_crawl' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/smartcrawl-seo/">SmartCrawl Seo</a>',
2730
+ 'the_seo_framework' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/autodescription/">The Seo Framework</a>',
2731
+ 'seo_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-seopress/">SEOPress</a>',
2732
+ 'aiosp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>',
2733
+ 'squirrly_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/squirrly-seo/">Squirrly SEO</a>',
2734
+ 'wp_recipe_maker' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-recipe-maker/">WP Recipe Maker</a>',
2735
+ 'wp_ultimate_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-ultimate-recipe/">WP Ultimate Recipe</a>',
2736
+ 'learn_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/learnpress/">Learn Press</a>',
2737
+ 'learn_dash' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.learndash.com/pricing-and-purchase/">Learn Dash</a>',
2738
+ 'lifter_lms' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/lifterlms/">LifterLMS</a>',
2739
+ 'wp_event_manager' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-event-manager/">WP Event Manager</a>',
2740
+ 'events_manager' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/events-manager/">Events Manager</a>',
2741
+ 'event_calendar_wd' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/event-calendar-wd/">Event Calendar WD</a>',
2742
+ 'event_organiser' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/event-organiser/">Event Organiser</a>',
2743
+ 'modern_events_calendar' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/modern-events-calendar-lite/">Modern Events Calendar Lite</a>',
2744
+ 'flex_mls_idx' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/flexmls-idx/">FlexMLS IDX</a>',
2745
+ 'woocommerce_membership' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Membership</a>',
2746
+ 'woocommerce_bookings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Bookings</a>',
2747
+ 'extra' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.elegantthemes.com/gallery/extra/">Extra Theme</a>',
2748
+ '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>',
2749
+ 'wpresidence' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wpresidence.net/">WP Residence</a>',
2750
+ '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>',
2751
+ '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>',
2752
+ '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>',
2753
+ 'zip_recipes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/zip-recipes/">Zip Recipes</a>',
2754
+ 'mediavine_create' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/mediavine-create/">Create by Mediavine</a>',
2755
+ '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>',
2756
+ 'easy_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easy-testimonials">Easy Testimonials</a>',
2757
+ 'bne_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bne-testimonials/">BNE Testimonials</a>',
2758
+ '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>',
2759
+ '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>'
2760
+
2761
+ );
2762
+
2763
+ $active = saswp_compatible_active_list();
2764
+
2765
+ if(!isset($active[$pname])){
2766
+
2767
+ return $notes[$pname];
2768
+
2769
+ }
2770
+
2771
+ }
2772
+
2773
+ function saswp_get_category_link($term_id){
2774
+
2775
+ $url = get_category_link($term_id);
2776
+
2777
+ if ((function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint()) || function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
2778
+
2779
+ if(function_exists('ampforwp_url_controller')){
2780
+
2781
+ $url = ampforwp_url_controller( $url );
2782
+
2783
+ }
2784
+
2785
+ }
2786
+
2787
+ return $url;
2788
+
2789
+ }
2790
+
2791
+ function saswp_get_current_url(){
2792
+
2793
+ $link = "http";
2794
+
2795
+ if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on'){
2796
+ $link = "https";
2797
+ }
2798
+
2799
+ $link .= "://";
2800
+ $link .= $_SERVER['HTTP_HOST'];
2801
+ $link .= $_SERVER['REQUEST_URI'];
2802
+
2803
+ return $link;
2804
+ }
2805
+
2806
+ function saswp_has_slash($url){
2807
+
2808
+ $response = false;
2809
+
2810
+ if(strrev($url)[0]==='/') {
2811
+ $response = true;
2812
+ }
2813
+
2814
+ return $response;
2815
+ }
2816
+
2817
+ function saswp_remove_slash($url){
2818
+
2819
+ $url = rtrim($url, '/\\');
2820
+
2821
+ return $url;
2822
+
2823
+ }
2824
+
2825
+ function saswp_get_user_roles(){
2826
+
2827
+ global $wp_roles;
2828
+ $allroles = array();
2829
+
2830
+ foreach ( $wp_roles->roles as $key=>$value ){
2831
+ $allroles[esc_attr($key)] = esc_html($value['name']);
2832
+ }
2833
+
2834
+ return $allroles;
2835
+ }
2836
+
2837
+ function saswp_get_capability_by_role($role){
2838
+
2839
+ $cap = 'manage_options';
2840
+
2841
+ switch ($role) {
2842
+
2843
+ case 'editor':
2844
+ $cap = 'edit_pages';
2845
+ break;
2846
+ case 'author':
2847
+ $cap = 'publish_posts';
2848
+ break;
2849
+ case 'contributor':
2850
+ $cap = 'edit_posts';
2851
+ break;
2852
+ case 'subscriber':
2853
+ $cap = 'read';
2854
+ break;
2855
+
2856
+ default:
2857
+ break;
2858
+ }
2859
+
2860
+ return $cap;
2861
+
2862
+ }
2863
+
2864
+ function saswp_current_user_role(){
2865
+
2866
+ if( is_user_logged_in() ) {
2867
+
2868
+ $user = wp_get_current_user();
2869
+ $role = (array) $user->roles;
2870
+
2871
+ return $role[0];
2872
+
2873
+ }
2874
+
2875
+ }
2876
+
2877
+ function saswp_current_user_allowed(){
2878
+
2879
+ global $sd_data;
2880
+
2881
+ if( is_user_logged_in() ) {
2882
+
2883
+ $currentUser = wp_get_current_user();
2884
+ $saswp_roles = isset($sd_data['saswp-role-based-access']) ? $sd_data['saswp-role-based-access'] : array('administrator');
2885
+ $currentuserrole = (array) $currentUser->roles;
2886
+
2887
+ $hasrole = array_intersect( $currentuserrole, $saswp_roles );
2888
+
2889
+ if( !empty($hasrole)){
2890
+ return $hasrole[0];
2891
+ }
2892
+
2893
+ }
2894
+
2895
+ return false;
2896
+ }
2897
+
2898
+ function saswp_current_user_can(){
2899
+
2900
+ $capability = saswp_current_user_allowed() ? saswp_get_capability_by_role(saswp_current_user_allowed()) : 'manage_options';
2901
+ return $capability;
2902
+ }
2903
+
2904
+ function saswp_post_type_capabilities(){
2905
+
2906
+ $caplist = array();
2907
+
2908
+ $cap = saswp_current_user_can();
2909
+
2910
+ if(saswp_current_user_role() != 'administrator'){
2911
+
2912
+ $caplist = array(
2913
+ 'publish_posts' => $cap,
2914
+ 'edit_posts' => $cap,
2915
+ 'edit_others_posts' => $cap,
2916
+ 'delete_posts' => $cap,
2917
+ 'delete_others_posts' => $cap,
2918
+ 'read_private_posts' => $cap,
2919
+ 'edit_post' => $cap,
2920
+ 'delete_post' => $cap,
2921
+ 'read_post' => $cap,
2922
+ );
2923
+
2924
+ }
2925
+
2926
+ return $caplist;
2927
+ }
admin_section/css/amp/rating-module-front.css ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*** Review Design CSS ****/
2
+ .saswp-g-review-header{
3
+ margin-top: 50px;
4
+ }
5
+ .saswp-g-review-body{
6
+ display:inline-grid;
7
+ grid-template-columns: 1fr 300px;
8
+ grid-gap:30px;
9
+ margin-top:30px;
10
+ width:100%;
11
+ }
12
+ .saswp-review-list{}
13
+ .saswp-channel-list{
14
+ margin-right: 15px;
15
+ }
16
+ .saswp-input-fields{
17
+ display: inline-flex;
18
+ align-items: center;
19
+ margin-bottom: 8px;
20
+ width: 100%;
21
+ }
22
+ .saswp-input-fields label{
23
+ width: 130px;
24
+ }
25
+ .saswp-panel h3{
26
+ font-size: 20px;
27
+ line-height: 1.4;
28
+ color: #222;
29
+ text-align: center;
30
+ margin: 10px 0px 20px 0px;
31
+ }
32
+ .saswp-input-fields a.button-primary{
33
+ margin-top:10px;
34
+ }
35
+ .saswp-glg-review-body{
36
+ display: grid;
37
+ grid-template-columns: 100px 1fr;
38
+ grid-gap: 20px;
39
+ background: #fff;
40
+ padding: 20px;
41
+ box-shadow: 0px 0px 20px 1px #d2cccc;
42
+ margin-bottom: 30px;
43
+ }
44
+ .saswp-g-plus{
45
+ float: right;
46
+ font-size: 15px;
47
+ width: 20px;
48
+ height: 20px;
49
+ position: absolute;
50
+ right: 0;
51
+ top:4px;
52
+ }
53
+ .saswp-g-plus amp-img{
54
+ width:100%;
55
+ }
56
+ .saswp-rtng{
57
+ padding-left: 5px;
58
+ font-size: 14px;
59
+ }
60
+ .saswp-pt-dt {
61
+ font-size: 12px;
62
+ color: #999;
63
+ font-weight: 600;
64
+ margin-top: 5px;
65
+ display: inline-block;
66
+ }
67
+ .saswp-athr{
68
+ font-size: 15px;
69
+ line-height: 1.4;
70
+ color: #000;
71
+ font-weight: bold;
72
+ display: inline-block;
73
+ vertical-align: middle;
74
+ }
75
+ .saswp-str-rtng .saswp-rvw-str{
76
+ display: inline-block;
77
+ vertical-align: middle;
78
+ padding-left: 10px;
79
+ width: auto;
80
+ }
81
+ .amp-sidebar .saswp-str-rtng .saswp-rvw-str{padding:5px 0px 0px 0px;}
82
+ .saswp-rv-cnt p{
83
+ font-size: 16px;
84
+ line-height: 1.6;
85
+ color: #000;
86
+ margin: 10px 0px 0px 0px;
87
+ }
88
+ .amp-sidebar .saswp-rv-img amp-img{max-width:50px;}
89
+ .amp-sidebar .saswp-glg-review-body {
90
+ display: inline-block;
91
+ width:100%;
92
+ }
93
+ .amp-sidebar .saswp-rv-img{
94
+ width:60px;
95
+ float:left;
96
+ }
97
+ .amp-sidebar .saswp-rtng{display:block;}
98
+
99
+ .saswp-rvw-str .half-str{
100
+ display:inline-block;
101
+ width: 20px;
102
+ height: 16px;
103
+ background-repeat: no-repeat;
104
+ }
105
+ .saswp-rvw-str .str-ic{
106
+ display:inline-block;
107
+ width: 20px;
108
+ height: 16px;
109
+ background-repeat: no-repeat;
110
+ }
111
+ .saswp-rvw-str .df-clr{
112
+ display:inline-block;
113
+ width: 20px;
114
+ height: 16px;
115
+ background-repeat: no-repeat;
116
+ }
117
+
118
+ @media(max-width:767px){
119
+ .saswp-glg-review-body {
120
+ grid-template-columns: 50px 1fr;
121
+ }
122
+ .saswp-rv-img img{
123
+ max-width:50px;
124
+ }
125
+ }
126
+ .widget .saswp-glg-review-body{
127
+ display: inline-block;
128
+ width: 100%;
129
+ }
130
+ .widget .saswp-rv-img{
131
+ margin-bottom:12px;
132
+ }
133
+ .widget .saswp-rv-img img {
134
+ max-width: 50px;
135
+ }
136
+
137
+ .saswp-rv-txt{
138
+ position: static;
139
+ height: 80px;
140
+ overflow-y: auto;
141
+ font-size: 14px;
142
+ line-height:1.6;
143
+ text-align: left;
144
+ padding: 0 2px 0 0;
145
+ margin: 10px 0 0;
146
+ }
147
+ .saswp-rv-txt p{
148
+ margin:0;
149
+ }
150
+ .saswp-rv-cnt::-webkit-scrollbar {
151
+ width: 4px ;
152
+ display:inline-block;
153
+ }
154
+ .saswp-rv-cnt::-webkit-scrollbar-thumb {
155
+ -webkit-border-radius: 10px ;
156
+ border-radius: 10px ;
157
+ background: #ccc ;
158
+ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5) ;
159
+ }
160
+ .saswp-rv-cnt::-webkit-scrollbar-track {
161
+ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
162
+ -webkit-border-radius: 4px;
163
+ }
164
+ .saswp-r5-rng{
165
+ position: relative;
166
+ }
admin_section/css/amp/rating-module.css ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .saswp-pc-wrap{
2
+ background-color: #004f74;
3
+ padding: 15px;
4
+ color: #fff;
5
+ display: flex;
6
+ width:auto;
7
+ flex-wrap: wrap;
8
+ margin-bottom: 20px;
9
+ }
10
+ .saswp-pc-wrap .saswp-lst span{
11
+ font-size: 18px;
12
+ font-weight: 500;
13
+ margin-bottom: 10px;
14
+ display: inline-block;
15
+ line-height: 1.3;
16
+ }
17
+ .saswp-pc-wrap .saswp-lst{
18
+ flex:1 0 42%;
19
+ }
20
+ .saswp-pc-wrap .saswp-lst ul{
21
+ margin:0;
22
+ }
23
+ .saswp-pc-wrap .saswp-lst p{
24
+ list-style-type: none;
25
+ font-size: 15px;
26
+ font-weight: lighter;
27
+ line-height: 1.2;
28
+ margin-bottom: 10px;
29
+ position: relative;
30
+ padding-left: 20px;
31
+ color:#eee;
32
+ }
33
+ .saswp-pc-wrap .saswp-lst p:before{
34
+ content: '';
35
+ position: absolute;
36
+ width: 8px;
37
+ height: 8px;
38
+ background-color: #ccc;
39
+ left: 0px;
40
+ top: 6px;
41
+ border-radius: 10px;
42
+ }
43
+ .sgl .saswp-rvw {
44
+ width: 100%;
45
+ margin-bottom: 34px;
46
+ font-size: 13px;
47
+ border-bottom: 1px solid #ededed;
48
+ }
49
+ .saswp-rvw-hd span {
50
+ background-color: #222;
51
+ color: #fff;
52
+ display: inline-block;
53
+ font-size: 15px;
54
+ line-height: 1.4;
55
+ padding: 8px 12px 6px;
56
+ margin: 26px 0px;
57
+ }
58
+ .saswp-rvw tbody{
59
+ width:100%;
60
+ display:inline-block;
61
+ }
62
+ .saswp-rvw td {
63
+ padding: 7px 14px;
64
+ }
65
+ .sgl table td, .saswp-rvw td {
66
+ border: 1px solid #ededed;
67
+ }
68
+ .saswp-rvw-sm span{
69
+ background-color: #222;
70
+ color: #fff;
71
+ display: inline-block;
72
+ padding: 8px 12px 6px;
73
+ margin-bottom: 13px;
74
+ position: relative;
75
+ font-size: 15px;
76
+ line-height: 1.2;
77
+ }
78
+ .saswp-rvw-fs {
79
+ line-height: 1.5;
80
+ font-size: 48px;
81
+ font-weight: 600;
82
+ margin-bottom: 5px;
83
+ }
84
+ .saswp-rvw-ov .ovs {
85
+ font-size: 11px;
86
+ font-weight:600;
87
+ }
88
+ .sgl .saswp-rvw tr td{
89
+ background:#fff;
90
+ width:100%;
91
+ }
92
+ .sgl .saswp-rvw tr:hover td {
93
+ background-color: #fcfcfc;
94
+ }
95
+ .saswp-rvw .saswp-rvw-sm {
96
+ padding: 21px 14px;
97
+ }
98
+ .str-ic{
99
+ font-size: 18px;
100
+ line-height: 1.2;
101
+ }
102
+ .saswp-rvw-str{
103
+ display: inline-flex;
104
+ width: 100%;
105
+ }
106
+ .saswp-rvw-ov{
107
+ text-align:center;
108
+ }
109
+
110
+ .saswp-rvw-str .half-str{
111
+ display:inline-block;
112
+ width: 20px;
113
+ height: 16px;
114
+ background-repeat: no-repeat;
115
+
116
+ }
117
+ .saswp-rvw-str .str-ic{
118
+ display:inline-block;
119
+ width: 20px;
120
+ height: 16px;
121
+ background-repeat: no-repeat;
122
+
123
+ }
124
+ .saswp-rvw-str .df-clr{
125
+ display:inline-block;
126
+ width: 20px;
127
+ height: 16px;
128
+ background-repeat: no-repeat;
129
+ }
130
+ @media(max-width:500px){
131
+ .saswp-pc-wrap{
132
+ display:block;
133
+ }
134
+ .saswp-pc-wrap .saswp-lst{
135
+ margin-bottom:20px;
136
+ }
137
+ }
admin_section/fields-generator.php CHANGED
@@ -220,7 +220,42 @@ class saswp_fields_generator {
220
  );
221
  }
222
  $input .= '</select>';
223
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  default:
225
 
226
  switch ($meta_field['id']) {
@@ -298,7 +333,7 @@ class saswp_fields_generator {
298
  <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/citysearch-img.png">
299
  <span>Citysearch</span>
300
  </li>
301
- <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/consumeraffairs-img.png">
302
  <span>Consumer Affairs</span>
303
  </li>
304
  <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/creditkarma-img.png">
@@ -322,7 +357,7 @@ class saswp_fields_generator {
322
  <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/expedia-img.png">
323
  <span>Expedia</span>
324
  </li>
325
- <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/facebook-1-img.png">
326
  <span>Facebook</span>
327
  </li>
328
  <li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/flipkart-img.png">
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']) {
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">
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">
admin_section/js/amp/collection-front.js DELETED
File without changes
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
 
@@ -607,108 +609,7 @@ return false;
607
  }else{
608
  $("#saswp-for-wordpress").val(0);
609
  }
610
- break;
611
- case 'saswp-facebook-enable-checkbox':
612
-
613
- if ($(this).is(':checked')) {
614
- $("#saswp-facebook-enable").val(1);
615
- $("#sd_facebook").show();
616
- }else{
617
- $("#saswp-facebook-enable").val(0);
618
- $("#sd_facebook").hide();
619
- }
620
- break;
621
- case 'saswp-twitter-enable-checkbox':
622
-
623
- if ($(this).is(':checked')) {
624
- $("#saswp-twitter-enable").val(1);
625
- $("#sd_twitter").show();
626
- }else{
627
- $("#saswp-twitter-enable").val(0);
628
- $("#sd_twitter").hide();
629
- }
630
- break;
631
- case 'saswp-google-plus-enable-checkbox':
632
-
633
- if ($(this).is(':checked')) {
634
- $("#saswp-google-plus-enable").val(1);
635
- $("#sd_google_plus").show();
636
- }else{
637
- $("#saswp-google-plus-enable").val(0);
638
- $("#sd_google_plus").hide();
639
- }
640
- break;
641
- case 'saswp-instagram-enable-checkbox':
642
-
643
- if ($(this).is(':checked')) {
644
- $("#saswp-instagram-enable").val(1);
645
- $("#sd_instagram").show();
646
- }else{
647
- $("#saswp-instagram-enable").val(0);
648
- $("#sd_instagram").hide();
649
- }
650
- break;
651
- case 'saswp-youtube-enable-checkbox':
652
-
653
- if ($(this).is(':checked')) {
654
- $("#sd_youtube").show();
655
- $("#saswp-youtube-enable").val(1);
656
- }else{
657
- $("#saswp-youtube-enable").val(0);
658
- $("#sd_youtube").hide();
659
- }
660
- break;
661
- case 'saswp-linkedin-enable-checkbox':
662
-
663
- if ($(this).is(':checked')) {
664
- $("#saswp-linkedin-enable").val(1);
665
- $("#sd_linkedin").show();
666
- }else{
667
- $("#saswp-linkedin-enable").val(0);
668
- $("#sd_linkedin").hide();
669
- }
670
- break;
671
- case 'saswp-pinterest-enable-checkbox':
672
-
673
- if ($(this).is(':checked')) {
674
- $("#saswp-pinterest-enable").val(1);
675
- $("#sd_pinterest").show();
676
- }else{
677
- $("#saswp-pinterest-enable").val(0);
678
- $("#sd_pinterest").hide();
679
- }
680
- break;
681
- case 'saswp-soundcloud-enable-checkbox':
682
-
683
- if ($(this).is(':checked')) {
684
- $("#saswp-soundcloud-enable").val(1);
685
- $("#sd_soundcloud").show();
686
- }else{
687
- $("#saswp-soundcloud-enable").val(0);
688
- $("#sd_soundcloud").hide();
689
- }
690
- break;
691
- case 'saswp-tumblr-enable-checkbox':
692
-
693
- if ($(this).is(':checked')) {
694
- $("#saswp-tumblr-enable").val(1);
695
- $("#sd_tumblr").show();
696
- }else{
697
- $("#saswp-tumblr-enable").val(0);
698
- $("#sd_tumblr").hide();
699
- }
700
- break;
701
- case 'saswp-yelp-enable-checkbox':
702
-
703
- if ($(this).is(':checked')) {
704
- $("#saswp-yelp-enable").val(1);
705
- $("#sd_yelp").show();
706
- }else{
707
- $("#saswp-yelp-enable").val(0);
708
- $("#sd_yelp").hide();
709
- }
710
- break;
711
-
712
  case 'saswp-for-amp-checkbox':
713
 
714
  if ($(this).is(':checked')) {
@@ -912,6 +813,15 @@ return false;
912
  }
913
  break;
914
 
 
 
 
 
 
 
 
 
 
915
  case 'saswp-realhomes-checkbox':
916
  saswp_compatibliy_notes(current, id);
917
  if ($(this).is(':checked')) {
@@ -1225,6 +1135,56 @@ return false;
1225
 
1226
  break;
1227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1228
  case 'saswp-betteramp-checkbox':
1229
  saswp_compatibliy_notes(current, id);
1230
  if ($(this).is(':checked')) {
@@ -1319,8 +1279,7 @@ return false;
1319
  $(document).on("click", ".saswp_prev_close", function(e){
1320
  e.preventDefault();
1321
 
1322
- var id = $(this).attr('data-id');
1323
- console.log(id);
1324
  $(this).parent().remove();
1325
  $("#"+id).val('');
1326
  $("input[data-id='"+id+"_id']").val('');
@@ -1451,19 +1410,20 @@ return false;
1451
 
1452
  $(".saswp-send-query").on("click", function(e){
1453
  e.preventDefault();
1454
- var message = $("#saswp_query_message").val();
1455
- if($.trim(message) !=''){
 
 
1456
  $.ajax({
1457
  type: "POST",
1458
  url:ajaxurl,
1459
  dataType: "json",
1460
- data:{action:"saswp_send_query_message", message:message, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
1461
  success:function(response){
1462
  if(response['status'] =='t'){
1463
  $(".saswp-query-success").show();
1464
  $(".saswp-query-error").hide();
1465
- }else{
1466
- console.log('dd');
1467
  $(".saswp-query-success").hide();
1468
  $(".saswp-query-error").show();
1469
  }
@@ -1473,7 +1433,20 @@ return false;
1473
  }
1474
  });
1475
  }else{
1476
- alert('Please enter the message');
 
 
 
 
 
 
 
 
 
 
 
 
 
1477
  }
1478
 
1479
  });
@@ -1597,9 +1570,7 @@ return false;
1597
  //Review js starts here
1598
 
1599
  $(document).on("click", ".saswp-add-more-item",function(e){
1600
- e.preventDefault();
1601
- var rows = $('.saswp-review-item-list-table tr').length;
1602
- console.log(rows);
1603
  var html = '<tr class="saswp-review-item-tr">';
1604
  html += '<td>Review Item Feature</td>';
1605
  html += '<td><input type="text" name="saswp-review-item-feature[]"></td>';
@@ -2052,12 +2023,10 @@ return false;
2052
  $(".saswp-rating-div").rateYo({
2053
 
2054
  rating: saswp_reviews_data.rating_val,
2055
- halfStar: true,
2056
- //normalFill: "#ffd700",
2057
  readOnly: saswp_reviews_data.readonly,
2058
  onSet: function (rating, rateYoInstance) {
2059
- $(this).next().val(rating);
2060
- console.log(rating);
2061
  }
2062
 
2063
  });
@@ -2066,6 +2035,7 @@ return false;
2066
  //rating ends here
2067
 
2068
  $("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){
 
2069
  var current = $(this);
2070
 
2071
  current.parent().find('.saswp-phone-validation').remove();
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
 
609
  }else{
610
  $("#saswp-for-wordpress").val(0);
611
  }
612
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
  case 'saswp-for-amp-checkbox':
614
 
615
  if ($(this).is(':checked')) {
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-wp-event-aggregator-checkbox':
1139
+ saswp_compatibliy_notes(current, id);
1140
+ if ($(this).is(':checked')) {
1141
+ $("#saswp-wp-event-aggregator").val(1);
1142
+ }else{
1143
+ $("#saswp-wp-event-aggregator").val(0);
1144
+ }
1145
+
1146
+ break;
1147
+
1148
+ case 'saswp-easy-recipe-checkbox':
1149
+ saswp_compatibliy_notes(current, id);
1150
+ if ($(this).is(':checked')) {
1151
+ $("#saswp-easy-recipe").val(1);
1152
+ }else{
1153
+ $("#saswp-easy-recipe").val(0);
1154
+ }
1155
+
1156
+ break;
1157
+
1158
+ case 'saswp-tevolution-events-checkbox':
1159
+ saswp_compatibliy_notes(current, id);
1160
+ if ($(this).is(':checked')) {
1161
+ $("#saswp-tevolution-events").val(1);
1162
+ }else{
1163
+ $("#saswp-tevolution-events").val(0);
1164
+ }
1165
+
1166
+ break;
1167
+
1168
+ case 'saswp-strong-testimonials-checkbox':
1169
+ saswp_compatibliy_notes(current, id);
1170
+ if ($(this).is(':checked')) {
1171
+ $("#saswp-strong-testimonials").val(1);
1172
+ }else{
1173
+ $("#saswp-strong-testimonials").val(0);
1174
+ }
1175
+
1176
+ break;
1177
+
1178
+ case 'saswp-wordlift-checkbox':
1179
+ saswp_compatibliy_notes(current, id);
1180
+ if ($(this).is(':checked')) {
1181
+ $("#saswp-wordlift").val(1);
1182
+ }else{
1183
+ $("#saswp-wordlift").val(0);
1184
+ }
1185
+
1186
+ break;
1187
+
1188
  case 'saswp-betteramp-checkbox':
1189
  saswp_compatibliy_notes(current, id);
1190
  if ($(this).is(':checked')) {
1279
  $(document).on("click", ".saswp_prev_close", function(e){
1280
  e.preventDefault();
1281
 
1282
+ var id = $(this).attr('data-id');
 
1283
  $(this).parent().remove();
1284
  $("#"+id).val('');
1285
  $("input[data-id='"+id+"_id']").val('');
1410
 
1411
  $(".saswp-send-query").on("click", function(e){
1412
  e.preventDefault();
1413
+ var message = $("#saswp_query_message").val();
1414
+ var premium_cus = $("#saswp_query_premium_cus").val();
1415
+
1416
+ if($.trim(message) !='' && premium_cus){
1417
  $.ajax({
1418
  type: "POST",
1419
  url:ajaxurl,
1420
  dataType: "json",
1421
+ data:{action:"saswp_send_query_message", premium_cus:premium_cus,message:message, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
1422
  success:function(response){
1423
  if(response['status'] =='t'){
1424
  $(".saswp-query-success").show();
1425
  $(".saswp-query-error").hide();
1426
+ }else{
 
1427
  $(".saswp-query-success").hide();
1428
  $(".saswp-query-error").show();
1429
  }
1433
  }
1434
  });
1435
  }else{
1436
+
1437
+ if($.trim(message) =='' && premium_cus ==''){
1438
+ alert('Please enter the message and select customer type');
1439
+ }else{
1440
+
1441
+ if(premium_cus ==''){
1442
+ alert('Select Customer type');
1443
+ }
1444
+ if($.trim(message) == ''){
1445
+ alert('Please enter the message');
1446
+ }
1447
+
1448
+ }
1449
+
1450
  }
1451
 
1452
  });
1570
  //Review js starts here
1571
 
1572
  $(document).on("click", ".saswp-add-more-item",function(e){
1573
+ e.preventDefault();
 
 
1574
  var html = '<tr class="saswp-review-item-tr">';
1575
  html += '<td>Review Item Feature</td>';
1576
  html += '<td><input type="text" name="saswp-review-item-feature[]"></td>';
2023
  $(".saswp-rating-div").rateYo({
2024
 
2025
  rating: saswp_reviews_data.rating_val,
2026
+ halfStar: true,
 
2027
  readOnly: saswp_reviews_data.readonly,
2028
  onSet: function (rating, rateYoInstance) {
2029
+ $(this).next().val(rating);
 
2030
  }
2031
 
2032
  });
2035
  //rating ends here
2036
 
2037
  $("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){
2038
+
2039
  var current = $(this);
2040
 
2041
  current.parent().find('.saswp-phone-validation').remove();
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-facebook-enable-checkbox":s(this).is(":checked")?(s("#saswp-facebook-enable").val(1),s("#sd_facebook").show()):(s("#saswp-facebook-enable").val(0),s("#sd_facebook").hide());break;case"saswp-twitter-enable-checkbox":s(this).is(":checked")?(s("#saswp-twitter-enable").val(1),s("#sd_twitter").show()):(s("#saswp-twitter-enable").val(0),s("#sd_twitter").hide());break;case"saswp-google-plus-enable-checkbox":s(this).is(":checked")?(s("#saswp-google-plus-enable").val(1),s("#sd_google_plus").show()):(s("#saswp-google-plus-enable").val(0),s("#sd_google_plus").hide());break;case"saswp-instagram-enable-checkbox":s(this).is(":checked")?(s("#saswp-instagram-enable").val(1),s("#sd_instagram").show()):(s("#saswp-instagram-enable").val(0),s("#sd_instagram").hide());break;case"saswp-youtube-enable-checkbox":s(this).is(":checked")?(s("#sd_youtube").show(),s("#saswp-youtube-enable").val(1)):(s("#saswp-youtube-enable").val(0),s("#sd_youtube").hide());break;case"saswp-linkedin-enable-checkbox":s(this).is(":checked")?(s("#saswp-linkedin-enable").val(1),s("#sd_linkedin").show()):(s("#saswp-linkedin-enable").val(0),s("#sd_linkedin").hide());break;case"saswp-pinterest-enable-checkbox":s(this).is(":checked")?(s("#saswp-pinterest-enable").val(1),s("#sd_pinterest").show()):(s("#saswp-pinterest-enable").val(0),s("#sd_pinterest").hide());break;case"saswp-soundcloud-enable-checkbox":s(this).is(":checked")?(s("#saswp-soundcloud-enable").val(1),s("#sd_soundcloud").show()):(s("#saswp-soundcloud-enable").val(0),s("#sd_soundcloud").hide());break;case"saswp-tumblr-enable-checkbox":s(this).is(":checked")?(s("#saswp-tumblr-enable").val(1),s("#sd_tumblr").show()):(s("#saswp-tumblr-enable").val(0),s("#sd_tumblr").hide());break;case"saswp-yelp-enable-checkbox":s(this).is(":checked")?(s("#saswp-yelp-enable").val(1),s("#sd_yelp").show()):(s("#saswp-yelp-enable").val(0),s("#sd_yelp").hide());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-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");console.log(a),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();""!=s.trim(a)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_send_query_message",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()):(console.log("dd"),s(".saswp-query-success").hide(),s(".saswp-query-error").show())},error:function(s){console.log(s)}}):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();var a=s(".saswp-review-item-list-table tr").length;console.log(a);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),console.log(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(),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||"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-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 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)});
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
 
@@ -1160,10 +1165,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
 
@@ -1271,8 +1289,8 @@ function saswp_import_callback(){
1271
 
1272
  </ul>
1273
  <?php
1274
- echo '<h2>'.esc_html__('Import / Export','schema-and-structured-data-for-wp').'</h2>';
1275
- $url = wp_nonce_url(admin_url('admin-ajax.php?action=saswp_export_all_settings_and_schema'), '_wpnonce');
1276
  ?>
1277
  <ul>
1278
  <li>
@@ -1579,7 +1597,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 +1695,30 @@ 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 +1805,18 @@ function saswp_compatibility_page_callback(){
1763
  'name' => 'sd_data[saswp-realhomes]',
1764
  )
1765
  );
 
 
 
 
 
 
 
 
 
 
 
 
1766
 
1767
  $learn_press = array(
1768
  'label' => 'LearnPress',
@@ -1940,6 +1994,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',
@@ -2167,6 +2233,30 @@ function saswp_compatibility_page_callback(){
2167
  'name' => 'sd_data[saswp-testimonial-pro]',
2168
  )
2169
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2170
 
2171
  $flex_lmx = array(
2172
  'label' => 'FlexMLS IDX Plugin',
@@ -2196,7 +2286,9 @@ function saswp_compatibility_page_callback(){
2196
  if(!is_plugin_active('real-estate-schema/real-estate-schema.php')){
2197
 
2198
  $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>';
2199
- $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>';
 
 
2200
 
2201
  }
2202
 
@@ -2216,6 +2308,8 @@ function saswp_compatibility_page_callback(){
2216
  $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>';
2217
  $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>';
2218
  $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>';
 
 
2219
 
2220
  }
2221
 
@@ -2224,7 +2318,8 @@ function saswp_compatibility_page_callback(){
2224
  $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>';
2225
  $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>';
2226
  $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>';
2227
- $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>';
 
2228
 
2229
  }
2230
 
@@ -2255,11 +2350,13 @@ function saswp_compatibility_page_callback(){
2255
  $recipe_maker,
2256
  $wp_ultimate_recipe,
2257
  $zip_recipes,
 
2258
  $mediavine_create,
2259
  $ht_recipes,
2260
  $rankmath,
2261
  $homeland_theme,
2262
  $real_homes,
 
2263
  $learn_press,
2264
  $learn_dash,
2265
  $lifter_lms,
@@ -2269,9 +2366,13 @@ function saswp_compatibility_page_callback(){
2269
  $events_calendar_wd,
2270
  $event_organiser,
2271
  $modern_events_calendar,
 
 
2272
  $easy_testimonials,
2273
  $bne_testimonials,
2274
  $testimonial_pro,
 
 
2275
  $flex_lmx
2276
 
2277
  );
@@ -2421,7 +2522,15 @@ function saswp_support_page_callback(){
2421
  <br>
2422
  <span class="saswp-query-success saswp_hide"><?php echo esc_html__('Message sent successfully, Please wait we will get back to you shortly', 'schema-and-structured-data-for-wp'); ?></span>
2423
  <span class="saswp-query-error saswp_hide"><?php echo esc_html__('Message not sent. please check your network connection', 'schema-and-structured-data-for-wp'); ?></span>
2424
- </li>
 
 
 
 
 
 
 
 
2425
  <li><button class="button saswp-send-query"><?php echo esc_html__('Send Message', 'schema-and-structured-data-for-wp'); ?></button></li>
2426
  </ul>
2427
 
@@ -2514,60 +2623,24 @@ function saswp_enqueue_style_js( $hook ) {
2514
  }
2515
  add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
2516
 
2517
- function saswp_get_field_note($pname){
 
 
 
 
 
 
 
2518
 
2519
- $notes = array(
2520
- '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>',
2521
- 'ampbyautomatic' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/amp/">AMP</a>',
2522
- 'betteramp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/kk-star-ratings/">Better AMP</a>',
2523
- '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>',
2524
- '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>',
2525
- '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>',
2526
- 'bb_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bbpress/">bbPress</a>',
2527
- 'woocommerce' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce</a>',
2528
- 'cooked' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/cooked/">Cooked</a>',
2529
- 'the_events_calendar' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/the-events-calendar/">The Events Calendar</a>',
2530
- 'yoast_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a>',
2531
- 'rank_math' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/seo-by-rank-math/">WordPress SEO Plugin – Rank Math</a>',
2532
- 'dw_qna' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">DW Question Answer</a>',
2533
- 'smart_crawl' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/smartcrawl-seo/">SmartCrawl Seo</a>',
2534
- 'the_seo_framework' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/autodescription/">The Seo Framework</a>',
2535
- 'seo_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-seopress/">SEOPress</a>',
2536
- 'aiosp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>',
2537
- 'squirrly_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/squirrly-seo/">Squirrly SEO</a>',
2538
- 'wp_recipe_maker' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-recipe-maker/">WP Recipe Maker</a>',
2539
- 'wp_ultimate_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-ultimate-recipe/">WP Ultimate Recipe</a>',
2540
- 'learn_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/learnpress/">Learn Press</a>',
2541
- 'learn_dash' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.learndash.com/pricing-and-purchase/">Learn Dash</a>',
2542
- 'lifter_lms' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/lifterlms/">LifterLMS</a>',
2543
- 'wp_event_manager' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-event-manager/">WP Event Manager</a>',
2544
- 'events_manager' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/events-manager/">Events Manager</a>',
2545
- 'event_calendar_wd' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/event-calendar-wd/">Event Calendar WD</a>',
2546
- 'event_organiser' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/event-organiser/">Event Organiser</a>',
2547
- 'modern_events_calendar' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/modern-events-calendar-lite/">Modern Events Calendar Lite</a>',
2548
- 'flex_mls_idx' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/flexmls-idx/">FlexMLS IDX</a>',
2549
- 'woocommerce_membership' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Membership</a>',
2550
- 'woocommerce_bookings' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce Bookings</a>',
2551
- 'extra' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.elegantthemes.com/gallery/extra/">Extra Theme</a>',
2552
- '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>',
2553
- '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>',
2554
- '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>',
2555
- '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>',
2556
- 'zip_recipes' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/zip-recipes/">Zip Recipes</a>',
2557
- 'mediavine_create' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/mediavine-create/">Create by Mediavine</a>',
2558
- '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>',
2559
- 'easy_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/easy-testimonials">Easy Testimonials</a>',
2560
- 'bne_testimonials' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/bne-testimonials/">BNE Testimonials</a>',
2561
- '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>'
2562
-
2563
- );
2564
-
2565
- $active = saswp_compatible_active_list();
2566
-
2567
- if(!isset($active[$pname])){
2568
-
2569
- return $notes[$pname];
2570
 
2571
  }
2572
 
2573
- }
 
 
 
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
 
1165
  'id' => 'saswp-other-images',
1166
  'name' => 'sd_data[saswp-other-images]',
1167
  )
1168
+ )
1169
 
1170
  );
1171
 
1172
+ if(saswp_current_user_role() == 'administrator'){
1173
+
1174
+ $meta_fields[] = array(
1175
+ 'label' => 'Role Based Access',
1176
+ 'id' => 'saswp-role-based-access',
1177
+ 'name' => 'sd_data[saswp-role-based-access]',
1178
+ 'type' => 'multiselect',
1179
+ 'note' => 'Choose the users whom you want to allow full access to this plugin',
1180
+ 'class' => 'saswp-role-based-access-class',
1181
+ 'options' => saswp_get_user_roles()
1182
+ );
1183
+
1184
+ }
1185
 
1186
  ?>
1187
 
1289
 
1290
  </ul>
1291
  <?php
1292
+ echo '<h2>'.esc_html__('Import / Export','schema-and-structured-data-for-wp').'</h2>';
1293
+ $url = wp_nonce_url(admin_url('admin-ajax.php?action=saswp_export_all_settings_and_schema'), '_wpnonce');
1294
  ?>
1295
  <ul>
1296
  <li>
1597
  <div class="saswp-quick-links-div">
1598
  <h4><?php echo esc_html__('Quick Links','schema-and-structured-data-for-wp'); ?></h4>
1599
  <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>
1600
+ <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>
1601
  </div>
1602
 
1603
  </div>
1695
  'name' => 'sd_data[saswp-ampbyautomatic]',
1696
  )
1697
  );
1698
+ $tevolution_events = array(
1699
+ 'label' => 'Tevolution Events',
1700
+ 'id' => 'saswp-tevolution-events-checkbox',
1701
+ 'name' => 'saswp-tevolution-events-checkbox',
1702
+ 'type' => 'checkbox',
1703
+ 'class' => 'checkbox saswp-checkbox',
1704
+ 'note' => saswp_get_field_note('tevolution_events'),
1705
+ 'hidden' => array(
1706
+ 'id' => 'saswp-tevolution-events',
1707
+ 'name' => 'sd_data[saswp-tevolution-events]',
1708
+ )
1709
+ );
1710
+ $wp_event_aggregator = array(
1711
+ 'label' => 'WP Event Aggregator',
1712
+ 'id' => 'saswp-wp-event-aggregator-checkbox',
1713
+ 'name' => 'saswp-wp-event-aggregator-checkbox',
1714
+ 'type' => 'checkbox',
1715
+ 'class' => 'checkbox saswp-checkbox',
1716
+ 'note' => saswp_get_field_note('wp_event_aggregator'),
1717
+ 'hidden' => array(
1718
+ 'id' => 'saswp-wp-event-aggregator',
1719
+ 'name' => 'sd_data[saswp-wp-event-aggregator]',
1720
+ )
1721
+ );
1722
  $betteramp = array(
1723
  'label' => 'Better AMP',
1724
  'id' => 'saswp-betteramp-checkbox',
1805
  'name' => 'sd_data[saswp-realhomes]',
1806
  )
1807
  );
1808
+ $wpresidence = array(
1809
+ 'label' => 'WP Residence Theme',
1810
+ 'id' => 'saswp-wpresidence-checkbox',
1811
+ 'name' => 'saswp-wpresidence-checkbox',
1812
+ 'type' => 'checkbox',
1813
+ 'class' => 'checkbox saswp-checkbox',
1814
+ 'note' => saswp_get_field_note('wpresidence'),
1815
+ 'hidden' => array(
1816
+ 'id' => 'saswp-wpresidence',
1817
+ 'name' => 'sd_data[saswp-wpresidence]',
1818
+ )
1819
+ );
1820
 
1821
  $learn_press = array(
1822
  'label' => 'LearnPress',
1994
  'name' => 'sd_data[saswp-zip-recipes]',
1995
  )
1996
  );
1997
+ $easyrecipe = array(
1998
+ 'label' => 'EasyRecipe',
1999
+ 'id' => 'saswp-easy-recipe-checkbox',
2000
+ 'name' => 'saswp-easy-recipe-checkbox',
2001
+ 'type' => 'checkbox',
2002
+ 'class' => 'checkbox saswp-checkbox',
2003
+ 'note' => saswp_get_field_note('easy_recipe'),
2004
+ 'hidden' => array(
2005
+ 'id' => 'saswp-easy-recipe',
2006
+ 'name' => 'sd_data[saswp-easy-recipe]',
2007
+ )
2008
+ );
2009
  $mediavine_create = array(
2010
  'label' => 'Create by Mediavine',
2011
  'id' => 'saswp-mediavine-create-checkbox',
2233
  'name' => 'sd_data[saswp-testimonial-pro]',
2234
  )
2235
  );
2236
+ $strong_testimonials = array(
2237
+ 'label' => 'Strong Testimonials',
2238
+ 'id' => 'saswp-strong-testimonials-checkbox',
2239
+ 'name' => 'saswp-strong-testimonials-checkbox',
2240
+ 'type' => 'checkbox',
2241
+ 'class' => 'checkbox saswp-checkbox',
2242
+ 'note' => saswp_get_field_note('strong_testimonials'),
2243
+ 'hidden' => array(
2244
+ 'id' => 'saswp-strong-testimonials',
2245
+ 'name' => 'sd_data[saswp-strong-testimonials]',
2246
+ )
2247
+ );
2248
+ $WordLift = array(
2249
+ 'label' => 'WordLift',
2250
+ 'id' => 'saswp-wordlift-checkbox',
2251
+ 'name' => 'saswp-wordlift-checkbox',
2252
+ 'type' => 'checkbox',
2253
+ 'class' => 'checkbox saswp-checkbox',
2254
+ 'note' => saswp_get_field_note('wordlift'),
2255
+ 'hidden' => array(
2256
+ 'id' => 'saswp-wordlift',
2257
+ 'name' => 'sd_data[saswp-wordlift]',
2258
+ )
2259
+ );
2260
 
2261
  $flex_lmx = array(
2262
  'label' => 'FlexMLS IDX Plugin',
2286
  if(!is_plugin_active('real-estate-schema/real-estate-schema.php')){
2287
 
2288
  $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>';
2289
+ $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>';
2290
+ $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>';
2291
+
2292
 
2293
  }
2294
 
2308
  $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>';
2309
  $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>';
2310
  $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>';
2311
+ $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>';
2312
+ $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>';
2313
 
2314
  }
2315
 
2318
  $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>';
2319
  $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>';
2320
  $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>';
2321
+ $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>';
2322
+ $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>';
2323
 
2324
  }
2325
 
2350
  $recipe_maker,
2351
  $wp_ultimate_recipe,
2352
  $zip_recipes,
2353
+ $easyrecipe,
2354
  $mediavine_create,
2355
  $ht_recipes,
2356
  $rankmath,
2357
  $homeland_theme,
2358
  $real_homes,
2359
+ $wpresidence,
2360
  $learn_press,
2361
  $learn_dash,
2362
  $lifter_lms,
2366
  $events_calendar_wd,
2367
  $event_organiser,
2368
  $modern_events_calendar,
2369
+ $tevolution_events,
2370
+ $wp_event_aggregator,
2371
  $easy_testimonials,
2372
  $bne_testimonials,
2373
  $testimonial_pro,
2374
+ $strong_testimonials,
2375
+ $WordLift,
2376
  $flex_lmx
2377
 
2378
  );
2522
  <br>
2523
  <span class="saswp-query-success saswp_hide"><?php echo esc_html__('Message sent successfully, Please wait we will get back to you shortly', 'schema-and-structured-data-for-wp'); ?></span>
2524
  <span class="saswp-query-error saswp_hide"><?php echo esc_html__('Message not sent. please check your network connection', 'schema-and-structured-data-for-wp'); ?></span>
2525
+ </li>
2526
+ <li>
2527
+ <strong><?php echo esc_html__('Are you a premium customer ?', 'schema-and-structured-data-for-wp'); ?></strong>
2528
+ <select id="saswp_query_premium_cus" name="saswp_query_premium_cus">
2529
+ <option value=""><?php echo esc_html__('Select', 'schema-and-structured-data-for-wp'); ?></option>
2530
+ <option value="yes"><?php echo esc_html__('Yes', 'schema-and-structured-data-for-wp'); ?></option>
2531
+ <option value="no"><?php echo esc_html__('No', 'schema-and-structured-data-for-wp'); ?></option>
2532
+ </select>
2533
+ </li>
2534
  <li><button class="button saswp-send-query"><?php echo esc_html__('Send Message', 'schema-and-structured-data-for-wp'); ?></button></li>
2535
  </ul>
2536
 
2623
  }
2624
  add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
2625
 
2626
+
2627
+ function saswp_option_page_capability( $capability ) {
2628
+ return saswp_current_user_can();
2629
+ }
2630
+
2631
+ add_filter( 'option_page_capability_sd_data_group', 'saswp_option_page_capability' );
2632
+
2633
+ function saswp_pre_update_settings($value, $old_value, $option){
2634
 
2635
+ if(saswp_current_user_role() != 'administrator'){
2636
+
2637
+ if(isset($old_value['saswp-role-based-access'])){
2638
+ $value['saswp-role-based-access'] = $old_value['saswp-role-based-access'];
2639
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2640
 
2641
  }
2642
 
2643
+ return $value;
2644
+ }
2645
+
2646
+ 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,13 +622,24 @@ if(is_admin()){
624
  'supports' => array('title'),
625
  'menu_position' => 100
626
 
627
- )
628
- );
629
- }
 
 
 
 
 
 
 
 
 
 
 
630
 
631
  function saswp_select_callback($post) {
632
 
633
- $data_group_array = esc_sql ( get_post_meta($post->ID, 'data_group_array', true) );
634
  $data_group_array = is_array($data_group_array)? array_values($data_group_array): array();
635
 
636
  if ( empty( $data_group_array ) ) {
@@ -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;
@@ -1274,23 +1288,32 @@ function saswp_send_query_message(){
1274
  if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
1275
  return;
1276
  }
 
 
 
 
1277
 
1278
- $message = sanitize_textarea_field($_POST['message']);
1279
- $user = wp_get_current_user();
 
1280
 
1281
- $message = $message.'\n\n\n'.'Support query from a Schema User';
 
 
1282
 
1283
  if($user){
1284
 
1285
  $user_data = $user->data;
1286
  $user_email = $user_data->user_email;
1287
  //php mailer variables
1288
- $sendto = 'team@magazine3.com';
1289
- $subject = "Schema Customer Query";
1290
- $headers = 'From: '. esc_attr($user_email) . "\r\n" .
1291
- 'Reply-To: ' . esc_attr($user_email) . "\r\n";
 
 
1292
  // Load WP components, no themes.
1293
- $sent = wp_mail($sendto, $subject, strip_tags($message), $headers);
1294
 
1295
  if($sent){
1296
 
@@ -1303,9 +1326,8 @@ function saswp_send_query_message(){
1303
  }
1304
 
1305
  }
1306
-
1307
-
1308
- wp_die();
1309
  }
1310
 
1311
  add_action('wp_ajax_saswp_send_query_message', 'saswp_send_query_message');
@@ -1317,7 +1339,7 @@ add_action('wp_ajax_saswp_send_query_message', 'saswp_send_query_message');
1317
  */
1318
  function saswp_import_plugin_data(){
1319
 
1320
- if ( ! current_user_can( 'manage_options' ) ) {
1321
  return;
1322
  }
1323
 
@@ -1392,7 +1414,7 @@ add_action('wp_ajax_saswp_import_plugin_data', 'saswp_import_plugin_data');
1392
 
1393
  function saswp_feeback_no_thanks(){
1394
 
1395
- if ( ! current_user_can( 'manage_options' ) ) {
1396
  return;
1397
  }
1398
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -1422,7 +1444,7 @@ add_action('wp_ajax_saswp_feeback_no_thanks', 'saswp_feeback_no_thanks');
1422
 
1423
  function saswp_feeback_remindme(){
1424
 
1425
- if ( ! current_user_can( 'manage_options' ) ) {
1426
  return;
1427
  }
1428
  if ( ! isset( $_GET['saswp_security_nonce'] ) ){
@@ -1586,7 +1608,7 @@ function saswp_license_status($add_on, $license_status, $license_key){
1586
 
1587
  function saswp_license_status_check(){
1588
 
1589
- if ( ! current_user_can( 'manage_options' ) ) {
1590
  return;
1591
  }
1592
  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
 
642
+ $data_group_array = get_post_meta($post->ID, 'data_group_array', true );
643
  $data_group_array = is_array($data_group_array)? array_values($data_group_array): array();
644
 
645
  if ( empty( $data_group_array ) ) {
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;
1288
  if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
1289
  return;
1290
  }
1291
+ $customer_type = 'Are you a premium customer ? No';
1292
+ $message = sanitize_textarea_field($_POST['message']);
1293
+ $premium_cus = sanitize_textarea_field($_POST['premium_cus']);
1294
+ $user = wp_get_current_user();
1295
 
1296
+ if($premium_cus == 'yes'){
1297
+ $customer_type = 'Are you a premium customer ? Yes';
1298
+ }
1299
 
1300
+ $message = '<p>'.$message.'</p><br><br>'
1301
+ . $customer_type
1302
+ . '<br><br>'.'Query from plugin support tab';
1303
 
1304
  if($user){
1305
 
1306
  $user_data = $user->data;
1307
  $user_email = $user_data->user_email;
1308
  //php mailer variables
1309
+ $sendto = 'team@magazine3.com';
1310
+ $subject = "Schema Customer Query";
1311
+
1312
+ $headers[] = 'Content-Type: text/html; charset=UTF-8';
1313
+ $headers[] = 'From: '. esc_attr($user_email);
1314
+ $headers[] = 'Reply-To: ' . esc_attr($user_email);
1315
  // Load WP components, no themes.
1316
+ $sent = wp_mail($sendto, $subject, $message, $headers);
1317
 
1318
  if($sent){
1319
 
1326
  }
1327
 
1328
  }
1329
+
1330
+ wp_die();
 
1331
  }
1332
 
1333
  add_action('wp_ajax_saswp_send_query_message', 'saswp_send_query_message');
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'] ) ){
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,38 @@ if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  return array(
6
  'plugins' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  'ampforwp' => array(
8
  'name' => 'AMPforWP',
9
  'free' => 'accelerated-mobile-pages/accelerated-moblie-pages.php',
@@ -267,5 +299,11 @@ return array(
267
  'opt_name' => 'saswp-realhomes',
268
  'part_in' => 'pro',
269
  ),
 
 
 
 
 
 
270
  )
271
  );
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',
30
+ 'opt_name' => 'saswp-strong-testimonials',
31
+ 'part_in' => 'free',
32
+ ),
33
+ 'wordlift' => array(
34
+ 'name' => 'WordLift',
35
+ 'free' => 'wordlift/wordlift.php',
36
+ 'opt_name' => 'saswp-wordlift',
37
+ 'part_in' => 'free',
38
+ ),
39
  'ampforwp' => array(
40
  'name' => 'AMPforWP',
41
  'free' => 'accelerated-mobile-pages/accelerated-moblie-pages.php',
299
  'opt_name' => 'saswp-realhomes',
300
  'part_in' => 'pro',
301
  ),
302
+ 'wpresidence' => array(
303
+ 'name' => 'WP Residence',
304
+ 'free' => 'wpresidence',
305
+ 'opt_name' => 'saswp-wpresidence',
306
+ 'part_in' => 'pro',
307
+ ),
308
  )
309
  );
core/array-list/repeater-fields.php CHANGED
@@ -145,9 +145,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(
145
  'label' => 'Performer Type',
146
  'name' => 'saswp_event_performer_type',
147
  'type' => 'select',
148
+ 'options' => array(
149
+ 'Person' => 'Person',
150
+ 'Organization' => 'Organization',
151
+ 'MusicGroup' => 'MusicGroup'
152
  )
153
  ),
154
  array(
core/array-list/schema-properties.php CHANGED
@@ -703,9 +703,9 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
703
  ),
704
  array(
705
  'label' => 'Organization Logo',
706
- 'id' => 'saswp_article_organization_logo_'.$schema_id,
707
- 'type' => 'media',
708
- 'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
709
  ),
710
  array(
711
  'label' => 'Speakable',
@@ -843,6 +843,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
 
@@ -1571,7 +1576,8 @@ 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',
@@ -3482,6 +3488,78 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
3482
  ),
3483
  );
3484
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3485
 
3486
  default:
3487
  break;
703
  ),
704
  array(
705
  'label' => 'Organization Logo',
706
+ 'id' => 'saswp_article_organization_logo_'.$schema_id,
707
+ 'type' => 'media',
708
+ 'default' => isset($sd_data['sd_logo']['url']) ? $sd_data['sd_logo']['url']:''
709
  ),
710
  array(
711
  'label' => 'Speakable',
843
  'id' => 'saswp_event_schema_url_'.$schema_id,
844
  'type' => 'text',
845
  ),
846
+ array(
847
+ 'label' => 'Performer Name',
848
+ 'id' => 'saswp_event_schema_performer_name_'.$schema_id,
849
+ 'type' => 'text',
850
+ ),
851
  );
852
  break;
853
 
1576
  'Event' => 'Event',
1577
  'HowTo' => 'HowTo',
1578
  'local_business' => 'LocalBusiness',
1579
+ 'MusicPlaylist' => 'Music Playlist',
1580
+ 'Organization' => 'Organization',
1581
  'Product' => 'Product',
1582
  'Recipe' => 'Recipe',
1583
  'SoftwareApplication' => 'SoftwareApplication',
3488
  ),
3489
  );
3490
  break;
3491
+
3492
+ case 'Organization':
3493
+
3494
+ $meta_field = array(
3495
+ array(
3496
+ 'label' => 'Name',
3497
+ 'id' => 'saswp_organization_name_'.$schema_id,
3498
+ 'type' => 'text',
3499
+ ),
3500
+ array(
3501
+ 'label' => 'Description',
3502
+ 'id' => 'saswp_organization_description_'.$schema_id,
3503
+ 'type' => 'text',
3504
+ ),
3505
+ array(
3506
+ 'label' => 'URL',
3507
+ 'id' => 'saswp_organization_url_'.$schema_id,
3508
+ 'type' => 'text',
3509
+ ),
3510
+ array(
3511
+ 'label' => 'Logo',
3512
+ 'id' => 'saswp_organization_logo_'.$schema_id,
3513
+ 'type' => 'media',
3514
+ ),
3515
+ array(
3516
+ 'label' => 'Street Address',
3517
+ 'id' => 'saswp_organization_street_address_'.$schema_id,
3518
+ 'type' => 'text',
3519
+ ),
3520
+ array(
3521
+ 'label' => 'City',
3522
+ 'id' => 'saswp_organization_city_'.$schema_id,
3523
+ 'type' => 'text',
3524
+ ),
3525
+ array(
3526
+ 'label' => 'State',
3527
+ 'id' => 'saswp_organization_state_'.$schema_id,
3528
+ 'type' => 'text',
3529
+ ),
3530
+ array(
3531
+ 'label' => 'Country',
3532
+ 'id' => 'saswp_organization_country_'.$schema_id,
3533
+ 'type' => 'text',
3534
+ ),
3535
+ array(
3536
+ 'label' => 'Postal Code',
3537
+ 'id' => 'saswp_organization_postal_code_'.$schema_id,
3538
+ 'type' => 'text',
3539
+ ),
3540
+ array(
3541
+ 'label' => 'Telephone',
3542
+ 'id' => 'saswp_organization_telephone_'.$schema_id,
3543
+ 'type' => 'text',
3544
+ ),
3545
+ array(
3546
+ 'label' => 'Aggregate Rating',
3547
+ 'id' => 'saswp_organization_enable_rating_'.$schema_id,
3548
+ 'type' => 'checkbox',
3549
+ ),
3550
+ array(
3551
+ 'label' => 'Rating',
3552
+ 'id' => 'saswp_organization_rating_value_'.$schema_id,
3553
+ 'type' => 'text',
3554
+ ),
3555
+ array(
3556
+ 'label' => 'Rating Count',
3557
+ 'id' => 'saswp_organization_rating_count_'.$schema_id,
3558
+ 'type' => 'text',
3559
+ ),
3560
+
3561
+ );
3562
+ break;
3563
 
3564
  default:
3565
  break;
core/queries_function.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ function saswp_post_exists($id){
8
+
9
+ global $wpdb;
10
+ $post_exists = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE id = '" . $id . "'", 'ARRAY_A');
11
+ return $post_exists;
12
+
13
+ }
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(){
@@ -243,21 +254,27 @@ class SASWP_Reviews_Collection {
243
 
244
  $collection = array();
245
  $total_collection = array();
 
246
  $dots = $f_interval = $f_visibility = $arrow = 1;
247
- $g_type = '';
248
 
249
  $collection_data = get_post_meta($attr['id'], $key='', true);
250
 
251
- $design = $collection_data['saswp_collection_design'][0];
252
- $this->_design = $design;
253
- $cols = $collection_data['saswp_collection_cols'][0];
 
 
 
 
 
 
254
 
255
  if(isset($collection_data['saswp_gallery_arrow'][0])){
256
 
257
  $arrow = $collection_data['saswp_gallery_arrow'][0];
258
  }
259
-
260
-
261
  if(isset($collection_data['saswp_gallery_dots'][0])){
262
  $dots = $collection_data['saswp_gallery_dots'][0];
263
  }
@@ -274,9 +291,14 @@ class SASWP_Reviews_Collection {
274
  $f_visibility = $collection_data['saswp_fomo_visibility'][0];
275
  }
276
 
277
- $sorting = $collection_data['saswp_collection_sorting'][0];
278
- $platform_id = unserialize($collection_data['saswp_platform_ids'][0]);
 
279
 
 
 
 
 
280
  if($platform_id){
281
 
282
  foreach ($platform_id as $key => $val){
@@ -355,7 +377,7 @@ class SASWP_Reviews_Collection {
355
 
356
  public function saswp_admin_collection_interface_render(){
357
 
358
- if ( ! current_user_can( 'manage_options' ) ) return;
359
  if ( !wp_verify_nonce( $_GET['_wpnonce'], '_wpnonce' ) ) return;
360
 
361
  $post_meta = array();
@@ -562,7 +584,7 @@ class SASWP_Reviews_Collection {
562
  public function saswp_save_collection_data(){
563
 
564
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
565
- if ( ! current_user_can( 'manage_options' ) ) return ;
566
  if ( ! isset( $_POST['saswp_collection_nonce'] ) || ! wp_verify_nonce( $_POST['saswp_collection_nonce'], 'saswp_collection_nonce_data' ) ) return;
567
 
568
  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(){
254
 
255
  $collection = array();
256
  $total_collection = array();
257
+ $platform_id = array();
258
  $dots = $f_interval = $f_visibility = $arrow = 1;
259
+ $g_type = $design = $cols = $sorting = '';
260
 
261
  $collection_data = get_post_meta($attr['id'], $key='', true);
262
 
263
+ if(isset($collection_data['saswp_collection_design'][0])){
264
+ $design = $collection_data['saswp_collection_design'][0];
265
+ $this->_design = $design;
266
+ }
267
+
268
+ if(isset($collection_data['saswp_collection_cols'][0])){
269
+
270
+ $cols = $collection_data['saswp_collection_cols'][0];
271
+ }
272
 
273
  if(isset($collection_data['saswp_gallery_arrow'][0])){
274
 
275
  $arrow = $collection_data['saswp_gallery_arrow'][0];
276
  }
277
+
 
278
  if(isset($collection_data['saswp_gallery_dots'][0])){
279
  $dots = $collection_data['saswp_gallery_dots'][0];
280
  }
291
  $f_visibility = $collection_data['saswp_fomo_visibility'][0];
292
  }
293
 
294
+ if(isset($collection_data['saswp_collection_sorting'][0])){
295
+ $sorting = $collection_data['saswp_collection_sorting'][0];
296
+ }
297
 
298
+ if(isset($collection_data['saswp_platform_ids'][0])){
299
+ $platform_id = unserialize($collection_data['saswp_platform_ids'][0]);
300
+ }
301
+
302
  if($platform_id){
303
 
304
  foreach ($platform_id as $key => $val){
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,15 +39,19 @@ 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
- require_once SASWP_PLUGIN_DIR_PATH .'core/3rd-party/class-amp-review-form-blacklist.php';
46
-
47
- unset($data['AMPFORWP_Blacklist_Sanitizer']);
48
- unset($data['AMP_Blacklist_Sanitizer']);
49
- $data[ 'AMP_Review_Form_Blacklist' ] = array();
50
-
51
  return $data;
52
 
53
  }
@@ -64,124 +68,61 @@ class SASWP_Reviews_Form {
64
  return self::$instance;
65
  }
66
 
 
 
67
  public function saswp_save_review_form_data(){
68
 
69
- $form_data = $_POST;
70
-
71
- if($form_data['action'] == 'saswp_review_form'){
72
-
73
- $rv_link = $form_data['saswp_review_link'];
74
-
75
- if(strpos($_SERVER['QUERY_STRING'], 'amp_source') !== false){
76
-
77
- $rv_link = ampforwp_url_controller($rv_link);
78
-
79
- header("access-control-allow-credentials:true");
80
- header("access-control-allow-headers:Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token");
81
- header("Access-Control-Allow-Origin:".$_SERVER['HTTP_ORIGIN']);
82
- $siteUrl = parse_url( get_site_url() );
83
- header("AMP-Access-Control-Allow-Source-Origin:".$siteUrl['scheme'] . '://' . $siteUrl['host']);
84
- header("Content-Type:application/json;charset=utf-8");
85
-
86
- if(!wp_verify_nonce($form_data['saswp_review_nonce'], 'saswp_review_form')){
87
- header("AMP-Redirect-To: ".$rv_link);
88
- header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin");
89
- echo json_decode(array('message'=> 'Nonce MisMatch'));
90
- die;
91
- }
92
-
93
- }else{
94
-
95
- if(!wp_verify_nonce($form_data['saswp_review_nonce'], 'saswp_review_form')){
96
- wp_redirect( $rv_link );
97
- exit;
98
- }
99
-
100
  }
 
 
101
 
102
- $rv_image = '';
103
- $postarr = array();
104
-
105
- if(is_user_logged_in()){
106
-
107
- $current_user = wp_get_current_user();
108
- $postarr['post_author'] = $current_user->ID;
109
- $rv_image = get_avatar_url($current_user->ID, array('size' => 300));
110
-
111
- }
112
-
113
- $rv_text = sanitize_textarea_field($form_data['saswp_review_text']);
114
- $rv_name = sanitize_text_field($form_data['saswp_reviewer_name']);
115
- $rv_rating = intval($form_data['saswp_review_rating']);
116
- $rv_place_id = intval($form_data['saswp_place_id']);
117
- $rv_date = date('Y-m-d');
118
- $rv_time = date("h:i:sa");
119
-
120
- if($rv_rating){
121
-
122
- $postarr = array(
123
- 'post_title' => $rv_name,
124
- 'post_status' => 'pending',
125
- 'post_name' => $rv_name,
126
- 'post_type' => 'saswp_reviews',
127
-
128
- );
129
-
130
- $post_id = wp_insert_post( $postarr );
131
-
132
- $term = get_term_by( 'slug','self', 'platform' );
133
-
134
- if($rv_image){
135
-
136
- $image_details = saswp_get_attachment_details($rv_image);
137
 
138
- $media_detail = array(
139
- 'width' => $image_details[0][0],
140
- 'height' => $image_details[0][1],
141
- 'thumbnail' => $rv_image,
142
- );
143
-
144
- }
145
-
146
- $review_meta = array(
147
- 'saswp_review_platform' => $term->term_id,
148
- 'saswp_review_location_id' => $rv_place_id,
149
- 'saswp_review_time' => $rv_time,
150
- 'saswp_review_date' => $rv_date,
151
- 'saswp_review_rating' => $rv_rating,
152
- 'saswp_review_text' => $rv_text,
153
- 'saswp_reviewer_lang' => null,
154
- 'saswp_reviewer_name' => $rv_name,
155
- 'saswp_review_link' => $rv_link,
156
- 'saswp_reviewer_image' => $rv_image ? $rv_image : SASWP_DIR_URI.'/admin_section/images/default_user.jpg',
157
- 'saswp_reviewer_image_detail' => $media_detail
158
- );
159
-
160
- if($post_id && !empty($review_meta) && is_array($review_meta)){
161
-
162
- foreach ($review_meta as $key => $val){
163
- update_post_meta($post_id, $key, $val);
164
  }
165
-
166
- }
167
 
168
- }
169
-
170
- if(strpos($_SERVER['QUERY_STRING'], 'amp_source') !==false){
171
-
172
- header("AMP-Redirect-To: ".$rv_link);
173
- header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin");
174
- echo json_decode(array('message'=> 'hel'));die;
175
-
176
- }else{
177
-
178
- wp_redirect( $rv_link );
179
- exit;
180
- }
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
- }
183
- if(strpos($_SERVER['QUERY_STRING'], 'amp_source') !==false){
184
- wp_die();
 
185
  }
186
 
187
  }
@@ -202,8 +143,17 @@ class SASWP_Reviews_Form {
202
  echo @file_get_contents($review_css);
203
 
204
  }
 
 
 
 
 
 
 
 
 
205
  public function saswp_reviews_form_render($attr){
206
-
207
  $is_amp = false;
208
 
209
  if(!saswp_non_amp()){
@@ -232,11 +182,13 @@ class SASWP_Reviews_Form {
232
  if(!$is_amp){
233
 
234
  $rating_html = '<div class="saswp-rating-front-div"></div><input type="hidden" name="saswp_review_rating" value="5">';
235
- $form .= '<form action="'.esc_url( admin_url('admin-post.php') ).'" method="post">';
236
 
237
  }else{
238
 
239
- $form .= '<form action-xhr="'.esc_url( admin_url('admin-post.php') ).'" method="post">';
 
 
240
 
241
  $rating_html = ''
242
  . '<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')){
46
+
47
+ require_once SASWP_PLUGIN_DIR_PATH .'core/3rd-party/class-amp-review-form-blacklist.php';
48
 
49
+ unset($data['AMPFORWP_Blacklist_Sanitizer']);
50
+ unset($data['AMP_Blacklist_Sanitizer']);
51
+ $data[ 'AMP_Review_Form_Blacklist' ] = array();
52
+
53
+ }
54
+
55
  return $data;
56
 
57
  }
68
  return self::$instance;
69
  }
70
 
71
+
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'];
79
+ if(isset($headers['AMP-Same-Origin'])){
80
+ $is_amp = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
+
83
+ if($form_data['action'] == 'saswp_review_form'){
84
 
85
+ if(!wp_verify_nonce($form_data['saswp_review_nonce'], 'saswp_review_form')){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
+ if($is_amp){
88
+ header("AMP-Redirect-To: ".$rv_link);
89
+ header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin");
90
+ echo json_decode(array('message'=> 'Nonce MisMatch'));die;
91
+ }else{
92
+ wp_redirect( $rv_link );
93
+ exit;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
 
 
95
 
96
+ }
97
+
98
+ if($is_amp){
99
+
100
+ header("access-control-allow-credentials:true");
101
+ header("access-control-allow-headers:Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token");
102
+ header("Access-Control-Allow-Origin:".$_SERVER['HTTP_ORIGIN']);
103
+ $siteUrl = parse_url( get_site_url() );
104
+ header("AMP-Access-Control-Allow-Source-Origin:".$siteUrl['scheme'] . '://' . $siteUrl['host']);
105
+ header("Content-Type:application/json;charset=utf-8");
106
+
107
+ }
108
+
109
+ $response = $this->_service->saswp_review_form_process_data($form_data);
110
+
111
+ if($response){
112
+
113
+ if($is_amp){
114
+ header("AMP-Redirect-To: ".$rv_link);
115
+ header("Access-Control-Expose-Headers: AMP-Redirect-To, AMP-Access-Control-Allow-Source-Origin");
116
+ }else{
117
+ wp_redirect( $rv_link );
118
+ exit;
119
+ }
120
+ }
121
 
122
+ }
123
+
124
+ if($is_amp){
125
+ wp_die();
126
  }
127
 
128
  }
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
@@ -24,6 +24,81 @@ class saswp_reviews_service {
24
  add_action ('amp_post_template_footer', array($this, 'saswp_fetched_reviews_schema_markup'),99);
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  public function saswp_fetched_reviews_schema_markup(){
28
 
29
  global $sd_data, $saswp_post_reviews;
@@ -172,7 +247,7 @@ class saswp_reviews_service {
172
 
173
  public function saswp_fetch_google_reviews(){
174
 
175
- if ( ! current_user_can( 'manage_options' ) ) {
176
  return;
177
  }
178
 
@@ -589,8 +664,13 @@ class saswp_reviews_service {
589
 
590
  if($term->slug == 'self'){
591
 
592
- $default_logo = $service_object->saswp_get_publisher(true);
593
- $review_data['saswp_review_platform_icon'] = $default_logo['url'];
 
 
 
 
 
594
 
595
  }else{
596
  $review_data['saswp_review_platform_icon'] = SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/'.esc_attr($term->slug).'-img.png';
24
  add_action ('amp_post_template_footer', array($this, 'saswp_fetched_reviews_schema_markup'),99);
25
  }
26
 
27
+ public function saswp_review_form_process_data($form_data){
28
+
29
+ $rv_image = '';
30
+ $postarr = array();
31
+
32
+ if(is_user_logged_in()){
33
+
34
+ $current_user = wp_get_current_user();
35
+ $postarr['post_author'] = $current_user->ID;
36
+ $rv_image = get_avatar_url($current_user->ID, array('size' => 300));
37
+
38
+ }
39
+
40
+ $rv_text = sanitize_textarea_field($form_data['saswp_review_text']);
41
+ $rv_name = sanitize_text_field($form_data['saswp_reviewer_name']);
42
+ $rv_rating = intval($form_data['saswp_review_rating']);
43
+ $rv_place_id = intval($form_data['saswp_place_id']);
44
+ $rv_link = sanitize_text_field($form_data['saswp_review_link']);
45
+ $rv_date = date('Y-m-d');
46
+ $rv_time = date("h:i:sa");
47
+
48
+ if($rv_rating){
49
+
50
+ $postarr = array(
51
+ 'post_title' => $rv_name,
52
+ 'post_status' => 'pending',
53
+ 'post_name' => $rv_name,
54
+ 'post_type' => 'saswp_reviews',
55
+
56
+ );
57
+
58
+ $post_id = wp_insert_post( $postarr );
59
+
60
+ $term = get_term_by( 'slug','self', 'platform' );
61
+
62
+ if($rv_image){
63
+
64
+ $image_details = saswp_get_attachment_details($rv_image);
65
+
66
+ $media_detail = array(
67
+ 'width' => $image_details[0][0],
68
+ 'height' => $image_details[0][1],
69
+ 'thumbnail' => $rv_image,
70
+ );
71
+
72
+ }
73
+
74
+ $review_meta = array(
75
+ 'saswp_review_platform' => $term->term_id,
76
+ 'saswp_review_location_id' => $rv_place_id,
77
+ 'saswp_review_time' => $rv_time,
78
+ 'saswp_review_date' => $rv_date,
79
+ 'saswp_review_rating' => $rv_rating,
80
+ 'saswp_review_text' => $rv_text,
81
+ 'saswp_reviewer_lang' => null,
82
+ 'saswp_reviewer_name' => $rv_name,
83
+ 'saswp_review_link' => $rv_link,
84
+ 'saswp_reviewer_image' => $rv_image ? $rv_image : SASWP_DIR_URI.'/admin_section/images/default_user.jpg',
85
+ 'saswp_reviewer_image_detail' => $media_detail
86
+ );
87
+
88
+ if($post_id && !empty($review_meta) && is_array($review_meta)){
89
+
90
+ foreach ($review_meta as $key => $val){
91
+ update_post_meta($post_id, $key, $val);
92
+ }
93
+
94
+ }
95
+
96
+ }
97
+
98
+ return $post_id;
99
+
100
+ }
101
+
102
  public function saswp_fetched_reviews_schema_markup(){
103
 
104
  global $sd_data, $saswp_post_reviews;
247
 
248
  public function saswp_fetch_google_reviews(){
249
 
250
+ if ( ! current_user_can( saswp_current_user_can() ) ) {
251
  return;
252
  }
253
 
664
 
665
  if($term->slug == 'self'){
666
 
667
+ $default_logo = $service_object->saswp_get_publisher(true);
668
+
669
+ if(isset($default_logo['url'])){
670
+
671
+ $review_data['saswp_review_platform_icon'] = $default_logo['url'];
672
+
673
+ }
674
 
675
  }else{
676
  $review_data['saswp_review_platform_icon'] = SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/'.esc_attr($term->slug).'-img.png';
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 ) {
@@ -137,14 +156,17 @@ function saswp_reviews_custom_columns_set( $column, $post_id ) {
137
 
138
  $service_object = new saswp_output_service();
139
  $default_logo = $service_object->saswp_get_publisher(true);
 
 
140
 
141
- echo '<span class="saswp-g-plus"><img src="'.esc_url($default_logo['url']).'" alt="Icon" /></span>';
 
 
142
 
143
  }else{
144
  echo '<span class="saswp-g-plus"><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/'.esc_attr($term->slug).'-img.png'.'" alt="Icon" /></span>';
145
  }
146
-
147
-
148
  }
149
 
150
  break;
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 ) {
156
 
157
  $service_object = new saswp_output_service();
158
  $default_logo = $service_object->saswp_get_publisher(true);
159
+
160
+ if(isset($default_logo['url'])){
161
 
162
+ echo '<span class="saswp-g-plus"><img src="'.esc_url($default_logo['url']).'" alt="Icon" /></span>';
163
+
164
+ }
165
 
166
  }else{
167
  echo '<span class="saswp-g-plus"><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/'.esc_attr($term->slug).'-img.png'.'" alt="Icon" /></span>';
168
  }
169
+
 
170
  }
171
 
172
  break;
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
  }
@@ -78,12 +82,12 @@ class Saswp_Reviews_Widget extends WP_Widget {
78
 
79
  $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Review Title', 'schema-and-structured-data-for-wp' );
80
  $ads = ! empty( $instance['g_review'] ) ? $instance['g_review'] : esc_html__( 'review list to be display', 'schema-and-structured-data-for-wp' );?>
81
- <p>
82
- <label for="<?php echo esc_attr( $this->get_field_id( 'g_review' ) ); ?>">
83
  <?php esc_attr_e( 'Reviews :', 'schema-and-structured-data-for-wp' ); ?>
84
- </label>
85
- <input id="<?php echo esc_attr( $this->get_field_id( 'g_review' )); ?>" name="<?php echo esc_attr( $this->get_field_name( 'g_review' ) ); ?>" type="text" placeholder="review count" value="<?php echo (isset($instance['g_review']) ? $instance['g_review'] : 5); ?>">
86
- </p>
87
  <?php
88
  }
89
 
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
  }
82
 
83
  $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Review Title', 'schema-and-structured-data-for-wp' );
84
  $ads = ! empty( $instance['g_review'] ) ? $instance['g_review'] : esc_html__( 'review list to be display', 'schema-and-structured-data-for-wp' );?>
85
+ <p>
86
+ <label for="<?php echo esc_attr( $this->get_field_id( 'g_review' ) ); ?>">
87
  <?php esc_attr_e( 'Reviews :', 'schema-and-structured-data-for-wp' ); ?>
88
+ </label>
89
+ <input id="<?php echo esc_attr( $this->get_field_id( 'g_review' )); ?>" name="<?php echo esc_attr( $this->get_field_name( 'g_review' ) ); ?>" type="text" placeholder="review count" value="<?php echo (isset($instance['g_review']) ? $instance['g_review'] : 5); ?>">
90
+ </p>
91
  <?php
92
  }
93
 
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
 
@@ -103,6 +102,24 @@ class saswp_output_compatibility{
103
 
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  public function saswp_soledad_override(){
107
 
108
  saswp_remove_anonymous_object_filter_or_action(
@@ -131,8 +148,7 @@ class saswp_output_compatibility{
131
  remove_action( 'wp_head', 'BF_Json_LD_Generator::print_output' );
132
  remove_action( 'better-amp/template/head', 'BF_Json_LD_Generator::print_output' );
133
 
134
- }
135
-
136
  public function saswp_easy_testimonials_override(){
137
 
138
  add_filter('easy_testimonials_json_ld', '__return_false');
@@ -152,6 +168,8 @@ class saswp_output_compatibility{
152
  update_post_meta(get_the_id(), 'sp_tpro_shortcode_options',$shortcode_opt);
153
  endwhile;
154
 
 
 
155
  }
156
 
157
  }
@@ -382,6 +400,21 @@ class saswp_output_compatibility{
382
  public function wpamp_on_activation(){
383
  $this->saswp_update_option_on_compatibility_activation('saswp-wpamp');
384
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  public function saswp_update_option_on_compatibility_activation($opt_name){
386
  $defaults = get_option('sd_data');
387
  $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
 
102
 
103
  }
104
 
105
+ public function saswp_wordlift_override(){
106
+
107
+ saswp_remove_anonymous_object_filter_or_action(
108
+ 'wp_head',
109
+ 'Wordlift_Term_JsonLd_Adapter',
110
+ 'wp_head',
111
+ 'action'
112
+ );
113
+
114
+ saswp_remove_anonymous_object_filter_or_action(
115
+ 'wp_head',
116
+ 'Wordlift_Jsonld_Service',
117
+ 'wp_head',
118
+ 'action'
119
+ );
120
+
121
+ }
122
+
123
  public function saswp_soledad_override(){
124
 
125
  saswp_remove_anonymous_object_filter_or_action(
148
  remove_action( 'wp_head', 'BF_Json_LD_Generator::print_output' );
149
  remove_action( 'better-amp/template/head', 'BF_Json_LD_Generator::print_output' );
150
 
151
+ }
 
152
  public function saswp_easy_testimonials_override(){
153
 
154
  add_filter('easy_testimonials_json_ld', '__return_false');
168
  update_post_meta(get_the_id(), 'sp_tpro_shortcode_options',$shortcode_opt);
169
  endwhile;
170
 
171
+ wp_reset_postdata();
172
+
173
  }
174
 
175
  }
400
  public function wpamp_on_activation(){
401
  $this->saswp_update_option_on_compatibility_activation('saswp-wpamp');
402
  }
403
+ public function wordlift_on_activation(){
404
+ $this->saswp_update_option_on_compatibility_activation('saswp-wordlift');
405
+ }
406
+ public function strong_testimonials_on_activation(){
407
+ $this->saswp_update_option_on_compatibility_activation('saswp-strong-testimonials');
408
+ }
409
+ public function tevolution_events_on_activation(){
410
+ $this->saswp_update_option_on_compatibility_activation('saswp-tevolution-events');
411
+ }
412
+ public function wp_event_aggregator_on_activation(){
413
+ $this->saswp_update_option_on_compatibility_activation('saswp-wp-event-aggregator');
414
+ }
415
+ public function easy_recipe_on_activation(){
416
+ $this->saswp_update_option_on_compatibility_activation('saswp-easy-recipe');
417
+ }
418
  public function saswp_update_option_on_compatibility_activation($opt_name){
419
  $defaults = get_option('sd_data');
420
  $defaults[$opt_name] = 1;
output/function.php CHANGED
@@ -98,12 +98,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();
@@ -203,9 +203,8 @@ 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
 
@@ -245,13 +244,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 +263,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
 
@@ -597,36 +601,54 @@ 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 +1280,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();
@@ -1314,6 +1384,88 @@ function saswp_get_bne_testimonials_data($atts, $testimo_str){
1314
 
1315
  }
1316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1317
  function saswp_get_testomonial_pro(){
1318
 
1319
  $testimonial = array();
@@ -1635,3 +1787,26 @@ function saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $sche
1635
  return $input1;
1636
 
1637
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  $item_list = $archive_output[0];
99
  }
100
 
101
+ $collection_page = isset($archive_output[1]) ? $archive_output[1]: array();
102
+ $blog_page = isset($archive_output[1]) ? $archive_output[2]: array();
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();
203
  unset($schema_breadcrumb_output['@context']);
204
  unset($webpage['mainEntity']);
205
  unset($kb_schema_output['@context']);
206
+ unset($kb_website_output['@context']);
207
+ $kb_schema_output['@type'] = isset($sd_data['saswp_kb_type']) ? $sd_data['saswp_kb_type'] : 'Organization';
 
208
 
209
  if($webpage){
210
 
244
  if($kb_website_output){
245
 
246
  $kb_website_output['publisher'] = array(
247
+ '@id' => isset($kb_schema_output['@id']) ? $kb_schema_output['@id'] : ''
248
  );
249
  }
250
+ if($sd_data['saswp_kb_type'] == 'Organization'){
251
+
252
+ $soutput['publisher'] = array(
253
+ '@id' => isset($kb_schema_output['@id']) ? $kb_schema_output['@id'] : ''
254
+ );
255
+
256
+ }
257
 
258
  }
259
 
263
  $final_output['@graph'][] = $kb_website_output;
264
 
265
  $final_output['@graph'][] = $webpage;
266
+
267
+ if($schema_breadcrumb_output){
268
+ $final_output['@graph'][] = $schema_breadcrumb_output;
269
+ }
270
 
271
  $final_output['@graph'][] = $soutput;
272
 
601
  */
602
  function saswp_get_comments($post_id){
603
 
604
+ global $sd_data;
605
 
 
 
 
606
  $comments = array();
607
+ $post_comments = array();
608
+
609
+ if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && get_post_type($post_id) == 'topic'){
610
+
611
+ $replies_query = array(
612
+ 'post_type' => 'reply',
613
+ );
614
+
615
+ if ( bbp_has_replies( $replies_query ) ) :
616
+
617
+ while ( bbp_replies() ) : bbp_the_reply();
618
+
619
+ $post_comments[] = (object) array(
620
+ 'comment_date' => bbp_get_reply_post_date(bbp_get_reply_id(),'c'),
621
+ 'comment_content' => bbp_get_reply_content(),
622
+ 'comment_author' => the_author(),
623
+ );
624
+
625
+ endwhile;
626
+ wp_reset_postdata();
627
+ endif;
628
+
629
+ }else{
630
+ $post_comments = get_comments( array(
631
+ 'post_id' => $post_id,
632
  'status' => 'approve',
633
  'type' => 'comment'
634
  )
635
+ );
636
+
637
+ }
638
+
639
  if ( count( $post_comments ) ) {
640
 
641
  foreach ( $post_comments as $comment ) {
642
 
643
  $comments[] = array (
644
  '@type' => 'Comment',
645
+ 'dateCreated' => saswp_format_date_time($comment->comment_date),
646
+ 'description' => strip_tags($comment->comment_content),
647
  'author' => array (
648
  '@type' => 'Person',
649
  'name' => esc_attr($comment->comment_author),
650
+ 'url' => isset($comment->comment_author_url) ? esc_url($comment->comment_author_url): '',
651
+ ),
652
  );
653
  }
654
 
1280
 
1281
  }
1282
 
1283
+ function saswp_get_strong_testimonials_data($testimonial){
1284
+
1285
+ $reviews = array();
1286
+ $ratings = array();
1287
+
1288
+ if(!empty($testimonial)){
1289
+
1290
+ $sumofrating = 0;
1291
+ $avg_rating = 1;
1292
+
1293
+ foreach ($testimonial as $value){
1294
+
1295
+ $rating = 5;
1296
+ $author = get_post_meta($value->ID, $key='client_name', true);
1297
+
1298
+ $sumofrating += $rating;
1299
+
1300
+ $reviews[] = array(
1301
+ '@type' => 'Review',
1302
+ 'author' => $author,
1303
+ 'datePublished' => saswp_format_date_time($value->post_date),
1304
+ 'description' => $value->post_content,
1305
+ 'reviewRating' => array(
1306
+ '@type' => 'Rating',
1307
+ 'bestRating' => '5',
1308
+ 'ratingValue' => $rating,
1309
+ 'worstRating' => '1',
1310
+ )
1311
+ );
1312
+
1313
+ }
1314
+
1315
+ if($sumofrating> 0){
1316
+ $avg_rating = $sumofrating / count($reviews);
1317
+ }
1318
+
1319
+ $ratings['aggregateRating'] = array(
1320
+ '@type' => 'AggregateRating',
1321
+ 'ratingValue' => $avg_rating,
1322
+ 'reviewCount' => count($testimonial)
1323
+ );
1324
+
1325
+ }
1326
+
1327
+ return array('reviews' => $reviews, 'rating' => $ratings);
1328
+
1329
+ }
1330
+
1331
  function saswp_get_bne_testimonials_data($atts, $testimo_str){
1332
 
1333
  $reviews = array();
1384
 
1385
  }
1386
 
1387
+ function saswp_get_strong_testimonials(){
1388
+
1389
+ $testimonial = array();
1390
+
1391
+ global $post, $sd_data;
1392
+
1393
+ if(isset($sd_data['saswp-strong-testimonials']) && $sd_data['saswp-strong-testimonials'] == 1){
1394
+
1395
+ if(is_object($post)){
1396
+
1397
+ $pattern = get_shortcode_regex();
1398
+
1399
+ if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
1400
+ && array_key_exists( 2, $matches ) )
1401
+ {
1402
+
1403
+ $testimo_str = '';
1404
+
1405
+ if(in_array( 'testimonial_view', $matches[2] )){
1406
+ $testimo_str = 'testimonial_view';
1407
+ }
1408
+
1409
+ if($testimo_str){
1410
+
1411
+ foreach ($matches[0] as $matche){
1412
+
1413
+ $mached = rtrim($matche, ']');
1414
+ $mached = ltrim($mached, '[');
1415
+ $mached = trim($mached);
1416
+
1417
+ $atts = shortcode_parse_atts('['.$mached.' ]');
1418
+ $atts = array('id' => $atts['id']);
1419
+
1420
+
1421
+ $out = shortcode_atts(
1422
+ array(),
1423
+ $atts,
1424
+ 'testimonial_view'
1425
+ );
1426
+
1427
+ if(class_exists('Strong_View_Form') && class_exists('Strong_View_Slideshow') && class_exists('Strong_View_Display')){
1428
+
1429
+ switch ( $out['mode'] ) {
1430
+ case 'form' :
1431
+ $view = new Strong_View_Form( $out );
1432
+ if ( isset( $_GET['success'] ) ) {
1433
+ $view->success();
1434
+ } else {
1435
+ $view->build();
1436
+ }
1437
+ break;
1438
+ case 'slideshow' :
1439
+ $view = new Strong_View_Slideshow( $out );
1440
+ $view->build();
1441
+ break;
1442
+ default :
1443
+ $view = new Strong_View_Display( $out );
1444
+ $view->build();
1445
+ }
1446
+ if(is_object($view)){
1447
+ $testimonial = saswp_get_strong_testimonials_data($view->query->posts);
1448
+ }
1449
+
1450
+ }
1451
+
1452
+ break;
1453
+ }
1454
+
1455
+ }
1456
+
1457
+ }
1458
+
1459
+ }
1460
+
1461
+ }
1462
+
1463
+ return $testimonial;
1464
+
1465
+ //tomorrow will do it
1466
+
1467
+ }
1468
+
1469
  function saswp_get_testomonial_pro(){
1470
 
1471
  $testimonial = array();
1787
  return $input1;
1788
 
1789
  }
1790
+
1791
+ function saswp_explod_by_semicolon($data){
1792
+
1793
+ $response = array();
1794
+
1795
+ if($data){
1796
+
1797
+ $explod = explode(';', $data);
1798
+
1799
+ if($explod){
1800
+
1801
+ foreach ($explod as $val){
1802
+
1803
+ $response[] = $val;
1804
+
1805
+ }
1806
+
1807
+ }
1808
+ }
1809
+
1810
+ return $response;
1811
+
1812
+ }
output/markup.php CHANGED
@@ -394,40 +394,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 +757,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();
@@ -1773,7 +1793,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
  ),
@@ -2410,6 +2430,12 @@ 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;
394
  $instruction = array();
395
 
396
  if(isset($all_post_meta['saswp_recipe_ingredient_'.$schema_id])){
397
+ $ingredient = saswp_explod_by_semicolon($all_post_meta['saswp_recipe_ingredient_'.$schema_id][0]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
399
 
400
  if(isset($all_post_meta['saswp_recipe_instructions_'.$schema_id])){
401
 
402
+ $explod = saswp_explod_by_semicolon($all_post_meta['saswp_recipe_instructions_'.$schema_id][0]);
403
+
404
+ foreach ($explod as $val){
 
 
405
 
406
  $instruction[] = array(
407
  '@type' => "HowToStep",
408
  'text' => $val,
409
  );
410
 
411
+ }
 
 
 
412
  }
413
 
414
  $input1 = array(
757
  return $input1;
758
  }
759
 
760
+ function saswp_organization_schema_markup($schema_id, $schema_post_id, $all_post_meta){
761
+
762
+ $input1 = array();
763
+
764
+ $input1['@context'] = saswp_context_url();
765
+ $input1['@type'] = 'Organization';
766
+ $input1['@id'] = trailingslashit(get_permalink()).'#Organization';
767
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_name_'.$schema_id, 'saswp_array');
768
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_url_'.$schema_id, 'saswp_array');
769
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_description_'.$schema_id, 'saswp_array');
770
+
771
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_organization_logo_'.$schema_id.'_detail',true);
772
+
773
+ if(!(empty($howto_image))){
774
+
775
+ $input1['logo']['@type'] = 'ImageObject';
776
+ $input1['logo']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
777
+ $input1['logo']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
778
+ $input1['logo']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
779
+
780
+ }
781
+
782
+ $input1['address']['@type'] = 'PostalAddress';
783
+ $input1['address']['streetAddress'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_street_address_'.$schema_id, 'saswp_array');
784
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_country_'.$schema_id, 'saswp_array');
785
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_city_'.$schema_id, 'saswp_array');
786
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_state_'.$schema_id, 'saswp_array');
787
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_postal_code_'.$schema_id, 'saswp_array');
788
+ $input1['telephone'] = saswp_remove_warnings($all_post_meta, 'saswp_organization_telephone_'.$schema_id, 'saswp_array');
789
+
790
+ 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])){
791
+ $input1['aggregateRating']['@type'] = 'aggregateRating';
792
+ $input1['aggregateRating']['ratingValue'] = $all_post_meta['saswp_organization_rating_value_'.$schema_id];
793
+ $input1['aggregateRating']['ratingCount'] = $all_post_meta['saswp_organization_rating_count_'.$schema_id];
794
+ }
795
+
796
+ return $input1;
797
+ }
798
+
799
  function saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta){
800
 
801
  $input1 = array();
1793
  '@type' => 'ImageObject',
1794
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_logo_'.$schema_id, 'saswp_array'),
1795
  'width' => saswp_remove_warnings($slogo, 'width', 'saswp_string'),
1796
+ 'height' => saswp_remove_warnings($slogo, 'height', 'saswp_string'),
1797
  ),
1798
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
1799
  ),
2430
  $item_schema = saswp_video_game_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2431
 
2432
  break;
2433
+
2434
+ case 'Organization':
2435
+
2436
+ $item_schema = saswp_organization_schema_markup($schema_id, $schema_post_id, $all_post_meta);
2437
+
2438
+ break;
2439
 
2440
  default:
2441
  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),
@@ -413,7 +416,11 @@ function saswp_schema_output() {
413
  $input1['@id'] = trailingslashit(get_permalink()).'#Book';
414
 
415
  $service = new saswp_output_service();
416
- $input1 = $service->saswp_schema_markup_generator($schema_type);
 
 
 
 
417
 
418
  unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8']);
419
 
@@ -589,6 +596,7 @@ function saswp_schema_output() {
589
  if( 'DiscussionForumPosting' === $schema_type){
590
 
591
  if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
 
592
  $input1 = array(
593
  '@context' => saswp_context_url(),
594
  '@type' => 'DiscussionForumPosting' ,
@@ -599,7 +607,7 @@ function saswp_schema_output() {
599
  "articleSection" => bbp_get_forum_title(),
600
  "articleBody" => saswp_get_the_content(),
601
  'url' => bbp_get_topic_permalink(),
602
- 'datePublished' => bbp_get_topic_post_date(),
603
  'dateModified' => esc_html($modified_date),
604
  'author' => saswp_get_author_details(),
605
  'interactionStatistic' => array(
@@ -738,11 +746,7 @@ function saswp_schema_output() {
738
  }
739
  if(!empty($extra_theme_review)){
740
  $input1 = array_merge($input1, $extra_theme_review);
741
- }
742
- if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
743
- $input1['comment'] = saswp_get_comments(get_the_ID());
744
- }
745
-
746
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
747
 
748
  $input1 = apply_filters('saswp_modify_event_schema_output', $input1 );
@@ -762,9 +766,13 @@ function saswp_schema_output() {
762
  'author' => saswp_get_author_details()
763
  );
764
 
765
- $service = new saswp_output_service();
766
- $input1 = $service->saswp_schema_markup_generator($schema_type);
767
-
 
 
 
 
768
  unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8']);
769
 
770
  if(!empty($publisher)){
@@ -1038,7 +1046,7 @@ function saswp_schema_output() {
1038
  $input1['@context'] = saswp_context_url();
1039
  $input1['@type'] = 'Review';
1040
  $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Review';
1041
- $input1['itemReviewed']['@type'] = $item_reviewed;
1042
 
1043
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
1044
 
@@ -1058,7 +1066,16 @@ function saswp_schema_output() {
1058
 
1059
  }
1060
  }
1061
-
 
 
 
 
 
 
 
 
 
1062
  if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 && (is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah') ){
1063
 
1064
  remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
@@ -1345,6 +1362,23 @@ function saswp_schema_output() {
1345
  }
1346
 
1347
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1348
 
1349
  }
1350
 
@@ -1493,6 +1527,8 @@ function saswp_woocommerce_category_schema(){
1493
  $service = new saswp_output_service();
1494
  $category_loop = new WP_Query( $query_string );
1495
 
 
 
1496
  $i = 1;
1497
 
1498
  if ( $category_loop->have_posts() ):
@@ -1501,8 +1537,17 @@ function saswp_woocommerce_category_schema(){
1501
  $category_posts = array();
1502
  $category_posts['@type'] = 'ListItem';
1503
  $category_posts['position'] = $i;
1504
- $category_posts['item'] = $service->saswp_schema_markup_generator('Product');
1505
- $category_posts['item']['url'] = rtrim( get_category_link($term->term_id), '/'). "#product_".$i;
 
 
 
 
 
 
 
 
 
1506
  unset($category_posts['item']['@id']);
1507
  unset($category_posts['item']['@context']);
1508
  $list_item[] = $category_posts;
@@ -1581,7 +1626,7 @@ function saswp_archive_output(){
1581
  if(isset($sd_data['sd_default_image'])){
1582
 
1583
  $archive_image['@type'] = 'ImageObject';
1584
- $archive_image['url'] = esc_url($sd_data['sd_default_image']['url']);
1585
  $archive_image['width'] = esc_attr($sd_data['sd_default_image_width']);
1586
  $archive_image['height'] = esc_attr($sd_data['sd_default_image_height']);
1587
  }
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),
416
  $input1['@id'] = trailingslashit(get_permalink()).'#Book';
417
 
418
  $service = new saswp_output_service();
419
+ $woo_markp = $service->saswp_schema_markup_generator($schema_type);
420
+
421
+ if($woo_markp){
422
+ $input1 = array_merge($input1, $woo_markp);
423
+ }
424
 
425
  unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8']);
426
 
596
  if( 'DiscussionForumPosting' === $schema_type){
597
 
598
  if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
599
+
600
  $input1 = array(
601
  '@context' => saswp_context_url(),
602
  '@type' => 'DiscussionForumPosting' ,
607
  "articleSection" => bbp_get_forum_title(),
608
  "articleBody" => saswp_get_the_content(),
609
  'url' => bbp_get_topic_permalink(),
610
+ 'datePublished' => saswp_format_date_time(bbp_get_topic_post_date()),
611
  'dateModified' => esc_html($modified_date),
612
  'author' => saswp_get_author_details(),
613
  'interactionStatistic' => array(
746
  }
747
  if(!empty($extra_theme_review)){
748
  $input1 = array_merge($input1, $extra_theme_review);
749
+ }
 
 
 
 
750
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
751
 
752
  $input1 = apply_filters('saswp_modify_event_schema_output', $input1 );
766
  'author' => saswp_get_author_details()
767
  );
768
 
769
+ $service = new saswp_output_service();
770
+ $woo_markp = $service->saswp_schema_markup_generator($schema_type);
771
+
772
+ if($woo_markp){
773
+ $input1 = array_merge($input1, $woo_markp);
774
+ }
775
+
776
  unset($input1['brand'], $input1['mpn'], $input1['sku'],$input1['gtin8']);
777
 
778
  if(!empty($publisher)){
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
 
1067
  }
1068
  }
1069
+
1070
+ $added_reviews = saswp_append_fetched_reviews($input1, $schema_post_id);
1071
+
1072
+ if(isset($added_reviews['review'])){
1073
+
1074
+ $input1['itemReviewed']['review'] = $added_reviews['review'];
1075
+ $input1['itemReviewed']['aggregateRating'] = $added_reviews['aggregateRating'];
1076
+
1077
+ }
1078
+
1079
  if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 && (is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah') ){
1080
 
1081
  remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
1362
  }
1363
 
1364
  }
1365
+
1366
+
1367
+ // Testomonial Pro
1368
+ $strong_testimonials = saswp_get_strong_testimonials();
1369
+
1370
+ if($strong_testimonials){
1371
+
1372
+ $input1 = array_merge($input1,$strong_testimonials['rating']);
1373
+
1374
+ if(isset($input1['review'])){
1375
+ $input1 = array_merge($input1['review'],$strong_testimonials['reviews']);
1376
+ }else{
1377
+ $input1['review'] = $strong_testimonials['reviews'];
1378
+ }
1379
+
1380
+ }
1381
+
1382
 
1383
  }
1384
 
1527
  $service = new saswp_output_service();
1528
  $category_loop = new WP_Query( $query_string );
1529
 
1530
+ $current_url = saswp_get_current_url();
1531
+
1532
  $i = 1;
1533
 
1534
  if ( $category_loop->have_posts() ):
1537
  $category_posts = array();
1538
  $category_posts['@type'] = 'ListItem';
1539
  $category_posts['position'] = $i;
1540
+ $category_posts['item'] = $service->saswp_schema_markup_generator('Product');
1541
+
1542
+ $feature_image = $service->saswp_get_fetaure_image();
1543
+ $category_posts['item'] = array_merge( $category_posts['item'], $feature_image);
1544
+
1545
+ if(saswp_has_slash($current_url)){
1546
+ $category_posts['item']['url'] = trailingslashit(saswp_get_category_link($term->term_id)). "#product_".$i;
1547
+ }else{
1548
+ $category_posts['item']['url'] = saswp_remove_slash(saswp_get_category_link($term->term_id)). "#product_".$i;
1549
+ }
1550
+
1551
  unset($category_posts['item']['@id']);
1552
  unset($category_posts['item']['@context']);
1553
  $list_item[] = $category_posts;
1626
  if(isset($sd_data['sd_default_image'])){
1627
 
1628
  $archive_image['@type'] = 'ImageObject';
1629
+ $archive_image['url'] = isset($sd_data['sd_default_image']['url']) ? esc_url($sd_data['sd_default_image']['url']):'';
1630
  $archive_image['width'] = esc_attr($sd_data['sd_default_image_width']);
1631
  $archive_image['height'] = esc_attr($sd_data['sd_default_image_height']);
1632
  }
output/service.php CHANGED
@@ -449,6 +449,47 @@ Class saswp_output_service{
449
  }
450
 
451
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
 
453
  case 'MusicAlbum':
454
 
@@ -1117,11 +1158,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'];
@@ -2783,7 +2824,7 @@ Class saswp_output_service{
2783
  $input1 = array(
2784
  '@context' => saswp_context_url(),
2785
  '@type' => $schema_type,
2786
- '@id' => trailingslashit(saswp_get_permalink()).'#product',
2787
  'url' => trailingslashit(saswp_get_permalink()),
2788
  'name' => saswp_remove_warnings($product_details, 'product_name', 'saswp_string'),
2789
  'sku' => saswp_remove_warnings($product_details, 'product_sku', 'saswp_string'),
@@ -2861,8 +2902,8 @@ Class saswp_output_service{
2861
  }else{
2862
 
2863
  $input1['@context'] = saswp_context_url();
2864
- $input1['@type'] = 'Product';
2865
- $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Product';
2866
  }
2867
 
2868
  if(!isset($input1['review'])){
@@ -2900,7 +2941,7 @@ 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
 
@@ -2914,23 +2955,18 @@ Class saswp_output_service{
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 +2976,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 +2994,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 +3013,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 +3103,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;
449
  }
450
 
451
  break;
452
+ case 'Organization':
453
+
454
+ if(isset($custom_fields['saswp_organization_name'])){
455
+ $input1['name'] = $custom_fields['saswp_organization_name'];
456
+ }
457
+ if(isset($custom_fields['saswp_organization_description'])){
458
+ $input1['description'] = $custom_fields['saswp_organization_description'];
459
+ }
460
+ if(isset($custom_fields['saswp_organization_url'])){
461
+ $input1['url'] = $custom_fields['saswp_organization_url'];
462
+ }
463
+ if(isset($custom_fields['saswp_organization_street_address'])){
464
+ $input1['address']['streetAddress'] = $custom_fields['saswp_organization_street_address'];
465
+ }
466
+ if(isset($custom_fields['saswp_organization_city'])){
467
+ $input1['address']['addressLocality'] = $custom_fields['saswp_organization_city'];
468
+ }
469
+ if(isset($custom_fields['saswp_organization_state'])){
470
+ $input1['address']['addressRegion'] = $custom_fields['saswp_organization_state'];
471
+ }
472
+ if(isset($custom_fields['saswp_organization_country'])){
473
+ $input1['address']['addressCountry'] = $custom_fields['saswp_organization_country'];
474
+ }
475
+ if(isset($custom_fields['saswp_organization_postal_code'])){
476
+ $input1['address']['postalCode'] = $custom_fields['saswp_organization_postal_code'];
477
+ }
478
+ if(isset($custom_fields['saswp_organization_telephone'])){
479
+ $input1['address']['telephone'] = $custom_fields['saswp_organization_telephone'];
480
+ }
481
+ if(isset($custom_fields['saswp_organization_logo'])){
482
+ $input1['logo'] = $custom_fields['saswp_organization_logo'];
483
+ }
484
+ if(isset($custom_fields['saswp_organization_rating_value']) && isset($custom_fields['saswp_organization_rating_count'])){
485
+ $input1['aggregateRating']['@type'] = 'AggregateRating';
486
+ $input1['aggregateRating']['worstRating'] = 0;
487
+ $input1['aggregateRating']['bestRating'] = 5;
488
+ $input1['aggregateRating']['ratingValue'] = $custom_fields['saswp_organization_rating_value'];
489
+ $input1['aggregateRating']['ratingCount'] = $custom_fields['saswp_organization_rating_count'];
490
+ }
491
+
492
+ break;
493
 
494
  case 'MusicAlbum':
495
 
1158
  $input1['nutrition']['calories'] = $custom_fields['saswp_recipe_nutrition'];
1159
  }
1160
 
1161
+ if(isset($custom_fields['saswp_recipe_ingredient'])){
1162
+ $input1['recipeIngredient'] = saswp_explod_by_semicolon($custom_fields['saswp_recipe_ingredient']);
1163
  }
1164
+ if(isset($custom_fields['saswp_recipe_instructions'])){
1165
+ $input1['recipeInstructions'] = saswp_explod_by_semicolon($custom_fields['saswp_recipe_instructions']);
1166
  }
1167
  if(isset($custom_fields['saswp_recipe_video_name'])){
1168
  $input1['video']['name'] = $custom_fields['saswp_recipe_video_name'];
2824
  $input1 = array(
2825
  '@context' => saswp_context_url(),
2826
  '@type' => $schema_type,
2827
+ '@id' => trailingslashit(saswp_get_permalink()).'#'.$schema_type,
2828
  'url' => trailingslashit(saswp_get_permalink()),
2829
  'name' => saswp_remove_warnings($product_details, 'product_name', 'saswp_string'),
2830
  'sku' => saswp_remove_warnings($product_details, 'product_sku', 'saswp_string'),
2902
  }else{
2903
 
2904
  $input1['@context'] = saswp_context_url();
2905
+ $input1['@type'] = $schema_type;
2906
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#'.$schema_type;
2907
  }
2908
 
2909
  if(!isset($input1['review'])){
2941
  global $post;
2942
  $input2 = array();
2943
  $image_id = get_post_thumbnail_id();
2944
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
2945
 
2946
  if( is_array($image_details) ){
2947
 
2955
  $resize_image = saswp_aq_resize( $image_details[0], $width[$i], $height[$i], true, false, true );
2956
 
2957
  if(isset($resize_image[0]) && isset($resize_image[1]) && isset($resize_image[2]) ){
2958
+
 
2959
  $input2['image'][$i]['@type'] = 'ImageObject';
2960
 
2961
+ if($i == 0){
2962
+ $input2['image'][$i]['@id'] = saswp_get_permalink().'#primaryimage';
 
 
2963
  }
2964
 
2965
  $input2['image'][$i]['url'] = esc_url($resize_image[0]);
2966
  $input2['image'][$i]['width'] = esc_attr($resize_image[1]);
2967
  $input2['image'][$i]['height'] = esc_attr($resize_image[2]);
2968
 
2969
+ }
 
 
2970
  }
2971
 
2972
  if(!empty($input2)){
2976
  }
2977
 
2978
  }else{
2979
+
2980
+ $width = array($image_details[1], 1200, 1200);
2981
+ $height = array($image_details[2], 900, 675);
2982
 
2983
+ for($i = 0; $i<3; $i++){
2984
 
2985
+ $resize_image = saswp_aq_resize( $image_details[0], $width[$i], $height[$i], true, false, true );
2986
 
2987
+ if(isset($resize_image[0]) && isset($resize_image[1]) && isset($resize_image[2]) ){
2988
 
2989
  $input2['image'][$i]['@type'] = 'ImageObject';
2990
 
2994
 
2995
  }
2996
 
2997
+ $input2['image'][$i]['url'] = esc_url($resize_image[0]);
2998
+ $input2['image'][$i]['width'] = esc_attr($resize_image[1]);
2999
+ $input2['image'][$i]['height'] = esc_attr($resize_image[2]);
3000
 
3001
  }
3002
+
 
3003
  }
3004
 
3005
  }
3013
  $input2['image']['height'] = esc_attr($image_details[2]);
3014
 
3015
  }
3016
+
 
3017
  }
3018
 
3019
  //Get All the images available on post
3103
  $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
3104
 
3105
  }
3106
+
 
3107
  }
3108
 
3109
  return $input2;
output/single.php CHANGED
@@ -166,7 +166,7 @@ function saswp_post_specific_schema_output() {
166
 
167
  if( 'Book' === $schema_type){
168
 
169
- $input1 = saswp_book_schema_markup($schema_id, $all_post_meta);
170
 
171
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
172
 
@@ -545,7 +545,37 @@ function saswp_post_specific_schema_output() {
545
  }
546
 
547
  }
548
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  }
550
 
551
  if( !empty($input1) && !isset($input1['image'])){
166
 
167
  if( 'Book' === $schema_type){
168
 
169
+ $input1 = saswp_book_schema_markup($schema_id, $schema_post_id, $all_post_meta);
170
 
171
  $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
172
 
545
  }
546
 
547
  }
548
+
549
+ // Testomonial Pro
550
+ $testomonial_pro = saswp_get_testomonial_pro();
551
+
552
+ if($testomonial_pro){
553
+
554
+ $input1 = array_merge($input1,$testomonial_pro['rating']);
555
+
556
+ if(isset($input1['review'])){
557
+ $input1 = array_merge($input1['review'],$testomonial_pro['reviews']);
558
+ }else{
559
+ $input1['review'] = $testomonial_pro['reviews'];
560
+ }
561
+
562
+ }
563
+
564
+ // Testomonial Pro
565
+ $strong_testimonials = saswp_get_strong_testimonials();
566
+
567
+ if($strong_testimonials){
568
+
569
+ $input1 = array_merge($input1,$strong_testimonials['rating']);
570
+
571
+ if(isset($input1['review'])){
572
+ $input1 = array_merge($input1['review'],$strong_testimonials['reviews']);
573
+ }else{
574
+ $input1['review'] = $strong_testimonials['reviews'];
575
+ }
576
+
577
+ }
578
+
579
  }
580
 
581
  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.18
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -118,6 +118,34 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  = 1.9.18 (14 Dec 2019) =
122
 
123
  * Major Feature: Added review form to submit user review from the post. Use the shortcode to show form [saswp-reviews-form] #538
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.20
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.20 (27 Dec 2019) =
122
+
123
+ * Added: Role Based Access feature #631
124
+ * Added: comment property in DiscussionForumPosting schema type using bbPress compatiblity. #649
125
+ * Added: itemReviewed type organization in Review schema #662
126
+ * Added: Compatibility with Strong testimonials plugin #664
127
+ * Fixed: Change Internal Links to AMP Option is not working from SASWP v1.9.18 #686
128
+ * Fixed: Notice: is_amp_endpoint was called incorrectly. #681
129
+ * Fixed: By default there are 10 comments showing in markup need to set this as per users site. #668
130
+ * Fixed: Invalid schema output when using ACF fields with recipe ingredients #659
131
+ * Fixed: In Review schema if Item Reviewed Type selected then show Add Reviews checkbox #667
132
+ * Fixed: How to show reviews on the website shows 404 page not found. #676
133
+ * Fixed: Fatal error: called to undefined function "saswp_reviews_front_output" #685
134
+ * Fixed: If image size greater than 1200px, Image croping based on image ratio is not working correct #683
135
+ * Fixed: Form ( Which should not be displayed on amp) is being displayed when SASWP is active. #679
136
+ * 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
137
+
138
+
139
+ = 1.9.19 (18 Dec 2019) =
140
+
141
+ * Fixed: Author URL is missing #665
142
+ * Fixed: SoftwareApplication is being changed to Product schema type #669
143
+ * Fixed: AMP By Automatic compatibility issue (Image is not visible on post/page when SASWP is activated) #671
144
+ * Fixed: All values provided for url must point to the same page. #653
145
+ * Added: Ask if they are a customer in Email sending via Option panel #647
146
+ * Added: Compatibility with WordLift plugin. #625
147
+ * Enhancement: Updated Export/Import feature #595
148
+
149
  = 1.9.18 (14 Dec 2019) =
150
 
151
  * Major Feature: Added review form to submit user review from the post. Use the shortcode to show form [saswp-reviews-form] #538
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.18
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.18');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
@@ -95,6 +95,7 @@ require_once SASWP_DIR_NAME.'/modules/reviews/reviews_collection.php';
95
  require_once SASWP_DIR_NAME.'/modules/reviews/reviews_form.php';
96
  require_once SASWP_DIR_NAME.'/core/array-list/schema-properties.php';
97
  require_once SASWP_DIR_NAME.'/core/global.php';
 
98
  //Module files load
99
  require_once SASWP_DIR_NAME.'/modules/gutenberg/includes/class-gutenberg.php';
100
 
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.20
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.20');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
95
  require_once SASWP_DIR_NAME.'/modules/reviews/reviews_form.php';
96
  require_once SASWP_DIR_NAME.'/core/array-list/schema-properties.php';
97
  require_once SASWP_DIR_NAME.'/core/global.php';
98
+ require_once SASWP_DIR_NAME.'/core/queries_function.php';
99
  //Module files load
100
  require_once SASWP_DIR_NAME.'/modules/gutenberg/includes/class-gutenberg.php';
101
 
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
 
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
 
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
 
@@ -172,7 +172,8 @@ 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
 
172
  'Event' => 'Event',
173
  'HowTo' => 'HowTo',
174
  'local_business' => 'LocalBusiness',
175
+ 'MusicPlaylist' => 'Music Playlist',
176
+ 'Organization' => 'Organization',
177
  'Product' => 'Product',
178
  'Recipe' => 'Recipe',
179
  'SoftwareApplication' => 'SoftwareApplication',