Changeset 2079665
- Timestamp:
- 05/03/2019 06:29:04 AM (7 years ago)
- Location:
- sandyhutextensions
- Files:
-
- 2 edited
- 6 copied
-
tags/2.0.0 (copied) (copied from sandyhutextensions/trunk)
-
tags/2.0.0/LICENSE (copied) (copied from sandyhutextensions/trunk/LICENSE)
-
tags/2.0.0/SandyhutExtensions.php (copied) (copied from sandyhutextensions/trunk/SandyhutExtensions.php) (4 diffs)
-
tags/2.0.0/index.php (copied) (copied from sandyhutextensions/trunk/index.php)
-
tags/2.0.0/readme.txt (copied) (copied from sandyhutextensions/trunk/readme.txt) (2 diffs)
-
tags/2.0.0/uninstall.php (copied) (copied from sandyhutextensions/trunk/uninstall.php)
-
trunk/SandyhutExtensions.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sandyhutextensions/tags/2.0.0/SandyhutExtensions.php
r2068354 r2079665 8 8 Plugin URI: https://github.com/serialbandicoot/SandyhutExtensions 9 9 Description: Extensions for AppCart 10 Version: 1.0.010 Version: 2.0.0 11 11 Author: @serialbandicoot 12 12 Author URI: https://appcart.io … … 22 22 function __construct(){ 23 23 add_action( 'rest_api_init', array( $this , 'activate_table_rate_shipping_data' ) ); 24 add_action( 'rest_api_init', array( $this , 'activate_static_page_routes' ) ); 25 add_action( 'init', array( $this, 'app_cart_static_pages' ) ); 24 26 add_filter( 'woocommerce_rest_prepare_product_object', array('SandyhutExtensions', 'get_product_media_images'), 10, 3 ); 25 27 } … … 27 29 function activate(){ 28 30 $this->get_table_rate_shipping_data(); 31 $this->activate_static_page_routes(); 32 $this->get_static_page_titles(); 29 33 flush_rewrite_rules(); 30 34 } … … 36 40 37 41 /* 38 URL: http://lhost/wp-json/shipping/v1/table_rate_data 42 URL: http://lhost/wp-json/appcart/v1/app_cart_static 43 */ 44 45 function app_cart_static_pages(){ 46 register_post_type('app_cart_static', 47 array( 48 'public' => true, 49 'show_in_menu' => true, 50 'label' => 'App Cart', 51 'show_in_rest' => true, 52 'hierarchical' => true 53 ) 54 ); 55 } 56 57 58 function activate_static_page_routes(){ 59 register_rest_route( 'appcart/v1', '/app_cart_static', array( 60 'methods' => 'GET', 61 'callback' => 'SandyhutExtensions::get_static_page_titles', 62 ) ); 63 } 64 65 static function get_static_page_titles(){ 66 67 $args = array ( 68 'post_status' => 'publish', 69 'post_type' => 'app_cart_static' 70 ); 71 72 $items = array(); 73 74 if ( $pages = get_posts( $args ) ) { 75 foreach ( $pages as $page ) { 76 $items[] = array( 77 'id' => $page->ID, 78 'title' => $page->post_title, 79 ); 80 } 81 } 82 return $items; 83 } 84 85 /* 86 URL: http://lhost/wp-json/appcart/v1/table_rate_data 39 87 */ 40 88 41 89 function activate_table_rate_shipping_data(){ 42 register_rest_route( ' shipping/v1', '/table_rate_data', array(90 register_rest_route( 'appcart/v1', '/table_rate_data', array( 43 91 'methods' => 'GET', 44 92 'callback' => 'SandyhutExtensions::get_table_rate_shipping_data', -
sandyhutextensions/tags/2.0.0/readme.txt
r2068354 r2079665 3 3 Contributors: samtreweek 4 4 Requires at least: 4.6 5 Tested up to: 5. 1.16 Stable tag: 1.0.05 Tested up to: 5.2.0 6 Stable tag: 2.0.0 7 7 Requires PHP: 7.1.23 8 8 License: GPLv2 or later … … 30 30 First version to be released. 31 31 32 = 2.0 = 33 Added in Static Pages. 34 32 35 == Screenshots == 33 36 -
sandyhutextensions/trunk/SandyhutExtensions.php
r2068354 r2079665 8 8 Plugin URI: https://github.com/serialbandicoot/SandyhutExtensions 9 9 Description: Extensions for AppCart 10 Version: 1.0.010 Version: 2.0.0 11 11 Author: @serialbandicoot 12 12 Author URI: https://appcart.io … … 22 22 function __construct(){ 23 23 add_action( 'rest_api_init', array( $this , 'activate_table_rate_shipping_data' ) ); 24 add_action( 'rest_api_init', array( $this , 'activate_static_page_routes' ) ); 25 add_action( 'init', array( $this, 'app_cart_static_pages' ) ); 24 26 add_filter( 'woocommerce_rest_prepare_product_object', array('SandyhutExtensions', 'get_product_media_images'), 10, 3 ); 25 27 } … … 27 29 function activate(){ 28 30 $this->get_table_rate_shipping_data(); 31 $this->activate_static_page_routes(); 32 $this->get_static_page_titles(); 29 33 flush_rewrite_rules(); 30 34 } … … 36 40 37 41 /* 38 URL: http://lhost/wp-json/shipping/v1/table_rate_data 42 URL: http://lhost/wp-json/appcart/v1/app_cart_static 43 */ 44 45 function app_cart_static_pages(){ 46 register_post_type('app_cart_static', 47 array( 48 'public' => true, 49 'show_in_menu' => true, 50 'label' => 'App Cart', 51 'show_in_rest' => true, 52 'hierarchical' => true 53 ) 54 ); 55 } 56 57 58 function activate_static_page_routes(){ 59 register_rest_route( 'appcart/v1', '/app_cart_static', array( 60 'methods' => 'GET', 61 'callback' => 'SandyhutExtensions::get_static_page_titles', 62 ) ); 63 } 64 65 static function get_static_page_titles(){ 66 67 $args = array ( 68 'post_status' => 'publish', 69 'post_type' => 'app_cart_static' 70 ); 71 72 $items = array(); 73 74 if ( $pages = get_posts( $args ) ) { 75 foreach ( $pages as $page ) { 76 $items[] = array( 77 'id' => $page->ID, 78 'title' => $page->post_title, 79 ); 80 } 81 } 82 return $items; 83 } 84 85 /* 86 URL: http://lhost/wp-json/appcart/v1/table_rate_data 39 87 */ 40 88 41 89 function activate_table_rate_shipping_data(){ 42 register_rest_route( ' shipping/v1', '/table_rate_data', array(90 register_rest_route( 'appcart/v1', '/table_rate_data', array( 43 91 'methods' => 'GET', 44 92 'callback' => 'SandyhutExtensions::get_table_rate_shipping_data', -
sandyhutextensions/trunk/readme.txt
r2068354 r2079665 3 3 Contributors: samtreweek 4 4 Requires at least: 4.6 5 Tested up to: 5. 1.16 Stable tag: 1.0.05 Tested up to: 5.2.0 6 Stable tag: 2.0.0 7 7 Requires PHP: 7.1.23 8 8 License: GPLv2 or later … … 30 30 First version to be released. 31 31 32 = 2.0 = 33 Added in Static Pages. 34 32 35 == Screenshots == 33 36
Note: See TracChangeset
for help on using the changeset viewer.