Plugin Directory

Changeset 2334429


Ignore:
Timestamp:
07/02/2020 06:15:11 PM (6 years ago)
Author:
codexshaper
Message:

Updated WordPress Coding standard and fixed after autoload dump composer script function name in composer.json

Location:
oauth2-server/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • oauth2-server/trunk/admin/class-codexshaper-oauth-server-admin-menu.php

    r2333274 r2334429  
    2323class Codexshaper_Oauth_Server_Admin_Menu {
    2424
    25     public $page_title;
     25    /**
     26     * The menu page title.
     27     *
     28     * @since    1.0.0
     29     * @access   public
     30     * @var      string    $page_title    The string used to set menu page title.
     31     */
     32    public $page_title;
    2633
     34    /**
     35     * The menu title.
     36     *
     37     * @since    1.0.0
     38     * @access   public
     39     * @var      string    $menu_title    The string used to set menu title.
     40     */
    2741    public $menu_title;
    2842
     43    /**
     44     * The menu capability.
     45     *
     46     * @since    1.0.0
     47     * @access   public
     48     * @var      string    $capability    The string used to set menu capability.
     49     */
    2950    public $capability;
    3051
     52    /**
     53     * The menu slug.
     54     *
     55     * @since    1.0.0
     56     * @access   public
     57     * @var      string    $slug    The string used to set menu slug.
     58     */
    3159    public $slug;
    3260
     61    /**
     62     * The callback to render content.
     63     *
     64     * @since    1.0.0
     65     * @access   public
     66     * @var      callback    $callback    The callback used to render content.
     67     */
    3368    public $callback;
    3469
     70    /**
     71     * The menu icon.
     72     *
     73     * @since    1.0.0
     74     * @access   public
     75     * @var      string    $icon    The string used to set menu icon.
     76     */
    3577    public $icon;
    3678
     79    /**
     80     * The menu position.
     81     *
     82     * @since    1.0.0
     83     * @access   public
     84     * @var      int    $position    The string used to set menu position.
     85     */
    3786    public $position;
    3887
    39     public $plugin_name;
     88    /**
     89     * The menu plugin name.
     90     *
     91     * @since    1.0.0
     92     * @access   private
     93     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
     94     */
     95    private $plugin_name;
    4096
    41     public function save()
    42     {
    43         add_action('admin_menu', [$this, 'create_menu']);
     97    /**
     98     * Boot Menu.
     99     *
     100     * @param  string $plugin_name The string used to uniquely identify this plugin.
     101     * @since    1.0.0
     102     * @access   public
     103     */
     104    public function __construct( $plugin_name ) {
     105        $this->plugin_name = $plugin_name;
    44106    }
    45107
    46     public static function make($options = [])
    47     {
    48         foreach ($options as $property => $value) {
    49             if (property_exists($this, $property)) {
     108    /**
     109     * Create a new menu page.
     110     *
     111     * @since    1.0.0
     112     * @access   public
     113     */
     114    public function save() {
     115        add_action( 'admin_menu', array( $this, 'create_menu' ) );
     116    }
     117
     118    /**
     119     * Create a new menu page.
     120     *
     121     * @since    1.0.0
     122     * @param    array $options Pass proprties as an array.
     123     * @access   public
     124     */
     125    public function make( $options = array() ) {
     126        foreach ( $options as $property => $value ) {
     127            if ( property_exists( get_called_class(), $property ) ) {
    50128                $this->{$property} = $value;
    51129            }
    52130        }
    53         add_action('admin_menu', [$this, 'create_menu']);
     131        add_action( 'admin_menu', array( $this, 'create_menu' ) );
    54132    }
    55133
    56134    /**
    57      * Register our menu page.
     135     * Register new menu page.
    58136     *
    59137     * @return void
    60138     */
    61     public function create_menu()
    62     {
    63         global $submenu;
    64 
     139    public function create_menu() {
    65140        $hook = add_menu_page(
    66141            $this->page_title,
     
    72147        );
    73148
    74         // if ( current_user_can( $this->capability ) ) {
    75         //     $submenu[ $this->slug ][] = array( __( 'Clients', 'textdomain' ), $this->capability, 'admin.php?page=' . $this->slug . '#/clients' );
    76         //     $submenu[ $this->slug ][] = array( __( 'Settings', 'textdomain' ), $this->capability, 'admin.php?page=' . $this->slug . '#/settings' );
    77         // }
    78 
    79         add_action('load-'.$hook, [$this, 'init_hooks']);
     149        add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
    80150    }
    81151
    82152    /**
    83      * Initialize our hooks for the admin page.
     153     * Initialize hooks for the admin page.
    84154     *
    85155     * @return void
    86156     */
    87     public function init_hooks()
    88     {
    89         add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts']);
     157    public function init_hooks() {
     158        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    90159    }
    91160
    92161    /**
    93      * Load scripts and styles for the app.
     162     * Load scripts and styles for the current menu page.
    94163     *
    95164     * @return void
    96165     */
    97     public function enqueue_scripts()
    98     {
    99         wp_enqueue_style($this->plugin_name . '-vendors');
    100         wp_enqueue_style($this->plugin_name . '-admin');
    101         wp_enqueue_script($this->plugin_name . '-admin');
    102     }
    103 
    104     /**
    105      * Render our admin page.
    106      *
    107      * @return void
    108      */
    109     public function plugin_page()
    110     {
    111         echo '<div class="wrap"><div id="'. $this->plugin_name .'-admin" csrf-token="'.csrf_token().'"></div></div>';
     166    public function enqueue_scripts() {
     167        wp_enqueue_style( $this->plugin_name . '-vendors' );
     168        wp_enqueue_style( $this->plugin_name . '-admin' );
     169        wp_enqueue_script( $this->plugin_name . '-admin' );
    112170    }
    113171
  • oauth2-server/trunk/admin/class-codexshaper-oauth-server-admin-submenu.php

    r2333274 r2334429  
    2323class Codexshaper_Oauth_Server_Admin_SubMenu {
    2424
    25     public $parent_slug;
    26 
     25    /**
     26     * The menu page title.
     27     *
     28     * @since    1.0.0
     29     * @access   public
     30     * @var      string    $page_title    The string used to set menu page title.
     31     */
    2732    public $page_title;
    2833
     34    /**
     35     * The menu title.
     36     *
     37     * @since    1.0.0
     38     * @access   public
     39     * @var      string    $menu_title    The string used to set menu title.
     40     */
    2941    public $menu_title;
    3042
     43    /**
     44     * The menu capability.
     45     *
     46     * @since    1.0.0
     47     * @access   public
     48     * @var      string    $capability    The string used to set menu capability.
     49     */
    3150    public $capability;
    3251
     52    /**
     53     * The menu slug.
     54     *
     55     * @since    1.0.0
     56     * @access   public
     57     * @var      string    $slug    The string used to set menu slug.
     58     */
    3359    public $slug;
    3460
     61    /**
     62     * The callback to render content.
     63     *
     64     * @since    1.0.0
     65     * @access   public
     66     * @var      callback    $callback    The callback used to render content.
     67     */
    3568    public $callback;
    3669
     70    /**
     71     * The menu icon.
     72     *
     73     * @since    1.0.0
     74     * @access   public
     75     * @var      string    $icon    The string used to set menu icon.
     76     */
     77    public $icon;
     78
     79    /**
     80     * The menu position.
     81     *
     82     * @since    1.0.0
     83     * @access   public
     84     * @var      int    $position    The string used to set menu position.
     85     */
    3786    public $position;
    3887
    39     public $plugin_name;
     88    /**
     89     * The menu plugin name.
     90     *
     91     * @since    1.0.0
     92     * @access   private
     93     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
     94     */
     95    private $plugin_name;
    4096
    41     public function save()
    42     {
    43         add_action('admin_menu', [$this, 'create_submenu']);
     97    /**
     98     * Boot Menu.
     99     *
     100     * @param  string $plugin_name The string used to uniquely identify this plugin.
     101     * @since    1.0.0
     102     * @access   public
     103     */
     104    public function __construct( $plugin_name ) {
     105        $this->plugin_name = $plugin_name;
    44106    }
    45107
    46     public static function make($options = [])
    47     {
    48         foreach ($options as $property => $value) {
    49             if (property_exists($this, $property)) {
     108    /**
     109     * Create a new menu page.
     110     *
     111     * @since    1.0.0
     112     * @access   public
     113     */
     114    public function save() {
     115        add_action( 'admin_menu', array( $this, 'create_submenu' ) );
     116    }
     117
     118    /**
     119     * Create a new submenu page.
     120     *
     121     * @since    1.0.0
     122     * @param    array $options Pass proprties as an array.
     123     * @access   public
     124     */
     125    public function make( $options = array() ) {
     126        foreach ( $options as $property => $value ) {
     127            if ( property_exists( $this, $property ) ) {
    50128                $this->{$property} = $value;
    51129            }
    52130        }
    53         add_action('admin_menu', [$this, 'create_submenu']);
     131        add_action( 'admin_menu', array( $this, 'create_submenu' ) );
    54132    }
    55133
    56134    /**
    57      * Register our menu page.
     135     * Register new submenu page.
    58136     *
    59137     * @return void
    60138     */
    61     public function create_submenu()
    62     {
    63         if (current_user_can($this->capability)) {
     139    public function create_submenu() {
     140        if ( current_user_can( $this->capability ) ) {
    64141            $hook = add_submenu_page(
    65142                $this->parent_slug,
     
    73150        }
    74151
    75         // if ( current_user_can( $this->capability ) ) {
    76         //     $submenu[ $this->slug ][] = array( __( 'Clients', 'textdomain' ), $this->capability, 'admin.php?page=' . $this->slug . '#/clients' );
    77         //     $submenu[ $this->slug ][] = array( __( 'Settings', 'textdomain' ), $this->capability, 'admin.php?page=' . $this->slug . '#/settings' );
    78         // }
    79 
    80         add_action('load-'.$hook, [$this, 'init_hooks']);
     152        add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
    81153    }
    82154
    83155    /**
    84      * Initialize our hooks for the admin page.
     156     * Initialize hooks for the admin page.
    85157     *
    86158     * @return void
    87159     */
    88     public function init_hooks()
    89     {
    90         add_action('admin_enqueue_scripts', [$this, 'enqueue_scripts']);
     160    public function init_hooks() {
     161        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
    91162    }
    92163
    93164    /**
    94      * Load scripts and styles for the app.
     165     * Load scripts and styles for the submenu page.
    95166     *
    96167     * @return void
    97168     */
    98     public function enqueue_scripts()
    99     {
    100         wp_enqueue_style($this->plugin_name . '-vendors');
    101         wp_enqueue_style($this->plugin_name . '-admin');
    102         wp_enqueue_script($this->plugin_name . '-admin');
     169    public function enqueue_scripts() {
     170        wp_enqueue_style( $this->plugin_name . '-vendors' );
     171        wp_enqueue_style( $this->plugin_name . '-admin' );
     172        wp_enqueue_script( $this->plugin_name . '-admin' );
    103173    }
    104 
    105     /**
    106      * Render our admin page.
    107      *
    108      * @return void
    109      */
    110     public function plugin_page()
    111     {
    112         echo '<div class="wrap"><div id="'. $this->plugin_name .'-admin" csrf-token="'.csrf_token().'"></div></div>';
    113     }
    114 
    115174}
  • oauth2-server/trunk/bootstrap/app.php

    r2334413 r2334429  
    11<?php
     2/**
     3 * The file that defines the bootsrap plugin
     4 *
     5 * @link       https://github.com/maab16
     6 * @since      1.0.0
     7 *
     8 * @package    Codexshaper_Oauth_Server
     9 * @subpackage Codexshaper_Oauth_Server/bootstrap
     10 */
    211
    312require_once ABSPATH . 'wp-includes/pluggable.php';
  • oauth2-server/trunk/composer.json

    r2333274 r2334429  
    4040    "scripts": {
    4141        "post-autoload-dump": [
    42             "CodexShaper\\Composer\\ComposerScripts::postAutoloadDump"
     42            "CodexShaper\\Composer\\ComposerScripts::post_autoload_dump"
    4343        ],
    4444        "post-install-cmd": [
  • oauth2-server/trunk/includes/class-codexshaper-oauth-server.php

    r2334413 r2334429  
    8484        $this->define_oauth2_hooks();
    8585
    86         $menu              = new Codexshaper_Oauth_Server_Admin_Menu();
    87         $menu->plugin_name = 'codexshaper-oauth-server';
     86        $menu              = new Codexshaper_Oauth_Server_Admin_Menu($this->plugin_name);
    8887        $menu->page_title  = 'OAuth2 Server';
    8988        $menu->menu_title  = 'OAuth2 Server';
     
    9695        $menu->save();
    9796
    98         $submenu              = new Codexshaper_Oauth_Server_Admin_SubMenu();
    99         $submenu->plugin_name = 'codexshaper-oauth-server';
     97        $submenu              = new Codexshaper_Oauth_Server_Admin_SubMenu($this->plugin_name);
    10098        $submenu->parent_slug = $menu->slug;
    10199        $submenu->page_title  = 'Clients';
  • oauth2-server/trunk/readme.txt

    r2334413 r2334429  
    3232= 1.0 =
    3333* This is the initial release.
     34
     35== Contribution ==
     36
     37This is free open source project, so anyone can use and contribute. If you are interested you can contribute in our github repository https://github.com/Codexshaper/wp-oauth2.
     38
     39If anyone found or face any security issue please mail us at codexshaper@gmail.com or create an issue in https://github.com/Codexshaper/wp-oauth2/issues.
     40
     41= Contributors =
     42
     43* [Md Abu Ahsan Basir](https://github.com/maab16)
Note: See TracChangeset for help on using the changeset viewer.