Skip to content

Commit e1ecebd

Browse files
authored
Merge pull request #187 from ahmedkaludi/1.5
1.5
2 parents df528e6 + 9847c73 commit e1ecebd

File tree

8 files changed

+142
-86
lines changed

8 files changed

+142
-86
lines changed

admin_section/css/main-style.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,13 @@ On/Off Buttons ends here
559559
.option-table-class tr > td{width: 30%;}
560560
.option-table-class tr td:last-child{width: 60%;}
561561

562-
.saswp-option-table-class input[type="text"], .saswp-option-table-class select{width:100%;}
563-
.saswp-paywall-table-class input[type="text"], .saswp-paywall-table-class select{width:100%;}
562+
.saswp-option-table-class input[type="text"], .saswp-option-table-class select{
563+
width:100%;
564+
}
565+
.saswp-paywall-table-class input[type="text"], .saswp-paywall-table-class select{
566+
width:100%;
567+
}
564568

569+
.saswp-custom-fields-table select{
570+
width: 100%;
571+
}

admin_section/js/saswp-add-new.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
var ajaxurl = saswp_add_new_params.ajaxurl;
23
var Merlin = (function($){
34

45
var t;

admin_section/js/saswp-install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
var ajaxurl = saswp_install_params.ajaxurl;
22
var Merlin = (function($){
33

44
var t;

output/function.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ function saswp_remove_amp_default_structure_data($metadata){
44
}
55

66
add_filter( 'amp_init', 'saswp_structured_data' );
7-
function saswp_structured_data()
8-
{
7+
function saswp_structured_data(){
8+
99
add_action( 'amp_post_template_head' , 'saswp_data_generator' );
1010
remove_action( 'amp_post_template_head', 'amp_post_template_add_schemaorg_metadata',99,1);
1111
}
@@ -73,61 +73,61 @@ function saswp_data_generator() {
7373

7474
if(!empty($contact_page_output)){
7575

76-
$output .= json_encode($contact_page_output);
77-
$output .= ",";
78-
$output .= "\n\n";
79-
76+
$output .= json_encode($contact_page_output);
77+
$output .= ",";
78+
$output .= "\n\n";
8079
}
8180
if(!empty($about_page_output)){
8281

83-
$output .= json_encode($about_page_output);
84-
$output .= ",";
85-
$output .= "\n\n";
82+
$output .= json_encode($about_page_output);
83+
$output .= ",";
84+
$output .= "\n\n";
8685
}
8786
if(!empty($author_output)){
8887

89-
$output .= json_encode($author_output);
90-
$output .= ",";
91-
$output .= "\n\n";
88+
$output .= json_encode($author_output);
89+
$output .= ",";
90+
$output .= "\n\n";
9291
}
9392
if(!empty($archive_output)){
9493

95-
$output .= json_encode($archive_output);
96-
$output .= ",";
97-
$output .= "\n\n";
94+
$output .= json_encode($archive_output);
95+
$output .= ",";
96+
$output .= "\n\n";
9897
}
9998
if(!empty($kb_website_output)){
10099

101-
$output .= json_encode($kb_website_output);
102-
$output .= ",";
103-
$output .= "\n\n";
100+
$output .= json_encode($kb_website_output);
101+
$output .= ",";
102+
$output .= "\n\n";
104103
}
105104
if(!empty($site_navigation)){
106105

107-
$output .= json_encode($site_navigation);
108-
$output .= ",";
109-
$output .= "\n\n";
110-
106+
$output .= json_encode($site_navigation);
107+
$output .= ",";
108+
$output .= "\n\n";
111109
}
112110
if(!empty($schema_breadcrumb_output)){
113111

114-
$output .= json_encode($schema_breadcrumb_output);
115-
$output .= ",";
116-
$output .= "\n\n";
112+
$output .= json_encode($schema_breadcrumb_output);
113+
$output .= ",";
114+
$output .= "\n\n";
117115
}
118-
if(!empty($schema_output)){
119-
foreach($schema_output as $schema){
120-
$schema = json_encode($schema);
121-
$output .= $schema;
122-
$output .= ",";
123-
$output .= "\n\n";
124-
}
116+
if(!empty($schema_output)){
117+
118+
foreach($schema_output as $schema){
119+
120+
$schema = json_encode($schema);
121+
$output .= $schema;
122+
$output .= ",";
123+
$output .= "\n\n";
124+
125+
}
125126
}
126127
if(!empty($kb_schema_output)){
127128

128-
$output .= json_encode($kb_schema_output);
129-
$output .= ",";
130-
129+
$output .= json_encode($kb_schema_output);
130+
$output .= ",";
131131
}
132132

133133
}

output/output.php

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ function saswp_schema_output() {
341341

342342
$input1 = array(
343343
'@context' => 'http://schema.org',
344-
'@type' => $schema_type ,
344+
'@type' => 'BlogPosting' ,
345345

346346
'mainEntityOfPage' => get_permalink(),
347347
'headline' => get_the_title(),
@@ -650,7 +650,7 @@ function saswp_schema_output() {
650650
'author' => array(
651651
'@type' => 'Person',
652652
'name' => esc_attr($aurthor_name),
653-
'Image' => array(
653+
'image' => array(
654654
'@type' => 'ImageObject',
655655
'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
656656
'height' => saswp_remove_warnings($author_details, 'height', 'saswp_string'),
@@ -1026,7 +1026,7 @@ function saswp_schema_output() {
10261026
'author' => array(
10271027
'@type' => 'Person',
10281028
'name' => esc_attr($aurthor_name),
1029-
'Image' => array(
1029+
'image' => array(
10301030
'@type' => 'ImageObject',
10311031
'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
10321032
'height' => saswp_remove_warnings($author_details, 'height', 'saswp_string'),
@@ -1296,7 +1296,7 @@ function saswp_schema_output() {
12961296
'author' => array(
12971297
'@type' => 'Person',
12981298
'name' => esc_attr($aurthor_name),
1299-
'Image' => array(
1299+
'image' => array(
13001300
'@type' => 'ImageObject',
13011301
'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
13021302
'height' => saswp_remove_warnings($author_details, 'height', 'saswp_string'),
@@ -1722,7 +1722,7 @@ function saswp_post_specific_schema_output() {
17221722
'@type' => 'Person',
17231723
'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array')
17241724
),
1725-
'Publisher' => array(
1725+
'publisher' => array(
17261726
'@type' => 'Organization',
17271727
'logo' => array(
17281728
'@type' => 'ImageObject',
@@ -1832,7 +1832,7 @@ function saswp_post_specific_schema_output() {
18321832
'author' => array(
18331833
'@type' => 'Person',
18341834
'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'), ),
1835-
'Publisher' => array(
1835+
'publisher' => array(
18361836
'@type' => 'Organization',
18371837
'logo' => array(
18381838
'@type' => 'ImageObject',
@@ -1880,7 +1880,7 @@ function saswp_post_specific_schema_output() {
18801880
'@type' => 'Person',
18811881
'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array')
18821882
),
1883-
'Publisher' => array(
1883+
'publisher' => array(
18841884
'@type' => 'Organization',
18851885
'logo' => array(
18861886
'@type' => 'ImageObject',
@@ -1921,7 +1921,7 @@ function saswp_post_specific_schema_output() {
19211921
'@type' => 'Person',
19221922
'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
19231923
),
1924-
'Publisher' => array(
1924+
'publisher' => array(
19251925
'@type' => 'Organization',
19261926
'logo' => array(
19271927
'@type' => 'ImageObject',
@@ -2036,7 +2036,7 @@ function saswp_post_specific_schema_output() {
20362036
'mainEntity' => array(
20372037
'@type' => 'WebPage',
20382038
'@id' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_main_entity_'.$schema_id, 'saswp_array'),
2039-
'Publisher' => array(
2039+
'publisher' => array(
20402040
'@type' => 'Organization',
20412041
'logo' => array(
20422042
'@type' => 'ImageObject',
@@ -2118,7 +2118,36 @@ function saswp_post_specific_schema_output() {
21182118
}
21192119
if(!empty($extra_theme_review)){
21202120
$input1 = array_merge($input1, $extra_theme_review);
2121-
}
2121+
}
2122+
2123+
$service = new saswp_output_service();
2124+
$product_details = $service->saswp_woocommerce_product_details(get_the_ID());
2125+
2126+
2127+
if(!empty($product_details['product_reviews'])){
2128+
2129+
$reviews = array();
2130+
2131+
foreach ($product_details['product_reviews'] as $review){
2132+
2133+
$reviews[] = array(
2134+
'@type' => 'Review',
2135+
'author' => esc_attr($review['author']),
2136+
'datePublished' => esc_html($review['datePublished']),
2137+
'description' => $review['description'],
2138+
'reviewRating' => array(
2139+
'@type' => 'Rating',
2140+
'bestRating' => '5',
2141+
'ratingValue' => esc_attr($review['reviewRating']),
2142+
'worstRating' => '1',
2143+
)
2144+
);
2145+
2146+
}
2147+
$input1['review'] = $reviews;
2148+
}
2149+
2150+
21222151
}
21232152

21242153
if( 'NewsArticle' === $schema_type ){
@@ -2155,7 +2184,7 @@ function saswp_post_specific_schema_output() {
21552184
'width' => saswp_remove_warnings($author_image, 'width', 'saswp_string')
21562185
),
21572186
),
2158-
'Publisher' => array(
2187+
'publisher' => array(
21592188
'@type' => 'Organization',
21602189
'logo' => array(
21612190
'@type' => 'ImageObject',
@@ -2204,7 +2233,7 @@ function saswp_post_specific_schema_output() {
22042233
'width' => saswp_remove_warnings($author_image, 'width', 'saswp_string')
22052234
),
22062235
),
2207-
'Publisher' => array(
2236+
'publisher' => array(
22082237
'@type' => 'Organization',
22092238
'logo' => array(
22102239
'@type' => 'ImageObject',
@@ -2333,12 +2362,12 @@ function saswp_post_specific_schema_output() {
23332362

23342363
if($site_name && $logo && $width && $height){
23352364

2336-
$input1['Publisher']['@type'] = 'Organization';
2337-
$input1['Publisher']['name'] = esc_attr($site_name);
2338-
$input1['Publisher']['logo']['@type'] = 'ImageObject';
2339-
$input1['Publisher']['logo']['url'] = esc_url($logo);
2340-
$input1['Publisher']['logo']['width'] = esc_attr($width);
2341-
$input1['Publisher']['logo']['height'] = esc_attr($height);
2365+
$input1['publisher']['@type'] = 'Organization';
2366+
$input1['publisher']['name'] = esc_attr($site_name);
2367+
$input1['publisher']['logo']['@type'] = 'ImageObject';
2368+
$input1['publisher']['logo']['url'] = esc_url($logo);
2369+
$input1['publisher']['logo']['width'] = esc_attr($width);
2370+
$input1['publisher']['logo']['height'] = esc_attr($height);
23422371

23432372
}
23442373

@@ -2977,7 +3006,7 @@ function saswp_site_navigation_output(){
29773006

29783007
if(!saswp_non_amp()){
29793008

2980-
if($type == 'amp-menu'){
3009+
if($type == 'amp-menu' || $type == 'amp-footer-menu'){
29813010

29823011
foreach($menuItems as $items){
29833012

0 commit comments

Comments
 (0)