Version Description
(18 March 2021) =
- Fixed: Call to undefined function wp_get_current_user in /admin_section/settings.php(4060) #1347
- Fixed: JobPosting Schema is not showing after modifying on post individually. #1349
- Fixed: Warning: one of contentUrl or embedUrl must be provided warning. #1348
- Fixed: Warning: Undefined variable $hook in \admin_section\settings.php on line 4108 #1346
- Fixed: Collection page(Archive) schema is not being generated for "tag" pages. #1339
- Fixed: Conflict with the forminator plugin #1340
- Fixed: Warning: Undefined array key #1350
- Fixed: Fatal error: Uncaught TypeError while saving post when WPGraphQL plugin is active #1352
- Added: More EmplymentType option inside JobPosting Schema #1353
Download this release
Release Info
Developer | magazine3 |
Plugin | Schema & Structured Data for WP & AMP |
Version | 1.9.68 |
Comparing to | |
See all releases |
Code changes from version 1.9.67 to 1.9.68
- admin_section/common-function.php +54 -28
- admin_section/fields-generator.php +6 -0
- admin_section/images/indexing.png +0 -0
- admin_section/images/reviews_platform_icon/goodreads-img.png +0 -0
- admin_section/images/reviews_platform_icon/shopify-app-store-img.png +0 -0
- admin_section/newsletter.php +1 -1
- admin_section/settings.php +122 -54
- admin_section/structure_admin.php +27 -17
- core/array-list/pro_extensions.php +5 -0
- core/array-list/schema-properties.php +10 -3
- modules/reviews/reviews_service.php +1 -1
- modules/reviews/reviews_setup.php +6 -4
- output/markup.php +1 -1
- output/output.php +1 -1
- output/service.php +1 -1
- readme.txt +13 -1
- structured-data-for-wp.php +2 -2
- view/common.php +38 -17
admin_section/common-function.php
CHANGED
@@ -1806,7 +1806,9 @@ if ( ! defined('ABSPATH') ) exit;
|
|
1806 |
'saswp-microdata-cleanup' => 1,
|
1807 |
'saswp-other-images' => 1,
|
1808 |
'saswp_default_review' => 1,
|
1809 |
-
'saswp-multiple-size-image' => 1
|
|
|
|
|
1810 |
|
1811 |
);
|
1812 |
|
@@ -3259,7 +3261,11 @@ function saswp_current_user_allowed(){
|
|
3259 |
|
3260 |
global $sd_data;
|
3261 |
|
3262 |
-
if(
|
|
|
|
|
|
|
|
|
3263 |
|
3264 |
$currentUser = wp_get_current_user();
|
3265 |
$saswp_roles = isset($sd_data['saswp-role-based-access']) ? $sd_data['saswp-role-based-access'] : array('administrator');
|
@@ -3300,24 +3306,33 @@ function saswp_current_user_can(){
|
|
3300 |
function saswp_post_type_capabilities(){
|
3301 |
|
3302 |
$caplist = array();
|
3303 |
-
|
3304 |
-
$cap = saswp_current_user_can();
|
3305 |
-
|
3306 |
-
if(!is_super_admin()){
|
3307 |
-
|
3308 |
-
$caplist = array(
|
3309 |
-
'publish_posts' => $cap,
|
3310 |
-
'edit_posts' => $cap,
|
3311 |
-
'edit_others_posts' => $cap,
|
3312 |
-
'delete_posts' => $cap,
|
3313 |
-
'delete_others_posts' => $cap,
|
3314 |
-
'read_private_posts' => $cap,
|
3315 |
-
'edit_post' => $cap,
|
3316 |
-
'delete_post' => $cap,
|
3317 |
-
'read_post' => $cap,
|
3318 |
-
);
|
3319 |
|
|
|
|
|
|
|
3320 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3321 |
|
3322 |
return $caplist;
|
3323 |
}
|
@@ -3501,19 +3516,30 @@ function saswp_get_video_metadata($content = ''){
|
|
3501 |
|
3502 |
}
|
3503 |
|
3504 |
-
$attributes = saswp_get_gutenberg_block_data('core-embed/youtube');
|
3505 |
-
|
3506 |
-
if(isset($attributes['attrs']['url'])){
|
3507 |
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
3511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3512 |
|
3513 |
-
$metadata['video_url'] = $vurl;
|
3514 |
-
$response[0] = $metadata;
|
3515 |
}
|
3516 |
-
|
3517 |
return $response;
|
3518 |
}
|
3519 |
|
1806 |
'saswp-microdata-cleanup' => 1,
|
1807 |
'saswp-other-images' => 1,
|
1808 |
'saswp_default_review' => 1,
|
1809 |
+
'saswp-multiple-size-image' => 1,
|
1810 |
+
'instant_indexing_action' => 1,
|
1811 |
+
'instant_indexing' => array('post' => 1, 'page' => 1)
|
1812 |
|
1813 |
);
|
1814 |
|
3261 |
|
3262 |
global $sd_data;
|
3263 |
|
3264 |
+
if(!function_exists('wp_get_current_user')) {
|
3265 |
+
require_once( ABSPATH . '/wp-includes/pluggable.php' );
|
3266 |
+
}
|
3267 |
+
|
3268 |
+
if( ( function_exists('is_user_logged_in') && is_user_logged_in() ) && function_exists('wp_get_current_user') ) {
|
3269 |
|
3270 |
$currentUser = wp_get_current_user();
|
3271 |
$saswp_roles = isset($sd_data['saswp-role-based-access']) ? $sd_data['saswp-role-based-access'] : array('administrator');
|
3306 |
function saswp_post_type_capabilities(){
|
3307 |
|
3308 |
$caplist = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3309 |
|
3310 |
+
if(!function_exists('is_super_admin') || !function_exists('wp_get_current_user')) {
|
3311 |
+
require_once( ABSPATH . '/wp-includes/capabilities.php' );
|
3312 |
+
require_once( ABSPATH . '/wp-includes/pluggable.php' );
|
3313 |
}
|
3314 |
+
|
3315 |
+
if( function_exists('is_super_admin') && function_exists('wp_get_current_user') ){
|
3316 |
+
|
3317 |
+
$cap = saswp_current_user_can();
|
3318 |
+
|
3319 |
+
if(!is_super_admin()){
|
3320 |
+
|
3321 |
+
$caplist = array(
|
3322 |
+
'publish_posts' => $cap,
|
3323 |
+
'edit_posts' => $cap,
|
3324 |
+
'edit_others_posts' => $cap,
|
3325 |
+
'delete_posts' => $cap,
|
3326 |
+
'delete_others_posts' => $cap,
|
3327 |
+
'read_private_posts' => $cap,
|
3328 |
+
'edit_post' => $cap,
|
3329 |
+
'delete_post' => $cap,
|
3330 |
+
'read_post' => $cap,
|
3331 |
+
);
|
3332 |
+
|
3333 |
+
}
|
3334 |
+
|
3335 |
+
}
|
3336 |
|
3337 |
return $caplist;
|
3338 |
}
|
3516 |
|
3517 |
}
|
3518 |
|
|
|
|
|
|
|
3519 |
|
3520 |
+
if(function_exists('has_block')){
|
3521 |
+
|
3522 |
+
if( has_block('core-embed/youtube') ){
|
3523 |
+
$attributes = saswp_get_gutenberg_block_data('core-embed/youtube');
|
3524 |
+
}
|
3525 |
+
|
3526 |
+
if( has_block('core/embed') ){
|
3527 |
+
$attributes = saswp_get_gutenberg_block_data('core/embed');
|
3528 |
+
}
|
3529 |
+
|
3530 |
+
if(isset($attributes['attrs']['url'])){
|
3531 |
+
|
3532 |
+
$vurl = $attributes['attrs']['url'];
|
3533 |
+
$rulr = 'https://www.youtube.com/oembed?url='.esc_attr($vurl).'&format=json';
|
3534 |
+
$result = @wp_remote_get($rulr);
|
3535 |
+
$metadata = json_decode(wp_remote_retrieve_body($result),true);
|
3536 |
+
|
3537 |
+
$metadata['video_url'] = $vurl;
|
3538 |
+
$response[0] = $metadata;
|
3539 |
+
}
|
3540 |
|
|
|
|
|
3541 |
}
|
3542 |
+
|
3543 |
return $response;
|
3544 |
}
|
3545 |
|
admin_section/fields-generator.php
CHANGED
@@ -504,6 +504,12 @@ class saswp_fields_generator {
|
|
504 |
<li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/judge-me-img.png">
|
505 |
<span>Judge.me</span>
|
506 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
</ul>
|
508 |
</div>
|
509 |
<div class="saswp-rev-btn">
|
504 |
<li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/judge-me-img.png">
|
505 |
<span>Judge.me</span>
|
506 |
</li>
|
507 |
+
<li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/shopify-app-store-img.png">
|
508 |
+
<span>Shopify App Store</span>
|
509 |
+
</li>
|
510 |
+
<li><img src="'.SASWP_PLUGIN_URL.'/admin_section/images/reviews_platform_icon/goodreads-img.png">
|
511 |
+
<span>Goodreads</span>
|
512 |
+
</li>
|
513 |
</ul>
|
514 |
</div>
|
515 |
<div class="saswp-rev-btn">
|
admin_section/images/indexing.png
ADDED
Binary file
|
admin_section/images/reviews_platform_icon/goodreads-img.png
ADDED
Binary file
|
admin_section/images/reviews_platform_icon/shopify-app-store-img.png
ADDED
Binary file
|
admin_section/newsletter.php
CHANGED
@@ -56,7 +56,7 @@ class saswp_ads_newsletter {
|
|
56 |
|
57 |
function saswp_add_localize_footer_data($object, $object_name){
|
58 |
|
59 |
-
$dismissed = explode (',', get_user_meta (wp_get_current_user
|
60 |
$do_tour = !in_array ('saswp_subscribe_pointer', $dismissed);
|
61 |
|
62 |
if ($do_tour) {
|
56 |
|
57 |
function saswp_add_localize_footer_data($object, $object_name){
|
58 |
|
59 |
+
$dismissed = explode (',', get_user_meta (wp_get_current_user()->ID, 'dismissed_wp_pointers', true));
|
60 |
$do_tour = !in_array ('saswp_subscribe_pointer', $dismissed);
|
61 |
|
62 |
if ($do_tour) {
|
admin_section/settings.php
CHANGED
@@ -95,12 +95,8 @@ function saswp_admin_interface_render(){
|
|
95 |
if ( isset( $_GET['settings-updated'] ) ) {
|
96 |
settings_errors();
|
97 |
}
|
98 |
-
|
99 |
-
|
100 |
-
$is_amp = true;
|
101 |
-
}
|
102 |
-
|
103 |
-
$tab = saswp_get_tab('general', array('general', 'amp','review','compatibility','email_schema', 'tools', 'tools','premium_features', 'services', 'support'));
|
104 |
|
105 |
?>
|
106 |
<div class="saswp-settings-container">
|
@@ -109,33 +105,29 @@ function saswp_admin_interface_render(){
|
|
109 |
<div>
|
110 |
<h2 class="nav-tab-wrapper saswp-tabs">
|
111 |
|
112 |
-
<?php
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
//echo '<a target="_blank" href="http://structured-data-for-wp.com/festive-season/" class="nav-tab saswp-offer-banner">50% OFF for LIMITED time</a>'
|
133 |
-
|
134 |
?>
|
135 |
|
136 |
</h2>
|
137 |
-
|
138 |
-
|
139 |
</div>
|
140 |
|
141 |
<form action="<?php echo admin_url("options.php") ?>" method="post" enctype="multipart/form-data" class="saswp-settings-form">
|
@@ -188,7 +180,7 @@ function saswp_admin_interface_render(){
|
|
188 |
// Status
|
189 |
do_settings_sections( 'saswp_email_schema_section' ); // Page slug
|
190 |
echo "</div>";
|
191 |
-
|
192 |
echo "<div class='saswp-tools' ".( $tab != 'tools' ? 'style="display:none;"' : '').">";
|
193 |
|
194 |
echo '<div id="saswp-tools-tabs" style="margin-top: 10px;">';
|
@@ -216,6 +208,8 @@ function saswp_admin_interface_render(){
|
|
216 |
do_settings_sections( 'saswp_support_section' ); // Page slug
|
217 |
echo "</div>";
|
218 |
|
|
|
|
|
219 |
?>
|
220 |
</div>
|
221 |
<div class="button-wrapper">
|
@@ -311,8 +305,7 @@ function saswp_settings_init(){
|
|
311 |
'saswp_email_schema_callback', // CB
|
312 |
'saswp_email_schema_section', // Page slug
|
313 |
'saswp_email_schema_section' // Settings Section ID
|
314 |
-
);
|
315 |
-
|
316 |
|
317 |
add_settings_section('saswp_support_section', __return_false(), '__return_false', 'saswp_support_section');
|
318 |
|
@@ -417,9 +410,42 @@ function saswp_handle_file_upload($option){
|
|
417 |
|
418 |
|
419 |
function saswp_premium_features_callback(){ ?>
|
|
|
420 |
<div class="saswp-pre-ftrs-wrap">
|
|
|
421 |
<ul class="saswp-features-blocks">
|
422 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
<li>
|
424 |
|
425 |
<?php
|
@@ -440,7 +466,7 @@ function saswp_premium_features_callback(){ ?>
|
|
440 |
<img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/polylang.png">
|
441 |
</div>
|
442 |
<div class="saswp-ele-tlt">
|
443 |
-
<h3><?php echo saswp_t_string('Polylang Compatibility
|
444 |
<p><?php echo saswp_t_string('It adds all the static labels from this plugin to Polylang Strings Translations dashboard where user can translate it') ?></p>
|
445 |
</div>
|
446 |
</div>
|
@@ -1429,7 +1455,7 @@ function saswp_import_callback(){
|
|
1429 |
|
1430 |
);
|
1431 |
|
1432 |
-
if(is_super_admin()){
|
1433 |
|
1434 |
$meta_fields[] = array(
|
1435 |
'label' => 'Role Based Access',
|
@@ -1651,7 +1677,13 @@ function saswp_import_callback(){
|
|
1651 |
<?php
|
1652 |
|
1653 |
$add_on = array();
|
1654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1655 |
if(is_plugin_active('cooked-compatibility-for-schema/cooked-compatibility-for-schema.php')){
|
1656 |
|
1657 |
$add_on[] = 'Cooked';
|
@@ -4023,6 +4055,8 @@ function saswp_enqueue_style_js( $hook ) {
|
|
4023 |
wp_style_add_data( 'saswp-main-css', 'rtl', 'replace' );
|
4024 |
|
4025 |
|
|
|
|
|
4026 |
}
|
4027 |
|
4028 |
}
|
@@ -4059,7 +4093,31 @@ function saswp_enqueue_saswp_select2_js( $hook ) {
|
|
4059 |
|
4060 |
}
|
4061 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4062 |
add_action( 'admin_enqueue_scripts', 'saswp_enqueue_saswp_select2_js',9999 );
|
|
|
4063 |
|
4064 |
add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
|
4065 |
|
@@ -4071,25 +4129,35 @@ add_filter( 'option_page_capability_sd_data_group', 'saswp_option_page_capabilit
|
|
4071 |
|
4072 |
function saswp_pre_update_settings($value, $old_value, $option){
|
4073 |
|
4074 |
-
|
4075 |
-
|
4076 |
-
|
4077 |
-
|
4078 |
-
}
|
4079 |
-
|
4080 |
-
}else{
|
4081 |
|
4082 |
-
if(
|
4083 |
-
|
4084 |
-
|
4085 |
-
|
4086 |
-
|
4087 |
-
|
4088 |
-
|
4089 |
-
|
4090 |
-
|
4091 |
-
|
4092 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4093 |
}
|
4094 |
|
4095 |
add_filter('pre_update_option_sd_data', 'saswp_pre_update_settings',10,3);
|
95 |
if ( isset( $_GET['settings-updated'] ) ) {
|
96 |
settings_errors();
|
97 |
}
|
98 |
+
|
99 |
+
$tab = saswp_get_tab('general', apply_filters( 'saswp_extra_settings_tab', array('general', 'amp','review','compatibility','email_schema', 'tools','premium_features', 'services', 'support') ));
|
|
|
|
|
|
|
|
|
100 |
|
101 |
?>
|
102 |
<div class="saswp-settings-container">
|
105 |
<div>
|
106 |
<h2 class="nav-tab-wrapper saswp-tabs">
|
107 |
|
108 |
+
<?php
|
109 |
+
|
110 |
+
$tab_links = apply_filters( 'saswp_extra_settings_tab_link',
|
111 |
+
array(
|
112 |
+
'<a href="' . esc_url(saswp_admin_link('general')) . '" class="nav-tab ' . esc_attr( $tab == 'general' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Global') . '</a>',
|
113 |
+
'<a href="' . esc_url(saswp_admin_link('amp')) . '" class="nav-tab ' . esc_attr( $tab == 'amp' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('AMP') . '</a>',
|
114 |
+
'<a href="' . esc_url(saswp_admin_link('review')) . '" class="nav-tab ' . esc_attr( $tab == 'review' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Review') . '</a>',
|
115 |
+
'<a href="' . esc_url(saswp_admin_link('compatibility')) . '" class="nav-tab ' . esc_attr( $tab == 'compatibility' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Compatibility') . '</a>',
|
116 |
+
'<a href="' . esc_url(saswp_admin_link('email_schema')) . '" class="nav-tab ' . esc_attr( $tab == 'email_schema' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Email Schema') . '</a>',
|
117 |
+
'<a href="' . esc_url(saswp_admin_link('tools')) . '" class="nav-tab ' . esc_attr( $tab == 'tools' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Advanced') . '</a>',
|
118 |
+
'<a href="' . esc_url(saswp_admin_link('premium_features')) . '" class="nav-tab ' . esc_attr( $tab == 'premium_features' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Premium Features') . '</a>',
|
119 |
+
'<a href="' . esc_url(saswp_admin_link('services')) . '" class="nav-tab ' . esc_attr( $tab == 'services' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Services') . '</a>',
|
120 |
+
'<a href="' . esc_url(saswp_admin_link('support')) . '" class="nav-tab ' . esc_attr( $tab == 'support' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . saswp_t_string('Support') . '</a>',
|
121 |
+
//'<a target="_blank" href="http://structured-data-for-wp.com/festive-season/" class="nav-tab saswp-offer-banner">50% OFF for LIMITED time</a>'
|
122 |
+
), $tab);
|
123 |
+
|
124 |
+
foreach($tab_links as $link){
|
125 |
+
echo $link;
|
126 |
+
}
|
|
|
|
|
|
|
127 |
?>
|
128 |
|
129 |
</h2>
|
130 |
+
|
|
|
131 |
</div>
|
132 |
|
133 |
<form action="<?php echo admin_url("options.php") ?>" method="post" enctype="multipart/form-data" class="saswp-settings-form">
|
180 |
// Status
|
181 |
do_settings_sections( 'saswp_email_schema_section' ); // Page slug
|
182 |
echo "</div>";
|
183 |
+
|
184 |
echo "<div class='saswp-tools' ".( $tab != 'tools' ? 'style="display:none;"' : '').">";
|
185 |
|
186 |
echo '<div id="saswp-tools-tabs" style="margin-top: 10px;">';
|
208 |
do_settings_sections( 'saswp_support_section' ); // Page slug
|
209 |
echo "</div>";
|
210 |
|
211 |
+
apply_filters('saswp_extra_settings_tab_div', $tab);
|
212 |
+
|
213 |
?>
|
214 |
</div>
|
215 |
<div class="button-wrapper">
|
305 |
'saswp_email_schema_callback', // CB
|
306 |
'saswp_email_schema_section', // Page slug
|
307 |
'saswp_email_schema_section' // Settings Section ID
|
308 |
+
);
|
|
|
309 |
|
310 |
add_settings_section('saswp_support_section', __return_false(), '__return_false', 'saswp_support_section');
|
311 |
|
410 |
|
411 |
|
412 |
function saswp_premium_features_callback(){ ?>
|
413 |
+
|
414 |
<div class="saswp-pre-ftrs-wrap">
|
415 |
+
|
416 |
<ul class="saswp-features-blocks">
|
417 |
|
418 |
+
<li>
|
419 |
+
|
420 |
+
<?php
|
421 |
+
|
422 |
+
$cooked_active_text = '';
|
423 |
+
|
424 |
+
if(is_plugin_active('1-click-indexing-api-integration-for-saswp/1-click-indexing-api-integration-for-saswp.php')){
|
425 |
+
$cooked_active_text = '<label class="saswp-sts-txt">Status :<span style="color:green;">Active</span></label>';
|
426 |
+
}else{
|
427 |
+
$cooked_active_text .='<label class="saswp-sts-txt">Status :<span>Inactive</span></label>';
|
428 |
+
$cooked_active_text .='<a target="_blank" href="http://structured-data-for-wp.com/extensions/"><span class="saswp-d-btn">Download</span></a>';
|
429 |
+
}
|
430 |
+
|
431 |
+
?>
|
432 |
+
|
433 |
+
<div class="saswp-features-ele">
|
434 |
+
<div class="saswp-ele-ic" style="background: #9fa2f5;">
|
435 |
+
<img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/indexing.png">
|
436 |
+
</div>
|
437 |
+
<div class="saswp-ele-tlt">
|
438 |
+
<h3><?php echo saswp_t_string('1-Click Indexing API Integration') ?></h3>
|
439 |
+
<p><?php echo saswp_t_string('The Indexing API allows any site owner to directly notify Google when pages are added or removed. This allows Google to schedule pages for a fresh crawl, which can lead to higher quality user traffic') ?></p>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
<div class="saswp-sts-btn">
|
443 |
+
|
444 |
+
<?php echo $cooked_active_text; ?>
|
445 |
+
|
446 |
+
</div>
|
447 |
+
</li>
|
448 |
+
|
449 |
<li>
|
450 |
|
451 |
<?php
|
466 |
<img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/polylang.png">
|
467 |
</div>
|
468 |
<div class="saswp-ele-tlt">
|
469 |
+
<h3><?php echo saswp_t_string('Polylang Compatibility') ?></h3>
|
470 |
<p><?php echo saswp_t_string('It adds all the static labels from this plugin to Polylang Strings Translations dashboard where user can translate it') ?></p>
|
471 |
</div>
|
472 |
</div>
|
1455 |
|
1456 |
);
|
1457 |
|
1458 |
+
if( function_exists('is_super_admin') && is_super_admin() ){
|
1459 |
|
1460 |
$meta_fields[] = array(
|
1461 |
'label' => 'Role Based Access',
|
1677 |
<?php
|
1678 |
|
1679 |
$add_on = array();
|
1680 |
+
|
1681 |
+
if(is_plugin_active('1-click-indexing-api-integration-for-saswp/1-click-indexing-api-integration-for-saswp.php')){
|
1682 |
+
|
1683 |
+
$add_on[] = 'OCIAIFS';
|
1684 |
+
|
1685 |
+
}
|
1686 |
+
|
1687 |
if(is_plugin_active('cooked-compatibility-for-schema/cooked-compatibility-for-schema.php')){
|
1688 |
|
1689 |
$add_on[] = 'Cooked';
|
4055 |
wp_style_add_data( 'saswp-main-css', 'rtl', 'replace' );
|
4056 |
|
4057 |
|
4058 |
+
apply_filters('saswp_wp_enqueue_more_script', '');
|
4059 |
+
|
4060 |
}
|
4061 |
|
4062 |
}
|
4093 |
|
4094 |
}
|
4095 |
|
4096 |
+
function saswp_dequeue_other_select2_on_saswp_screen(){
|
4097 |
+
|
4098 |
+
global $saswp_metaboxes;
|
4099 |
+
|
4100 |
+
$post_type = $hook = '';
|
4101 |
+
$current_screen = get_current_screen();
|
4102 |
+
|
4103 |
+
if(isset($current_screen->id)){
|
4104 |
+
$hook = $current_screen->id;
|
4105 |
+
}
|
4106 |
+
|
4107 |
+
if(isset($current_screen->post_type)){
|
4108 |
+
$post_type = $current_screen->post_type;
|
4109 |
+
}
|
4110 |
+
|
4111 |
+
if($saswp_metaboxes || $post_type == 'saswp' || $post_type == 'saswp-collections' || $post_type == 'saswp_reviews' || $hook == 'saswp_page_structured_data_options' || $hook == 'saswp_page_collection' ){
|
4112 |
+
|
4113 |
+
wp_dequeue_script( 'forminator-shared-ui' );
|
4114 |
+
|
4115 |
+
}
|
4116 |
+
|
4117 |
+
}
|
4118 |
+
|
4119 |
add_action( 'admin_enqueue_scripts', 'saswp_enqueue_saswp_select2_js',9999 );
|
4120 |
+
add_action( 'admin_footer', 'saswp_dequeue_other_select2_on_saswp_screen',9999 );
|
4121 |
|
4122 |
add_action( 'admin_enqueue_scripts', 'saswp_enqueue_style_js' );
|
4123 |
|
4129 |
|
4130 |
function saswp_pre_update_settings($value, $old_value, $option){
|
4131 |
|
4132 |
+
if(!function_exists('is_super_admin') || !function_exists('wp_get_current_user') ) {
|
4133 |
+
require_once( ABSPATH . '/wp-includes/capabilities.php' );
|
4134 |
+
require_once( ABSPATH . '/wp-includes/pluggable.php' );
|
4135 |
+
}
|
|
|
|
|
|
|
4136 |
|
4137 |
+
if( function_exists('is_super_admin') && function_exists('wp_get_current_user') ){
|
4138 |
+
|
4139 |
+
if(!is_super_admin()){
|
4140 |
+
|
4141 |
+
if(isset($old_value['saswp-role-based-access'])){
|
4142 |
+
$value['saswp-role-based-access'] = $old_value['saswp-role-based-access'];
|
4143 |
+
}
|
4144 |
+
|
4145 |
+
}else{
|
4146 |
+
|
4147 |
+
if(isset($value['saswp-role-based-access']) && !empty($value['saswp-role-based-access'])){
|
4148 |
+
if(!in_array('administrator', $value['saswp-role-based-access'])){
|
4149 |
+
array_push($value['saswp-role-based-access'], 'administrator');
|
4150 |
+
}
|
4151 |
+
}else{
|
4152 |
+
$value['saswp-role-based-access'] = array();
|
4153 |
+
array_push($value['saswp-role-based-access'], 'administrator');
|
4154 |
+
}
|
4155 |
+
|
4156 |
+
}
|
4157 |
+
|
4158 |
+
}
|
4159 |
+
|
4160 |
+
return $value;
|
4161 |
}
|
4162 |
|
4163 |
add_filter('pre_update_option_sd_data', 'saswp_pre_update_settings',10,3);
|
admin_section/structure_admin.php
CHANGED
@@ -296,7 +296,11 @@ function saswp_comparison_logic_checker($input){
|
|
296 |
$result = '';
|
297 |
|
298 |
// Get all the users registered
|
299 |
-
$user =
|
|
|
|
|
|
|
|
|
300 |
|
301 |
switch ($type) {
|
302 |
|
@@ -380,9 +384,15 @@ function saswp_comparison_logic_checker($input){
|
|
380 |
// Logged in User Type
|
381 |
case 'user_type':
|
382 |
if ( $comparison == 'equal') {
|
383 |
-
|
|
|
|
|
|
|
384 |
$result = true;
|
|
|
|
|
385 |
}
|
|
|
386 |
}
|
387 |
if ( $comparison == 'not_equal') {
|
388 |
|
@@ -963,9 +973,7 @@ function saswp_dequeue_script() {
|
|
963 |
|
964 |
// if our current user can't edit this post, bail
|
965 |
if( !current_user_can( saswp_current_user_can() ) ) return;
|
966 |
-
|
967 |
-
$meta_value = get_post_meta( $post_id, null, true );
|
968 |
-
|
969 |
$post_data_group_array = array();
|
970 |
$temp_condition_array = array();
|
971 |
$show_globally = false;
|
@@ -1460,17 +1468,18 @@ function saswp_send_query_message(){
|
|
1460 |
$message = sanitize_textarea_field($_POST['message']);
|
1461 |
$email = sanitize_textarea_field($_POST['email']);
|
1462 |
$premium_cus = sanitize_textarea_field($_POST['premium_cus']);
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
|
|
1474 |
|
1475 |
$user_data = $user->data;
|
1476 |
$user_email = $user_data->user_email;
|
@@ -1701,7 +1710,8 @@ function saswp_license_status($add_on, $license_status, $license_key){
|
|
1701 |
'es' => 'Event Schema',
|
1702 |
'rs' => 'Recipe Schema',
|
1703 |
'qanda' => 'Q&A Schema Compatibility',
|
1704 |
-
'faq' => 'FAQ Schema Compatibility'
|
|
|
1705 |
);
|
1706 |
|
1707 |
$edd_action = '';
|
296 |
$result = '';
|
297 |
|
298 |
// Get all the users registered
|
299 |
+
$user = null;
|
300 |
+
|
301 |
+
if( function_exists('wp_get_current_user') ){
|
302 |
+
$user = wp_get_current_user();
|
303 |
+
}
|
304 |
|
305 |
switch ($type) {
|
306 |
|
384 |
// Logged in User Type
|
385 |
case 'user_type':
|
386 |
if ( $comparison == 'equal') {
|
387 |
+
|
388 |
+
if(is_object($user)){
|
389 |
+
|
390 |
+
if ( in_array( $data, (array) $user->roles ) ) {
|
391 |
$result = true;
|
392 |
+
}
|
393 |
+
|
394 |
}
|
395 |
+
|
396 |
}
|
397 |
if ( $comparison == 'not_equal') {
|
398 |
|
973 |
|
974 |
// if our current user can't edit this post, bail
|
975 |
if( !current_user_can( saswp_current_user_can() ) ) return;
|
976 |
+
|
|
|
|
|
977 |
$post_data_group_array = array();
|
978 |
$temp_condition_array = array();
|
979 |
$show_globally = false;
|
1468 |
$message = sanitize_textarea_field($_POST['message']);
|
1469 |
$email = sanitize_textarea_field($_POST['email']);
|
1470 |
$premium_cus = sanitize_textarea_field($_POST['premium_cus']);
|
1471 |
+
|
1472 |
+
if(function_exists('wp_get_current_user')){
|
1473 |
+
|
1474 |
+
$user = wp_get_current_user();
|
1475 |
+
|
1476 |
+
if($premium_cus == 'yes'){
|
1477 |
+
$customer_type = 'Are you a premium customer ? Yes';
|
1478 |
+
}
|
1479 |
+
|
1480 |
+
$message = '<p>'.$message.'</p><br><br>'
|
1481 |
+
. $customer_type
|
1482 |
+
. '<br><br>'.'Query from plugin support tab';
|
1483 |
|
1484 |
$user_data = $user->data;
|
1485 |
$user_email = $user_data->user_email;
|
1710 |
'es' => 'Event Schema',
|
1711 |
'rs' => 'Recipe Schema',
|
1712 |
'qanda' => 'Q&A Schema Compatibility',
|
1713 |
+
'faq' => 'FAQ Schema Compatibility',
|
1714 |
+
'ociaifs' => '1 Click Indexing Api Integration For SASWP'
|
1715 |
);
|
1716 |
|
1717 |
$edd_action = '';
|
core/array-list/pro_extensions.php
CHANGED
@@ -3,6 +3,11 @@
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
return array(
|
|
|
|
|
|
|
|
|
|
|
6 |
array(
|
7 |
'key' => 'polylang_compatibility_for_saswp',
|
8 |
'name' => 'Polylang Compatibility For SASWP',
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
return array(
|
6 |
+
array(
|
7 |
+
'key' => 'ociaifs_for_saswp',
|
8 |
+
'name' => '1 Click Indexing Api Integration For SASWP',
|
9 |
+
'path' => '1-click-indexing-api-integration-for-saswp/1-click-indexing-api-integration-for-saswp.php',
|
10 |
+
),
|
11 |
array(
|
12 |
'key' => 'polylang_compatibility_for_saswp',
|
13 |
'name' => 'Polylang Compatibility For SASWP',
|
core/array-list/schema-properties.php
CHANGED
@@ -32,12 +32,16 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
|
|
32 |
if(is_object($post)){
|
33 |
$post_id = $post->ID;
|
34 |
}
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
37 |
$author_desc = get_the_author_meta( 'user_description' );
|
38 |
$author_url = get_the_author_meta( 'user_url' );
|
39 |
|
40 |
-
if(function_exists('get_avatar_data')){
|
41 |
$author_details = get_avatar_data($current_user->ID);
|
42 |
}
|
43 |
|
@@ -4762,7 +4766,10 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
|
|
4762 |
'options' => array(
|
4763 |
'Full-Time' => 'Full-Time',
|
4764 |
'Part-Time' => 'Part-Time',
|
4765 |
-
'Contractor' => 'Contractor',
|
|
|
|
|
|
|
4766 |
)
|
4767 |
),
|
4768 |
array(
|
32 |
if(is_object($post)){
|
33 |
$post_id = $post->ID;
|
34 |
}
|
35 |
+
$current_user = null;
|
36 |
|
37 |
+
if( function_exists('wp_get_current_user') ){
|
38 |
+
$current_user = wp_get_current_user();
|
39 |
+
}
|
40 |
+
|
41 |
$author_desc = get_the_author_meta( 'user_description' );
|
42 |
$author_url = get_the_author_meta( 'user_url' );
|
43 |
|
44 |
+
if(function_exists('get_avatar_data') && is_object($current_user) ){
|
45 |
$author_details = get_avatar_data($current_user->ID);
|
46 |
}
|
47 |
|
4766 |
'options' => array(
|
4767 |
'Full-Time' => 'Full-Time',
|
4768 |
'Part-Time' => 'Part-Time',
|
4769 |
+
'Contractor' => 'Contractor',
|
4770 |
+
'Temporary' => 'Temporary',
|
4771 |
+
'Seasonal' => 'Seasonal',
|
4772 |
+
'Internship' => 'Internship',
|
4773 |
)
|
4774 |
),
|
4775 |
array(
|
modules/reviews/reviews_service.php
CHANGED
@@ -115,7 +115,7 @@ class saswp_reviews_service {
|
|
115 |
$rv_image = '';
|
116 |
$postarr = array();
|
117 |
|
118 |
-
if(is_user_logged_in()){
|
119 |
|
120 |
$current_user = wp_get_current_user();
|
121 |
$postarr['post_author'] = $current_user->ID;
|
115 |
$rv_image = '';
|
116 |
$postarr = array();
|
117 |
|
118 |
+
if( (function_exists('is_user_logged_in') && is_user_logged_in() ) && function_exists('wp_get_current_user') ){
|
119 |
|
120 |
$current_user = wp_get_current_user();
|
121 |
$postarr['post_author'] = $current_user->ID;
|
modules/reviews/reviews_setup.php
CHANGED
@@ -353,7 +353,7 @@ function saswp_insert_platform_terms(){
|
|
353 |
|
354 |
$platform_inserted = get_transient('saswp_platform_inserted');
|
355 |
|
356 |
-
if($platform_inserted !=
|
357 |
|
358 |
$term_array = array(
|
359 |
'Self',
|
@@ -364,10 +364,11 @@ function saswp_insert_platform_terms(){
|
|
364 |
'Expedia',
|
365 |
'Facebook',
|
366 |
'Google',
|
|
|
367 |
'TripAdvisor',
|
368 |
'Yelp',
|
369 |
'Zillow',
|
370 |
-
'Zomato',
|
371 |
'Airbnb',
|
372 |
'AliExpress',
|
373 |
'AlternativeTo',
|
@@ -420,6 +421,7 @@ function saswp_insert_platform_terms(){
|
|
420 |
'Siftery',
|
421 |
'Steam',
|
422 |
'SoftwareAdvice',
|
|
|
423 |
'Shopper Approved',
|
424 |
'Talabat',
|
425 |
'The Knot',
|
@@ -459,8 +461,8 @@ function saswp_insert_platform_terms(){
|
|
459 |
|
460 |
}
|
461 |
|
462 |
-
if(count($term_ids) ==
|
463 |
-
set_transient('saswp_platform_inserted',
|
464 |
}
|
465 |
|
466 |
}
|
353 |
|
354 |
$platform_inserted = get_transient('saswp_platform_inserted');
|
355 |
|
356 |
+
if($platform_inserted != 81){
|
357 |
|
358 |
$term_array = array(
|
359 |
'Self',
|
364 |
'Expedia',
|
365 |
'Facebook',
|
366 |
'Google',
|
367 |
+
'Goodreads',
|
368 |
'TripAdvisor',
|
369 |
'Yelp',
|
370 |
'Zillow',
|
371 |
+
'Zomato',
|
372 |
'Airbnb',
|
373 |
'AliExpress',
|
374 |
'AlternativeTo',
|
421 |
'Siftery',
|
422 |
'Steam',
|
423 |
'SoftwareAdvice',
|
424 |
+
'Shopify App Store',
|
425 |
'Shopper Approved',
|
426 |
'Talabat',
|
427 |
'The Knot',
|
461 |
|
462 |
}
|
463 |
|
464 |
+
if(count($term_ids) == 81){
|
465 |
+
set_transient('saswp_platform_inserted', 81, 24*7*HOUR_IN_SECONDS );
|
466 |
}
|
467 |
|
468 |
}
|
output/markup.php
CHANGED
@@ -2181,7 +2181,7 @@ function saswp_job_posting_schema_markup($schema_id, $schema_post_id, $all_post_
|
|
2181 |
$input1['estimatedSalary']['value']['value'] = saswp_remove_warnings($all_post_meta, 'saswp_jobposting_schema_es_value_'.$schema_id, 'saswp_array');
|
2182 |
$input1['estimatedSalary']['value']['unitText'] = saswp_remove_warnings($all_post_meta, 'saswp_jobposting_schema_es_unittext_'.$schema_id, 'saswp_array');
|
2183 |
|
2184 |
-
if(isset($all_post_meta['saswp_jobposting_schema_validthrough_'.$schema_id][0]) && date('Y-m-d',strtotime($all_post_meta['saswp_jobposting_schema_validthrough_'.$schema_id][0])) < date('Y-m-d')){
|
2185 |
$input1 = array();
|
2186 |
}
|
2187 |
|
2181 |
$input1['estimatedSalary']['value']['value'] = saswp_remove_warnings($all_post_meta, 'saswp_jobposting_schema_es_value_'.$schema_id, 'saswp_array');
|
2182 |
$input1['estimatedSalary']['value']['unitText'] = saswp_remove_warnings($all_post_meta, 'saswp_jobposting_schema_es_unittext_'.$schema_id, 'saswp_array');
|
2183 |
|
2184 |
+
if( ( isset($all_post_meta['saswp_jobposting_schema_validthrough_'.$schema_id][0] ) && $all_post_meta['saswp_jobposting_schema_validthrough_'.$schema_id][0] !='' ) && date('Y-m-d',strtotime($all_post_meta['saswp_jobposting_schema_validthrough_'.$schema_id][0]) ) < date('Y-m-d') ){
|
2185 |
$input1 = array();
|
2186 |
}
|
2187 |
|
output/output.php
CHANGED
@@ -2483,7 +2483,7 @@ function saswp_archive_output(){
|
|
2483 |
|
2484 |
if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
|
2485 |
|
2486 |
-
if ( (is_category() || is_tax()) && !$product_cat ) {
|
2487 |
|
2488 |
$i = 1;
|
2489 |
$category_loop = new WP_Query( $query_string );
|
2483 |
|
2484 |
if(isset($sd_data['saswp_archive_schema']) && $sd_data['saswp_archive_schema'] == 1){
|
2485 |
|
2486 |
+
if ( ( is_category() || is_tag() || is_tax()) && !$product_cat ) {
|
2487 |
|
2488 |
$i = 1;
|
2489 |
$category_loop = new WP_Query( $query_string );
|
output/service.php
CHANGED
@@ -3501,7 +3501,7 @@ Class saswp_output_service{
|
|
3501 |
if(isset($custom_fields['saswp_jobposting_schema_dateposted'])){
|
3502 |
$input1['datePosted'] = $custom_fields['saswp_jobposting_schema_dateposted'];
|
3503 |
}
|
3504 |
-
if(isset($custom_fields['saswp_jobposting_schema_validthrough'])){
|
3505 |
$input1['validThrough'] = $custom_fields['saswp_jobposting_schema_validthrough'];
|
3506 |
}
|
3507 |
if(isset($custom_fields['saswp_jobposting_schema_employment_type'])){
|
3501 |
if(isset($custom_fields['saswp_jobposting_schema_dateposted'])){
|
3502 |
$input1['datePosted'] = $custom_fields['saswp_jobposting_schema_dateposted'];
|
3503 |
}
|
3504 |
+
if(isset($custom_fields['saswp_jobposting_schema_validthrough']) && $custom_fields['saswp_jobposting_schema_validthrough'] !='' ){
|
3505 |
$input1['validThrough'] = $custom_fields['saswp_jobposting_schema_validthrough'];
|
3506 |
}
|
3507 |
if(isset($custom_fields['saswp_jobposting_schema_employment_type'])){
|
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.7
|
6 |
-
Stable tag: 1.9.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -120,6 +120,18 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
= 1.9.67 (09 March 2021) =
|
124 |
|
125 |
* Fixed: Fatal error occuring, when trying to activate elemtor plugin along with the saswp plugin(While using PHP 8 versioin) #1336
|
3 |
Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 5.7
|
6 |
+
Stable tag: 1.9.68
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 1.9.68 (18 March 2021) =
|
124 |
+
|
125 |
+
* Fixed: Call to undefined function wp_get_current_user in /admin_section/settings.php(4060) #1347
|
126 |
+
* Fixed: JobPosting Schema is not showing after modifying on post individually. #1349
|
127 |
+
* Fixed: Warning: one of contentUrl or embedUrl must be provided warning. #1348
|
128 |
+
* Fixed: Warning: Undefined variable $hook in \admin_section\settings.php on line 4108 #1346
|
129 |
+
* Fixed: Collection page(Archive) schema is not being generated for "tag" pages. #1339
|
130 |
+
* Fixed: Conflict with the forminator plugin #1340
|
131 |
+
* Fixed: Warning: Undefined array key #1350
|
132 |
+
* Fixed: Fatal error: Uncaught TypeError while saving post when WPGraphQL plugin is active #1352
|
133 |
+
* Added: More EmplymentType option inside JobPosting Schema #1353
|
134 |
+
|
135 |
= 1.9.67 (09 March 2021) =
|
136 |
|
137 |
* Fixed: Fatal error occuring, when trying to activate elemtor plugin along with the saswp plugin(While using PHP 8 versioin) #1336
|
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.
|
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.
|
17 |
define('SASWP_DIR_NAME_FILE', __FILE__ );
|
18 |
define('SASWP_DIR_NAME', dirname( __FILE__ ));
|
19 |
define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
|
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.68
|
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.68');
|
17 |
define('SASWP_DIR_NAME_FILE', __FILE__ );
|
18 |
define('SASWP_DIR_NAME', dirname( __FILE__ ));
|
19 |
define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
|
view/common.php
CHANGED
@@ -85,7 +85,7 @@ class saswp_view_common_class {
|
|
85 |
$img_prev = '';
|
86 |
$src = '';
|
87 |
|
88 |
-
if(wp_get_attachment_url($data[$meta_field['name'].'_id'])){
|
89 |
|
90 |
$src = wp_get_attachment_url(esc_attr($data[$meta_field['name'].'_id']));
|
91 |
|
@@ -97,9 +97,15 @@ class saswp_view_common_class {
|
|
97 |
}
|
98 |
|
99 |
//$img_prev is already escapped
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$input = '<fieldset>
|
101 |
<input style="width:79%" type="text" id="'.esc_attr($name).'" name="'.esc_attr($name).'" value="'.esc_url($src).'">
|
102 |
-
<input type="hidden" data-id="'.esc_attr($name).'_id" name="'.esc_attr($meta_name).'_'.esc_attr($schema_id).'['.esc_attr($index).']['.esc_attr($meta_field['name']).'_id]'.'" id="'.esc_attr($name).'_id" value="'.esc_attr($
|
103 |
<input data-id="media" style="width: 19%" class="button" id="'.esc_attr($name).'_button" name="'.esc_attr($name).'_button" type="button" value="Upload">
|
104 |
<div class="saswp_image_div_'.esc_attr($name).'">'.$img_prev.'</div>
|
105 |
</fieldset>';
|
@@ -109,14 +115,19 @@ class saswp_view_common_class {
|
|
109 |
break;
|
110 |
|
111 |
case 'textarea':
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
case 'select':
|
122 |
|
@@ -139,12 +150,16 @@ class saswp_view_common_class {
|
|
139 |
break;
|
140 |
|
141 |
case 'checkbox':
|
|
|
|
|
|
|
|
|
142 |
|
143 |
$input = sprintf(
|
144 |
'<input id="%s" name="%s" type="checkbox" value="1" %s>',
|
145 |
esc_attr($meta_field['name']).'_'.esc_attr($index).'_'.esc_attr($schema_id),
|
146 |
esc_attr($meta_name).'_'.esc_attr($schema_id).'['.esc_attr($index).']['.esc_attr($meta_field['name']).']',
|
147 |
-
|
148 |
);
|
149 |
break;
|
150 |
|
@@ -275,13 +290,19 @@ class saswp_view_common_class {
|
|
275 |
public function saswp_saswp_post_specific($schema_type, $saswp_meta_fields, $post_id, $schema_id=null, $item_reviewed = null, $disabled_schema=null, $modify_this=null, $modified= null) {
|
276 |
|
277 |
global $sd_data;
|
278 |
-
|
279 |
-
$current_user = wp_get_current_user();
|
280 |
$author_details = array();
|
281 |
-
|
282 |
-
if(function_exists('
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
$output = '';
|
286 |
|
287 |
foreach ( $saswp_meta_fields as $meta_field ) {
|
85 |
$img_prev = '';
|
86 |
$src = '';
|
87 |
|
88 |
+
if( isset($data[$meta_field['name'].'_id']) && wp_get_attachment_url( $data[$meta_field['name'].'_id'] ) ){
|
89 |
|
90 |
$src = wp_get_attachment_url(esc_attr($data[$meta_field['name'].'_id']));
|
91 |
|
97 |
}
|
98 |
|
99 |
//$img_prev is already escapped
|
100 |
+
$img_val = '';
|
101 |
+
|
102 |
+
if( isset($data[$meta_field['name'].'_id']) ){
|
103 |
+
$img_val = $data[$meta_field['name'].'_id'];
|
104 |
+
}
|
105 |
+
|
106 |
$input = '<fieldset>
|
107 |
<input style="width:79%" type="text" id="'.esc_attr($name).'" name="'.esc_attr($name).'" value="'.esc_url($src).'">
|
108 |
+
<input type="hidden" data-id="'.esc_attr($name).'_id" name="'.esc_attr($meta_name).'_'.esc_attr($schema_id).'['.esc_attr($index).']['.esc_attr($meta_field['name']).'_id]'.'" id="'.esc_attr($name).'_id" value="'.esc_attr($img_val).'">
|
109 |
<input data-id="media" style="width: 19%" class="button" id="'.esc_attr($name).'_button" name="'.esc_attr($name).'_button" type="button" value="Upload">
|
110 |
<div class="saswp_image_div_'.esc_attr($name).'">'.$img_prev.'</div>
|
111 |
</fieldset>';
|
115 |
break;
|
116 |
|
117 |
case 'textarea':
|
118 |
+
$textarea_val = '';
|
119 |
+
if( isset($data[$meta_field['name']]) ){
|
120 |
+
$textarea_val = $data[$meta_field['name']];
|
121 |
+
}
|
122 |
+
|
123 |
+
$input = sprintf(
|
124 |
+
'<textarea style="width: 100%%" id="%s" name="%s" rows="5">%s</textarea>',
|
125 |
+
esc_attr($meta_field['name']).'_'.esc_attr($index).'_'.esc_attr($schema_id),
|
126 |
+
esc_attr($meta_name).'_'.esc_attr($schema_id).'['.esc_attr($index).']['.esc_attr($meta_field['name']).']',
|
127 |
+
esc_textarea($textarea_val)
|
128 |
+
);
|
129 |
+
|
130 |
+
break;
|
131 |
|
132 |
case 'select':
|
133 |
|
150 |
break;
|
151 |
|
152 |
case 'checkbox':
|
153 |
+
$check_val = '';
|
154 |
+
if(isset($data[$meta_field['name']])){
|
155 |
+
$check_val = $data[$meta_field['name']];
|
156 |
+
}
|
157 |
|
158 |
$input = sprintf(
|
159 |
'<input id="%s" name="%s" type="checkbox" value="1" %s>',
|
160 |
esc_attr($meta_field['name']).'_'.esc_attr($index).'_'.esc_attr($schema_id),
|
161 |
esc_attr($meta_name).'_'.esc_attr($schema_id).'['.esc_attr($index).']['.esc_attr($meta_field['name']).']',
|
162 |
+
$check_val === '1' ? 'checked' : ''
|
163 |
);
|
164 |
break;
|
165 |
|
290 |
public function saswp_saswp_post_specific($schema_type, $saswp_meta_fields, $post_id, $schema_id=null, $item_reviewed = null, $disabled_schema=null, $modify_this=null, $modified= null) {
|
291 |
|
292 |
global $sd_data;
|
293 |
+
|
|
|
294 |
$author_details = array();
|
295 |
+
|
296 |
+
if( function_exists('wp_get_current_user') ) {
|
297 |
+
|
298 |
+
$current_user = wp_get_current_user();
|
299 |
+
|
300 |
+
if(function_exists('get_avatar_data')){
|
301 |
+
$author_details = get_avatar_data($current_user->ID);
|
302 |
+
}
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
$output = '';
|
307 |
|
308 |
foreach ( $saswp_meta_fields as $meta_field ) {
|