Skip to content

Commit f16b3b9

Browse files
authored
Merge pull request #207 from ahmedkaludi/1.6
1.6
2 parents e1ecebd + 32fec44 commit f16b3b9

14 files changed

+581
-359
lines changed

admin_section/ajax-selectbox.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,20 @@ function saswp_post_taxonomy_generator(){
273273

274274
$taxonomies = '';
275275
$choices = array();
276+
277+
276278
$taxonomies = get_taxonomies( array('public' => true), 'objects' );
277279

280+
if($taxonomies){
281+
278282
foreach($taxonomies as $taxonomy) {
279283

280284
$choices[ $taxonomy->name ] = $taxonomy->labels->name;
281285

282286
}
283-
287+
288+
}
289+
284290
// unset post_format (why is this a public taxonomy?)
285291
if( isset($choices['post_format']) ) {
286292

admin_section/common-function.php

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function saswp_import_all_settings_and_schema(){
1010

1111
$url = get_option('saswp-file-upload_url');
1212
global $wpdb;
13-
$result ='';
13+
$result = '';
1414
$errorDesc = array();
1515

1616
if($url){
@@ -21,12 +21,10 @@ function saswp_import_all_settings_and_schema(){
2121

2222
$sd_data = $json_array['sd_data'];
2323
$schema_post = array();
24-
25-
24+
2625
if($all_schema_post){
2726
// begin transaction
2827
$wpdb->query('START TRANSACTION');
29-
3028

3129
foreach($all_schema_post as $schema_post){
3230

@@ -273,20 +271,20 @@ function saswp_import_schema_plugin_data(){
273271
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
274272

275273
$saswp_plugin_options = array(
276-
'sd_logo' => array(
277-
'url' =>$schema_plugin_options['logo'],
278-
'id' =>$custom_logo_id,
279-
'height' =>'600',
280-
'width' =>'60',
281-
'thumbnail' =>$schema_plugin_options['logo']
274+
'sd_logo' => array(
275+
'url' =>$schema_plugin_options['logo'],
276+
'id' =>$custom_logo_id,
277+
'height' =>'600',
278+
'width' =>'60',
279+
'thumbnail' =>$schema_plugin_options['logo']
282280
),
283-
'saswp_kb_contact_1'=> 0,
281+
'saswp_kb_contact_1' => 0,
284282
//AMP Block
285-
'saswp-for-amp' => 1,
286-
'saswp-for-wordpress'=>1,
287-
'saswp-logo-width' => '60',
288-
'saswp-logo-height' => '60',
289-
'sd_initial_wizard_status' =>1,
283+
'saswp-for-amp' => 1,
284+
'saswp-for-wordpress' => 1,
285+
'saswp-logo-width' => '60',
286+
'saswp-logo-height' => '60',
287+
'sd_initial_wizard_status' => 1,
290288

291289
);
292290
if(isset($schema_plugin_options['facebook'])){
@@ -603,12 +601,6 @@ function saswp_import_wp_seo_schema_plugin_data(){
603601
if(isset($settings['site_telephone'])){
604602
$local_business_details['local_phone'] = $settings['site_telephone'];
605603
}
606-
// if(isset($settings['business_info']['openingHours'])){
607-
//
608-
// }
609-
// if(isset($settings['business_info']['openingHours'])){
610-
//
611-
// }
612604
if(isset($settings['web_url'])){
613605
$local_business_details['local_website'] = $settings['web_url'];
614606
}
@@ -1141,7 +1133,8 @@ function saswp_expanded_allowed_tags() {
11411133
'readonly' => array(),
11421134
'disabled' => array(),
11431135
'width' => array(),
1144-
'data-id' => array()
1136+
'data-id' => array(),
1137+
'checked' => array()
11451138
);
11461139
$my_allowed['hidden'] = array(
11471140
'id' => array(),
@@ -1238,6 +1231,7 @@ function saswp_defaultSettings(){
12381231

12391232
global $sd_data;
12401233
$sd_name = 'default';
1234+
$logo = array();
12411235
$bloginfo = get_bloginfo('name', 'display');
12421236

12431237
if($bloginfo){
@@ -1248,8 +1242,11 @@ function saswp_defaultSettings(){
12481242

12491243
$current_url = get_home_url();
12501244
$custom_logo_id = get_theme_mod( 'custom_logo' );
1251-
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
1252-
1245+
1246+
if($custom_logo_id){
1247+
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
1248+
}
1249+
12531250
$user_id = get_current_user_id();
12541251
$username = '';
12551252

admin_section/css/main-style.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,31 @@ On/Off Buttons ends here
568568

569569
.saswp-custom-fields-table select{
570570
width: 100%;
571-
}
571+
}
572+
573+
/*
574+
Compatibility tab css starts here
575+
*/
576+
.saswp-email_schema table th{
577+
width: auto;
578+
padding: 0px;
579+
}
580+
.saswp-email_schema .saswp-knowledge-label {
581+
float: left;
582+
clear: both;
583+
}
584+
.saswp-email_schema .saswp-knowledge-field {
585+
float: right;
586+
width: 75%;
587+
padding-bottom: 10px;
588+
}
589+
/*
590+
Compatibility tab css ends
591+
*/
592+
.saswp-add-on-plugin label{
593+
margin-top: 10px;
594+
}
595+
.saswp-add-on-plugin span{
596+
width: 250px;
597+
display: inline-block;
598+
}

admin_section/fields-generator.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,21 @@ public function saswp_field_generator( $meta_fields, $settings ) {
3131
$tooltip_message = $this->saswp_tooltip_message($meta_field['id']);
3232

3333
$class = "";
34-
$note = "";
34+
$note = "";
35+
$proversion = false;
3536
$hidden = array();
3637
$attribute = array();
3738

3839
if(array_key_exists('class', $meta_field)){
3940

4041
$class = $meta_field['class'];
4142

43+
}
44+
if(array_key_exists('proversion', $meta_field)){
45+
46+
$proversion = $meta_field['proversion'];
47+
48+
4249
}
4350
if(array_key_exists('note', $meta_field)){
4451

@@ -132,17 +139,7 @@ public function saswp_field_generator( $meta_fields, $settings ) {
132139

133140
}
134141
$message ='';
135-
136-
if (! is_plugin_active('flexmls-idx/flexmls_connect.php')) {
137-
138-
if($meta_field['id'] =='saswp_compativility_checkbox'){
139-
140-
$note = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
141-
142-
}
143-
144-
}
145-
142+
146143
$input = sprintf(
147144
'<input class="%s" id="%s" name="%s" type="checkbox" %s %s><p>'.$message.'</p>',
148145
esc_attr($class),
@@ -199,7 +196,13 @@ public function saswp_field_generator( $meta_fields, $settings ) {
199196
}
200197

201198
$allowed_html = saswp_expanded_allowed_tags();
202-
$output .= '<li><div class="saswp-knowledge-label">'.$label.'</div><div class="saswp-knowledge-field">'.$input.'<p>'.esc_html__($note,'schema-and-structured-data-for-wp').'</p></div></li>';
199+
200+
if($note =='' || $proversion == 1){
201+
$output .= '<li><div class="saswp-knowledge-label">'.$label.'</div><div class="saswp-knowledge-field">'.$input.'<p data-id="'.esc_attr($proversion).'">'.esc_html__($note,'schema-and-structured-data-for-wp').'</p></div></li>';
202+
}else{
203+
$output .= '<li><div class="saswp-knowledge-label">'.$label.'</div><div class="saswp-knowledge-field">'.$input.'<p class="saswp_hide">'.esc_html__($note,'schema-and-structured-data-for-wp').'</p></div></li>';
204+
}
205+
203206
}
204207
echo '<div><div class="saswp-settings-list"><ul>' . wp_kses($output, $allowed_html) . '</ul></div></div>';
205208
}

admin_section/js/main-script.js

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,24 @@ jQuery(document).ready(function($){
125125

126126
//Settings page jquery starts here
127127

128+
129+
128130
$(".saswp-checkbox").change(function(){
129-
var id = $(this).attr("id");
131+
132+
var id = $(this).attr("id");
133+
var plugin_name = id.replace('-checkbox','');
134+
var text = $("#"+plugin_name).next('p').text();
135+
136+
if ($(this).is(':checked') && text !=='') {
137+
$("#"+plugin_name).next('p').removeClass('saswp_hide');
138+
}else{
139+
140+
if($("#"+plugin_name).next('p').attr('data-id') == 1){
141+
$("#"+plugin_name).next('p').text('This feature is only available in pro version');
142+
}else{
143+
$("#"+plugin_name).next('p').addClass('saswp_hide');
144+
}
145+
}
130146
switch(id){
131147
case 'saswp-for-wordpress-checkbox':
132148

@@ -291,12 +307,12 @@ jQuery(document).ready(function($){
291307
}
292308
break;
293309

294-
case 'saswp_compativility_checkbox':
310+
case 'saswp-compativility-checkbox':
295311

296312
if ($(this).is(':checked')) {
297-
$("#saswp_compativility").val(1);
313+
$("#saswp-flexmlx-compativility").val(1);
298314
}else{
299-
$("#saswp_compativility").val(0);
315+
$("#saswp-flexmlx-compativility").val(0);
300316
}
301317
break;
302318

@@ -320,9 +336,9 @@ jQuery(document).ready(function($){
320336
case 'saswp-woocommerce-checkbox':
321337

322338
if ($(this).is(':checked')) {
323-
$("#saswp-woocommerce").val(1);
339+
$("#saswp-woocommerce").val(1);
324340
}else{
325-
$("#saswp-woocommerce").val(0);
341+
$("#saswp-woocommerce").val(0);
326342
}
327343
break;
328344

@@ -380,14 +396,55 @@ jQuery(document).ready(function($){
380396
}
381397
break;
382398

399+
case 'saswp-the-events-calendar-checkbox':
400+
401+
if ($(this).is(':checked')) {
402+
$("#saswp-the-events-calendar").val(1);
403+
}else{
404+
$("#saswp-the-events-calendar").val(0);
405+
}
406+
break;
407+
408+
case 'saswp-woocommerce-booking-checkbox':
409+
410+
if ($(this).is(':checked')) {
411+
$("#saswp-woocommerce-booking").val(1);
412+
$("#saswp-woocommerce-booking-main").val(1);
413+
}else{
414+
$("#saswp-woocommerce-booking").val(0);
415+
$("#saswp-woocommerce-booking-main").val(0);
416+
}
417+
break;
418+
419+
case 'saswp-woocommerce-booking-main-checkbox':
420+
421+
if ($(this).is(':checked')) {
422+
$("#saswp-woocommerce-booking-main").val(1);
423+
$("#saswp-woocommerce-booking").val(1);
424+
}else{
425+
$("#saswp-woocommerce-booking-main").val(0);
426+
$("#saswp-woocommerce-booking").val(0);
427+
}
428+
break;
429+
430+
case 'saswp-woocommerce-membership-checkbox':
431+
432+
if ($(this).is(':checked')) {
433+
$("#saswp-woocommerce-membership").val(1);
434+
}else{
435+
$("#saswp-woocommerce-membership").val(0);
436+
}
437+
break;
438+
383439

384440
default:
385441
break;
386442
}
387443

388444
}).change();
389445

390-
$("#saswp_kb_type").change(function(){
446+
$("#saswp_kb_type").change(function(){
447+
391448
var datatype = $(this).val();
392449

393450
$(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass('saswp_hide');
@@ -747,13 +804,13 @@ jQuery(document).ready(function($){
747804

748805
$(document).on("click","div.saswp-tab ul.saswp-tab-nav a", function(e){
749806
e.preventDefault();
750-
var attr = $(this).attr('data-id');
751-
$(".saswp-post-specific-wrapper").hide();
752-
$("#"+attr).show();
753-
$('div.saswp-tab ul.saswp-tab-nav a').removeClass('selected');
754-
$('div.saswp-tab ul.saswp-tab-nav li').removeClass('selected');
755-
$(this).addClass('selected');
756-
$(this).parent().addClass('selected');
807+
var attr = $(this).attr('data-id');
808+
$(".saswp-post-specific-wrapper").hide();
809+
$("#"+attr).show();
810+
$('div.saswp-tab ul.saswp-tab-nav a').removeClass('selected');
811+
$('div.saswp-tab ul.saswp-tab-nav li').removeClass('selected');
812+
$(this).addClass('selected');
813+
$(this).parent().addClass('selected');
757814
saswp_enable_rating_review();
758815
});
759816

0 commit comments

Comments
 (0)