Plugin Directory

Changeset 2079665


Ignore:
Timestamp:
05/03/2019 06:29:04 AM (7 years ago)
Author:
samtreweek
Message:

tagging version 2.0.0

Location:
sandyhutextensions
Files:
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • sandyhutextensions/tags/2.0.0/SandyhutExtensions.php

    r2068354 r2079665  
    88Plugin URI: https://github.com/serialbandicoot/SandyhutExtensions
    99Description: Extensions for AppCart
    10 Version: 1.0.0
     10Version: 2.0.0
    1111Author: @serialbandicoot
    1212Author URI: https://appcart.io
     
    2222    function __construct(){
    2323        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' ) );
    2426        add_filter( 'woocommerce_rest_prepare_product_object', array('SandyhutExtensions', 'get_product_media_images'), 10, 3 );
    2527    }
     
    2729    function activate(){
    2830        $this->get_table_rate_shipping_data();
     31        $this->activate_static_page_routes();
     32        $this->get_static_page_titles();
    2933        flush_rewrite_rules();
    3034    }
     
    3640
    3741    /*
    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
    3987    */
    4088
    4189    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(
    4391                'methods' => 'GET',
    4492                'callback' => 'SandyhutExtensions::get_table_rate_shipping_data',
  • sandyhutextensions/tags/2.0.0/readme.txt

    r2068354 r2079665  
    33Contributors: samtreweek
    44Requires at least: 4.6
    5 Tested up to: 5.1.1
    6 Stable tag: 1.0.0
     5Tested up to: 5.2.0
     6Stable tag: 2.0.0
    77Requires PHP: 7.1.23
    88License: GPLv2 or later
     
    3030First version to be released.
    3131
     32= 2.0 =
     33Added in Static Pages.
     34
    3235== Screenshots ==
    3336
  • sandyhutextensions/trunk/SandyhutExtensions.php

    r2068354 r2079665  
    88Plugin URI: https://github.com/serialbandicoot/SandyhutExtensions
    99Description: Extensions for AppCart
    10 Version: 1.0.0
     10Version: 2.0.0
    1111Author: @serialbandicoot
    1212Author URI: https://appcart.io
     
    2222    function __construct(){
    2323        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' ) );
    2426        add_filter( 'woocommerce_rest_prepare_product_object', array('SandyhutExtensions', 'get_product_media_images'), 10, 3 );
    2527    }
     
    2729    function activate(){
    2830        $this->get_table_rate_shipping_data();
     31        $this->activate_static_page_routes();
     32        $this->get_static_page_titles();
    2933        flush_rewrite_rules();
    3034    }
     
    3640
    3741    /*
    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
    3987    */
    4088
    4189    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(
    4391                'methods' => 'GET',
    4492                'callback' => 'SandyhutExtensions::get_table_rate_shipping_data',
  • sandyhutextensions/trunk/readme.txt

    r2068354 r2079665  
    33Contributors: samtreweek
    44Requires at least: 4.6
    5 Tested up to: 5.1.1
    6 Stable tag: 1.0.0
     5Tested up to: 5.2.0
     6Stable tag: 2.0.0
    77Requires PHP: 7.1.23
    88License: GPLv2 or later
     
    3030First version to be released.
    3131
     32= 2.0 =
     33Added in Static Pages.
     34
    3235== Screenshots ==
    3336
Note: See TracChangeset for help on using the changeset viewer.