Plugin Directory

Changeset 2058424


Ignore:
Timestamp:
03/27/2019 04:35:37 PM (7 years ago)
Author:
waughjai
Message:

Update dependencies & test in WordPress 5.1

Location:
waj-image
Files:
271 added
6 edited

Legend:

Unmodified
Added
Removed
  • waj-image/trunk/composer.lock

    r2005904 r2058424  
    471471        {
    472472            "name": "waughj/verified-arguments",
    473             "version": "0.5.0",
     473            "version": "0.6.0",
    474474            "source": {
    475475                "type": "git",
    476476                "url": "https://github.com/waughjai/verified-arguments.git",
    477                 "reference": "8f4add12563aaea34444e902ea833712e2702da8"
    478             },
    479             "dist": {
    480                 "type": "zip",
    481                 "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/8f4add12563aaea34444e902ea833712e2702da8",
    482                 "reference": "8f4add12563aaea34444e902ea833712e2702da8",
     477                "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8"
     478            },
     479            "dist": {
     480                "type": "zip",
     481                "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
     482                "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
    483483                "shasum": ""
    484484            },
     
    511511                "safety"
    512512            ],
    513             "time": "2018-10-24T17:22:20+00:00"
     513            "time": "2019-01-10T23:55:47+00:00"
    514514        },
    515515        {
  • waj-image/trunk/readme.txt

    r2008729 r2058424  
    33Tags: image, loader, html generator
    44Requires at least: 5.0.0
    5 Tested up to: 5.0.1
    6 Stable tag: 2.0.1
     5Tested up to: 5.1.1
     6Stable tag: 2.1.0
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    9393== Changelog ==
    9494
     95= 2.1.0
     96* Update dependencies, test for WordPress 5.1.
     97
    9598= 2.0.1 =
    9699* Fix buggy WPUploadImage class.
  • waj-image/trunk/vendor/composer/installed.json

    r2005904 r2058424  
    484484    {
    485485        "name": "waughj/verified-arguments",
    486         "version": "0.5.0",
    487         "version_normalized": "0.5.0.0",
     486        "version": "0.6.0",
     487        "version_normalized": "0.6.0.0",
    488488        "source": {
    489489            "type": "git",
    490490            "url": "https://github.com/waughjai/verified-arguments.git",
    491             "reference": "8f4add12563aaea34444e902ea833712e2702da8"
    492         },
    493         "dist": {
    494             "type": "zip",
    495             "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/8f4add12563aaea34444e902ea833712e2702da8",
    496             "reference": "8f4add12563aaea34444e902ea833712e2702da8",
     491            "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8"
     492        },
     493        "dist": {
     494            "type": "zip",
     495            "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
     496            "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
    497497            "shasum": ""
    498498        },
     
    503503            "phpunit/phpunit": "6.*"
    504504        },
    505         "time": "2018-10-24T17:22:20+00:00",
     505        "time": "2019-01-10T23:55:47+00:00",
    506506        "type": "library",
    507507        "installation-source": "dist",
  • waj-image/trunk/vendor/waughj/verified-arguments/src/VerifiedArguments.php

    r1983500 r2058424  
    66    class VerifiedArguments
    77    {
    8         public function __construct( array $args, array $defaults = [] )
    9         {
    10             $this->args = [];
    11             foreach ( $defaults as $default_key => $default )
     8        //
     9        //  PUBLIC
     10        //
     11        /////////////////////////////////////////////////////////
     12
     13            public function __construct( array $args, array $defaults = [] )
    1214            {
    13                 if ( is_array( $default ) && array_key_exists( "value", $default ) )
     15                $this->args = [];
     16                foreach ( $defaults as $default_key => $default )
    1417                {
    15                     $this->args[ $default_key ] = $default[ "value" ];
     18                    if ( is_array( $default ) && array_key_exists( "value", $default ) )
     19                    {
     20                        $this->args[ $default_key ] = $default[ "value" ];
     21                    }
    1622                }
    17             }
    1823
    19             foreach ( $args as $arg_key => $arg_value )
    20             {
    21                 if ( array_key_exists( $arg_key, $defaults ) )
     24                foreach ( $args as $arg_key => $arg_value )
    2225                {
    23                     if ( self::testExpectedType( $defaults[ $arg_key ], $arg_value ) )
     26                    if ( array_key_exists( $arg_key, $defaults ) )
     27                    {
     28                        if ( self::testExpectedType( $defaults[ $arg_key ], $arg_value ) )
     29                        {
     30                            $this->args[ $arg_key ] = $arg_value;
     31                        }
     32                    }
     33                    else
    2434                    {
    2535                        $this->args[ $arg_key ] = $arg_value;
    2636                    }
    2737                }
    28                 else
     38            }
     39
     40            public function get( string $key )
     41            {
     42                return ( array_key_exists( $key, $this->args ) ) ? $this->args[ $key ] : null;
     43            }
     44
     45            public function getList() : array
     46            {
     47                return $this->args;
     48            }
     49
     50
     51
     52        //
     53        //  PRIVATE
     54        //
     55        /////////////////////////////////////////////////////////
     56
     57            private static function testExpectedType( array $obj, $value ) : bool
     58            {
     59                if ( array_key_exists( "type", $obj ) )
    2960                {
    30                     $this->args[ $arg_key ] = $arg_value;
     61                    if ( is_array( $obj[ "type" ] ) )
     62                    {
     63                        foreach ( $obj[ "type" ] as $type )
     64                        {
     65                            if ( self::testType( $type, $value ) )
     66                            {
     67                                return true;
     68                            }
     69                        }
     70                        return false;
     71                    }
     72                    else if ( is_string( $obj[ "type" ] ) )
     73                    {
     74                        return self::testType( $obj[ "type" ], $value );
     75                    }
    3176                }
     77                return true;
    3278            }
    33         }
    3479
    35         public function get( string $key )
    36         {
    37             return ( array_key_exists( $key, $this->args ) ) ? $this->args[ $key ] : null;
    38         }
     80            private static function testType( $expected, $tested ) : bool
     81            {
     82                return gettype( $tested ) === $expected || ( is_object( $tested ) && get_class( $tested ) === $expected );
     83            }
    3984
    40         private static function testExpectedType( array $obj, $value ) : bool
    41         {
    42             if ( array_key_exists( "type", $obj ) )
    43             {
    44                 if ( is_array( $obj[ "type" ] ) )
    45                 {
    46                     foreach ( $obj[ "type" ] as $type )
    47                     {
    48                         if ( self::testType( $type, $value ) )
    49                         {
    50                             return true;
    51                         }
    52                     }
    53                     return false;
    54                 }
    55                 else if ( is_string( $obj[ "type" ] ) )
    56                 {
    57                     return self::testType( $obj[ "type" ], $value );
    58                 }
    59             }
    60             return true;
    61         }
    62 
    63         private static function testType( $expected, $tested )
    64         {
    65             return gettype( $tested ) === $expected || ( is_object( $tested ) && get_class( $tested ) === $expected );
    66         }
    67 
    68         private $args;
    69         private $defaults;
     85            private $args;
     86            private $defaults;
    7087    }
    7188}
  • waj-image/trunk/vendor/waughj/verified-arguments/tests/VerifiedArgumentsTest.php

    r1983500 r2058424  
    4343        $snd_args = new VerifiedArguments( [ "name" => new DateTime( "10/23/2018" ) ], [ "name" => [ "type" => \DateTime::class, "value" => false ]]);
    4444        $this->assertEquals( $snd_args->get( "name" ), new DateTime( "10/23/2018" ) );
     45
     46        $trd_args = new VerifiedArguments( [ "name" => new DateTime( "10/23/2018" ) ], [ "name" => [ "type" => "object", "value" => false ]]);
     47        $this->assertEquals( $trd_args->get( "name" ), new DateTime( "10/23/2018" ) );
     48    }
     49
     50    public function testGetList() : void
     51    {
     52        $hash = [ "name" => "Jaimeson", "age" => 27 ];
     53        $args = new VerifiedArguments( $hash );
     54        $this->assertEquals( $hash, $args->getList() );
    4555    }
    4656}
  • waj-image/trunk/waj-image-loaders.php

    r2008729 r2058424  
    44    Plugin URI:   https://github.com/waughjai/waj-image-loaders
    55    Description:  Classes & shortcodes for making image HTML generation simpler for WordPress.
    6     Version:      2.0.1
     6    Version:      2.1.0
    77    Author:       Jaimeson Waugh
    88    Author URI:   https://www.jaimeson-waugh.com
Note: See TracChangeset for help on using the changeset viewer.