Plugin Directory

Changeset 1742242


Ignore:
Timestamp:
10/06/2017 03:20:51 PM (8 years ago)
Author:
postpostmodern
Message:

v0.6.3

Location:
admin-ajax-php-no-thank-you/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • admin-ajax-php-no-thank-you/trunk/_plugin.php

    r1741843 r1742242  
    88Domain Path:    /lang
    99Text Domain:   
    10 Version:        0.6.1
     10Version:        0.6.3
    1111*/
    1212
  • admin-ajax-php-no-thank-you/trunk/functions.php

    r1690123 r1742242  
    88*   @param object|array
    99*/
    10 function render($_template, $vars = array())
     10function render($_template, $vars = [])
    1111{
    1212    $_template_file = sprintf( '%s/views/%s.php', __DIR__, $_template );
     
    3535    return $data['Version'];
    3636}
    37 
    38 /**
    39 *
    40 */
    41 function wp_ajax_test()
    42 {
    43     $response = array(
    44         'post' => $_POST
    45     );
    46 
    47     wp_send_json( $response );
    48 }
    49 add_action( 'wp_ajax_admin-ajax-test', __NAMESPACE__.'\wp_ajax_test' );
    50 //add_action( 'wp_ajax_nopriv_admin-ajax-test', __NAMESPACE__.'\wp_ajax_test' );
  • admin-ajax-php-no-thank-you/trunk/lib/Admin_Ajax/Admin.php

    r1702468 r1742242  
    77    public function __construct()
    88    {
    9         add_filter( 'admin_footer_text', array($this, 'admin_footer_text') );
    10         add_action( 'admin_menu', array($this, 'admin_menu') );
    11         add_filter( 'plugin_action_links_admin-ajax-dot-php-no-thank-you/_plugin.php', array($this, 'plugin_action_links') );
     9        add_filter( 'admin_footer_text', [$this, 'admin_footer_text'] );
     10        add_action( 'admin_menu', [$this, 'admin_menu'] );
     11        add_filter( 'plugin_action_links_admin-ajax-dot-php-no-thank-you/_plugin.php', [$this, 'plugin_action_links'] );
    1212    }
    1313
     
    1919    public function admin_footer_text($original = '')
    2020    {
    21         return render( 'admin/options-general_footer', array(
     21        return render( 'admin/options-general_footer', [
    2222            'version' => version()
    23         ) );
     23        ] );
    2424    }
    2525
     
    3636            'manage_options',
    3737            'admin-ajax.php-no-thank-you',
    38             array($this, 'render_main')
     38            [$this, 'render_main']
    3939        );
    4040
     
    4242            'admin_ajax_no_thank_you_settings_section',
    4343            '',    // subhead
    44             array($this,'description'),
     44            [$this,'description'],
    4545            'admin_ajax_no_thank_you'
    4646        );
     
    4949            'admin_ajax_no_thank_you-endpoints',
    5050            'Endpoints',
    51             array($this, 'render_enabled'),
     51            [$this, 'render_enabled'],
    5252            'admin_ajax_no_thank_you',
    5353            'admin_ajax_no_thank_you_settings_section'
    5454        );
    5555
    56         register_setting( 'admin_ajax_no_thank_you', 'admin_ajax_no_thank_you', array($this,'save_setting') );
     56        register_setting( 'admin_ajax_no_thank_you', 'admin_ajax_no_thank_you', [$this,'save_setting'] );
    5757    }
    5858
     
    8888        $settings = No_Thank_You::get_settings();
    8989       
    90         echo render( 'admin/options-general-enabled', array(
    91             'endpoints' => array(
     90        echo render( 'admin/options-general-enabled', [
     91            'endpoints' => [
    9292                'rest' => No_Thank_You::get_endpoint_rest(),
    9393                'rewrite' => No_Thank_You::get_endpoint_rewrite()
    94             ),
     94            ],
    9595            'settings' => $settings
    96         ) );
     96        ] );
    9797    }
    9898
     
    102102    public function render_main()
    103103    {
    104         wp_enqueue_script( 'taxonomy-taxi', plugins_url('public/admin/options-general.js', dirname(__DIR__)), array(), version(), 'all' );
     104        wp_enqueue_script( 'taxonomy-taxi', plugins_url('public/admin/options-general.js', dirname(__DIR__)), [], version(), 'all' );
    105105        echo render( 'admin/options-general' );
    106106    }
  • admin-ajax-php-no-thank-you/trunk/lib/Admin_Ajax/No_Thank_You.php

    r1702468 r1742242  
    1111        self::load_settings();
    1212       
    13         add_filter( 'admin_url', array($this, 'rewrite_ajax_admin_url'), 10, 3 );
    14         add_action( 'rest_api_init', array($this, 'rest_api_init') );
    15         add_filter( 'pre_get_posts', array($this, 'rewrite_ajax_pre_get_posts'), 1, 1 );
    16         add_filter( 'query_vars', array($this, 'rewrite_ajax_query_vars'), 10, 1 );
    17         add_filter( 'root_rewrite_rules', array($this, 'rewrite_ajax_root_rewrite_rules'), 10, 1 );
     13        add_filter( 'admin_url', [$this, 'rewrite_ajax_admin_url'], 10, 3 );
     14        add_action( 'rest_api_init', [$this, 'rest_api_init'] );
     15        add_filter( 'pre_get_posts', [$this, 'rewrite_ajax_pre_get_posts'], 1, 1 );
     16        add_filter( 'query_vars', [$this, 'rewrite_ajax_query_vars'], 10, 1 );
     17        add_filter( 'root_rewrite_rules', [$this, 'rewrite_ajax_root_rewrite_rules'], 10, 1 );
     18
     19        // testing
     20        add_action( 'wp_ajax_admin-ajax-test', [$this, 'wp_ajax_test'] );
     21        //add_action( 'wp_ajax_nopriv_admin-ajax-test', [$this, 'wp_ajax_test'] );
    1822    }
    1923
     
    3438    {
    3539        $url = get_rest_url( $blog_id, self::$settings['endpoint']['rest-api'] );
    36         $url = add_query_arg( array(
     40        $url = add_query_arg( [
    3741            '_wpnonce' => wp_create_nonce( 'wp_rest' )
    38         ), $url );
     42        ], $url );
    3943
    4044        return $url;
     
    5660    public static function load_settings()
    5761    {
    58         $defaults = array(
     62        $defaults = [
    5963            'default' => '',
    60             'enabled' => array(),
    61             'endpoint' => array(
     64            'enabled' => [],
     65            'endpoint' => [
    6266                'rewrite' => 'ajax',
    6367                'rest-api' => 'wp/v2/admin-ajax'
    64             )
    65         );
     68            ]
     69        ];
    6670
    67         $settings = get_option( 'admin_ajax_no_thank_you', array() );
     71        $settings = get_option( 'admin_ajax_no_thank_you', [] );
    6872       
    6973        self::$settings = array_merge( $defaults, $settings );
     
    168172        $route = implode( '/', array_slice($endpoint, 2) );
    169173       
    170         register_rest_route( $namespace, $route, array(
     174        register_rest_route( $namespace, $route, [
    171175            'methods' => 'GET, POST',
    172             'callback' => array($this, 'require_admin_ajax'),
    173         ) );
     176            'callback' => [$this, 'require_admin_ajax'],
     177        ] );
     178    }
     179
     180    /**
     181    *   returns post data in json
     182    *   used for testing wp-admin/options-general.php?page=admin-ajax.php-no-thank-you
     183    */
     184    function wp_ajax_test()
     185    {
     186        $response = [
     187            'post' => $_POST
     188        ];
     189
     190        wp_send_json( $response );
    174191    }
    175192}
  • admin-ajax-php-no-thank-you/trunk/vendor/autoload.php

    r1741843 r1742242  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitd31aed9946977beb7ec1dd48403ce777::getLoader();
     7return ComposerAutoloaderInitbb5fee69188b1e5af9cbd549cbf21d3c::getLoader();
  • admin-ajax-php-no-thank-you/trunk/vendor/composer/autoload_real.php

    r1741843 r1742242  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd31aed9946977beb7ec1dd48403ce777
     5class ComposerAutoloaderInitbb5fee69188b1e5af9cbd549cbf21d3c
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitd31aed9946977beb7ec1dd48403ce777', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitbb5fee69188b1e5af9cbd549cbf21d3c', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitd31aed9946977beb7ec1dd48403ce777', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitbb5fee69188b1e5af9cbd549cbf21d3c', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInitd31aed9946977beb7ec1dd48403ce777::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInitbb5fee69188b1e5af9cbd549cbf21d3c::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
     
    4949
    5050        if ($useStaticLoader) {
    51             $includeFiles = Composer\Autoload\ComposerStaticInitd31aed9946977beb7ec1dd48403ce777::$files;
     51            $includeFiles = Composer\Autoload\ComposerStaticInitbb5fee69188b1e5af9cbd549cbf21d3c::$files;
    5252        } else {
    5353            $includeFiles = require __DIR__ . '/autoload_files.php';
    5454        }
    5555        foreach ($includeFiles as $fileIdentifier => $file) {
    56             composerRequired31aed9946977beb7ec1dd48403ce777($fileIdentifier, $file);
     56            composerRequirebb5fee69188b1e5af9cbd549cbf21d3c($fileIdentifier, $file);
    5757        }
    5858
     
    6161}
    6262
    63 function composerRequired31aed9946977beb7ec1dd48403ce777($fileIdentifier, $file)
     63function composerRequirebb5fee69188b1e5af9cbd549cbf21d3c($fileIdentifier, $file)
    6464{
    6565    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • admin-ajax-php-no-thank-you/trunk/vendor/composer/autoload_static.php

    r1741843 r1742242  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitd31aed9946977beb7ec1dd48403ce777
     7class ComposerStaticInitbb5fee69188b1e5af9cbd549cbf21d3c
    88{
    99    public static $files = array (
     
    2828    {
    2929        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInitd31aed9946977beb7ec1dd48403ce777::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInitd31aed9946977beb7ec1dd48403ce777::$prefixDirsPsr4;
     30            $loader->prefixLengthsPsr4 = ComposerStaticInitbb5fee69188b1e5af9cbd549cbf21d3c::$prefixLengthsPsr4;
     31            $loader->prefixDirsPsr4 = ComposerStaticInitbb5fee69188b1e5af9cbd549cbf21d3c::$prefixDirsPsr4;
    3232
    3333        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.