Plugin Directory

Changeset 2058442


Ignore:
Timestamp:
03/27/2019 05:00:50 PM (7 years ago)
Author:
waughjai
Message:

Test in WordPress 5.1

Location:
waj-scripts
Files:
156 added
7 edited

Legend:

Unmodified
Added
Removed
  • waj-scripts/trunk/readme.txt

    r1996660 r2058442  
    33Tags: scripts
    44Requires at least: 5.0.0
    5 Tested up to: 5.0.1
    6 Stable tag: 1.0.1
     5Tested up to: 5.1
     6Stable tag: 1.0.2
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    3838== Changelog ==
    3939
     40= 1.0.2 =
     41* Test in WordPress 5.1
     42
    4043= 1.0.1 =
    4144* Fix bug causing meta boxes to try loading empty filename for empty meta boxes.
  • waj-scripts/trunk/vendor/composer/installed.json

    r1995163 r2058442  
    292292    {
    293293        "name": "waughj/verified-arguments",
    294         "version": "0.5.0",
    295         "version_normalized": "0.5.0.0",
     294        "version": "0.6.0",
     295        "version_normalized": "0.6.0.0",
    296296        "source": {
    297297            "type": "git",
    298298            "url": "https://github.com/waughjai/verified-arguments.git",
    299             "reference": "8f4add12563aaea34444e902ea833712e2702da8"
    300         },
    301         "dist": {
    302             "type": "zip",
    303             "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/8f4add12563aaea34444e902ea833712e2702da8",
    304             "reference": "8f4add12563aaea34444e902ea833712e2702da8",
     299            "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8"
     300        },
     301        "dist": {
     302            "type": "zip",
     303            "url": "https://api.github.com/repos/waughjai/verified-arguments/zipball/1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
     304            "reference": "1a1c9158d6c97f62eea1c51e8ee6039408f2a8d8",
    305305            "shasum": ""
    306306        },
     
    311311            "phpunit/phpunit": "6.*"
    312312        },
    313         "time": "2018-10-24T17:22:20+00:00",
     313        "time": "2019-01-10T23:55:47+00:00",
    314314        "type": "library",
    315315        "installation-source": "dist",
     
    386386    {
    387387        "name": "waughj/wp-meta-box",
    388         "version": "0.1.4",
    389         "version_normalized": "0.1.4.0",
     388        "version": "0.2.0",
     389        "version_normalized": "0.2.0.0",
    390390        "source": {
    391391            "type": "git",
    392392            "url": "https://github.com/waughjai/wp-meta-box.git",
    393             "reference": "a6576effdb7e6fb6ff4b2e4d08e1867a54037dfb"
    394         },
    395         "dist": {
    396             "type": "zip",
    397             "url": "https://api.github.com/repos/waughjai/wp-meta-box/zipball/a6576effdb7e6fb6ff4b2e4d08e1867a54037dfb",
    398             "reference": "a6576effdb7e6fb6ff4b2e4d08e1867a54037dfb",
     393            "reference": "b89440f2a2364f62ffc378b28f57217ea57d2113"
     394        },
     395        "dist": {
     396            "type": "zip",
     397            "url": "https://api.github.com/repos/waughjai/wp-meta-box/zipball/b89440f2a2364f62ffc378b28f57217ea57d2113",
     398            "reference": "b89440f2a2364f62ffc378b28f57217ea57d2113",
    399399            "shasum": ""
    400400        },
     
    406406            "phpunit/phpunit": "6.*"
    407407        },
    408         "time": "2018-12-12T00:50:36+00:00",
     408        "time": "2018-12-20T00:48:03+00:00",
    409409        "type": "library",
    410410        "installation-source": "dist",
  • waj-scripts/trunk/vendor/waughj/verified-arguments/src/VerifiedArguments.php

    r1995163 r2058442  
    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-scripts/trunk/vendor/waughj/verified-arguments/tests/VerifiedArgumentsTest.php

    r1995163 r2058442  
    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-scripts/trunk/vendor/waughj/wp-meta-box/src/WPMetaBox.php

    r1995163 r2058442  
    7272            {
    7373                return $this->title;
     74            }
     75
     76            public function getValue( $id, bool $singular = true )
     77            {
     78                if ( $id === null )
     79                {
     80                    $id = get_the_ID();
     81                }
     82                return get_post_meta( $id, $this->slug, $singular );
    7483            }
    7584
  • waj-scripts/trunk/vendor/waughj/wp-meta-box/tests/WPMetaBoxTest.php

    r1995163 r2058442  
    4949        $this->assertEquals( $meta_box->getInputContent( $post ), '<select id="scrum-drum" name="scrum-drum"><option value="0" label="Red">Red</option><option value="1" label="Blue">Blue</option><option value="2" label="Green">Green</option></select>' );
    5050    }
     51
     52    public function testGetValue()
     53    {
     54        $meta_box = new WPMetaBox( 'scrum-drum', 'Sassafrass' );
     55        $post = getDemoPost();
     56        $this->assertEquals( $meta_box->getValue( $post->ID ), get_post_meta( $post->ID, 'scrum-drum', true ) );
     57    }
    5158}
  • waj-scripts/trunk/waj-scripts.php

    r1996660 r2058442  
    55    Plugin URI:   https://github.com/waughjai/waj-scripts
    66    Description:  WordPress plugin for easily adding CSS stylesheets & JavaScript files.
    7     Version:      1.0.1
     7    Version:      1.0.2
    88    Author:       Jaimeson Waugh
    99    Author URI:   https://www.jaimeson-waugh.com
Note: See TracChangeset for help on using the changeset viewer.