Kaynağa Gözat

Merge branch 'master' of https://github.com/zendframework/zf1

Minh-Quan Tran 11 yıl önce
ebeveyn
işleme
3a44b54073

+ 1 - 1
library/Zend/Dojo/View/Helper/Dojo/Container.php

@@ -1026,7 +1026,7 @@ EOJ;
             return '';
         }
 
-        array_reverse($stylesheets);
+        $stylesheets = array_reverse($stylesheets);
         $style = '<style type="text/css">' . PHP_EOL
                . (($this->_isXhtml) ? '<!--' : '<!--') . PHP_EOL;
         foreach ($stylesheets as $stylesheet) {

+ 5 - 0
library/Zend/Locale.php

@@ -1639,6 +1639,11 @@ class Zend_Locale
             return true;
         }
 
+        // Is it an alias?
+        if (is_string($locale) && array_key_exists($locale, self::$_localeAliases)) {
+            return true;
+        }
+
         if (($locale === null) || (!is_string($locale) and !is_array($locale))) {
             return false;
         }

+ 15 - 5
library/Zend/Navigation/Container.php

@@ -200,12 +200,12 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable
     /**
      * Removes the given page from the container
      *
-     * @param  Zend_Navigation_Page|int $page  page to remove, either a page
-     *                                         instance or a specific page order
-     * @return bool                            whether the removal was
-     *                                         successful
+     * @param  Zend_Navigation_Page|int $page      page to remove, either a page
+     *                                             instance or a specific page order
+     * @param  bool                     $recursive [optional] whether to remove recursively
+     * @return bool whether the removal was successful
      */
-    public function removePage($page)
+    public function removePage($page, $recursive = false)
     {
         if ($page instanceof Zend_Navigation_Page) {
             $hash = $page->hashCode();
@@ -225,6 +225,16 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable
             return true;
         }
 
+        if ($recursive) {
+            /** @var Zend_Navigation_Page $childPage */
+            foreach ($this->_pages as $childPage) {
+                if ($childPage->hasPage($page, true)) {
+                    $childPage->removePage($page, true);
+                    return true;
+                }
+            }
+        }
+
         return false;
     }
 

+ 191 - 1
library/Zend/Validate/Hostname.php

@@ -110,7 +110,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
     /**
      * Array of valid top-level-domains
      *
-     * Version 2014012600, Last Updated Sun Jan 26 07:07:01 2014 UTC
+     * Version 2014050501, Last Updated Tue May  6 07:07:01 2014 UTC
      *
      * @see http://data.iana.org/TLD/tlds-alpha-by-domain.txt  List of all TLDs by domain
      * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs
@@ -119,6 +119,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
     protected $_validTlds = array(
         'ac',
         'academy',
+        'actor',
         'ad',
         'ae',
         'aero',
@@ -126,33 +127,44 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'ag',
         'agency',
         'ai',
+        'airforce',
         'al',
         'am',
         'an',
         'ao',
         'aq',
         'ar',
+        'archi',
         'arpa',
         'as',
         'asia',
+        'associates',
         'at',
         'au',
         'aw',
         'ax',
+        'axa',
         'az',
         'ba',
+        'bar',
         'bargains',
+        'bayern',
         'bb',
         'bd',
         'be',
         'berlin',
+        'best',
         'bf',
         'bg',
         'bh',
         'bi',
+        'bid',
         'bike',
         'biz',
         'bj',
+        'black',
+        'blackfriday',
+        'blue',
         'bm',
         'bn',
         'bo',
@@ -171,8 +183,14 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'cab',
         'camera',
         'camp',
+        'capital',
+        'cards',
+        'care',
+        'career',
         'careers',
+        'cash',
         'cat',
+        'catering',
         'cc',
         'cd',
         'center',
@@ -181,9 +199,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'cg',
         'ch',
         'cheap',
+        'christmas',
         'ci',
+        'citic',
         'ck',
         'cl',
+        'cleaning',
+        'clinic',
         'clothing',
         'club',
         'cm',
@@ -191,15 +213,23 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'co',
         'codes',
         'coffee',
+        'college',
+        'cologne',
         'com',
         'community',
         'company',
         'computer',
+        'condos',
         'construction',
+        'consulting',
         'contractors',
+        'cooking',
         'cool',
         'coop',
+        'country',
         'cr',
+        'creditcard',
+        'cruises',
         'cu',
         'cv',
         'cw',
@@ -210,11 +240,15 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'dating',
         'de',
         'democrat',
+        'dental',
+        'desi',
         'diamonds',
         'directory',
+        'discount',
         'dj',
         'dk',
         'dm',
+        'dnp',
         'do',
         'domains',
         'dz',
@@ -224,6 +258,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'ee',
         'eg',
         'email',
+        'engineering',
         'enterprises',
         'equipment',
         'er',
@@ -231,16 +266,35 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'estate',
         'et',
         'eu',
+        'eus',
+        'events',
+        'exchange',
         'expert',
+        'exposed',
+        'fail',
         'farm',
+        'feedback',
         'fi',
+        'finance',
+        'financial',
+        'fish',
+        'fishing',
+        'fitness',
         'fj',
         'fk',
+        'flights',
         'florist',
         'fm',
         'fo',
+        'foo',
+        'foundation',
         'fr',
+        'frogans',
+        'fund',
+        'furniture',
+        'futbol',
         'ga',
+        'gal',
         'gallery',
         'gb',
         'gd',
@@ -252,13 +306,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'gift',
         'gl',
         'glass',
+        'globo',
         'gm',
+        'gmo',
         'gn',
+        'gop',
         'gov',
         'gp',
         'gq',
         'gr',
         'graphics',
+        'gratis',
+        'gripe',
         'gs',
         'gt',
         'gu',
@@ -266,11 +325,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'guru',
         'gw',
         'gy',
+        'haus',
         'hk',
         'hm',
         'hn',
         'holdings',
         'holiday',
+        'horse',
         'house',
         'hr',
         'ht',
@@ -281,16 +342,21 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'im',
         'immobilien',
         'in',
+        'industries',
         'info',
+        'ink',
         'institute',
+        'insure',
         'int',
         'international',
+        'investments',
         'io',
         'iq',
         'ir',
         'is',
         'it',
         'je',
+        'jetzt',
         'jm',
         'jo',
         'jobs',
@@ -305,8 +371,10 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'kiwi',
         'km',
         'kn',
+        'koeln',
         'kp',
         'kr',
+        'kred',
         'kw',
         'ky',
         'kz',
@@ -314,11 +382,14 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'land',
         'lb',
         'lc',
+        'lease',
         'li',
         'lighting',
+        'limited',
         'limo',
         'link',
         'lk',
+        'london',
         'lr',
         'ls',
         'lt',
@@ -327,14 +398,19 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'lv',
         'ly',
         'ma',
+        'maison',
         'management',
+        'mango',
         'marketing',
         'mc',
         'md',
         'me',
+        'media',
+        'meet',
         'menu',
         'mg',
         'mh',
+        'miami',
         'mil',
         'mk',
         'ml',
@@ -343,7 +419,9 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'mo',
         'mobi',
         'moda',
+        'moe',
         'monash',
+        'moscow',
         'mp',
         'mq',
         'mr',
@@ -357,10 +435,12 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'my',
         'mz',
         'na',
+        'nagoya',
         'name',
         'nc',
         'ne',
         'net',
+        'neustar',
         'nf',
         'ng',
         'ni',
@@ -370,11 +450,16 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'np',
         'nr',
         'nu',
+        'nyc',
         'nz',
+        'okinawa',
         'om',
         'onl',
         'org',
         'pa',
+        'paris',
+        'partners',
+        'parts',
         'pe',
         'pf',
         'pg',
@@ -383,6 +468,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'photography',
         'photos',
         'pics',
+        'pictures',
         'pink',
         'pk',
         'pl',
@@ -392,26 +478,43 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'post',
         'pr',
         'pro',
+        'productions',
+        'properties',
         'ps',
         'pt',
+        'pub',
         'pw',
         'py',
         'qa',
+        'qpon',
+        'quebec',
         're',
         'recipes',
         'red',
+        'reisen',
+        'ren',
+        'rentals',
         'repair',
+        'report',
+        'rest',
+        'reviews',
         'rich',
         'ro',
+        'rocks',
+        'rodeo',
         'rs',
         'ru',
         'ruhr',
         'rw',
+        'ryukyu',
         'sa',
+        'saarland',
         'sb',
         'sc',
+        'schule',
         'sd',
         'se',
+        'services',
         'sexy',
         'sg',
         'sh',
@@ -426,18 +529,24 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'sn',
         'so',
         'social',
+        'sohu',
         'solar',
         'solutions',
+        'soy',
         'sr',
         'st',
         'su',
+        'supplies',
+        'supply',
         'support',
+        'surgery',
         'sv',
         'sx',
         'sy',
         'systems',
         'sz',
         'tattoo',
+        'tax',
         'tc',
         'td',
         'technology',
@@ -454,9 +563,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'tn',
         'to',
         'today',
+        'tokyo',
         'tools',
+        'town',
+        'toys',
         'tp',
         'tr',
+        'trade',
         'training',
         'travel',
         'tt',
@@ -466,29 +579,106 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract
         'ua',
         'ug',
         'uk',
+        'university',
         'uno',
         'us',
         'uy',
         'uz',
         'va',
+        'vacations',
         'vc',
         've',
+        'vegas',
         'ventures',
         'vg',
         'vi',
         'viajes',
+        'villas',
+        'vision',
         'vn',
+        'vodka',
+        'vote',
+        'voting',
+        'voto',
         'voyage',
         'vu',
         'wang',
         'watch',
+        'webcam',
         'wed',
         'wf',
         'wien',
+        'wiki',
         'works',
         'ws',
+        'wtc',
+        'wtf',
+        'xn--3bst00m',
+        'xn--3ds443g',
+        'xn--3e0b707e',
+        'xn--45brj9c',
+        'xn--55qw42g',
+        'xn--55qx5d',
+        'xn--6frz82g',
+        'xn--6qq986b3xl',
+        'xn--80adxhks',
+        'xn--80ao21a',
+        'xn--80asehdb',
+        'xn--80aswg',
+        'xn--90a3ac',
+        'xn--c1avg',
+        'xn--cg4bki',
+        'xn--clchc0ea0b2g2a9gcd',
+        'xn--czru2d',
+        'xn--d1acj3b',
+        'xn--fiq228c5hs',
+        'xn--fiq64b',
+        'xn--fiqs8s',
+        'xn--fiqz9s',
+        'xn--fpcrj9c3d',
+        'xn--fzc2c9e2c',
+        'xn--gecrj9c',
+        'xn--h2brj9c',
+        'xn--i1b6b1a6a2e',
+        'xn--io0a7i',
+        'xn--j1amh',
+        'xn--j6w193g',
+        'xn--kprw13d',
+        'xn--kpry57d',
+        'xn--l1acc',
+        'xn--lgbbat1ad8j',
+        'xn--mgb9awbf',
+        'xn--mgba3a4f16a',
+        'xn--mgbaam7a8h',
+        'xn--mgbab2bd',
+        'xn--mgbayh7gpa',
+        'xn--mgbbh1a71e',
+        'xn--mgbc0a9azcg',
+        'xn--mgberp4a5d4ar',
+        'xn--mgbx4cd0ab',
+        'xn--ngbc5azd',
+        'xn--nqv7f',
+        'xn--nqv7fs00ema',
+        'xn--o3cw4h',
+        'xn--ogbpf8fl',
+        'xn--p1ai',
+        'xn--pgbs0dh',
+        'xn--q9jyb4c',
+        'xn--rhqv96g',
+        'xn--s9brj9c',
+        'xn--ses554g',
+        'xn--unup4y',
+        'xn--wgbh1c',
+        'xn--wgbl6a',
+        'xn--xkc2al3hye2a',
+        'xn--xkc2dl3a5ee0h',
+        'xn--yfro4i67o',
+        'xn--ygbi2ammx',
+        'xn--zfr164b',
         'xxx',
+        'xyz',
         'ye',
+        'yokohama',
         'yt',
         'za',
         'zm',

+ 33 - 0
tests/Zend/Dojo/View/Helper/DojoTest.php

@@ -51,6 +51,11 @@ require_once 'Zend/View.php';
 class Zend_Dojo_View_Helper_DojoTest extends PHPUnit_Framework_TestCase
 {
     /**
+     * @var Zend_Dojo_View_Helper_Dojo_Container
+     */
+    protected $helper;
+
+    /**
      * Runs the test methods of this class.
      *
      * @return void
@@ -909,6 +914,34 @@ function() {
         $this->assertRegexp('#(function\\(\\){alert\\(\'foo\'\\);})#', $output);
     }
 
+    /**
+     * @group GH-340
+     */
+    public function testRenderStylesheetsOrder()
+    {
+        $helper = $this->helper;
+        $options = array(
+            'localPath'              => '',
+            'stylesheetmodules'      => 'test.stylesheet.module',
+            'registerdojostylesheet' => true,
+            'enable'                 => true,
+        );
+        $helper->setOptions($options);
+
+        $expected = '<style type="text/css">' . "\n"
+                  . '<!--' . "\n"
+                  . '    @import "/dojo/resources/dojo.css";' . "\n"
+                  . '    @import "/test/stylesheet/module/module.css";' . "\n"
+                  . '-->' . "\n"
+                  . '</style>';
+
+        $actual = (string) $helper;
+        $end    = '</style>';
+        $actual = substr($actual, 0, strpos($actual, $end) + strlen($end));
+
+        $this->assertEquals($expected, $actual);
+    }
+
     public function setupDojo()
     {
         $this->helper->requireModule('dijit.layout.ContentPane')

+ 18 - 0
tests/Zend/LocaleTest.php

@@ -110,6 +110,24 @@ class Zend_LocaleTest extends PHPUnit_Framework_TestCase
     }
 
     /**
+     * @group GH-337
+     */
+    public function testIsLocaleMethodWithAliases()
+    {
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_CN'));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_CN', false, false));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_CN', true, true));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_CN', false, true));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_CN', true, false));
+
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_Hans_CN'));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_Hans_CN', false, false));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_Hans_CN', true, true));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_Hans_CN', false, true));
+        $this->assertEquals(true, Zend_Locale::isLocale('zh_Hans_CN', true, false));
+    }
+
+    /**
      * test for object creation
      * expected object instance
      */

+ 24 - 0
tests/Zend/Navigation/ContainerTest.php

@@ -1260,4 +1260,28 @@ class Zend_Navigation_ContainerTest extends PHPUnit_Framework_TestCase
 
         $this->assertEquals(null, $container->getChildren());
     }
+
+    public function testRemovePageRecursively()
+    {
+        $container = new Zend_Navigation(array(
+            array(
+                'route' => 'foo',
+                'pages' => array(
+                    array(
+                        'route' => 'bar',
+                        'pages' => array(
+                            array(
+                                'route' => 'baz',
+                            ),
+                        ),
+                    )
+                )
+            ),
+        ));
+
+        $container->removePage($container->findOneBy('route', 'baz'), true);
+        $this->assertNull($container->findOneBy('route', 'baz'));
+        $container->removePage($container->findOneBy('route', 'bar'), true);
+        $this->assertNull($container->findOneBy('route', 'bar'));
+    }
 }