55 * @package Schema - All In One Schema Rich Snippets.
66 */
77
8+ defined ( 'ABSPATH ' ) || exit;
9+
810ob_start ();
911if ( is_admin () ) {
1012 add_action ( 'admin_footer ' , 'add_footer_script ' );
@@ -400,7 +402,6 @@ function rich_snippet_dashboard() {
400402 </div>
401403 </div>
402404
403-
404405 <div class="postbox closed">
405406 <button type="button" class="handlediv" aria-expanded="false"><span class="screen-reader-text"> ' . esc_html__ ( 'Toggle panel: Frontend Options ' , 'rich-snippets ' ) . '</span><span class="toggle-indicator" aria-hidden="true"></span></button>
406407 <h3 class="hndle"><span> ' . esc_html__ ( 'Video ' , 'rich-snippets ' ) . '</span></h3>
@@ -558,7 +559,6 @@ function rich_snippet_dashboard() {
558559 </div>
559560 </div>
560561
561-
562562 <div id="tab-5">
563563 <div id="poststuff">
564564 <div id="postbox-container-17" class="postbox-container">
@@ -984,8 +984,7 @@ function rich_snippet_dashboard() {
984984if ( isset ( $ _POST ['setting_analytics_submit ' ] ) ) {
985985 if ( ! isset ( $ _POST ['snippet_analytics_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_analytics_nonce_field ' ] ) ), 'snippet_analytics_form_action ' ) || ! current_user_can ( 'manage_options ' )
986986 ) {
987- print 'Sorry, your nonce did not verify. ' ;
988- exit ;
987+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
989988 } else {
990989 if ( isset ( $ _POST ['aiosrs_analytics_optin ' ] ) ) {
991990 update_option ( 'aiosrs_analytics_optin ' , 'yes ' );
@@ -997,8 +996,7 @@ function rich_snippet_dashboard() {
997996if ( isset ( $ _POST ['setting_submit ' ] ) ) {
998997 if ( ! isset ( $ _POST ['snippet_woocommerce_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_woocommerce_nonce_field ' ] ) ), 'snippet_woocommerce_form_action ' ) || ! current_user_can ( 'manage_options ' )
999998 ) {
1000- print 'Sorry, your nonce did not verify. ' ;
1001- exit ;
999+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10021000 } else {
10031001 $ args = null ;
10041002 if ( isset ( $ _POST ['woocommerce_option ' ] ) ) {
@@ -1012,9 +1010,8 @@ function rich_snippet_dashboard() {
10121010 }
10131011}
10141012if ( isset ( $ _POST ['item_submit ' ] ) ) {
1015- if ( ! isset ( $ _POST ['snippet_review_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_review_nonce_field ' ], 'snippet_review_form_action ' ) || ! current_user_can ( 'manage_options ' ) ) {
1016- print 'Sorry, your nonce did not verify. ' ;
1017- exit ;
1013+ if ( ! isset ( $ _POST ['snippet_review_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_review_nonce_field ' ] ) ), 'snippet_review_form_action ' ) || ! current_user_can ( 'manage_options ' ) ) {
1014+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10181015 } else {
10191016 $ args = array (); // Defining the $args variable.
10201017 foreach ( array ( 'review_title ' , 'item_reviewer ' , 'review_date ' , 'item_name ' , 'item_rating ' ) as $ option ) {
@@ -1027,10 +1024,9 @@ function rich_snippet_dashboard() {
10271024 }
10281025}
10291026if ( isset ( $ _POST ['event_submit ' ] ) ) {
1030- if ( ! isset ( $ _POST ['snippet_event_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_event_nonce_field ' ], 'snippet_event_form_action ' ) || ! current_user_can ( 'manage_options ' )
1027+ if ( ! isset ( $ _POST ['snippet_event_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_event_nonce_field ' ] ) ) , 'snippet_event_form_action ' ) || ! current_user_can ( 'manage_options ' )
10311028 ) {
1032- print 'Sorry, your nonce did not verify. ' ;
1033- exit ;
1029+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10341030 } else {
10351031 $ args = array (); // Defining the $args variable.
10361032 foreach ( array ( 'snippet_title ' , 'event_title ' , 'event_location ' , 'event_performer ' , 'start_time ' , 'end_time ' , 'event_desc ' , 'events_price ' ) as $ option ) {
@@ -1043,10 +1039,9 @@ function rich_snippet_dashboard() {
10431039 }
10441040}
10451041if ( isset ( $ _POST ['person_submit ' ] ) ) {
1046- if ( ! isset ( $ _POST ['snippet_person_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_person_nonce_field ' ], 'snippet_person_form_action ' ) || ! current_user_can ( 'manage_options ' )
1042+ if ( ! isset ( $ _POST ['snippet_person_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_person_nonce_field ' ] ) ) , 'snippet_person_form_action ' ) || ! current_user_can ( 'manage_options ' )
10471043 ) {
1048- print 'Sorry, your nonce did not verify. ' ;
1049- exit ;
1044+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10501045 } else {
10511046 $ args = array (); // Defining the $args variable.
10521047 foreach ( array ( 'snippet_title ' , 'person_name ' , 'person_nickname ' , 'person_job_title ' , 'person_website ' , 'person_company ' , 'person_address ' ) as $ option ) {
@@ -1059,10 +1054,9 @@ function rich_snippet_dashboard() {
10591054 }
10601055}
10611056if ( isset ( $ _POST ['product_submit ' ] ) ) {
1062- if ( ! isset ( $ _POST ['snippet_product_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_product_nonce_field ' ], 'snippet_product_form_action ' ) || ! current_user_can ( 'manage_options ' )
1057+ if ( ! isset ( $ _POST ['snippet_product_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_product_nonce_field ' ] ) ) , 'snippet_product_form_action ' ) || ! current_user_can ( 'manage_options ' )
10631058 ) {
1064- print 'Sorry, your nonce did not verify. ' ;
1065- exit ;
1059+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10661060 } else {
10671061 $ args = array (); // Defining the $args variable.
10681062 foreach ( array ( 'snippet_title ' , 'product_rating ' , 'product_brand ' , 'product_name ' , 'product_agr ' , 'product_price ' , 'product_avail ' ) as $ option ) {
@@ -1075,10 +1069,9 @@ function rich_snippet_dashboard() {
10751069 }
10761070}
10771071if ( isset ( $ _POST ['recipe_submit ' ] ) ) {
1078- if ( ! isset ( $ _POST ['snippet_recipe_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_recipe_nonce_field ' ], 'snippet_recipe_form_action ' ) || ! current_user_can ( 'manage_options ' )
1072+ if ( ! isset ( $ _POST ['snippet_recipe_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_recipe_nonce_field ' ] ) ) , 'snippet_recipe_form_action ' ) || ! current_user_can ( 'manage_options ' )
10791073 ) {
1080- print 'Sorry, your nonce did not verify. ' ;
1081- exit ;
1074+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10821075 } else {
10831076 $ args = array (); // Defining the $args variable.
10841077 foreach ( array ( 'snippet_title ' , 'recipe_name ' , 'author_name ' , 'recipe_pub ' , 'recipe_prep ' , 'recipe_cook ' , 'recipe_time ' , 'recipe_desc ' , 'recipe_rating ' ) as $ option ) {
@@ -1091,10 +1084,9 @@ function rich_snippet_dashboard() {
10911084 }
10921085}
10931086if ( isset ( $ _POST ['software_submit ' ] ) ) {
1094- if ( ! isset ( $ _POST ['snippet_soft_app_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_soft_app_nonce_field ' ], 'snippet_soft_app_form_action ' ) || ! current_user_can ( 'manage_options ' )
1087+ if ( ! isset ( $ _POST ['snippet_soft_app_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_soft_app_nonce_field ' ] ) ) , 'snippet_soft_app_form_action ' ) || ! current_user_can ( 'manage_options ' )
10951088 ) {
1096- print 'Sorry, your nonce did not verify. ' ;
1097- exit ;
1089+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
10981090 } else {
10991091 $ args = array (); // Defining the $args variable.
11001092 foreach ( array ( 'snippet_title ' , 'software_rating ' , 'software_agr ' , 'software_price ' , 'software_name ' , 'software_os ' , 'software_website ' ) as $ option ) {
@@ -1107,10 +1099,9 @@ function rich_snippet_dashboard() {
11071099 }
11081100}
11091101if ( isset ( $ _POST ['video_submit ' ] ) ) {
1110- if ( ! isset ( $ _POST ['snippet_video_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_video_nonce_field ' ], 'snippet_video_form_action ' ) || ! current_user_can ( 'manage_options ' )
1102+ if ( ! isset ( $ _POST ['snippet_video_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_video_nonce_field ' ] ) ) , 'snippet_video_form_action ' ) || ! current_user_can ( 'manage_options ' )
11111103 ) {
1112- print 'Sorry, your nonce did not verify. ' ;
1113- exit ;
1104+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
11141105 } else {
11151106 $ args = array (); // Defining the $args variable.
11161107 foreach ( array ( 'snippet_title ' , 'video_title ' , 'video_desc ' , 'video_time ' , 'video_date ' ) as $ option ) {
@@ -1123,10 +1114,9 @@ function rich_snippet_dashboard() {
11231114 }
11241115}
11251116if ( isset ( $ _POST ['article_submit ' ] ) ) {
1126- if ( ! isset ( $ _POST ['snippet_article_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_article_nonce_field ' ], 'snippet_article_form_action ' ) || ! current_user_can ( 'manage_options ' )
1117+ if ( ! isset ( $ _POST ['snippet_article_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_article_nonce_field ' ] ) ) , 'snippet_article_form_action ' ) || ! current_user_can ( 'manage_options ' )
11271118 ) {
1128- print 'Sorry, your nonce did not verify. ' ;
1129- exit ;
1119+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
11301120 } else {
11311121 $ args = array (); // Defining the $args variable.
11321122 foreach ( array ( 'snippet_title ' , 'article_name ' , 'article_author ' , 'article_desc ' , 'article_image ' , 'article_publisher ' , 'article_publisher_logo ' ) as $ option ) {
@@ -1139,10 +1129,9 @@ function rich_snippet_dashboard() {
11391129 }
11401130}
11411131if ( isset ( $ _POST ['service_submit ' ] ) ) {
1142- if ( ! isset ( $ _POST ['snippet_service_nonce_field ' ] ) || ! wp_verify_nonce ( $ _POST ['snippet_service_nonce_field ' ], 'snippet_service_form_action ' ) || ! current_user_can ( 'manage_options ' )
1132+ if ( ! isset ( $ _POST ['snippet_service_nonce_field ' ] ) || ! wp_verify_nonce ( sanitize_text_field ( wp_unslash ( $ _POST ['snippet_service_nonce_field ' ] ) ) , 'snippet_service_form_action ' ) || ! current_user_can ( 'manage_options ' )
11431133 ) {
1144- print 'Sorry, your nonce did not verify. ' ;
1145- exit ;
1134+ wp_die ( esc_html__ ( 'Sorry, your nonce did not verify. ' , 'rich-snippets ' ) );
11461135 } else {
11471136 $ args = array (); // Defining the $args variable.
11481137 foreach ( array ( 'snippet_title ' , 'service_type ' , 'service_area ' , 'service_desc ' , 'service_provider_name ' , 'provider_location ' , 'service_rating ' , 'service_channel ' , 'service_url_link ' ) as $ option ) {
@@ -1167,48 +1156,48 @@ function display_status( $status ) {
11671156 }
11681157}
11691158if ( isset ( $ _GET ['action ' ] ) ) {
1170- if ( 'reset ' == sanitize_text_field ( wp_unslash ( $ _GET ['action ' ] ) ) && isset ( $ _GET ['nonce ' ] ) && current_user_can ( 'manage_options ' ) ) {
1159+ if ( 'reset ' === sanitize_text_field ( wp_unslash ( $ _GET ['action ' ] ) ) && isset ( $ _GET ['nonce ' ] ) && current_user_can ( 'manage_options ' ) ) {
11711160 $ option_to_reset = sanitize_text_field ( wp_unslash ( $ _GET ['options ' ] ) );
11721161 $ nonce_value = sanitize_text_field ( wp_unslash ( $ _GET ['nonce ' ] ) );
11731162 $ nonce_verified = false ;
11741163
1175- if ( 'review ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_item_nonce ' ) ) {
1164+ if ( 'review ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_item_nonce ' ) ) {
11761165 delete_option ( 'bsf_review ' );
11771166 $ nonce_verified = true ;
11781167 }
1179- if ( 'event ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_event_nonce ' ) ) {
1168+ if ( 'event ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_event_nonce ' ) ) {
11801169 delete_option ( 'bsf_event ' );
11811170 $ nonce_verified = true ;
11821171 }
1183- if ( 'person ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_person_nonce ' ) ) {
1172+ if ( 'person ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_person_nonce ' ) ) {
11841173 delete_option ( 'bsf_person ' );
11851174 $ nonce_verified = true ;
11861175 }
1187- if ( 'product ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_product_nonce ' ) ) {
1176+ if ( 'product ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_product_nonce ' ) ) {
11881177 delete_option ( 'bsf_product ' );
11891178 $ nonce_verified = true ;
11901179 }
1191- if ( 'recipe ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_recipe_nonce ' ) ) {
1180+ if ( 'recipe ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_recipe_nonce ' ) ) {
11921181 delete_option ( 'bsf_recipe ' );
11931182 $ nonce_verified = true ;
11941183 }
1195- if ( 'software ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_software_nonce ' ) ) {
1184+ if ( 'software ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_software_nonce ' ) ) {
11961185 delete_option ( 'bsf_software ' );
11971186 $ nonce_verified = true ;
11981187 }
1199- if ( 'video ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_video_nonce ' ) ) {
1188+ if ( 'video ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_video_nonce ' ) ) {
12001189 delete_option ( 'bsf_video ' );
12011190 $ nonce_verified = true ;
12021191 }
1203- if ( 'article ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_article_nonce ' ) ) {
1192+ if ( 'article ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_article_nonce ' ) ) {
12041193 delete_option ( 'bsf_article ' );
12051194 $ nonce_verified = true ;
12061195 }
1207- if ( 'service ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_service_nonce ' ) ) {
1196+ if ( 'service ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_service_nonce ' ) ) {
12081197 delete_option ( 'bsf_service ' );
12091198 $ nonce_verified = true ;
12101199 }
1211- if ( 'color ' == $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_color_nonce ' ) ) {
1200+ if ( 'color ' === $ option_to_reset && wp_verify_nonce ( $ nonce_value , 'aiosrs_color_nonce ' ) ) {
12121201 delete_option ( 'bsf_custom ' );
12131202 $ nonce_verified = true ;
12141203 }
@@ -1228,38 +1217,39 @@ function bsf_reset_options( $option_to_reset ) {
12281217 define ( 'AIOSRS_PRO_DIR ' , '' );
12291218 }
12301219 require_once AIOSRS_PRO_DIR . '/settings.php ' ;
1231- if ( 'review ' == $ option_to_reset ) {
1220+ if ( 'review ' === $ option_to_reset ) {
12321221 add_review_option ();
12331222 }
1234- if ( 'event ' == $ option_to_reset ) {
1223+ if ( 'event ' === $ option_to_reset ) {
12351224 add_event_option ();
12361225 }
1237- if ( 'person ' == $ option_to_reset ) {
1226+ if ( 'person ' === $ option_to_reset ) {
12381227 add_person_option ();
12391228 }
1240- if ( 'product ' == $ option_to_reset ) {
1229+ if ( 'product ' === $ option_to_reset ) {
12411230 add_product_option ();
12421231 }
1243- if ( 'recipe ' == $ option_to_reset ) {
1232+ if ( 'recipe ' === $ option_to_reset ) {
12441233 add_recipe_option ();
12451234 }
1246- if ( 'software ' == $ option_to_reset ) {
1235+ if ( 'software ' === $ option_to_reset ) {
12471236 add_software_option ();
12481237 }
1249- if ( 'video ' == $ option_to_reset ) {
1238+ if ( 'video ' === $ option_to_reset ) {
12501239 add_video_option ();
12511240 }
1252- if ( 'article ' == $ option_to_reset ) {
1241+ if ( 'article ' === $ option_to_reset ) {
12531242 add_article_option ();
12541243 }
1255- if ( 'service ' == $ option_to_reset ) {
1244+ if ( 'service ' === $ option_to_reset ) {
12561245 add_service_option ();
12571246 }
1258- if ( 'color ' == $ option_to_reset ) {
1247+ if ( 'color ' === $ option_to_reset ) {
12591248 add_color_option ();
12601249 }
12611250
1262- header ( 'location:?page=rich_snippet_dashboard ' );
1251+ wp_safe_redirect ( admin_url ( 'admin.php?page=rich_snippet_dashboard ' ) );
1252+ exit ;
12631253}
12641254/**
12651255 * Add footer script.
@@ -1291,7 +1281,8 @@ function (response) {
12911281 );
12921282 });
12931283 </script>
1294- <?php }
1284+ <?php
1285+ }
12951286
12961287/**
12971288 * Get support.
@@ -1306,7 +1297,7 @@ function get_support() {
13061297 <form name="support" id="support_form" action="" method="post" onsubmit="return false;">
13071298 <input type="hidden" id="aiosrs_support_form_nonce" name="aiosrs_support_form_nonce" value=" ' . esc_attr ( wp_create_nonce ( 'aiosrs_support_form ' ) ) . '" />
13081299 <p> ' . esc_html__ ( 'Just fill out the form below and your message will be emailed to the Plugin Developers. ' , 'rich-snippets ' ) . ' </p>
1309- <table class="bsf_metabox" > <input type="hidden" name="site_url" value=" ' . site_url () . '" /> </p>
1300+ <table class="bsf_metabox" > <input type="hidden" name="site_url" value=" ' . esc_url ( site_url () ) . '" /> </p>
13101301 <tr><td><label for="name"><strong> ' . esc_html__ ( 'Your Name: ' , 'rich-snippets ' ) . '<span style="color:red;"> *</span></strong> </label></td>
13111302 <td><input required="required" type="text" class="bsf_text_medium" name="name" /></td></tr>
13121303 <tr><td><label for="email"><strong> ' . esc_html__ ( 'Your Email: ' , 'rich-snippets ' ) . '<span style="color:red;"> *</span></strong> </label></td>
@@ -1339,4 +1330,3 @@ function get_support() {
13391330 ' ;
13401331 return $ html ;
13411332}
1342- ?>
0 commit comments