Plugin Directory

Changeset 1776739


Ignore:
Timestamp:
11/28/2017 09:56:55 AM (8 years ago)
Author:
poliuk
Message:

v1.0.3 released: /

  • endpoint changed from /wp_pwa to /wp-pwa
  • /wp-pwa/site-info endpoint restored
  • "per_page" attribute available in /site-info
Location:
wp-pwa
Files:
16 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-pwa/trunk/readme.txt

    r1773939 r1776739  
    11=== WordPress PWA ===
    2 Contributors: poliuk, luisherranz, rmartinezduque, orballo
     2Contributors: poliuk, luisherranz, rmartinezduque, orballo, davidarenas
    33Tags: html5, pwa, webapp, progressive web app
    44Donate link:
    55Requires at least: 4.4
    66Tested up to: 4.8.2
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    1212
    1313== Description ==
     14<blockquote><strong>IMPORTANT</strong>
     15This plugin is still in beta, if you want to access the beta program please write an email to support@worona.org.</blockquote>
     16
    1417
    1518The simplest way to create Progressive Web Apps with WordPress. No coding skills required. Free forever.
     19
    1620
    1721== Installation ==
     
    2226
    2327== Changelog ==
     28
     29= 1.0.3 =
     30* /wp-pwa/site-info/ endpoint available again.
    2431
    2532= 1.0.2 =
  • wp-pwa/trunk/wp-pwa.php

    r1773939 r1776739  
    44Plugin URI: https://wordpress.org/plugins/wordpress-pwa/
    55Description: WordPress plugin to turn WordPress blogs into Progressive Web Apps.
    6 Version: 1.0.2
     6Version: 1.0.3
    77Author: WordPress PWA
    88Author URI:
     
    1616{
    1717    // vars
    18     public $plugin_version = '1.0.2';
     18    public $plugin_version = '1.0.3';
    1919    public $rest_api_installed  = false;
    2020    public $rest_api_active     = false;
     
    5656
    5757        add_action( 'rest_api_init', function () {
    58             register_rest_route( 'wp_pwa/v1', '/siteid/', array(
     58            register_rest_route( 'wp-pwa/v1', '/siteid/', array(
    5959                'methods' => 'GET',
    6060                'callback' => array( $this,'get_wp_pwa_site_id'))
    6161            );
    62             register_rest_route( 'wp_pwa/v1', '/discover/', array(
     62            register_rest_route( 'wp-pwa/v1', '/discover/', array(
    6363                'methods' => 'GET',
    6464                'callback' => array( $this,'discover_url'))
    6565            );
    66             register_rest_route( 'wp_pwa/v1', '/plugin-version/', array(
     66            register_rest_route( 'wp-pwa/v1', '/plugin-version/', array(
    6767                'methods' => 'GET',
    6868                'callback' => array( $this,'get_wp_pwa_plugin_version'))
    6969            );
     70            register_rest_route( 'wp-pwa/v1', '/site-info/', array(
     71                'methods' => 'GET',
     72                'callback' => array( $this,'get_site_info'))
     73            );
    7074        });
    7175        // filters
     
    192196    function get_wp_pwa_plugin_version() {
    193197        return array('plugin_version' => $this->plugin_version);
     198    }
     199
     200    function get_site_info() {
     201        $homepage_title = get_bloginfo( 'name' );
     202        $homepage_metadesc = get_bloginfo( 'description' );
     203        $per_page = get_option("posts_per_page");
     204
     205        $site_info = array(
     206            'homepage_title' => $homepage_title,
     207            'homepage_metadesc' => $homepage_metadesc,
     208            'per_page' => $per_page
     209        );
     210
     211        if(has_filter('wp_pwa_get_site_info')) {
     212            $site_info = apply_filters('wp_pwa_get_site_info', $site_info);
     213        }
     214
     215        return array(
     216            'home' => array(
     217                'title' => $site_info['homepage_title'],
     218                'description' => $site_info['homepage_metadesc']
     219            ),
     220            'perPage' => $site_info['per_page']
     221        );
    194222    }
    195223
Note: See TracChangeset for help on using the changeset viewer.