Version Description
(1 Feb 2020) =
- Fixed: User can not select to a specific post tag in placement section #751
- Fixed: Offer is not a known valid target type for the image property #752
- Fixed: Double display of Woocommerce-Categories on Archive-Pages #743
- Fixed: Fatal error: Cannot redeclare seopress_titles_single_cpt_noindex_option() when SEOPress compatibility is on #748
- Fixed: Description field and the plublished date validation issue with video object in WP Recipe Maker Plugin #744
- Fixed: Warning & Notices fixes #746, #766, #755
- Fixed: Error in Article schema due to WP recipe maker plugin #747
- Fixed: Breaks Yoast FAQ block schema #762
- Fixed: Fatal error: Cannot redeclare seopress_titles_single_cpt_noindex_option(), When SEOPress compatibility is on
- Fixed: Aggregate rating still loading in Service schema which is not allowed by google #761
- Added: "Review Form" label in the Translation Panel #764
- Added: FAQ filter in Gutenberg schema block #764
Download this release
Release Info
Developer | magazine3 |
Plugin | Schema & Structured Data for WP & AMP |
Version | 1.9.25 |
Comparing to | |
See all releases |
Code changes from version 1.9.24 to 1.9.25
- admin_section/common-function.php +15 -6
- admin_section/js/structure_admin.js +2 -2
- admin_section/js/structure_admin.min.js +1 -1
- admin_section/settings.php +2 -2
- admin_section/structure_admin.php +2 -2
- core/3rd-party/aqua_resizer.php +4 -2
- core/array-list/schema-properties.php +12 -0
- core/global.php +1 -0
- modules/divi-builder/extension.php +12 -12
- modules/divi-builder/includes/Extension.php +46 -46
- modules/divi-builder/includes/loader.js +9 -9
- modules/divi-builder/includes/loader.php +14 -14
- modules/divi-builder/includes/modules/FaqBlock/FaqBlock.jsx +58 -58
- modules/divi-builder/includes/modules/FaqBlock/style.css +3 -3
- modules/divi-builder/includes/modules/FaqBlockChild/FaqBlockChild.php +200 -200
- modules/divi-builder/includes/modules/index.js +5 -5
- modules/divi-builder/media/slick.svg +14 -14
- modules/divi-builder/scripts/frontend.js +3 -3
- modules/elementor/assets/js/faq-block.js +14 -14
- modules/elementor/elementor-loader.php +99 -99
- modules/elementor/widgets/faq-block.php +154 -154
- modules/reviews/reviews_collection.php +1 -0
- modules/reviews/reviews_form.php +2 -2
- modules/reviews/reviews_service.php +25 -15
- output/compatibility.php +8 -0
- output/divi-builder.php +6 -0
- output/elementor.php +6 -0
- output/function.php +19 -4
- output/gutenberg.php +150 -10
- output/markup.php +3 -1
- output/output.php +6 -18
- output/service.php +2 -4
- readme.txt +17 -1
- structured-data-for-wp.php +2 -2
- view/common.php +38 -18
- view/post_specific.php +2 -2
- view/schema_type.php +19 -16
admin_section/common-function.php
CHANGED
@@ -2112,13 +2112,22 @@ if ( ! defined('ABSPATH') ) exit;
|
|
2112 |
|
2113 |
//SEOPress
|
2114 |
if(saswp_remove_warnings($sd_data, 'saswp-seo-press', 'saswp_string') == 1){
|
2115 |
-
|
2116 |
-
|
|
|
|
|
2117 |
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2122 |
}
|
2123 |
|
2124 |
//All in one Seo pack
|
2112 |
|
2113 |
//SEOPress
|
2114 |
if(saswp_remove_warnings($sd_data, 'saswp-seo-press', 'saswp_string') == 1){
|
2115 |
+
|
2116 |
+
if(!is_admin()){
|
2117 |
+
|
2118 |
+
require_once ( WP_PLUGIN_DIR. '/wp-seopress/inc/functions/options-titles-metas.php');
|
2119 |
|
2120 |
+
if(function_exists('seopress_titles_the_title') && seopress_titles_the_title() !=''){
|
2121 |
+
|
2122 |
+
$c_title = seopress_titles_the_title();
|
2123 |
+
if($c_title){
|
2124 |
+
$title = $c_title;
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
}
|
2130 |
+
|
2131 |
}
|
2132 |
|
2133 |
//All in one Seo pack
|
admin_section/js/structure_admin.js
CHANGED
@@ -70,7 +70,7 @@ jQuery(document).ready(function($){
|
|
70 |
});
|
71 |
|
72 |
var currentFiledNumber = $(this).attr("class").split(" ")[2];
|
73 |
-
var saswp_call_nonce =
|
74 |
|
75 |
parent.find(".ajax-output").remove();
|
76 |
parent.find(".ajax-output-child").remove();
|
@@ -131,7 +131,7 @@ function taxonomyDataCall(){
|
|
131 |
parentSelector = jQuery(this).parents("td").find(".insert-ajax-select");
|
132 |
var selectedValue = jQuery(this).val();
|
133 |
var currentFiledNumber = jQuery(this).attr("name").split("[")[1].replace("]",'');
|
134 |
-
var saswp_call_nonce =
|
135 |
|
136 |
parentSelector.find(".ajax-output-child").remove();
|
137 |
parentSelector.find(".spinner").attr("style","visibility:visible");
|
70 |
});
|
71 |
|
72 |
var currentFiledNumber = $(this).attr("class").split(" ")[2];
|
73 |
+
var saswp_call_nonce = jQuery("#saswp_select_name_nonce").val();
|
74 |
|
75 |
parent.find(".ajax-output").remove();
|
76 |
parent.find(".ajax-output-child").remove();
|
131 |
parentSelector = jQuery(this).parents("td").find(".insert-ajax-select");
|
132 |
var selectedValue = jQuery(this).val();
|
133 |
var currentFiledNumber = jQuery(this).attr("name").split("[")[1].replace("]",'');
|
134 |
+
var saswp_call_nonce = jQuery("#saswp_select_name_nonce").val();
|
135 |
|
136 |
parentSelector.find(".ajax-output-child").remove();
|
137 |
parentSelector.find(".spinner").attr("style","visibility:visible");
|
admin_section/js/structure_admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var clone=function(){jQuery(".structured-clone").off("click").click(function(){var e=jQuery(this).closest(".saswp-placement-group").attr("data-id"),t=jQuery(document).find("#call_html_template_sdwp").html();nextId=jQuery(this).parents("tbody").find("tr").length,t=(t=t.replace(/\[0\]/g,"["+nextId+"]")).replace(/\[group-0\]/g,"[group-"+e+"]"),jQuery(this).parents("tr").after(t),removeHtml(),clone()})},removeHtml=function(){jQuery(".structured-delete").off("click").click(function(){1==jQuery(".saswp-placement-group").length?jQuery(this).parents("tbody").find("tr").length>1&&jQuery(this).parents("tr").remove():1==jQuery(this).parents("tbody").find("tr").length?jQuery(this).parents(".saswp-placement-group").remove():jQuery(this).parents("tr").remove()})};function taxonomyDataCall(){jQuery("select.ajax-output").change(function(){if("ef_taxonomy"==jQuery(".select-post-type").val()){parentSelector=jQuery(this).parents("td").find(".insert-ajax-select");var e=jQuery(this).val(),t=jQuery(this).attr("name").split("[")[1].replace("]",""),a
|
1 |
+
var clone=function(){jQuery(".structured-clone").off("click").click(function(){var e=jQuery(this).closest(".saswp-placement-group").attr("data-id"),t=jQuery(document).find("#call_html_template_sdwp").html();nextId=jQuery(this).parents("tbody").find("tr").length,t=(t=t.replace(/\[0\]/g,"["+nextId+"]")).replace(/\[group-0\]/g,"[group-"+e+"]"),jQuery(this).parents("tr").after(t),removeHtml(),clone()})},removeHtml=function(){jQuery(".structured-delete").off("click").click(function(){1==jQuery(".saswp-placement-group").length?jQuery(this).parents("tbody").find("tr").length>1&&jQuery(this).parents("tr").remove():1==jQuery(this).parents("tbody").find("tr").length?jQuery(this).parents(".saswp-placement-group").remove():jQuery(this).parents("tr").remove()})};function taxonomyDataCall(){jQuery("select.ajax-output").change(function(){if("ef_taxonomy"==jQuery(".select-post-type").val()){parentSelector=jQuery(this).parents("td").find(".insert-ajax-select");var e=jQuery(this).val(),t=jQuery(this).attr("name").split("[")[1].replace("]",""),a=jQuery("#saswp_select_name_nonce").val();parentSelector.find(".ajax-output-child").remove(),parentSelector.find(".spinner").attr("style","visibility:visible"),parentSelector.children(".spinner").addClass("show");var r=saswp_app_object.ajax_url,s=jQuery(this).closest(".saswp-placement-group").attr("data-id");jQuery.ajax({url:r,method:"POST",data:{action:"create_ajax_select_sdwp_taxonomy",id:e,number:t,group_number:s,saswp_call_nonce:a},beforeSend:function(){},success:function(e){parentSelector.find(".ajax-output-child").remove(),parentSelector.children(".spinner").removeClass("show"),parentSelector.find(".spinner").attr("style","visibility:hidden").hide(),parentSelector.append(e),taxonomyDataCall()},error:function(e){console.log("Failed Ajax Request"),console.log(e)}})}})}jQuery(document).ready(function(e){e("#saswp-dayofweek-opens-time").timepicker({timeFormat:"H:i:s"}),e("#saswp-dayofweek-closes-time").timepicker({timeFormat:"H:i:s"}),e(".saswp-placement-or-group").on("click",function(t){t.preventDefault();var a="",r=(a=e(".saswp-placement-group").length,jQuery(document).find("#call_html_template_sdwp").html()),s="";s+='<table class="widefat saswp-placement-table" style="border:0px;">',s+=r=r.replace(/\[group-0\]/g,"[group-"+a+"]");var n="";n+='<div class="saswp-placement-group" name="data_group_array['+a+']" data-id="'+a+'">',n+='<span style="margin-left:10px;font-weight:600">Or</span>',n+=s+="</table>",n+="</div>",e(".saswp-placement-group[data-id="+(a-1)+"]").after(n),a++,clone(),removeHtml()});var t=e("#saswp_amp_select").find("table.widefat tr").html();e("body").append("<script type='template/html' id='call_html_template_sdwp'><tr class='toclone cloneya'>"+t+"</tr>"),clone(),removeHtml(),e(document).on("change",".select-post-type",function(){var t=e(this),a=e(this).parents("tr").find(".insert-ajax-select"),r=e(this).val(),s=[1,2,3,4];if("show_globally"!=r){e.each(s,function(a,r){e(t).closest("tr").find("td").eq(r).show()});var n=e(this).attr("class").split(" ")[2],l=jQuery("#saswp_select_name_nonce").val();a.find(".ajax-output").remove(),a.find(".ajax-output-child").remove(),a.find(".spinner").attr("style","visibility:visible"),a.children(".spinner").addClass("show");var o=saswp_app_object.ajax_url,i=jQuery(this).closest(".saswp-placement-group").attr("data-id");e.ajax({url:o,method:"POST",data:{action:"create_ajax_select_sdwp",id:r,number:n,group_number:i,saswp_call_nonce:l},beforeSend:function(){},success:function(e){a.find(".ajax-output").remove(),a.children(".spinner").removeClass("show"),a.find(".spinner").attr("style","visibility:hidden").hide(),a.append(e),taxonomyDataCall()},error:function(e){console.log("Failed Ajax Request"),console.log(e)}})}else e.each(s,function(a,r){e(t).closest("tr").find("td").eq(r).hide()})}),taxonomyDataCall(),e("#notAccessibleForFree").click(function(){e(this).is(":checked")?(e("#paywall_class_name").parents("tr").show(),e("#isAccessibleForFree").parents("tr").show()):(e("#paywall_class_name").parents("tr").hide(),e("#isAccessibleForFree").parents("tr").hide())})});
|
admin_section/settings.php
CHANGED
@@ -786,7 +786,7 @@ function saswp_general_page_callback(){
|
|
786 |
'name' => 'sd_data[sd_about_page]',
|
787 |
'id' => 'sd_about_page',
|
788 |
'echo' => 0,
|
789 |
-
'show_option_none' => esc_html__( 'Select
|
790 |
'option_none_value' => '',
|
791 |
'selected' => isset($settings['sd_about_page']) ? esc_attr($settings['sd_about_page']) : '',
|
792 |
)); ?>
|
@@ -807,7 +807,7 @@ function saswp_general_page_callback(){
|
|
807 |
'name' => 'sd_data[sd_contact_page]',
|
808 |
'id' => 'sd_contact_page-select',
|
809 |
'echo' => 0,
|
810 |
-
'show_option_none' => esc_html( 'Select
|
811 |
'option_none_value' => '',
|
812 |
'selected' => isset($settings['sd_contact_page']) ? esc_attr($settings['sd_contact_page']) : '',
|
813 |
)); ?>
|
786 |
'name' => 'sd_data[sd_about_page]',
|
787 |
'id' => 'sd_about_page',
|
788 |
'echo' => 0,
|
789 |
+
'show_option_none' => esc_html__( 'Select a Page', 'schema-and-structured-data-for-wp' ),
|
790 |
'option_none_value' => '',
|
791 |
'selected' => isset($settings['sd_about_page']) ? esc_attr($settings['sd_about_page']) : '',
|
792 |
)); ?>
|
807 |
'name' => 'sd_data[sd_contact_page]',
|
808 |
'id' => 'sd_contact_page-select',
|
809 |
'echo' => 0,
|
810 |
+
'show_option_none' => esc_html( 'Select a Page', 'schema-and-structured-data-for-wp' ),
|
811 |
'option_none_value' => '',
|
812 |
'selected' => isset($settings['sd_contact_page']) ? esc_attr($settings['sd_contact_page']) : '',
|
813 |
)); ?>
|
admin_section/structure_admin.php
CHANGED
@@ -830,8 +830,8 @@ function saswp_dequeue_script() {
|
|
830 |
//Enque select 2 script starts here
|
831 |
if($hook == 'saswp' || get_post_type() == 'saswp'){
|
832 |
|
833 |
-
wp_dequeue_script( 'avada-fusion-options' );
|
834 |
-
wp_register_script( 'structure_admin', SASWP_PLUGIN_URL . 'admin_section/js/structure_admin.min.js', array( 'jquery', 'jquery-ui-core'), SASWP_VERSION, true );
|
835 |
|
836 |
wp_localize_script( 'structure_admin', 'saswp_app_object', $data_array );
|
837 |
wp_enqueue_script( 'structure_admin' );
|
830 |
//Enque select 2 script starts here
|
831 |
if($hook == 'saswp' || get_post_type() == 'saswp'){
|
832 |
|
833 |
+
wp_dequeue_script( 'avada-fusion-options' );
|
834 |
+
wp_register_script( 'structure_admin', SASWP_PLUGIN_URL . 'admin_section/js/'.(SASWP_ENVIRONMENT == 'production' ? 'structure_admin.min.js' : 'structure_admin.js'), array( 'jquery', 'jquery-ui-core'), SASWP_VERSION, true );
|
835 |
|
836 |
wp_localize_script( 'structure_admin', 'saswp_app_object', $data_array );
|
837 |
wp_enqueue_script( 'structure_admin' );
|
core/3rd-party/aqua_resizer.php
CHANGED
@@ -121,8 +121,10 @@ if(!class_exists('Aq_Resize')) {
|
|
121 |
$wp_upload_dir = wp_upload_dir();
|
122 |
$dir_baseurl = $wp_upload_dir['baseurl'];
|
123 |
$dir_baseurl = explode('/', $dir_baseurl);
|
124 |
-
$dir_name = end($dir_baseurl);
|
125 |
-
|
|
|
|
|
126 |
if ( ! isset($cdn_url[1]) ) {
|
127 |
$cdn_url = array();
|
128 |
$cdn_url[1] = '';
|
121 |
$wp_upload_dir = wp_upload_dir();
|
122 |
$dir_baseurl = $wp_upload_dir['baseurl'];
|
123 |
$dir_baseurl = explode('/', $dir_baseurl);
|
124 |
+
$dir_name = end($dir_baseurl);
|
125 |
+
if($dir_name){
|
126 |
+
$cdn_url = explode($dir_name, $cdn_url);
|
127 |
+
}
|
128 |
if ( ! isset($cdn_url[1]) ) {
|
129 |
$cdn_url = array();
|
130 |
$cdn_url[1] = '';
|
core/array-list/schema-properties.php
CHANGED
@@ -647,6 +647,18 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
|
|
647 |
'type' => 'textarea',
|
648 |
'default' => get_the_excerpt()
|
649 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
array(
|
651 |
'label' => 'Keywords',
|
652 |
'id' => 'saswp_article_keywords_'.$schema_id,
|
647 |
'type' => 'textarea',
|
648 |
'default' => get_the_excerpt()
|
649 |
),
|
650 |
+
array(
|
651 |
+
'label' => 'Article Section',
|
652 |
+
'id' => 'saswp_article_section_'.$schema_id,
|
653 |
+
'type' => 'textarea',
|
654 |
+
'default' => get_the_excerpt()
|
655 |
+
),
|
656 |
+
array(
|
657 |
+
'label' => 'Article Body',
|
658 |
+
'id' => 'saswp_article_body_'.$schema_id,
|
659 |
+
'type' => 'textarea',
|
660 |
+
'default' => get_the_content()
|
661 |
+
),
|
662 |
array(
|
663 |
'label' => 'Keywords',
|
664 |
'id' => 'saswp_article_keywords_'.$schema_id,
|
core/global.php
CHANGED
@@ -59,6 +59,7 @@ $translation_labels = array(
|
|
59 |
'translation-time-needed' => 'Time Needed',
|
60 |
'translation-name' => 'Name',
|
61 |
'translation-comment' => 'Comment',
|
|
|
62 |
);
|
63 |
$saswp_post_reviews = array();
|
64 |
$saswp_elementor_faq = array();
|
59 |
'translation-time-needed' => 'Time Needed',
|
60 |
'translation-name' => 'Name',
|
61 |
'translation-comment' => 'Comment',
|
62 |
+
'translation-review-form' => 'Review Form',
|
63 |
);
|
64 |
$saswp_post_reviews = array();
|
65 |
$saswp_elementor_faq = array();
|
modules/divi-builder/extension.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! function_exists( 'saswp_initialize_extension' ) ):
|
3 |
-
/**
|
4 |
-
* Creates the extension's main class instance.
|
5 |
-
*
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
function saswp_initialize_extension() {
|
9 |
-
require_once plugin_dir_path( __FILE__ ) . 'includes/Extension.php';
|
10 |
-
}
|
11 |
-
add_action( 'divi_extensions_init', 'saswp_initialize_extension' );
|
12 |
-
endif;
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists( 'saswp_initialize_extension' ) ):
|
3 |
+
/**
|
4 |
+
* Creates the extension's main class instance.
|
5 |
+
*
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
function saswp_initialize_extension() {
|
9 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/Extension.php';
|
10 |
+
}
|
11 |
+
add_action( 'divi_extensions_init', 'saswp_initialize_extension' );
|
12 |
+
endif;
|
modules/divi-builder/includes/Extension.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SASWP_Extension extends DiviExtension {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The gettext domain for the extension's translations.
|
7 |
-
*
|
8 |
-
* @since 1.0.0
|
9 |
-
*
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
public $gettext_domain = 'saswp-extension';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* The extension's WP Plugin name.
|
16 |
-
*
|
17 |
-
* @since 1.0.0
|
18 |
-
*
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
public $name = 'extension';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* The extension's version
|
25 |
-
*
|
26 |
-
* @since 1.0.0
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
public $version = '1.0.0';
|
31 |
-
|
32 |
-
/**
|
33 |
-
* SASWP_Extension constructor.
|
34 |
-
*
|
35 |
-
* @param string $name
|
36 |
-
* @param array $args
|
37 |
-
*/
|
38 |
-
public function __construct( $name = 'extension', $args = array() ) {
|
39 |
-
$this->plugin_dir = plugin_dir_path( __FILE__ );
|
40 |
-
$this->plugin_dir_url = plugin_dir_url( $this->plugin_dir );
|
41 |
-
|
42 |
-
parent::__construct( $name, $args );
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
new SASWP_Extension;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SASWP_Extension extends DiviExtension {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The gettext domain for the extension's translations.
|
7 |
+
*
|
8 |
+
* @since 1.0.0
|
9 |
+
*
|
10 |
+
* @var string
|
11 |
+
*/
|
12 |
+
public $gettext_domain = 'saswp-extension';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The extension's WP Plugin name.
|
16 |
+
*
|
17 |
+
* @since 1.0.0
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
public $name = 'extension';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* The extension's version
|
25 |
+
*
|
26 |
+
* @since 1.0.0
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $version = '1.0.0';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* SASWP_Extension constructor.
|
34 |
+
*
|
35 |
+
* @param string $name
|
36 |
+
* @param array $args
|
37 |
+
*/
|
38 |
+
public function __construct( $name = 'extension', $args = array() ) {
|
39 |
+
$this->plugin_dir = plugin_dir_path( __FILE__ );
|
40 |
+
$this->plugin_dir_url = plugin_dir_url( $this->plugin_dir );
|
41 |
+
|
42 |
+
parent::__construct( $name, $args );
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
new SASWP_Extension;
|
modules/divi-builder/includes/loader.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
// External Dependencies
|
2 |
-
import $ from 'jquery';
|
3 |
-
|
4 |
-
// Internal Dependencies
|
5 |
-
import modules from './modules';
|
6 |
-
|
7 |
-
$(window).on('et_builder_api_ready', (event, API) => {
|
8 |
-
API.registerModules(modules);
|
9 |
-
});
|
1 |
+
// External Dependencies
|
2 |
+
import $ from 'jquery';
|
3 |
+
|
4 |
+
// Internal Dependencies
|
5 |
+
import modules from './modules';
|
6 |
+
|
7 |
+
$(window).on('et_builder_api_ready', (event, API) => {
|
8 |
+
API.registerModules(modules);
|
9 |
+
});
|
modules/divi-builder/includes/loader.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! class_exists( 'ET_Builder_Element' ) ) {
|
4 |
-
return;
|
5 |
-
}
|
6 |
-
|
7 |
-
$module_files = glob( __DIR__ . '/modules/*/*.php' );
|
8 |
-
|
9 |
-
// Load custom Divi Builder modules
|
10 |
-
foreach ( (array) $module_files as $module_file ) {
|
11 |
-
if ( $module_file && preg_match( "/\/modules\/\b([^\/]+)\/\\1\.php$/", $module_file ) ) {
|
12 |
-
require_once $module_file;
|
13 |
-
}
|
14 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'ET_Builder_Element' ) ) {
|
4 |
+
return;
|
5 |
+
}
|
6 |
+
|
7 |
+
$module_files = glob( __DIR__ . '/modules/*/*.php' );
|
8 |
+
|
9 |
+
// Load custom Divi Builder modules
|
10 |
+
foreach ( (array) $module_files as $module_file ) {
|
11 |
+
if ( $module_file && preg_match( "/\/modules\/\b([^\/]+)\/\\1\.php$/", $module_file ) ) {
|
12 |
+
require_once $module_file;
|
13 |
+
}
|
14 |
+
}
|
modules/divi-builder/includes/modules/FaqBlock/FaqBlock.jsx
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
// External Dependencies
|
2 |
-
import React, { Component, Fragment } from 'react';
|
3 |
-
import ReactHtmlParser from 'react-html-parser';
|
4 |
-
|
5 |
-
// Internal Dependencies
|
6 |
-
import './style.css';
|
7 |
-
|
8 |
-
class FaqBlock extends Component {
|
9 |
-
|
10 |
-
static slug = 'saswp_divi_faqblock';
|
11 |
-
|
12 |
-
render() {
|
13 |
-
|
14 |
-
const items = [];
|
15 |
-
const item_list = this.props.content;
|
16 |
-
const order_type = this.props.order_type;
|
17 |
-
|
18 |
-
for(var i=0; i < item_list.length; i++){
|
19 |
-
|
20 |
-
if( order_type === ''){
|
21 |
-
|
22 |
-
items.push(
|
23 |
-
<li className="saswp-divi-faq-li" key={i}>
|
24 |
-
<h3 className="saswp-hello-header-heading">{item_list[i].props.attrs.faq_question}</h3>
|
25 |
-
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
26 |
-
</li>
|
27 |
-
);
|
28 |
-
|
29 |
-
}else if(order_type === 'order_list'){
|
30 |
-
items.push(
|
31 |
-
<li className="saswp-divi-faq-li" key={i}>
|
32 |
-
<h3 className="saswp-hello-header-heading"> <span>{i+1} . </span> {item_list[i].props.attrs.faq_question}</h3>
|
33 |
-
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
34 |
-
</li>
|
35 |
-
);
|
36 |
-
|
37 |
-
}else{
|
38 |
-
items.push(
|
39 |
-
<li key={i}>
|
40 |
-
<h3 className="saswp-hello-header-heading">{item_list[i].props.attrs.faq_question}</h3>
|
41 |
-
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
42 |
-
</li>
|
43 |
-
);
|
44 |
-
}
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
return (
|
49 |
-
<Fragment>
|
50 |
-
<ul>
|
51 |
-
{items}
|
52 |
-
</ul>
|
53 |
-
</Fragment>
|
54 |
-
);
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
export default FaqBlock;
|
1 |
+
// External Dependencies
|
2 |
+
import React, { Component, Fragment } from 'react';
|
3 |
+
import ReactHtmlParser from 'react-html-parser';
|
4 |
+
|
5 |
+
// Internal Dependencies
|
6 |
+
import './style.css';
|
7 |
+
|
8 |
+
class FaqBlock extends Component {
|
9 |
+
|
10 |
+
static slug = 'saswp_divi_faqblock';
|
11 |
+
|
12 |
+
render() {
|
13 |
+
|
14 |
+
const items = [];
|
15 |
+
const item_list = this.props.content;
|
16 |
+
const order_type = this.props.order_type;
|
17 |
+
|
18 |
+
for(var i=0; i < item_list.length; i++){
|
19 |
+
|
20 |
+
if( order_type === ''){
|
21 |
+
|
22 |
+
items.push(
|
23 |
+
<li className="saswp-divi-faq-li" key={i}>
|
24 |
+
<h3 className="saswp-hello-header-heading">{item_list[i].props.attrs.faq_question}</h3>
|
25 |
+
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
26 |
+
</li>
|
27 |
+
);
|
28 |
+
|
29 |
+
}else if(order_type === 'order_list'){
|
30 |
+
items.push(
|
31 |
+
<li className="saswp-divi-faq-li" key={i}>
|
32 |
+
<h3 className="saswp-hello-header-heading"> <span>{i+1} . </span> {item_list[i].props.attrs.faq_question}</h3>
|
33 |
+
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
34 |
+
</li>
|
35 |
+
);
|
36 |
+
|
37 |
+
}else{
|
38 |
+
items.push(
|
39 |
+
<li key={i}>
|
40 |
+
<h3 className="saswp-hello-header-heading">{item_list[i].props.attrs.faq_question}</h3>
|
41 |
+
<p >{ReactHtmlParser(item_list[i].props.attrs.faq_answer)}</p>
|
42 |
+
</li>
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
return (
|
49 |
+
<Fragment>
|
50 |
+
<ul>
|
51 |
+
{items}
|
52 |
+
</ul>
|
53 |
+
</Fragment>
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
export default FaqBlock;
|
modules/divi-builder/includes/modules/FaqBlock/style.css
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
.saswp-divi-faq-li {
|
2 |
-
list-style: none;
|
3 |
-
}
|
1 |
+
.saswp-divi-faq-li {
|
2 |
+
list-style: none;
|
3 |
+
}
|
modules/divi-builder/includes/modules/FaqBlockChild/FaqBlockChild.php
CHANGED
@@ -1,200 +1,200 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class SASWP_Divi_FaqBlockChild extends ET_Builder_Module {
|
4 |
-
// Module slug (also used as shortcode tag)
|
5 |
-
public $slug = 'saswpfaqblockchild';
|
6 |
-
|
7 |
-
// Module item has to use `child` as its type property
|
8 |
-
public $type = 'child';
|
9 |
-
|
10 |
-
// Module item's attribute that will be used for module item label on modal
|
11 |
-
public $child_title_var = 'question';
|
12 |
-
|
13 |
-
// Full Visual Builder support
|
14 |
-
public $vb_support = 'on';
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Module properties initialization
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
*
|
21 |
-
* @todo Remove $this->advanced_options['background'] once https://github.com/elegantthemes/Divi/issues/6913 has been addressed
|
22 |
-
*/
|
23 |
-
function init() {
|
24 |
-
|
25 |
-
$this->advanced_setting_title_text = esc_html__( 'Question', 'schema-and-structured-data-for-wp' );
|
26 |
-
$this->settings_text = esc_html__( 'Question Settings', 'schema-and-structured-data-for-wp' );
|
27 |
-
$this->main_css_element = '%%order_class%%';
|
28 |
-
// Toggle settings
|
29 |
-
$this->settings_modal_toggles = array(
|
30 |
-
'general' => array(
|
31 |
-
'toggles' => array(
|
32 |
-
'main_content' => esc_html__( 'Content', 'schema-and-structured-data-for-wp' ),
|
33 |
-
),
|
34 |
-
),
|
35 |
-
'advanced' => array(
|
36 |
-
'toggles' => array(
|
37 |
-
'text' => array(
|
38 |
-
'title' => esc_html__( 'Text', 'schema-and-structured-data-for-wp' ),
|
39 |
-
'priority' => 45,
|
40 |
-
'bb_icons_support' => true,
|
41 |
-
),
|
42 |
-
'header' => array(
|
43 |
-
'title' => esc_html__( 'Heading Text', 'schema-and-structured-data-for-wp' ),
|
44 |
-
'priority' => 49,
|
45 |
-
'tabbed_subtoggles' => true,
|
46 |
-
'sub_toggles' => array(
|
47 |
-
'h2' => array(
|
48 |
-
'name' => 'H2',
|
49 |
-
'icon' => 'text-h2',
|
50 |
-
),
|
51 |
-
'h3' => array(
|
52 |
-
'name' => 'H3',
|
53 |
-
'icon' => 'text-h3',
|
54 |
-
),
|
55 |
-
|
56 |
-
|
57 |
-
),
|
58 |
-
),
|
59 |
-
),
|
60 |
-
),
|
61 |
-
);
|
62 |
-
}
|
63 |
-
|
64 |
-
public function get_fields() {
|
65 |
-
return array(
|
66 |
-
'faq_question' => array(
|
67 |
-
'label' => esc_html__( 'Question', 'schema-and-structured-data-for-wp' ),
|
68 |
-
'type' => 'text',
|
69 |
-
'option_category' => 'basic_option',
|
70 |
-
'description' => esc_html__( 'Input your question here', 'schema-and-structured-data-for-wp' ),
|
71 |
-
'toggle_slug' => 'main_content',
|
72 |
-
),
|
73 |
-
'faq_answer' => array(
|
74 |
-
'label' => esc_html__( 'Answer', 'schema-and-structured-data-for-wp' ),
|
75 |
-
'type' => 'tiny_mce',
|
76 |
-
'option_category' => 'basic_option',
|
77 |
-
'description' => esc_html__( 'Input your answer here', 'schema-and-structured-data-for-wp' ),
|
78 |
-
'toggle_slug' => 'main_content',
|
79 |
-
),
|
80 |
-
);
|
81 |
-
|
82 |
-
|
83 |
-
}
|
84 |
-
public function get_advanced_fields_config() {
|
85 |
-
$advanced_fields = $this->advanced_tab_options;
|
86 |
-
|
87 |
-
$advanced_fields['fonts'] = array(
|
88 |
-
'main_text' => array(
|
89 |
-
'label' => esc_html__( 'Content', 'schema-and-structured-data-for-wp' ),
|
90 |
-
'css' => array(
|
91 |
-
'main' => "{$this->main_css_element} .saswp_timeline_child_inner",
|
92 |
-
),
|
93 |
-
'font_size' => array(
|
94 |
-
'default' => absint( '14' ) . 'px',
|
95 |
-
),
|
96 |
-
'line_height' => array(
|
97 |
-
'default' => '1.4em',
|
98 |
-
),
|
99 |
-
'letter_spacing' => array(
|
100 |
-
'default' => '0px',
|
101 |
-
),
|
102 |
-
'toggle_slug' => 'text',
|
103 |
-
),
|
104 |
-
'header' => array(
|
105 |
-
'label' => esc_html__( 'Heading', 'schema-and-structured-data-for-wp' ),
|
106 |
-
'css' => array(
|
107 |
-
'main' => "{$this->main_css_element} .saswp_timeline_child_inner h1",
|
108 |
-
),
|
109 |
-
'font_size' => array(
|
110 |
-
'default' => absint( et_get_option( 'body_header_size', '30' ) ) . 'px',
|
111 |
-
),
|
112 |
-
'toggle_slug' => 'header',
|
113 |
-
'sub_toggle' => 'h1',
|
114 |
-
),
|
115 |
-
'header_2' => array(
|
116 |
-
'label' => esc_html__( 'Heading 2', 'schema-and-structured-data-for-wp' ),
|
117 |
-
'css' => array(
|
118 |
-
'main' => "{$this->main_css_element} .saswp_timeline_child_inner h2",
|
119 |
-
),
|
120 |
-
'font_size' => array(
|
121 |
-
'default' => '26px',
|
122 |
-
),
|
123 |
-
'line_height' => array(
|
124 |
-
'default' => '1em',
|
125 |
-
),
|
126 |
-
'toggle_slug' => 'header',
|
127 |
-
'sub_toggle' => 'h2',
|
128 |
-
),
|
129 |
-
'header_3' => array(
|
130 |
-
'label' => esc_html__( 'Heading 3', 'schema-and-structured-data-for-wp' ),
|
131 |
-
'css' => array(
|
132 |
-
'main' => "{$this->main_css_element} .saswp_timeline_date h3",
|
133 |
-
),
|
134 |
-
'font_size' => array(
|
135 |
-
'default' => '22px',
|
136 |
-
),
|
137 |
-
'line_height' => array(
|
138 |
-
'default' => '1em',
|
139 |
-
),
|
140 |
-
'toggle_slug' => 'header',
|
141 |
-
'sub_toggle' => 'h3',
|
142 |
-
),
|
143 |
-
'header_4' => array(
|
144 |
-
'label' => esc_html__( 'Heading 4', 'schema-and-structured-data-for-wp' ),
|
145 |
-
'css' => array(
|
146 |
-
'main' => "{$this->main_css_element} h4",
|
147 |
-
),
|
148 |
-
'font_size' => array(
|
149 |
-
'default' => '18px',
|
150 |
-
),
|
151 |
-
'line_height' => array(
|
152 |
-
'default' => '1em',
|
153 |
-
),
|
154 |
-
'toggle_slug' => 'header',
|
155 |
-
'sub_toggle' => 'h4',
|
156 |
-
),
|
157 |
-
'header_5' => array(
|
158 |
-
'label' => esc_html__( 'Heading 5', 'schema-and-structured-data-for-wp' ),
|
159 |
-
'css' => array(
|
160 |
-
'main' => "{$this->main_css_element} h5",
|
161 |
-
),
|
162 |
-
'font_size' => array(
|
163 |
-
'default' => '16px',
|
164 |
-
),
|
165 |
-
'line_height' => array(
|
166 |
-
'default' => '1em',
|
167 |
-
),
|
168 |
-
'toggle_slug' => 'header',
|
169 |
-
'sub_toggle' => 'h5',
|
170 |
-
),
|
171 |
-
'header_6' => array(
|
172 |
-
'label' => esc_html__( 'Heading 6', 'schema-and-structured-data-for-wp' ),
|
173 |
-
'css' => array(
|
174 |
-
'main' => "{$this->main_css_element} h6",
|
175 |
-
),
|
176 |
-
'font_size' => array(
|
177 |
-
'default' => '14px',
|
178 |
-
),
|
179 |
-
'line_height' => array(
|
180 |
-
'default' => '1em',
|
181 |
-
),
|
182 |
-
'toggle_slug' => 'header',
|
183 |
-
'sub_toggle' => 'h6',
|
184 |
-
),
|
185 |
-
);
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
return $advanced_fields;
|
190 |
-
}
|
191 |
-
|
192 |
-
function render( $attrs, $content = null, $render_slug ) {
|
193 |
-
|
194 |
-
global $saswp_divi_faq;
|
195 |
-
$saswp_divi_faq[] = $attrs;
|
196 |
-
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
new SASWP_Divi_FaqBlockChild;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SASWP_Divi_FaqBlockChild extends ET_Builder_Module {
|
4 |
+
// Module slug (also used as shortcode tag)
|
5 |
+
public $slug = 'saswpfaqblockchild';
|
6 |
+
|
7 |
+
// Module item has to use `child` as its type property
|
8 |
+
public $type = 'child';
|
9 |
+
|
10 |
+
// Module item's attribute that will be used for module item label on modal
|
11 |
+
public $child_title_var = 'question';
|
12 |
+
|
13 |
+
// Full Visual Builder support
|
14 |
+
public $vb_support = 'on';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Module properties initialization
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*
|
21 |
+
* @todo Remove $this->advanced_options['background'] once https://github.com/elegantthemes/Divi/issues/6913 has been addressed
|
22 |
+
*/
|
23 |
+
function init() {
|
24 |
+
|
25 |
+
$this->advanced_setting_title_text = esc_html__( 'Question', 'schema-and-structured-data-for-wp' );
|
26 |
+
$this->settings_text = esc_html__( 'Question Settings', 'schema-and-structured-data-for-wp' );
|
27 |
+
$this->main_css_element = '%%order_class%%';
|
28 |
+
// Toggle settings
|
29 |
+
$this->settings_modal_toggles = array(
|
30 |
+
'general' => array(
|
31 |
+
'toggles' => array(
|
32 |
+
'main_content' => esc_html__( 'Content', 'schema-and-structured-data-for-wp' ),
|
33 |
+
),
|
34 |
+
),
|
35 |
+
'advanced' => array(
|
36 |
+
'toggles' => array(
|
37 |
+
'text' => array(
|
38 |
+
'title' => esc_html__( 'Text', 'schema-and-structured-data-for-wp' ),
|
39 |
+
'priority' => 45,
|
40 |
+
'bb_icons_support' => true,
|
41 |
+
),
|
42 |
+
'header' => array(
|
43 |
+
'title' => esc_html__( 'Heading Text', 'schema-and-structured-data-for-wp' ),
|
44 |
+
'priority' => 49,
|
45 |
+
'tabbed_subtoggles' => true,
|
46 |
+
'sub_toggles' => array(
|
47 |
+
'h2' => array(
|
48 |
+
'name' => 'H2',
|
49 |
+
'icon' => 'text-h2',
|
50 |
+
),
|
51 |
+
'h3' => array(
|
52 |
+
'name' => 'H3',
|
53 |
+
'icon' => 'text-h3',
|
54 |
+
),
|
55 |
+
|
56 |
+
|
57 |
+
),
|
58 |
+
),
|
59 |
+
),
|
60 |
+
),
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
public function get_fields() {
|
65 |
+
return array(
|
66 |
+
'faq_question' => array(
|
67 |
+
'label' => esc_html__( 'Question', 'schema-and-structured-data-for-wp' ),
|
68 |
+
'type' => 'text',
|
69 |
+
'option_category' => 'basic_option',
|
70 |
+
'description' => esc_html__( 'Input your question here', 'schema-and-structured-data-for-wp' ),
|
71 |
+
'toggle_slug' => 'main_content',
|
72 |
+
),
|
73 |
+
'faq_answer' => array(
|
74 |
+
'label' => esc_html__( 'Answer', 'schema-and-structured-data-for-wp' ),
|
75 |
+
'type' => 'tiny_mce',
|
76 |
+
'option_category' => 'basic_option',
|
77 |
+
'description' => esc_html__( 'Input your answer here', 'schema-and-structured-data-for-wp' ),
|
78 |
+
'toggle_slug' => 'main_content',
|
79 |
+
),
|
80 |
+
);
|
81 |
+
|
82 |
+
|
83 |
+
}
|
84 |
+
public function get_advanced_fields_config() {
|
85 |
+
$advanced_fields = $this->advanced_tab_options;
|
86 |
+
|
87 |
+
$advanced_fields['fonts'] = array(
|
88 |
+
'main_text' => array(
|
89 |
+
'label' => esc_html__( 'Content', 'schema-and-structured-data-for-wp' ),
|
90 |
+
'css' => array(
|
91 |
+
'main' => "{$this->main_css_element} .saswp_timeline_child_inner",
|
92 |
+
),
|
93 |
+
'font_size' => array(
|
94 |
+
'default' => absint( '14' ) . 'px',
|
95 |
+
),
|
96 |
+
'line_height' => array(
|
97 |
+
'default' => '1.4em',
|
98 |
+
),
|
99 |
+
'letter_spacing' => array(
|
100 |
+
'default' => '0px',
|
101 |
+
),
|
102 |
+
'toggle_slug' => 'text',
|
103 |
+
),
|
104 |
+
'header' => array(
|
105 |
+
'label' => esc_html__( 'Heading', 'schema-and-structured-data-for-wp' ),
|
106 |
+
'css' => array(
|
107 |
+
'main' => "{$this->main_css_element} .saswp_timeline_child_inner h1",
|
108 |
+
),
|
109 |
+
'font_size' => array(
|
110 |
+
'default' => absint( et_get_option( 'body_header_size', '30' ) ) . 'px',
|
111 |
+
),
|
112 |
+
'toggle_slug' => 'header',
|
113 |
+
'sub_toggle' => 'h1',
|
114 |
+
),
|
115 |
+
'header_2' => array(
|
116 |
+
'label' => esc_html__( 'Heading 2', 'schema-and-structured-data-for-wp' ),
|
117 |
+
'css' => array(
|
118 |
+
'main' => "{$this->main_css_element} .saswp_timeline_child_inner h2",
|
119 |
+
),
|
120 |
+
'font_size' => array(
|
121 |
+
'default' => '26px',
|
122 |
+
),
|
123 |
+
'line_height' => array(
|
124 |
+
'default' => '1em',
|
125 |
+
),
|
126 |
+
'toggle_slug' => 'header',
|
127 |
+
'sub_toggle' => 'h2',
|
128 |
+
),
|
129 |
+
'header_3' => array(
|
130 |
+
'label' => esc_html__( 'Heading 3', 'schema-and-structured-data-for-wp' ),
|
131 |
+
'css' => array(
|
132 |
+
'main' => "{$this->main_css_element} .saswp_timeline_date h3",
|
133 |
+
),
|
134 |
+
'font_size' => array(
|
135 |
+
'default' => '22px',
|
136 |
+
),
|
137 |
+
'line_height' => array(
|
138 |
+
'default' => '1em',
|
139 |
+
),
|
140 |
+
'toggle_slug' => 'header',
|
141 |
+
'sub_toggle' => 'h3',
|
142 |
+
),
|
143 |
+
'header_4' => array(
|
144 |
+
'label' => esc_html__( 'Heading 4', 'schema-and-structured-data-for-wp' ),
|
145 |
+
'css' => array(
|
146 |
+
'main' => "{$this->main_css_element} h4",
|
147 |
+
),
|
148 |
+
'font_size' => array(
|
149 |
+
'default' => '18px',
|
150 |
+
),
|
151 |
+
'line_height' => array(
|
152 |
+
'default' => '1em',
|
153 |
+
),
|
154 |
+
'toggle_slug' => 'header',
|
155 |
+
'sub_toggle' => 'h4',
|
156 |
+
),
|
157 |
+
'header_5' => array(
|
158 |
+
'label' => esc_html__( 'Heading 5', 'schema-and-structured-data-for-wp' ),
|
159 |
+
'css' => array(
|
160 |
+
'main' => "{$this->main_css_element} h5",
|
161 |
+
),
|
162 |
+
'font_size' => array(
|
163 |
+
'default' => '16px',
|
164 |
+
),
|
165 |
+
'line_height' => array(
|
166 |
+
'default' => '1em',
|
167 |
+
),
|
168 |
+
'toggle_slug' => 'header',
|
169 |
+
'sub_toggle' => 'h5',
|
170 |
+
),
|
171 |
+
'header_6' => array(
|
172 |
+
'label' => esc_html__( 'Heading 6', 'schema-and-structured-data-for-wp' ),
|
173 |
+
'css' => array(
|
174 |
+
'main' => "{$this->main_css_element} h6",
|
175 |
+
),
|
176 |
+
'font_size' => array(
|
177 |
+
'default' => '14px',
|
178 |
+
),
|
179 |
+
'line_height' => array(
|
180 |
+
'default' => '1em',
|
181 |
+
),
|
182 |
+
'toggle_slug' => 'header',
|
183 |
+
'sub_toggle' => 'h6',
|
184 |
+
),
|
185 |
+
);
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
return $advanced_fields;
|
190 |
+
}
|
191 |
+
|
192 |
+
function render( $attrs, $content = null, $render_slug ) {
|
193 |
+
|
194 |
+
global $saswp_divi_faq;
|
195 |
+
$saswp_divi_faq[] = $attrs;
|
196 |
+
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
new SASWP_Divi_FaqBlockChild;
|
modules/divi-builder/includes/modules/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
import FaqBlock from './FaqBlock/FaqBlock';
|
2 |
-
export default [FaqBlock];
|
3 |
-
|
4 |
-
//import HelloWorld from './HelloWorld/HelloWorld';
|
5 |
-
//export default [HelloWorld];
|
1 |
+
import FaqBlock from './FaqBlock/FaqBlock';
|
2 |
+
export default [FaqBlock];
|
3 |
+
|
4 |
+
//import HelloWorld from './HelloWorld/HelloWorld';
|
5 |
+
//export default [HelloWorld];
|
modules/divi-builder/media/slick.svg
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
<?xml version="1.0" standalone="no"?>
|
2 |
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
-
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
-
<metadata>Generated by Fontastic.me</metadata>
|
5 |
-
<defs>
|
6 |
-
<font id="slick" horiz-adv-x="512">
|
7 |
-
<font-face font-family="slick" units-per-em="512" ascent="480" descent="-32"/>
|
8 |
-
<missing-glyph horiz-adv-x="512" />
|
9 |
-
|
10 |
-
<glyph unicode="→" d="M241 113l130 130c4 4 6 8 6 13 0 5-2 9-6 13l-130 130c-3 3-7 5-12 5-5 0-10-2-13-5l-29-30c-4-3-6-7-6-12 0-5 2-10 6-13l87-88-87-88c-4-3-6-8-6-13 0-5 2-9 6-12l29-30c3-3 8-5 13-5 5 0 9 2 12 5z m234 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
11 |
-
<glyph unicode="←" d="M296 113l29 30c4 3 6 7 6 12 0 5-2 10-6 13l-87 88 87 88c4 3 6 8 6 13 0 5-2 9-6 12l-29 30c-3 3-8 5-13 5-5 0-9-2-12-5l-130-130c-4-4-6-8-6-13 0-5 2-9 6-13l130-130c3-3 7-5 12-5 5 0 10 2 13 5z m179 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
12 |
-
<glyph unicode="•" d="M475 256c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
13 |
-
<glyph unicode="a" d="M475 439l0-128c0-5-1-9-5-13-4-4-8-5-13-5l-128 0c-8 0-13 3-17 11-3 7-2 14 4 20l40 39c-28 26-62 39-100 39-20 0-39-4-57-11-18-8-33-18-46-32-14-13-24-28-32-46-7-18-11-37-11-57 0-20 4-39 11-57 8-18 18-33 32-46 13-14 28-24 46-32 18-7 37-11 57-11 23 0 44 5 64 15 20 9 38 23 51 42 2 1 4 3 7 3 3 0 5-1 7-3l39-39c2-2 3-3 3-6 0-2-1-4-2-6-21-25-46-45-76-59-29-14-60-20-93-20-30 0-58 5-85 17-27 12-51 27-70 47-20 19-35 43-47 70-12 27-17 55-17 85 0 30 5 58 17 85 12 27 27 51 47 70 19 20 43 35 70 47 27 12 55 17 85 17 28 0 55-5 81-15 26-11 50-26 70-45l37 37c6 6 12 7 20 4 8-4 11-9 11-17z"/>
|
14 |
-
</font></defs></svg>
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by Fontastic.me</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="slick" horiz-adv-x="512">
|
7 |
+
<font-face font-family="slick" units-per-em="512" ascent="480" descent="-32"/>
|
8 |
+
<missing-glyph horiz-adv-x="512" />
|
9 |
+
|
10 |
+
<glyph unicode="→" d="M241 113l130 130c4 4 6 8 6 13 0 5-2 9-6 13l-130 130c-3 3-7 5-12 5-5 0-10-2-13-5l-29-30c-4-3-6-7-6-12 0-5 2-10 6-13l87-88-87-88c-4-3-6-8-6-13 0-5 2-9 6-12l29-30c3-3 8-5 13-5 5 0 9 2 12 5z m234 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
11 |
+
<glyph unicode="←" d="M296 113l29 30c4 3 6 7 6 12 0 5-2 10-6 13l-87 88 87 88c4 3 6 8 6 13 0 5-2 9-6 12l-29 30c-3 3-8 5-13 5-5 0-9-2-12-5l-130-130c-4-4-6-8-6-13 0-5 2-9 6-13l130-130c3-3 7-5 12-5 5 0 10 2 13 5z m179 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
12 |
+
<glyph unicode="•" d="M475 256c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
13 |
+
<glyph unicode="a" d="M475 439l0-128c0-5-1-9-5-13-4-4-8-5-13-5l-128 0c-8 0-13 3-17 11-3 7-2 14 4 20l40 39c-28 26-62 39-100 39-20 0-39-4-57-11-18-8-33-18-46-32-14-13-24-28-32-46-7-18-11-37-11-57 0-20 4-39 11-57 8-18 18-33 32-46 13-14 28-24 46-32 18-7 37-11 57-11 23 0 44 5 64 15 20 9 38 23 51 42 2 1 4 3 7 3 3 0 5-1 7-3l39-39c2-2 3-3 3-6 0-2-1-4-2-6-21-25-46-45-76-59-29-14-60-20-93-20-30 0-58 5-85 17-27 12-51 27-70 47-20 19-35 43-47 70-12 27-17 55-17 85 0 30 5 58 17 85 12 27 27 51 47 70 19 20 43 35 70 47 27 12 55 17 85 17 28 0 55-5 81-15 26-11 50-26 70-45l37 37c6 6 12 7 20 4 8-4 11-9 11-17z"/>
|
14 |
+
</font></defs></svg>
|
modules/divi-builder/scripts/frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
// This script is loaded both on the frontend page and in the Visual Builder.
|
2 |
-
|
3 |
-
jQuery(function($) {});
|
1 |
+
// This script is loaded both on the frontend page and in the Visual Builder.
|
2 |
+
|
3 |
+
jQuery(function($) {});
|
modules/elementor/assets/js/faq-block.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
( function( $ ) {
|
2 |
-
/**
|
3 |
-
* @param $scope The Widget wrapper element as a jQuery element
|
4 |
-
* @param $ The jQuery alias
|
5 |
-
*/
|
6 |
-
var WidgetHelloWorldHandler = function( $scope, $ ) {
|
7 |
-
console.log( $scope );
|
8 |
-
};
|
9 |
-
|
10 |
-
// Make sure you run this code under Elementor.
|
11 |
-
$( window ).on( 'elementor/frontend/init', function() {
|
12 |
-
elementorFrontend.hooks.addAction( 'frontend/element_ready/faq-block.default', WidgetHelloWorldHandler );
|
13 |
-
} );
|
14 |
-
} )( jQuery );
|
1 |
+
( function( $ ) {
|
2 |
+
/**
|
3 |
+
* @param $scope The Widget wrapper element as a jQuery element
|
4 |
+
* @param $ The jQuery alias
|
5 |
+
*/
|
6 |
+
var WidgetHelloWorldHandler = function( $scope, $ ) {
|
7 |
+
console.log( $scope );
|
8 |
+
};
|
9 |
+
|
10 |
+
// Make sure you run this code under Elementor.
|
11 |
+
$( window ).on( 'elementor/frontend/init', function() {
|
12 |
+
elementorFrontend.hooks.addAction( 'frontend/element_ready/faq-block.default', WidgetHelloWorldHandler );
|
13 |
+
} );
|
14 |
+
} )( jQuery );
|
modules/elementor/elementor-loader.php
CHANGED
@@ -1,99 +1,99 @@
|
|
1 |
-
<?php
|
2 |
-
namespace SASWPElementorModule;
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Class Plugin
|
6 |
-
*
|
7 |
-
* Main Plugin class
|
8 |
-
* @since 1.2.0
|
9 |
-
*/
|
10 |
-
class SASWP_Elementor_Loader {
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Instance
|
14 |
-
*
|
15 |
-
* @since 1.2.0
|
16 |
-
* @access private
|
17 |
-
* @static
|
18 |
-
*
|
19 |
-
* @var Plugin The single instance of the class.
|
20 |
-
*/
|
21 |
-
private static $_instance = null;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Instance
|
25 |
-
*
|
26 |
-
* Ensures only one instance of the class is loaded or can be loaded.
|
27 |
-
*
|
28 |
-
* @since 1.2.0
|
29 |
-
* @access public
|
30 |
-
*
|
31 |
-
* @return Plugin An instance of the class.
|
32 |
-
*/
|
33 |
-
public static function instance() {
|
34 |
-
if ( is_null( self::$_instance ) ) {
|
35 |
-
self::$_instance = new self();
|
36 |
-
}
|
37 |
-
return self::$_instance;
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* widget_scripts
|
42 |
-
*
|
43 |
-
* Load required plugin core files.
|
44 |
-
*
|
45 |
-
* @since 1.2.0
|
46 |
-
* @access public
|
47 |
-
*/
|
48 |
-
public function widget_scripts() {
|
49 |
-
wp_register_script( 'elementor-helloff-world', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Include Widgets files
|
54 |
-
*
|
55 |
-
* Load widgets files
|
56 |
-
*
|
57 |
-
* @since 1.2.0
|
58 |
-
* @access private
|
59 |
-
*/
|
60 |
-
private function include_widgets_files() {
|
61 |
-
require_once( __DIR__ . '/widgets/faq-block.php' );
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Register Widgets
|
66 |
-
*
|
67 |
-
* Register new Elementor widgets.
|
68 |
-
*
|
69 |
-
* @since 1.2.0
|
70 |
-
* @access public
|
71 |
-
*/
|
72 |
-
public function register_widgets() {
|
73 |
-
// Its is now safe to include Widgets files
|
74 |
-
$this->include_widgets_files();
|
75 |
-
|
76 |
-
// Register Widgets
|
77 |
-
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Plugin class constructor
|
82 |
-
*
|
83 |
-
* Register plugin action hooks and filters
|
84 |
-
*
|
85 |
-
* @since 1.2.0
|
86 |
-
* @access public
|
87 |
-
*/
|
88 |
-
public function __construct() {
|
89 |
-
|
90 |
-
// Register widget scripts
|
91 |
-
add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] );
|
92 |
-
|
93 |
-
// Register widgets
|
94 |
-
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
// Instantiate Plugin Class
|
99 |
-
SASWP_Elementor_Loader::instance();
|
1 |
+
<?php
|
2 |
+
namespace SASWPElementorModule;
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Class Plugin
|
6 |
+
*
|
7 |
+
* Main Plugin class
|
8 |
+
* @since 1.2.0
|
9 |
+
*/
|
10 |
+
class SASWP_Elementor_Loader {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Instance
|
14 |
+
*
|
15 |
+
* @since 1.2.0
|
16 |
+
* @access private
|
17 |
+
* @static
|
18 |
+
*
|
19 |
+
* @var Plugin The single instance of the class.
|
20 |
+
*/
|
21 |
+
private static $_instance = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Instance
|
25 |
+
*
|
26 |
+
* Ensures only one instance of the class is loaded or can be loaded.
|
27 |
+
*
|
28 |
+
* @since 1.2.0
|
29 |
+
* @access public
|
30 |
+
*
|
31 |
+
* @return Plugin An instance of the class.
|
32 |
+
*/
|
33 |
+
public static function instance() {
|
34 |
+
if ( is_null( self::$_instance ) ) {
|
35 |
+
self::$_instance = new self();
|
36 |
+
}
|
37 |
+
return self::$_instance;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* widget_scripts
|
42 |
+
*
|
43 |
+
* Load required plugin core files.
|
44 |
+
*
|
45 |
+
* @since 1.2.0
|
46 |
+
* @access public
|
47 |
+
*/
|
48 |
+
public function widget_scripts() {
|
49 |
+
wp_register_script( 'elementor-helloff-world', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Include Widgets files
|
54 |
+
*
|
55 |
+
* Load widgets files
|
56 |
+
*
|
57 |
+
* @since 1.2.0
|
58 |
+
* @access private
|
59 |
+
*/
|
60 |
+
private function include_widgets_files() {
|
61 |
+
require_once( __DIR__ . '/widgets/faq-block.php' );
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Register Widgets
|
66 |
+
*
|
67 |
+
* Register new Elementor widgets.
|
68 |
+
*
|
69 |
+
* @since 1.2.0
|
70 |
+
* @access public
|
71 |
+
*/
|
72 |
+
public function register_widgets() {
|
73 |
+
// Its is now safe to include Widgets files
|
74 |
+
$this->include_widgets_files();
|
75 |
+
|
76 |
+
// Register Widgets
|
77 |
+
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Plugin class constructor
|
82 |
+
*
|
83 |
+
* Register plugin action hooks and filters
|
84 |
+
*
|
85 |
+
* @since 1.2.0
|
86 |
+
* @access public
|
87 |
+
*/
|
88 |
+
public function __construct() {
|
89 |
+
|
90 |
+
// Register widget scripts
|
91 |
+
add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] );
|
92 |
+
|
93 |
+
// Register widgets
|
94 |
+
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
// Instantiate Plugin Class
|
99 |
+
SASWP_Elementor_Loader::instance();
|
modules/elementor/widgets/faq-block.php
CHANGED
@@ -1,155 +1,155 @@
|
|
1 |
-
<?php
|
2 |
-
namespace SASWPElementorModule\Widgets;
|
3 |
-
|
4 |
-
use Elementor\Repeater;
|
5 |
-
use Elementor\Widget_Base;
|
6 |
-
use Elementor\Controls_Manager;
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
9 |
-
|
10 |
-
|
11 |
-
class Faq_Block extends Widget_Base {
|
12 |
-
|
13 |
-
public function get_name() {
|
14 |
-
return 'saswp-faq-block';
|
15 |
-
}
|
16 |
-
|
17 |
-
public function get_title() {
|
18 |
-
return __( 'Faq Block', 'elementor' );
|
19 |
-
}
|
20 |
-
public function get_keywords() {
|
21 |
-
return [ 'faq', 'faq schema', 'schema', 'structured data' ];
|
22 |
-
}
|
23 |
-
public function get_icon() {
|
24 |
-
return 'eicon-text';
|
25 |
-
}
|
26 |
-
|
27 |
-
protected function _register_controls() {
|
28 |
-
|
29 |
-
$this->start_controls_section(
|
30 |
-
'content_section',
|
31 |
-
[
|
32 |
-
'label' => __( 'FAQ Block', 'plugin-name' ),
|
33 |
-
'tab' => Controls_Manager::TAB_CONTENT,
|
34 |
-
]
|
35 |
-
);
|
36 |
-
|
37 |
-
$repeater = new Repeater();
|
38 |
-
|
39 |
-
$repeater->add_control(
|
40 |
-
'faq_question', [
|
41 |
-
'label' => __( 'Question', 'schema-and-structured-data-for-wp' ),
|
42 |
-
'type' => Controls_Manager::TEXT,
|
43 |
-
'label_block' => true,
|
44 |
-
'default' => __( 'Question' , 'schema-and-structured-data-for-wp' ),
|
45 |
-
'dynamic' => [
|
46 |
-
'active' => true,
|
47 |
-
],
|
48 |
-
]
|
49 |
-
);
|
50 |
-
|
51 |
-
$repeater->add_control(
|
52 |
-
'faq_answer', [
|
53 |
-
'label' => __( 'Answer', 'schema-and-structured-data-for-wp' ),
|
54 |
-
'type' => Controls_Manager::WYSIWYG,
|
55 |
-
'show_label' => false,
|
56 |
-
'default' => __( 'Answer' , 'schema-and-structured-data-for-wp' ),
|
57 |
-
]
|
58 |
-
);
|
59 |
-
|
60 |
-
$this->add_control(
|
61 |
-
'order_type',
|
62 |
-
[
|
63 |
-
'label' => __( 'Order Type', 'schema-and-structured-data-for-wp' ),
|
64 |
-
'type' => Controls_Manager::SELECT,
|
65 |
-
'options' => [
|
66 |
-
'' => __( 'Select', 'schema-and-structured-data-for-wp' ),
|
67 |
-
'order_list' => __( 'Order List', 'schema-and-structured-data-for-wp' ),
|
68 |
-
'unorder_list' => __( 'Unorder List', 'schema-and-structured-data-for-wp' ),
|
69 |
-
],
|
70 |
-
]
|
71 |
-
);
|
72 |
-
|
73 |
-
$this->add_control(
|
74 |
-
'list',
|
75 |
-
[
|
76 |
-
'label' => __( 'Question List', 'schema-and-structured-data-for-wp' ),
|
77 |
-
'type' => Controls_Manager::REPEATER,
|
78 |
-
'fields' => $repeater->get_controls(),
|
79 |
-
'default' => [
|
80 |
-
[
|
81 |
-
'saswp_faq_question' => __( 'First Question', 'schema-and-structured-data-for-wp' ),
|
82 |
-
'saswp_faq_answer' => __( 'First Answer. Click the edit button to change this text.', 'schema-and-structured-data-for-wp' ),
|
83 |
-
]
|
84 |
-
],
|
85 |
-
'title_field' => '{{{ faq_question }}}',
|
86 |
-
]
|
87 |
-
);
|
88 |
-
|
89 |
-
$this->end_controls_section();
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
protected function render() {
|
94 |
-
|
95 |
-
global $saswp_elementor_faq;
|
96 |
-
|
97 |
-
$settings = $this->get_settings_for_display();
|
98 |
-
$order_type = $settings['order_type'];
|
99 |
-
$style ='';
|
100 |
-
|
101 |
-
if($order_type == 'order_list' || $order_type == ''){
|
102 |
-
$style = 'style="list-style:none"';
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( $settings['list'] ) {
|
106 |
-
|
107 |
-
$saswp_elementor_faq = $settings['list'];
|
108 |
-
echo '<ul>';
|
109 |
-
$i = 1;
|
110 |
-
foreach ( $settings['list'] as $item ) {
|
111 |
-
echo '<li '.$style.' class="elementor-repeater-item-' . esc_attr($item['_id']) . '">';
|
112 |
-
echo '<h3>';
|
113 |
-
|
114 |
-
if($order_type == 'order_list'){
|
115 |
-
echo '<span>'.$i.'. </span>';
|
116 |
-
}
|
117 |
-
echo esc_html($item['faq_question']);
|
118 |
-
echo '</h3>';
|
119 |
-
echo '<p>' . wp_unslash($item['faq_answer']) . '</p>';
|
120 |
-
|
121 |
-
$i++;
|
122 |
-
}
|
123 |
-
echo '</ul>';
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
protected function _content_template() {
|
128 |
-
?>
|
129 |
-
<# if ( settings.list.length ) {
|
130 |
-
|
131 |
-
var order_type = settings['order_type'];
|
132 |
-
var step_style = '';
|
133 |
-
|
134 |
-
if(order_type == 'order_list' || order_type == ''){
|
135 |
-
step_style = 'style="list-style:none"';
|
136 |
-
}
|
137 |
-
|
138 |
-
#>
|
139 |
-
<ul>
|
140 |
-
<# _.each( settings.list, function( item, index ) { #>
|
141 |
-
<li {{{step_style}}} class="elementor-repeater-item-{{ item._id }}">
|
142 |
-
<h3>
|
143 |
-
<# if(order_type == 'order_list'){ #>
|
144 |
-
<span>{{{ index + 1 }}} .</span>
|
145 |
-
<# } #>
|
146 |
-
{{{ item.faq_question }}}
|
147 |
-
</h3>
|
148 |
-
<p>{{{ item.faq_answer }}}</p>
|
149 |
-
</li>
|
150 |
-
<# }); #>
|
151 |
-
</ul>
|
152 |
-
<# } #>
|
153 |
-
<?php
|
154 |
-
}
|
155 |
}
|
1 |
+
<?php
|
2 |
+
namespace SASWPElementorModule\Widgets;
|
3 |
+
|
4 |
+
use Elementor\Repeater;
|
5 |
+
use Elementor\Widget_Base;
|
6 |
+
use Elementor\Controls_Manager;
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
9 |
+
|
10 |
+
|
11 |
+
class Faq_Block extends Widget_Base {
|
12 |
+
|
13 |
+
public function get_name() {
|
14 |
+
return 'saswp-faq-block';
|
15 |
+
}
|
16 |
+
|
17 |
+
public function get_title() {
|
18 |
+
return __( 'Faq Block', 'elementor' );
|
19 |
+
}
|
20 |
+
public function get_keywords() {
|
21 |
+
return [ 'faq', 'faq schema', 'schema', 'structured data' ];
|
22 |
+
}
|
23 |
+
public function get_icon() {
|
24 |
+
return 'eicon-text';
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _register_controls() {
|
28 |
+
|
29 |
+
$this->start_controls_section(
|
30 |
+
'content_section',
|
31 |
+
[
|
32 |
+
'label' => __( 'FAQ Block', 'plugin-name' ),
|
33 |
+
'tab' => Controls_Manager::TAB_CONTENT,
|
34 |
+
]
|
35 |
+
);
|
36 |
+
|
37 |
+
$repeater = new Repeater();
|
38 |
+
|
39 |
+
$repeater->add_control(
|
40 |
+
'faq_question', [
|
41 |
+
'label' => __( 'Question', 'schema-and-structured-data-for-wp' ),
|
42 |
+
'type' => Controls_Manager::TEXT,
|
43 |
+
'label_block' => true,
|
44 |
+
'default' => __( 'Question' , 'schema-and-structured-data-for-wp' ),
|
45 |
+
'dynamic' => [
|
46 |
+
'active' => true,
|
47 |
+
],
|
48 |
+
]
|
49 |
+
);
|
50 |
+
|
51 |
+
$repeater->add_control(
|
52 |
+
'faq_answer', [
|
53 |
+
'label' => __( 'Answer', 'schema-and-structured-data-for-wp' ),
|
54 |
+
'type' => Controls_Manager::WYSIWYG,
|
55 |
+
'show_label' => false,
|
56 |
+
'default' => __( 'Answer' , 'schema-and-structured-data-for-wp' ),
|
57 |
+
]
|
58 |
+
);
|
59 |
+
|
60 |
+
$this->add_control(
|
61 |
+
'order_type',
|
62 |
+
[
|
63 |
+
'label' => __( 'Order Type', 'schema-and-structured-data-for-wp' ),
|
64 |
+
'type' => Controls_Manager::SELECT,
|
65 |
+
'options' => [
|
66 |
+
'' => __( 'Select', 'schema-and-structured-data-for-wp' ),
|
67 |
+
'order_list' => __( 'Order List', 'schema-and-structured-data-for-wp' ),
|
68 |
+
'unorder_list' => __( 'Unorder List', 'schema-and-structured-data-for-wp' ),
|
69 |
+
],
|
70 |
+
]
|
71 |
+
);
|
72 |
+
|
73 |
+
$this->add_control(
|
74 |
+
'list',
|
75 |
+
[
|
76 |
+
'label' => __( 'Question List', 'schema-and-structured-data-for-wp' ),
|
77 |
+
'type' => Controls_Manager::REPEATER,
|
78 |
+
'fields' => $repeater->get_controls(),
|
79 |
+
'default' => [
|
80 |
+
[
|
81 |
+
'saswp_faq_question' => __( 'First Question', 'schema-and-structured-data-for-wp' ),
|
82 |
+
'saswp_faq_answer' => __( 'First Answer. Click the edit button to change this text.', 'schema-and-structured-data-for-wp' ),
|
83 |
+
]
|
84 |
+
],
|
85 |
+
'title_field' => '{{{ faq_question }}}',
|
86 |
+
]
|
87 |
+
);
|
88 |
+
|
89 |
+
$this->end_controls_section();
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function render() {
|
94 |
+
|
95 |
+
global $saswp_elementor_faq;
|
96 |
+
|
97 |
+
$settings = $this->get_settings_for_display();
|
98 |
+
$order_type = $settings['order_type'];
|
99 |
+
$style ='';
|
100 |
+
|
101 |
+
if($order_type == 'order_list' || $order_type == ''){
|
102 |
+
$style = 'style="list-style:none"';
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( $settings['list'] ) {
|
106 |
+
|
107 |
+
$saswp_elementor_faq = $settings['list'];
|
108 |
+
echo '<ul>';
|
109 |
+
$i = 1;
|
110 |
+
foreach ( $settings['list'] as $item ) {
|
111 |
+
echo '<li '.$style.' class="elementor-repeater-item-' . esc_attr($item['_id']) . '">';
|
112 |
+
echo '<h3>';
|
113 |
+
|
114 |
+
if($order_type == 'order_list'){
|
115 |
+
echo '<span>'.$i.'. </span>';
|
116 |
+
}
|
117 |
+
echo esc_html($item['faq_question']);
|
118 |
+
echo '</h3>';
|
119 |
+
echo '<p>' . wp_unslash($item['faq_answer']) . '</p>';
|
120 |
+
|
121 |
+
$i++;
|
122 |
+
}
|
123 |
+
echo '</ul>';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
protected function _content_template() {
|
128 |
+
?>
|
129 |
+
<# if ( settings.list.length ) {
|
130 |
+
|
131 |
+
var order_type = settings['order_type'];
|
132 |
+
var step_style = '';
|
133 |
+
|
134 |
+
if(order_type == 'order_list' || order_type == ''){
|
135 |
+
step_style = 'style="list-style:none"';
|
136 |
+
}
|
137 |
+
|
138 |
+
#>
|
139 |
+
<ul>
|
140 |
+
<# _.each( settings.list, function( item, index ) { #>
|
141 |
+
<li {{{step_style}}} class="elementor-repeater-item-{{ item._id }}">
|
142 |
+
<h3>
|
143 |
+
<# if(order_type == 'order_list'){ #>
|
144 |
+
<span>{{{ index + 1 }}} .</span>
|
145 |
+
<# } #>
|
146 |
+
{{{ item.faq_question }}}
|
147 |
+
</h3>
|
148 |
+
<p>{{{ item.faq_answer }}}</p>
|
149 |
+
</li>
|
150 |
+
<# }); #>
|
151 |
+
</ul>
|
152 |
+
<# } #>
|
153 |
+
<?php
|
154 |
+
}
|
155 |
}
|
modules/reviews/reviews_collection.php
CHANGED
@@ -258,6 +258,7 @@ class SASWP_Reviews_Collection {
|
|
258 |
$platform_id = array();
|
259 |
$pagination = null;
|
260 |
$perpage = null;
|
|
|
261 |
$dots = $f_interval = $f_visibility = $arrow = 1;
|
262 |
$g_type = $design = $cols = $sorting = '';
|
263 |
|
258 |
$platform_id = array();
|
259 |
$pagination = null;
|
260 |
$perpage = null;
|
261 |
+
$data_id = null;
|
262 |
$dots = $f_interval = $f_visibility = $arrow = 1;
|
263 |
$g_type = $design = $cols = $sorting = '';
|
264 |
|
modules/reviews/reviews_form.php
CHANGED
@@ -188,7 +188,7 @@ class SASWP_Reviews_Form {
|
|
188 |
if(!$is_amp){
|
189 |
|
190 |
if($on_button){
|
191 |
-
$form .= '<div class="saswp-rv-form-btn"><a href="#" class="button button-default">
|
192 |
}
|
193 |
|
194 |
$rating_html = '<div class="saswp-rating-front-div"></div><input type="hidden" name="saswp_review_rating" value="5">';
|
@@ -199,7 +199,7 @@ class SASWP_Reviews_Form {
|
|
199 |
add_action( 'amp_post_template_data', array($this, 'saswp_reviews_form_amp_script'));
|
200 |
|
201 |
if($on_button){
|
202 |
-
$form .= '<div class="saswp-rv-form-btn"><span href="#" class="button button-default" on="tap:AMP.setState({ saswp_review_form_toggle: !saswp_review_form_toggle })" role="button" tabindex="1">
|
203 |
}
|
204 |
|
205 |
$form .= '<form action-xhr="'.esc_url( admin_url('admin-post.php') ).'" method="post" class="saswp-review-submission-form '.($on_button ? "saswp_hide" : "").'" [class]="saswp_review_form_toggle ? \'saswp-review-submission-form\' : \'saswp_hide saswp-review-submission-form\' ">';
|
188 |
if(!$is_amp){
|
189 |
|
190 |
if($on_button){
|
191 |
+
$form .= '<div class="saswp-rv-form-btn"><a href="#" class="button button-default">'.saswp_label_text('translation-review-form').'</a></div>';
|
192 |
}
|
193 |
|
194 |
$rating_html = '<div class="saswp-rating-front-div"></div><input type="hidden" name="saswp_review_rating" value="5">';
|
199 |
add_action( 'amp_post_template_data', array($this, 'saswp_reviews_form_amp_script'));
|
200 |
|
201 |
if($on_button){
|
202 |
+
$form .= '<div class="saswp-rv-form-btn"><span href="#" class="button button-default" on="tap:AMP.setState({ saswp_review_form_toggle: !saswp_review_form_toggle })" role="button" tabindex="1">'.saswp_label_text('translation-review-form').'</span></div>';
|
203 |
}
|
204 |
|
205 |
$form .= '<form action-xhr="'.esc_url( admin_url('admin-post.php') ).'" method="post" class="saswp-review-submission-form '.($on_button ? "saswp_hide" : "").'" [class]="saswp_review_form_toggle ? \'saswp-review-submission-form\' : \'saswp_hide saswp-review-submission-form\' ">';
|
modules/reviews/reviews_service.php
CHANGED
@@ -700,7 +700,9 @@ class saswp_reviews_service {
|
|
700 |
case 'lowest':
|
701 |
|
702 |
usort($collection, function($a, $b) {
|
703 |
-
|
|
|
|
|
704 |
});
|
705 |
|
706 |
break;
|
@@ -708,19 +710,24 @@ class saswp_reviews_service {
|
|
708 |
case 'highest':
|
709 |
|
710 |
usort($collection, function($a, $b) {
|
711 |
-
|
|
|
|
|
|
|
712 |
});
|
713 |
|
714 |
$collection = array_reverse($collection);
|
715 |
-
|
716 |
|
717 |
break;
|
718 |
|
719 |
case 'newest':
|
720 |
case 'recent':
|
721 |
|
722 |
-
usort($collection, function($a, $b) {
|
723 |
-
|
|
|
|
|
|
|
724 |
});
|
725 |
|
726 |
$collection = array_reverse($collection);
|
@@ -729,8 +736,10 @@ class saswp_reviews_service {
|
|
729 |
|
730 |
case 'oldest':
|
731 |
|
732 |
-
usort($collection, function($a, $b) {
|
733 |
-
|
|
|
|
|
734 |
});
|
735 |
|
736 |
break;
|
@@ -753,8 +762,10 @@ class saswp_reviews_service {
|
|
753 |
|
754 |
$response = array();
|
755 |
|
756 |
-
|
757 |
-
|
|
|
|
|
758 |
|
759 |
return $response;
|
760 |
|
@@ -784,7 +795,6 @@ class saswp_reviews_service {
|
|
784 |
foreach ($collection as $value){
|
785 |
|
786 |
$date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
|
787 |
-
|
788 |
$html .= '<li>';
|
789 |
$html .= '<div class="saswp-rc">';
|
790 |
$html .= '<div class="saswp-rc-a">';
|
@@ -794,7 +804,7 @@ class saswp_reviews_service {
|
|
794 |
$html .= '<div class="saswp-rc-nm">';
|
795 |
$html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'.esc_attr($value['saswp_reviewer_name']).'</a>';
|
796 |
$html .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
|
797 |
-
$html .= '<span class="saswp-rc-dt">'.esc_attr($date_str['date']).'</span>';
|
798 |
$html .= '</div>';
|
799 |
$html .= '</div>';
|
800 |
|
@@ -872,7 +882,7 @@ class saswp_reviews_service {
|
|
872 |
$html .= '<img src="'.esc_url($value['saswp_reviewer_image']).'"/>';
|
873 |
$html .= '<div class="saswp-rc-nm">';
|
874 |
$html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'. esc_attr($value['saswp_reviewer_name']).'</a>';
|
875 |
-
$html .= '<span class="saswp-rc-dt">'.esc_attr($date_str['date']).'</span>';
|
876 |
$html .= '</div>';
|
877 |
$html .= '</div>';
|
878 |
$html .= '<div class="saswp-rc-lg">';
|
@@ -1159,7 +1169,7 @@ class saswp_reviews_service {
|
|
1159 |
$html_list .= '<span class="saswp-r4-str">';
|
1160 |
$html_list .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
|
1161 |
$html_list .= '</span>';
|
1162 |
-
$html_list .= '<span class="saswp-r4-tx">'. esc_attr($date_str['date']).'</span>';
|
1163 |
$html_list .= '</div>';
|
1164 |
|
1165 |
$html_list .= '<div class="saswp-r4-cnt">';
|
@@ -1287,7 +1297,7 @@ class saswp_reviews_service {
|
|
1287 |
$html .='<span>by</span>';
|
1288 |
$html .= '<span>'.esc_attr($value['saswp_reviewer_name']).'</span>';
|
1289 |
$html .='</div>';
|
1290 |
-
$html .= '<span class="saswp-r5-dt">'.esc_attr($date_str['date']).'</span>';
|
1291 |
$html .= '</div>';
|
1292 |
$html .= '</div>';
|
1293 |
$html .= '</div>';
|
@@ -1320,7 +1330,7 @@ class saswp_reviews_service {
|
|
1320 |
$html .='<span> by</span>';
|
1321 |
$html .= '<span>'.esc_attr($value['saswp_reviewer_name']).'</span>';
|
1322 |
$html .='</div>';
|
1323 |
-
$html .= '<span class="saswp-r5-dt">'.esc_attr($date_str['date']).'</span>';
|
1324 |
$html .= '</div>';
|
1325 |
$html .= '</div>';
|
1326 |
$html .= '</div>';
|
700 |
case 'lowest':
|
701 |
|
702 |
usort($collection, function($a, $b) {
|
703 |
+
if(isset(a['saswp_review_rating'])){
|
704 |
+
return $a['saswp_review_rating'] - $b['saswp_review_rating'];
|
705 |
+
}
|
706 |
});
|
707 |
|
708 |
break;
|
710 |
case 'highest':
|
711 |
|
712 |
usort($collection, function($a, $b) {
|
713 |
+
if(isset($a['saswp_review_rating'])){
|
714 |
+
return $a['saswp_review_rating'] - $b['saswp_review_rating'];
|
715 |
+
}
|
716 |
+
|
717 |
});
|
718 |
|
719 |
$collection = array_reverse($collection);
|
|
|
720 |
|
721 |
break;
|
722 |
|
723 |
case 'newest':
|
724 |
case 'recent':
|
725 |
|
726 |
+
usort($collection, function($a, $b) {
|
727 |
+
if(isset($a['saswp_review_date'])){
|
728 |
+
return strtotime($a['saswp_review_date']) - strtotime($b['saswp_review_date']);
|
729 |
+
}
|
730 |
+
|
731 |
});
|
732 |
|
733 |
$collection = array_reverse($collection);
|
736 |
|
737 |
case 'oldest':
|
738 |
|
739 |
+
usort($collection, function($a, $b) {
|
740 |
+
if(isset($a['saswp_review_date'])){
|
741 |
+
return strtotime($a['saswp_review_date']) - strtotime($b['saswp_review_date']);
|
742 |
+
}
|
743 |
});
|
744 |
|
745 |
break;
|
762 |
|
763 |
$response = array();
|
764 |
|
765 |
+
if($date_str){
|
766 |
+
$response['date'] = date('Y-m-d', strtotime($date_str));
|
767 |
+
$response['time'] = date('G:i:s', strtotime($date_str));
|
768 |
+
}
|
769 |
|
770 |
return $response;
|
771 |
|
795 |
foreach ($collection as $value){
|
796 |
|
797 |
$date_str = $this->saswp_convert_datetostring($value['saswp_review_date']);
|
|
|
798 |
$html .= '<li>';
|
799 |
$html .= '<div class="saswp-rc">';
|
800 |
$html .= '<div class="saswp-rc-a">';
|
804 |
$html .= '<div class="saswp-rc-nm">';
|
805 |
$html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'.esc_attr($value['saswp_reviewer_name']).'</a>';
|
806 |
$html .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
|
807 |
+
$html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
|
808 |
$html .= '</div>';
|
809 |
$html .= '</div>';
|
810 |
|
882 |
$html .= '<img src="'.esc_url($value['saswp_reviewer_image']).'"/>';
|
883 |
$html .= '<div class="saswp-rc-nm">';
|
884 |
$html .= '<a target="_blank" href="'.esc_url($value['saswp_review_link']).'">'. esc_attr($value['saswp_reviewer_name']).'</a>';
|
885 |
+
$html .= '<span class="saswp-rc-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
|
886 |
$html .= '</div>';
|
887 |
$html .= '</div>';
|
888 |
$html .= '<div class="saswp-rc-lg">';
|
1169 |
$html_list .= '<span class="saswp-r4-str">';
|
1170 |
$html_list .= saswp_get_rating_html_by_value($value['saswp_review_rating']);
|
1171 |
$html_list .= '</span>';
|
1172 |
+
$html_list .= '<span class="saswp-r4-tx">'. (isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
|
1173 |
$html_list .= '</div>';
|
1174 |
|
1175 |
$html_list .= '<div class="saswp-r4-cnt">';
|
1297 |
$html .='<span>by</span>';
|
1298 |
$html .= '<span>'.esc_attr($value['saswp_reviewer_name']).'</span>';
|
1299 |
$html .='</div>';
|
1300 |
+
$html .= '<span class="saswp-r5-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
|
1301 |
$html .= '</div>';
|
1302 |
$html .= '</div>';
|
1303 |
$html .= '</div>';
|
1330 |
$html .='<span> by</span>';
|
1331 |
$html .= '<span>'.esc_attr($value['saswp_reviewer_name']).'</span>';
|
1332 |
$html .='</div>';
|
1333 |
+
$html .= '<span class="saswp-r5-dt">'.(isset($date_str['date']) ? esc_attr($date_str['date']): '' ).'</span>';
|
1334 |
$html .= '</div>';
|
1335 |
$html .= '</div>';
|
1336 |
$html .= '</div>';
|
output/compatibility.php
CHANGED
@@ -1,4 +1,12 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
|
4 |
class saswp_output_compatibility{
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Output Page
|
4 |
+
*
|
5 |
+
* @author Magazine3
|
6 |
+
* @category Frontend
|
7 |
+
* @path output/compatibility
|
8 |
+
* @version 1.9.0
|
9 |
+
*/
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
class saswp_output_compatibility{
|
output/divi-builder.php
CHANGED
@@ -9,6 +9,12 @@
|
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
function saswp_divi_builder_faq_schema(){
|
13 |
|
14 |
$input1 = array();
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
12 |
+
/**
|
13 |
+
* Function to generate schema markup for divi-builder Faq block
|
14 |
+
* @global type $post
|
15 |
+
* @global type $saswp_divi_faq
|
16 |
+
* @return type array
|
17 |
+
*/
|
18 |
function saswp_divi_builder_faq_schema(){
|
19 |
|
20 |
$input1 = array();
|
output/elementor.php
CHANGED
@@ -9,6 +9,12 @@
|
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
function saswp_elementor_faq_schema(){
|
13 |
|
14 |
$input1 = array();
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
12 |
+
/**
|
13 |
+
* Function to generate schema markup for elementor Faq block
|
14 |
+
* @global type $post
|
15 |
+
* @global type $saswp_elementor_faq
|
16 |
+
* @return type array
|
17 |
+
*/
|
18 |
function saswp_elementor_faq_schema(){
|
19 |
|
20 |
$input1 = array();
|
output/function.php
CHANGED
@@ -612,7 +612,8 @@ function saswp_remove_warnings($data, $index, $type){
|
|
612 |
* @return type array
|
613 |
*/
|
614 |
function saswp_reading_time_and_word_count() {
|
615 |
-
|
|
|
616 |
// Predefined words-per-minute rate.
|
617 |
$words_per_minute = 225;
|
618 |
$words_per_second = $words_per_minute / 60;
|
@@ -620,8 +621,11 @@ function saswp_reading_time_and_word_count() {
|
|
620 |
// Count the words in the content.
|
621 |
$word_count = 0;
|
622 |
$text = trim( strip_tags( @get_the_content() ) );
|
|
|
|
|
|
|
|
|
623 |
$word_count = substr_count( "$text ", ' ' );
|
624 |
-
|
625 |
// How many seconds (total)?
|
626 |
$seconds = floor( $word_count / $words_per_second );
|
627 |
|
@@ -1116,9 +1120,9 @@ function saswp_wp_recipe_schema_json($recipe){
|
|
1116 |
|
1117 |
$image_size = @getimagesize($image_url);
|
1118 |
|
1119 |
-
if($image_size[0] <
|
1120 |
|
1121 |
-
$image_details = @saswp_aq_resize( $image_url,
|
1122 |
|
1123 |
if($image_details){
|
1124 |
|
@@ -1139,6 +1143,17 @@ function saswp_wp_recipe_schema_json($recipe){
|
|
1139 |
}
|
1140 |
|
1141 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1142 |
|
1143 |
return $metadata;
|
1144 |
}
|
612 |
* @return type array
|
613 |
*/
|
614 |
function saswp_reading_time_and_word_count() {
|
615 |
+
|
616 |
+
global $post;
|
617 |
// Predefined words-per-minute rate.
|
618 |
$words_per_minute = 225;
|
619 |
$words_per_second = $words_per_minute / 60;
|
621 |
// Count the words in the content.
|
622 |
$word_count = 0;
|
623 |
$text = trim( strip_tags( @get_the_content() ) );
|
624 |
+
|
625 |
+
if(!$text && is_object($post)){
|
626 |
+
$text = $post->post_content;
|
627 |
+
}
|
628 |
$word_count = substr_count( "$text ", ' ' );
|
|
|
629 |
// How many seconds (total)?
|
630 |
$seconds = floor( $word_count / $words_per_second );
|
631 |
|
1120 |
|
1121 |
$image_size = @getimagesize($image_url);
|
1122 |
|
1123 |
+
if($image_size[0] < 1200 && $image_size[1] < 720){
|
1124 |
|
1125 |
+
$image_details = @saswp_aq_resize( $image_url, 1200, 720, true, false, true );
|
1126 |
|
1127 |
if($image_details){
|
1128 |
|
1143 |
}
|
1144 |
|
1145 |
}
|
1146 |
+
|
1147 |
+
if(isset($metadata['video'])){
|
1148 |
+
|
1149 |
+
if(!$metadata['video']['description']){
|
1150 |
+
$metadata['video']['description'] = saswp_get_the_excerpt();
|
1151 |
+
}
|
1152 |
+
if(!$metadata['video']['uploadDate']){
|
1153 |
+
$metadata['video']['uploadDate'] = get_the_date('c');
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
}
|
1157 |
|
1158 |
return $metadata;
|
1159 |
}
|
output/gutenberg.php
CHANGED
@@ -9,6 +9,12 @@
|
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
function saswp_get_gutenberg_block_data($block){
|
13 |
|
14 |
global $post;
|
@@ -20,7 +26,7 @@ function saswp_get_gutenberg_block_data($block){
|
|
20 |
if(function_exists('parse_blocks') && is_object($post)){
|
21 |
|
22 |
$blocks = parse_blocks($post->post_content);
|
23 |
-
|
24 |
if($blocks){
|
25 |
|
26 |
foreach ($blocks as $parse_blocks){
|
@@ -45,9 +51,102 @@ function saswp_get_gutenberg_block_data($block){
|
|
45 |
|
46 |
function saswp_gutenberg_how_to_schema(){
|
47 |
|
48 |
-
global $post;
|
|
|
49 |
$input1 = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
$parse_blocks = saswp_get_gutenberg_block_data('saswp/how-to-block');
|
52 |
|
53 |
if(isset($parse_blocks['attrs'])){
|
@@ -134,9 +233,9 @@ function saswp_gutenberg_how_to_schema(){
|
|
134 |
|
135 |
if($val['title'] || $val['description']){
|
136 |
|
137 |
-
if($val['
|
138 |
$direction['@type'] = 'HowToDirection';
|
139 |
-
$direction['text'] = $val['
|
140 |
}
|
141 |
|
142 |
if($val['description']){
|
@@ -174,7 +273,7 @@ function saswp_gutenberg_how_to_schema(){
|
|
174 |
|
175 |
}
|
176 |
|
177 |
-
if(isset($parse_blocks['attrs']['days']) || $parse_blocks['attrs']['hours'] || $parse_blocks['attrs']['minutes']){
|
178 |
|
179 |
$input1['totalTime'] = 'P'.
|
180 |
((isset($parse_blocks['attrs']['days']) && $parse_blocks['attrs']['days'] !='') ? esc_attr($parse_blocks['attrs']['days']).'DT':'').
|
@@ -184,19 +283,58 @@ function saswp_gutenberg_how_to_schema(){
|
|
184 |
}
|
185 |
|
186 |
}
|
|
|
|
|
|
|
187 |
|
188 |
-
return $input1;
|
189 |
|
190 |
}
|
191 |
|
192 |
function saswp_gutenberg_faq_schema(){
|
193 |
|
194 |
-
global $post;
|
195 |
$input1 = array();
|
196 |
|
197 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
$input1['@context'] = saswp_context_url();
|
202 |
$input1['@type'] = 'FAQPage';
|
@@ -230,8 +368,10 @@ function saswp_gutenberg_faq_schema(){
|
|
230 |
}
|
231 |
|
232 |
}
|
|
|
|
|
233 |
|
234 |
-
return $input1;
|
235 |
|
236 |
}
|
237 |
|
9 |
*/
|
10 |
if (! defined('ABSPATH') ) exit;
|
11 |
|
12 |
+
/**
|
13 |
+
* Function to generate schema markup for Gutenberg Faq block
|
14 |
+
* @global type $post
|
15 |
+
* @param type $block
|
16 |
+
* @return type array
|
17 |
+
*/
|
18 |
function saswp_get_gutenberg_block_data($block){
|
19 |
|
20 |
global $post;
|
26 |
if(function_exists('parse_blocks') && is_object($post)){
|
27 |
|
28 |
$blocks = parse_blocks($post->post_content);
|
29 |
+
|
30 |
if($blocks){
|
31 |
|
32 |
foreach ($blocks as $parse_blocks){
|
51 |
|
52 |
function saswp_gutenberg_how_to_schema(){
|
53 |
|
54 |
+
global $post, $sd_data;
|
55 |
+
|
56 |
$input1 = array();
|
57 |
+
|
58 |
+
$yoast_howto = saswp_get_gutenberg_block_data('yoast/how-to-block');
|
59 |
+
if(isset($sd_data['saswp-yoast']) && $sd_data['saswp-yoast'] == 1 && $yoast_howto && isset($yoast_howto['attrs'])){
|
60 |
+
|
61 |
+
$service_object = new saswp_output_service();
|
62 |
+
$feature_image = $service_object->saswp_get_fetaure_image();
|
63 |
+
|
64 |
+
$input1['@context'] = saswp_context_url();
|
65 |
+
$input1['@type'] = 'HowTo';
|
66 |
+
$input1['@id'] = trailingslashit(saswp_get_permalink()).'#HowTo';
|
67 |
+
$input1['name'] = saswp_get_the_title();
|
68 |
+
$input1['datePublished'] = get_the_date("c");
|
69 |
+
$input1['dateModified'] = get_the_modified_date("c");
|
70 |
+
|
71 |
+
if(!empty($feature_image)){
|
72 |
+
|
73 |
+
$input1 = array_merge($input1, $feature_image);
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
if(array_key_exists('jsonDescription', $yoast_howto['attrs'])){
|
78 |
+
$input1['description'] = $yoast_howto['attrs']['jsonDescription'];
|
79 |
+
}else{
|
80 |
+
$input1['description'] = saswp_get_the_excerpt();
|
81 |
+
}
|
82 |
+
|
83 |
+
$step = array();
|
84 |
+
$step_arr = array();
|
85 |
+
|
86 |
+
if(array_key_exists('steps', $yoast_howto['attrs'])){
|
87 |
+
$step = $yoast_howto['attrs']['steps'];
|
88 |
+
}
|
89 |
+
if(!empty($step)){
|
90 |
+
|
91 |
+
foreach($step as $key => $val){
|
92 |
+
|
93 |
+
$supply_data = array();
|
94 |
+
$direction = array();
|
95 |
+
$tip = array();
|
96 |
+
|
97 |
+
if($val['name'] || $val['text']){
|
98 |
+
|
99 |
+
if(isset($val['text'][0])){
|
100 |
+
$direction['@type'] = 'HowToDirection';
|
101 |
+
$direction['text'] = $val['text'][0];
|
102 |
+
}
|
103 |
+
|
104 |
+
if(isset($val['text'][0])){
|
105 |
+
|
106 |
+
$tip['@type'] = 'HowToTip';
|
107 |
+
$tip['text'] = $val['text'][0];
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
$supply_data['@type'] = 'HowToStep';
|
112 |
+
$supply_data['url'] = trailingslashit(saswp_get_permalink()).'#step'.++$key;
|
113 |
+
$supply_data['name'] = $val['name'][0];
|
114 |
+
|
115 |
+
if(isset($direction['text']) || isset($tip['text'])){
|
116 |
+
$supply_data['itemListElement'] = array($direction, $tip);
|
117 |
+
}
|
118 |
+
|
119 |
+
if(isset($val['text'][1]['key']) && $val['text'][1]['key'] !=''){
|
120 |
|
121 |
+
$image_details = saswp_get_image_by_id($val['text'][1]['key']);
|
122 |
+
|
123 |
+
if($image_details){
|
124 |
+
$supply_data['image'] = $image_details;
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
$step_arr[] = $supply_data;
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
$input1['step'] = $step_arr;
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
if(isset($yoast_howto['attrs']['days']) || isset($yoast_howto['attrs']['hours']) || isset($yoast_howto['attrs']['minutes'])){
|
140 |
+
|
141 |
+
$input1['totalTime'] = 'P'.
|
142 |
+
((isset($yoast_howto['attrs']['days']) && $yoast_howto['attrs']['days'] !='') ? esc_attr($yoast_howto['attrs']['days']).'DT':'').
|
143 |
+
((isset($yoast_howto['attrs']['hours']) && $yoast_howto['attrs']['hours'] !='') ? esc_attr($yoast_howto['attrs']['hours']).'H':'').
|
144 |
+
((isset($yoast_howto['attrs']['minutes']) && $yoast_howto['attrs']['minutes'] !='') ? esc_attr($yoast_howto['attrs']['minutes']).'M':'');
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
}else{
|
149 |
+
|
150 |
$parse_blocks = saswp_get_gutenberg_block_data('saswp/how-to-block');
|
151 |
|
152 |
if(isset($parse_blocks['attrs'])){
|
233 |
|
234 |
if($val['title'] || $val['description']){
|
235 |
|
236 |
+
if($val['description']){
|
237 |
$direction['@type'] = 'HowToDirection';
|
238 |
+
$direction['text'] = $val['description'];
|
239 |
}
|
240 |
|
241 |
if($val['description']){
|
273 |
|
274 |
}
|
275 |
|
276 |
+
if(isset($parse_blocks['attrs']['days']) || isset($parse_blocks['attrs']['hours']) || isset($parse_blocks['attrs']['minutes'])){
|
277 |
|
278 |
$input1['totalTime'] = 'P'.
|
279 |
((isset($parse_blocks['attrs']['days']) && $parse_blocks['attrs']['days'] !='') ? esc_attr($parse_blocks['attrs']['days']).'DT':'').
|
283 |
}
|
284 |
|
285 |
}
|
286 |
+
|
287 |
+
}
|
288 |
+
|
289 |
|
290 |
+
return apply_filters('saswp_modify_howto_schema_output', $input1 );
|
291 |
|
292 |
}
|
293 |
|
294 |
function saswp_gutenberg_faq_schema(){
|
295 |
|
296 |
+
global $post, $sd_data;
|
297 |
$input1 = array();
|
298 |
|
299 |
+
$yoast_faq = saswp_get_gutenberg_block_data('yoast/faq-block');
|
300 |
+
|
301 |
+
if(isset($sd_data['saswp-yoast']) && $sd_data['saswp-yoast'] == 1 && $yoast_faq && isset($yoast_faq['attrs'])){
|
302 |
+
|
303 |
+
$input1['@context'] = saswp_context_url();
|
304 |
+
$input1['@type'] = 'FAQPage';
|
305 |
+
$input1['@id'] = trailingslashit(saswp_get_permalink()).'#FAQPage';
|
306 |
+
|
307 |
+
$faq_question_arr = array();
|
308 |
+
|
309 |
+
if(!empty($yoast_faq['attrs']['questions'])){
|
310 |
+
|
311 |
+
foreach($yoast_faq['attrs']['questions'] as $val){
|
312 |
+
|
313 |
+
$supply_data = array();
|
314 |
+
$supply_data['@type'] = 'Question';
|
315 |
+
$supply_data['name'] = $val['question'][0];
|
316 |
+
$supply_data['acceptedAnswer']['@type'] = 'Answer';
|
317 |
+
$supply_data['acceptedAnswer']['text'] = $val['answer'][0];
|
318 |
+
|
319 |
+
if(isset($val['answer'][1]['key']) && $val['answer'][1]['key'] !=''){
|
320 |
|
321 |
+
$image_details = saswp_get_image_by_id($val['answer'][1]['key']);
|
322 |
+
|
323 |
+
if($image_details){
|
324 |
+
$supply_data['image'] = $image_details;
|
325 |
+
}
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
$faq_question_arr[] = $supply_data;
|
330 |
+
}
|
331 |
+
$input1['mainEntity'] = $faq_question_arr;
|
332 |
+
}
|
333 |
+
}else{
|
334 |
+
|
335 |
+
$attributes = saswp_get_gutenberg_block_data('saswp/faq-block');
|
336 |
+
|
337 |
+
if(isset($attributes['attrs'])){
|
338 |
|
339 |
$input1['@context'] = saswp_context_url();
|
340 |
$input1['@type'] = 'FAQPage';
|
368 |
}
|
369 |
|
370 |
}
|
371 |
+
|
372 |
+
}
|
373 |
|
374 |
+
return apply_filters('saswp_modify_faq_schema_output', $input1 );
|
375 |
|
376 |
}
|
377 |
|
output/markup.php
CHANGED
@@ -629,7 +629,7 @@ function saswp_product_schema_markup($schema_id, $schema_post_id, $all_post_meta
|
|
629 |
|
630 |
if(isset($product_image['thumbnail']) && $product_image['thumbnail']){
|
631 |
|
632 |
-
$input1['image']['@type'] = '
|
633 |
$input1['image']['url'] = $product_image['thumbnail'];
|
634 |
$input1['image']['width'] = $product_image['width'];
|
635 |
$input1['image']['height'] = $product_image['height'];
|
@@ -2189,6 +2189,8 @@ function saswp_article_schema_markup($schema_id, $schema_post_id, $all_post_meta
|
|
2189 |
'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
|
2190 |
'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
|
2191 |
'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
|
|
|
|
|
2192 |
'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_article_keywords_'.$schema_id, 'saswp_array'),
|
2193 |
'datePublished' => isset($all_post_meta['saswp_article_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_published_'.$schema_id][0], get_post_time('h:i:s')):'',
|
2194 |
'dateModified' => isset($all_post_meta['saswp_article_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')):'',
|
629 |
|
630 |
if(isset($product_image['thumbnail']) && $product_image['thumbnail']){
|
631 |
|
632 |
+
$input1['image']['@type'] = 'ImageObject';
|
633 |
$input1['image']['url'] = $product_image['thumbnail'];
|
634 |
$input1['image']['width'] = $product_image['width'];
|
635 |
$input1['image']['height'] = $product_image['height'];
|
2189 |
'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
|
2190 |
'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
|
2191 |
'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
|
2192 |
+
'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_article_section_'.$schema_id, 'saswp_array'),
|
2193 |
+
'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_article_body_'.$schema_id, 'saswp_array'),
|
2194 |
'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_article_keywords_'.$schema_id, 'saswp_array'),
|
2195 |
'datePublished' => isset($all_post_meta['saswp_article_date_published_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_published_'.$schema_id][0], get_post_time('h:i:s')):'',
|
2196 |
'dateModified' => isset($all_post_meta['saswp_article_date_modified_'.$schema_id][0])? saswp_format_date_time($all_post_meta['saswp_article_date_modified_'.$schema_id][0], get_the_modified_time('h:i:s')):'',
|
output/output.php
CHANGED
@@ -120,9 +120,9 @@ function saswp_kb_schema_output() {
|
|
120 |
'@context' => saswp_context_url(),
|
121 |
'@type' => esc_attr($sd_data['saswp_kb_type']),
|
122 |
'@id' => $site_url.'#Person',
|
123 |
-
'name' => esc_attr($sd_data['sd-person-name']),
|
124 |
-
'jobTitle' => esc_attr($sd_data['sd-person-job-title']),
|
125 |
-
'url' => esc_url($sd_data['sd-person-url']),
|
126 |
'sameAs' => isset($sd_data['saswp_social_links']) ? $sd_data['saswp_social_links'] : array(),
|
127 |
'image' => array(
|
128 |
'@type' => 'ImageObject',
|
@@ -1189,16 +1189,7 @@ function saswp_schema_output() {
|
|
1189 |
$input1['@context'] = saswp_context_url();
|
1190 |
$input1['@type'] = $schema_type;
|
1191 |
$input1['@id'] = trailingslashit(saswp_get_permalink()).'#service';
|
1192 |
-
|
1193 |
-
if(!empty($aggregateRating)){
|
1194 |
-
$input1['aggregateRating'] = $aggregateRating;
|
1195 |
-
}
|
1196 |
-
if(!empty($extra_theme_review)){
|
1197 |
-
$input1 = array_merge($input1, $extra_theme_review);
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
$input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
|
1201 |
-
|
1202 |
$input1 = apply_filters('saswp_modify_service_schema_output', $input1 );
|
1203 |
|
1204 |
$input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
|
@@ -1820,8 +1811,7 @@ function saswp_woocommerce_shop_page(){
|
|
1820 |
if($display_type == 'products' || $display_type == 'both'){
|
1821 |
|
1822 |
$item_list = array();
|
1823 |
-
|
1824 |
-
woocommerce_product_loop_start();
|
1825 |
$i = 1;
|
1826 |
if ( have_posts() ) :
|
1827 |
while ( have_posts() ) :
|
@@ -1835,9 +1825,7 @@ function saswp_woocommerce_shop_page(){
|
|
1835 |
$i++;
|
1836 |
endwhile;
|
1837 |
endif;
|
1838 |
-
|
1839 |
-
woocommerce_product_loop_end();
|
1840 |
-
|
1841 |
if($item_list){
|
1842 |
$item_list_res['@context'] = saswp_context_url();
|
1843 |
$item_list_res['@type'] = 'ItemList';
|
120 |
'@context' => saswp_context_url(),
|
121 |
'@type' => esc_attr($sd_data['saswp_kb_type']),
|
122 |
'@id' => $site_url.'#Person',
|
123 |
+
'name' => isset($sd_data['sd-person-name']) ? esc_attr($sd_data['sd-person-name']) : '',
|
124 |
+
'jobTitle' => isset($sd_data['sd-person-job-title']) ? esc_attr($sd_data['sd-person-job-title']) : '',
|
125 |
+
'url' => isset($sd_data['sd-person-url']) ? esc_url($sd_data['sd-person-url']) : '',
|
126 |
'sameAs' => isset($sd_data['saswp_social_links']) ? $sd_data['saswp_social_links'] : array(),
|
127 |
'image' => array(
|
128 |
'@type' => 'ImageObject',
|
1189 |
$input1['@context'] = saswp_context_url();
|
1190 |
$input1['@type'] = $schema_type;
|
1191 |
$input1['@id'] = trailingslashit(saswp_get_permalink()).'#service';
|
1192 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
$input1 = apply_filters('saswp_modify_service_schema_output', $input1 );
|
1194 |
|
1195 |
$input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
|
1811 |
if($display_type == 'products' || $display_type == 'both'){
|
1812 |
|
1813 |
$item_list = array();
|
1814 |
+
|
|
|
1815 |
$i = 1;
|
1816 |
if ( have_posts() ) :
|
1817 |
while ( have_posts() ) :
|
1825 |
$i++;
|
1826 |
endwhile;
|
1827 |
endif;
|
1828 |
+
|
|
|
|
|
1829 |
if($item_list){
|
1830 |
$item_list_res['@context'] = saswp_context_url();
|
1831 |
$item_list_res['@type'] = 'ItemList';
|
output/service.php
CHANGED
@@ -18,10 +18,8 @@ Class saswp_output_service{
|
|
18 |
public function saswp_service_hooks(){
|
19 |
|
20 |
add_action( 'wp_ajax_saswp_get_custom_meta_fields', array($this, 'saswp_get_custom_meta_fields'));
|
21 |
-
add_action( 'wp_ajax_saswp_get_schema_type_fields', array($this, 'saswp_get_schema_type_fields'));
|
22 |
-
|
23 |
-
add_action( 'wp_ajax_saswp_get_meta_list', array($this, 'saswp_get_meta_list'));
|
24 |
-
|
25 |
add_filter( 'saswp_modify_post_meta_list', array( $this, 'saswp_get_acf_meta_keys' ) );
|
26 |
|
27 |
}
|
18 |
public function saswp_service_hooks(){
|
19 |
|
20 |
add_action( 'wp_ajax_saswp_get_custom_meta_fields', array($this, 'saswp_get_custom_meta_fields'));
|
21 |
+
add_action( 'wp_ajax_saswp_get_schema_type_fields', array($this, 'saswp_get_schema_type_fields'));
|
22 |
+
add_action( 'wp_ajax_saswp_get_meta_list', array($this, 'saswp_get_meta_list'));
|
|
|
|
|
23 |
add_filter( 'saswp_modify_post_meta_list', array( $this, 'saswp_get_acf_meta_keys' ) );
|
24 |
|
25 |
}
|
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.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -118,6 +118,22 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 1.9.24 (25 Jan 2020) =
|
122 |
|
123 |
* Added: FAQ schema block for DIVI builder. #722
|
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.25
|
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.25 (1 Feb 2020) =
|
122 |
+
|
123 |
+
* Fixed: User can not select to a specific post tag in placement section #751
|
124 |
+
* Fixed: Offer is not a known valid target type for the image property #752
|
125 |
+
* Fixed: Double display of Woocommerce-Categories on Archive-Pages #743
|
126 |
+
* Fixed: Fatal error: Cannot redeclare seopress_titles_single_cpt_noindex_option() when SEOPress compatibility is on #748
|
127 |
+
* Fixed: Description field and the plublished date validation issue with video object in WP Recipe Maker Plugin #744
|
128 |
+
* Fixed: Warning & Notices fixes #746, #766, #755
|
129 |
+
* Fixed: Error in Article schema due to WP recipe maker plugin #747
|
130 |
+
* Fixed: Breaks Yoast FAQ block schema #762
|
131 |
+
* Fixed: Fatal error: Cannot redeclare seopress_titles_single_cpt_noindex_option(), When SEOPress compatibility is on
|
132 |
+
* Fixed: Aggregate rating still loading in Service schema which is not allowed by google #761
|
133 |
+
* Added: "Review Form" label in the Translation Panel #764
|
134 |
+
* Added: FAQ filter in Gutenberg schema block #764
|
135 |
+
|
136 |
+
|
137 |
= 1.9.24 (25 Jan 2020) =
|
138 |
|
139 |
* Added: FAQ schema block for DIVI builder. #722
|
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.25
|
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.25');
|
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
@@ -46,6 +46,10 @@ class saswp_view_common_class {
|
|
46 |
|
47 |
public function saswp_get_dynamic_html($schema_id, $meta_name, $index, $data){
|
48 |
|
|
|
|
|
|
|
|
|
49 |
$item_type = get_post_meta($schema_id, 'saswp_itemlist_item_type', true);
|
50 |
|
51 |
if($meta_name == 'itemlist_item'){
|
@@ -65,8 +69,10 @@ class saswp_view_common_class {
|
|
65 |
$meta_fields = $this->_meta_name[$meta_name];
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
|
71 |
|
72 |
$label = '<label for="' . $meta_field['name'] . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ) . '</label>';
|
@@ -165,8 +171,11 @@ class saswp_view_common_class {
|
|
165 |
$output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
|
166 |
}
|
167 |
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
170 |
return $response;
|
171 |
|
172 |
}
|
@@ -637,28 +646,39 @@ class saswp_view_common_class {
|
|
637 |
|
638 |
foreach($all_schema as $schema){
|
639 |
|
640 |
-
|
641 |
-
|
|
|
|
|
642 |
foreach ($this->schema_type_element as $element){
|
643 |
|
644 |
foreach($element as $key => $val){
|
645 |
-
|
646 |
-
$element_val = array();
|
647 |
|
648 |
-
$
|
649 |
-
|
650 |
-
|
651 |
|
652 |
-
$
|
|
|
|
|
653 |
|
654 |
-
|
655 |
-
|
656 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
|
658 |
-
|
659 |
|
660 |
-
|
661 |
-
|
|
|
662 |
|
663 |
}
|
664 |
|
46 |
|
47 |
public function saswp_get_dynamic_html($schema_id, $meta_name, $index, $data){
|
48 |
|
49 |
+
$meta_fields = array();
|
50 |
+
$response = '';
|
51 |
+
$output = '';
|
52 |
+
|
53 |
$item_type = get_post_meta($schema_id, 'saswp_itemlist_item_type', true);
|
54 |
|
55 |
if($meta_name == 'itemlist_item'){
|
69 |
$meta_fields = $this->_meta_name[$meta_name];
|
70 |
}
|
71 |
|
72 |
+
|
73 |
+
if($meta_fields){
|
74 |
+
|
75 |
+
foreach ( $meta_fields as $meta_field ) {
|
76 |
|
77 |
|
78 |
$label = '<label for="' . $meta_field['name'] . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ) . '</label>';
|
171 |
$output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
|
172 |
}
|
173 |
|
174 |
+
//$output has been escapped while create this variable
|
175 |
+
$response = '<table class="form-table">'.$output.'</table>';
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
return $response;
|
180 |
|
181 |
}
|
646 |
|
647 |
foreach($all_schema as $schema){
|
648 |
|
649 |
+
if(isset($_POST['saswp_modify_this_schema_'.$schema->ID])){
|
650 |
+
update_post_meta( $post_id, 'saswp_modify_this_schema_'.$schema->ID, intval($_POST['saswp_modify_this_schema_'.$schema->ID]));
|
651 |
+
}
|
652 |
+
|
653 |
foreach ($this->schema_type_element as $element){
|
654 |
|
655 |
foreach($element as $key => $val){
|
|
|
|
|
656 |
|
657 |
+
if( isset($_POST[$val.'_'.$schema->ID]) && !empty($_POST[$val.'_'.$schema->ID]) ){
|
658 |
+
|
659 |
+
$element_val = array();
|
660 |
|
661 |
+
$data = (array) $_POST[$val.'_'.$schema->ID];
|
662 |
+
|
663 |
+
if($data){
|
664 |
|
665 |
+
foreach ($data as $supply){
|
666 |
+
|
667 |
+
$sanitize_data = array();
|
668 |
+
|
669 |
+
foreach($supply as $k => $el){
|
670 |
+
$sanitize_data[$k] = wp_kses_post(wp_unslash($el));
|
671 |
+
}
|
672 |
+
|
673 |
+
$element_val[] = $sanitize_data;
|
674 |
+
|
675 |
+
}
|
676 |
|
677 |
+
update_post_meta( $post_id, $val.'_'.intval($schema->ID), $element_val);
|
678 |
|
679 |
+
}
|
680 |
+
|
681 |
+
}
|
682 |
|
683 |
}
|
684 |
|
view/post_specific.php
CHANGED
@@ -245,7 +245,7 @@ class saswp_post_specific {
|
|
245 |
$schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
|
246 |
$custom_markp = get_post_meta($post->ID, 'saswp_custom_schema_field', true);
|
247 |
$disable_btn.= '<div class="saswp-disable-btn-container">'
|
248 |
-
. '<span class="saswp-disable-label">'.esc_html__( 'Disable on this page', 'schema-and-structured-data-for-wp' ).'</span>'
|
249 |
. '<label class="saswp-switch">'
|
250 |
. '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="custom" data-post-id="'.esc_attr($post->ID).'" '.( (isset($schema_enable['custom']) && $schema_enable['custom'] == 0) ? 'checked' : '' ).'>'
|
251 |
. '<span class="saswp-slider"></span>'
|
@@ -361,7 +361,7 @@ class saswp_post_specific {
|
|
361 |
$setting_options.= '</div>';
|
362 |
|
363 |
$btn_in_loop = '<div class="saswp-disable-btn-container">'
|
364 |
-
. '<span class="saswp-disable-label">'.esc_html__( 'Disable on this page', 'schema-and-structured-data-for-wp' ).'</span>'
|
365 |
. '<label class="saswp-switch">'
|
366 |
. '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($schema->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$disabled.'>'
|
367 |
. '<span class="saswp-slider"></span>'
|
245 |
$schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
|
246 |
$custom_markp = get_post_meta($post->ID, 'saswp_custom_schema_field', true);
|
247 |
$disable_btn.= '<div class="saswp-disable-btn-container">'
|
248 |
+
. '<span class="saswp-disable-label">'.esc_html__( 'Disable custom schema on this page', 'schema-and-structured-data-for-wp' ).'</span>'
|
249 |
. '<label class="saswp-switch">'
|
250 |
. '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="custom" data-post-id="'.esc_attr($post->ID).'" '.( (isset($schema_enable['custom']) && $schema_enable['custom'] == 0) ? 'checked' : '' ).'>'
|
251 |
. '<span class="saswp-slider"></span>'
|
361 |
$setting_options.= '</div>';
|
362 |
|
363 |
$btn_in_loop = '<div class="saswp-disable-btn-container">'
|
364 |
+
. '<span class="saswp-disable-label">'.esc_html__( 'Disable '.$schema_type_txt.' on this page', 'schema-and-structured-data-for-wp' ).'</span>'
|
365 |
. '<label class="saswp-switch">'
|
366 |
. '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($schema->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$disabled.'>'
|
367 |
. '<span class="saswp-slider"></span>'
|
view/schema_type.php
CHANGED
@@ -249,18 +249,21 @@ function saswp_schema_type_meta_box_callback( $post) {
|
|
249 |
$option_html = '';
|
250 |
|
251 |
foreach($type as $key => $value){
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
|
|
|
|
|
|
256 |
$option_html.= "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
|
257 |
|
258 |
-
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
}
|
265 |
|
266 |
}
|
@@ -842,8 +845,8 @@ function saswp_schema_type_meta_box_callback( $post) {
|
|
842 |
|
843 |
<div class="saswp-dynamic-container <?php echo ((isset($schema_options['saswp_modify_method']) && $schema_options['saswp_modify_method'] == 'automatic') ? '':'saswp_hide'); ?>">
|
844 |
|
845 |
-
|
846 |
-
|
847 |
|
848 |
<?php
|
849 |
if(!empty($meta_list)){
|
@@ -1029,11 +1032,11 @@ function saswp_schema_type_meta_box_callback( $post) {
|
|
1029 |
?>
|
1030 |
|
1031 |
</table>
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
|
1036 |
-
|
1037 |
|
1038 |
</div>
|
1039 |
|
@@ -1111,7 +1114,7 @@ function saswp_get_reviews_on_load(){
|
|
1111 |
foreach($collection as $col){
|
1112 |
|
1113 |
$reviews[] = array(
|
1114 |
-
'saswp_review_id'
|
1115 |
'saswp_reviewer_name' => $col['label']
|
1116 |
);
|
1117 |
|
249 |
$option_html = '';
|
250 |
|
251 |
foreach($type as $key => $value){
|
252 |
+
|
253 |
+
$sel = '';
|
254 |
+
|
255 |
+
if($schema_type == $key){
|
256 |
+
$sel = 'selected';
|
257 |
+
}
|
258 |
+
|
259 |
$option_html.= "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
|
260 |
|
261 |
+
}
|
262 |
|
263 |
+
echo '<optgroup label="'.esc_attr($parent_type).'">';
|
264 |
+
//Escaping is done while adding data in this variable
|
265 |
+
echo $option_html;
|
266 |
+
echo '</optgroup>';
|
267 |
}
|
268 |
|
269 |
}
|
845 |
|
846 |
<div class="saswp-dynamic-container <?php echo ((isset($schema_options['saswp_modify_method']) && $schema_options['saswp_modify_method'] == 'automatic') ? '':'saswp_hide'); ?>">
|
847 |
|
848 |
+
<div class="saswp-custom-fields-div">
|
849 |
+
<table class="saswp-custom-fields-table">
|
850 |
|
851 |
<?php
|
852 |
if(!empty($meta_list)){
|
1032 |
?>
|
1033 |
|
1034 |
</table>
|
1035 |
+
<table class="option-table-class">
|
1036 |
+
<tr><td><a class="button button-primary saswp-add-custom-fields"><?php echo esc_html__( 'Add Property', 'schema-and-structured-data-for-wp' ); ?></a></td><td></td></tr>
|
1037 |
+
</table>
|
1038 |
|
1039 |
+
</div>
|
1040 |
|
1041 |
</div>
|
1042 |
|
1114 |
foreach($collection as $col){
|
1115 |
|
1116 |
$reviews[] = array(
|
1117 |
+
'saswp_review_id' => $col['value'],
|
1118 |
'saswp_reviewer_name' => $col['label']
|
1119 |
);
|
1120 |
|