Changeset 2129926
- Timestamp:
- 07/29/2019 04:13:13 AM (7 years ago)
- Location:
- schema-app-structured-data-for-schemaorg
- Files:
-
- 26 added
- 5 edited
-
tags/1.14.0 (added)
-
tags/1.14.0/css (added)
-
tags/1.14.0/css/schemaStyle.css (added)
-
tags/1.14.0/data (added)
-
tags/1.14.0/data/tree.jsonld (added)
-
tags/1.14.0/hunch-schema.php (added)
-
tags/1.14.0/js (added)
-
tags/1.14.0/js/schema.js (added)
-
tags/1.14.0/js/schemaAdmin.js (added)
-
tags/1.14.0/js/schemaEditor.js (added)
-
tags/1.14.0/lib (added)
-
tags/1.14.0/lib/HunchSchema (added)
-
tags/1.14.0/lib/HunchSchema/Author.php (added)
-
tags/1.14.0/lib/HunchSchema/Blog.php (added)
-
tags/1.14.0/lib/HunchSchema/Category.php (added)
-
tags/1.14.0/lib/HunchSchema/Page.php (added)
-
tags/1.14.0/lib/HunchSchema/Post.php (added)
-
tags/1.14.0/lib/HunchSchema/Search.php (added)
-
tags/1.14.0/lib/HunchSchema/Tag.php (added)
-
tags/1.14.0/lib/HunchSchema/Thing.php (added)
-
tags/1.14.0/lib/SchemaEditor.php (added)
-
tags/1.14.0/lib/SchemaFront.php (added)
-
tags/1.14.0/lib/SchemaServer.php (added)
-
tags/1.14.0/lib/SchemaSettings.php (added)
-
tags/1.14.0/lib/classmap.php (added)
-
tags/1.14.0/readme.txt (added)
-
trunk/hunch-schema.php (modified) (1 diff)
-
trunk/lib/SchemaFront.php (modified) (2 diffs)
-
trunk/lib/SchemaServer.php (modified) (1 diff)
-
trunk/lib/SchemaSettings.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
schema-app-structured-data-for-schemaorg/trunk/hunch-schema.php
r2097983 r2129926 5 5 * Plugin URI: http://www.schemaapp.com 6 6 * Description: This plugin adds http://schema.org structured data to your website 7 * Version: 1.1 3.07 * Version: 1.14.0 8 8 * Author: Hunch Manifest 9 9 * Author URI: https://www.hunchmanifest.com -
schema-app-structured-data-for-schemaorg/trunk/lib/SchemaFront.php
r2070040 r2129926 18 18 add_action( 'plugins_loaded', array( $this, 'hook_plugins_loaded' ) ); 19 19 add_action( 'init', array( $this, 'HandleCache' ) ); 20 add_action( 'rest_api_init', array( $this, 'hook_rest_api_init' ) ); 20 21 21 22 if ( ! empty( $this->Settings['SchemaLinkedOpenData'] ) ) { … … 84 85 85 86 exit; 87 } 88 } 89 90 91 public function hook_rest_api_init() { 92 register_rest_route( 'hunch_schema', '/cache/', array( 93 array( 'methods' => 'GET', 'callback' => array( $this, 'rest_api_cache' ) ), 94 array( 'methods' => 'POST', 'callback' => array( $this, 'rest_api_cache_modify' ) ), 95 ) ); 96 } 97 98 99 public function rest_api_cache( $request ) { 100 return new WP_REST_Response( array( 'status' => 'error', 'message' => 'Please use POST method to send data' ), 405 ); 101 } 102 103 104 public function rest_api_cache_modify( $request ) { 105 $request_data = json_decode( $request->get_body() ); 106 107 if ( empty( $request->get_body() ) || empty( $request_data ) ) { 108 return new WP_REST_Response( array( 'status' => 'error', 'message' => 'Invalid JSON data' ), 400 ); 109 } elseif ( empty( $request_data->{"@type"} ) || empty( $request_data->{"@id"} ) || empty( $request_data->{"@graph"} ) ) { 110 return new WP_REST_Response( array( 'status' => 'error', 'message' => 'Invalid @type, @id or @graph property' ), 400 ); 111 } else { 112 if ( stripos( $request_data->{"@id"}, site_url() ) === false ) { 113 return new WP_REST_Response( array( 'status' => 'error', 'message' => 'Invalid @id property, url does not match' ), 400 ); 114 } 115 116 $transient_id = 'HunchSchema-Markup-' . md5( $request_data->{"@id"} ); 117 118 switch ( $request_data->{"@type"} ) { 119 case 'EntityCreated': 120 case 'EntityUpdated': 121 set_transient( $transient_id, json_encode( reset( $request_data->{"@graph"} ) ), 86400 ); 122 return new WP_REST_Response( array( 'status' => 'ok', 'message' => 'Cache updated' ), 200 ); 123 break; 124 case 'EntityDeleted': 125 delete_transient( $transient_id ); 126 return new WP_REST_Response( array( 'status' => 'ok', 'message' => 'Cache deleted' ), 200 ); 127 break; 128 default: 129 return new WP_REST_Response( array( 'status' => 'error', 'message' => 'Invalid @type property' ), 400 ); 130 } 86 131 } 87 132 } -
schema-app-structured-data-for-schemaorg/trunk/lib/SchemaServer.php
r2097983 r2129926 128 128 * @param type $params 129 129 */ 130 public function activateLicense($params) { 130 public function activateLicense( $params ) { 131 $response = wp_remote_post( 'https://app.schemaapp.com/schemaApi/license/addSite', array( 132 'sslverify' => false, 133 'headers' => array( 'Content-Type' => 'application/json' ), 134 'body' => json_encode( $params ), 135 )); 131 136 132 $api = self::API_SERVER . self::ACTIVATE; 137 $response_code = wp_remote_retrieve_response_code( $response ); 138 $response_data = json_decode( wp_remote_retrieve_body( $response ) ); 133 139 134 // Call the custom API. 135 $response = wp_remote_post($api, array( 136 'timeout' => 15, 137 'sslverify' => false, 138 'body' => $params 139 )); 140 $response_code = wp_remote_retrieve_response_code($response); 141 142 // decode the license data 143 $license_data = json_decode(wp_remote_retrieve_body($response)); 144 145 if (in_array($response_code, array(200, 201))) { 146 return array(true, $license_data); 147 } else { 148 return array(false, $license_data); 149 } 140 if ( in_array( $response_code, array( 200, 201 ) ) ) { 141 return array( true, $response_data->status ); 142 } else { 143 return array( false, $response_data->error ); 144 } 150 145 } 151 146 -
schema-app-structured-data-for-schemaorg/trunk/lib/SchemaSettings.php
r2097983 r2129926 546 546 $SchemaServer = new SchemaServer(); 547 547 548 $Response = $SchemaServer->activateLicense( array( 'license' => $new_input['schema_license_wc'], ' item_name' => urlencode( SchemaSettings::SCHEMA_ITEM_NAME ), 'url' => home_url() ) );548 $Response = $SchemaServer->activateLicense( array( 'license' => $new_input['schema_license_wc'], 'siteToAdd' => site_url() ) ); 549 549 550 550 if ( $Response[0] == true ) -
schema-app-structured-data-for-schemaorg/trunk/readme.txt
r2097983 r2129926 9 9 Requires PHP: 5.4 10 10 Tested up to: 5.2 11 Stable tag: 1.1 3.011 Stable tag: 1.14.0 12 12 License: GPL2 13 13 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 87 87 == Changelog == 88 88 89 = 1.14.0 = 90 - Feature, Added webhook support for schema data events which will update markup cache in realtime 91 - Improve, WC migrate license web service 92 89 93 = 1.13.0 = 90 94 - Feature, Added HunchSchema_Thing markup filters `hunch_schema_thing_markup_` permalink, excerpt, image, videos, tags, comments, author, publisher … … 376 380 == Upgrade Notice == 377 381 378 = 1.1 3.0 =379 - Added HunchSchema_Thing markup filters, switched API calls to api.schemaapp.com382 = 1.14.0 = 383 - Added webhook support for schema data events, WC migrate license web service
Note: See TracChangeset
for help on using the changeset viewer.