Plugin Directory

Changeset 1000678


Ignore:
Timestamp:
10/02/2014 02:47:45 PM (12 years ago)
Author:
mgrt
Message:

Added compatibility with PHP 5.3

Location:
mgrt/trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • mgrt/trunk/LICENSE

    r986149 r1000678  
    1 Copyright (c) 2011-2014 Mgrt <contact@mgrt.net>
     1Copyright (c) 2011-2014 Mgrt <contact@mgrt.com>
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy of
  • mgrt/trunk/Mgrt/Wordpress/Manager/SyncManager.php

    r986149 r1000678  
    289289        );
    290290        $opts = array();
     291
    291292        if ($list_id != -1) {
    292             $opts[] = (new MailingList())->setId(intval($list_id));
     293            $ml = new MailingList();
     294            $ml->setId(intval($list_id));
     295            $opts[] = $ml;
    293296        }
    294297        $opts[] = array(
     
    366369        $this->import_sync = true;
    367370        if (isset($_GET['webhook']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    368             $call = (new WebhookCallInput())
    369                 ->setSecretKey($this->bootstrap->getDataManager()->getOption('webhook_secret_key', MGRT__OPTION_KEY.'-webhook'))
    370                 ->fromInputs();
     371            $call = new WebhookCallInput();
     372            $call->setSecretKey($this->bootstrap->getDataManager()->getOption('webhook_secret_key', MGRT__OPTION_KEY.'-webhook'));
     373            $call->fromInputs();
    371374
    372375            if ($call === false) {
  • mgrt/trunk/Mgrt/Wordpress/Manager/ViewManager.php

    r988019 r1000678  
    3838    {
    3939        if (is_string($views)) {
    40             $views = [$views];
     40            $views = array($views);
    4141        }
    4242
     
    8888    {
    8989        if (is_string($views)) {
    90             $views = [$views];
     90            $views = array($views);
    9191        }
    9292
     
    105105            $object = new $class($this->bootstrap);
    106106
    107             if (!is_subclass_of($object, 'Mgrt\Wordpress\AbstractView', false)) {
    108                 return;
    109             }
     107
     108            // if (!is_subclass_of($object, 'Mgrt\Wordpress\AbstractView', false)) {
     109            //     return;
     110            // }
    110111
    111112            $this->loaded[$view] = $object;
     
    191192        }
    192193
    193         $args = ['page' => $page];
     194        $args = array('page' => $page);
    194195
    195196        if (!empty($action)) {
  • mgrt/trunk/Mgrt/Wordpress/Shortcode/NewsletterShortcode.php

    r986149 r1000678  
    131131        $mailingLists = array();
    132132        foreach ($targets as $targetId) {
    133             $mailingLists[] = (new MailingList())->setId($targetId);
     133            $ml = new MailingList();
     134            $ml->setId($targetId);
     135            $mailingLists[] = $ml;
    134136        }
    135137
    136138        $customFields = array();
    137139        foreach ($fields as $fieldId => $fieldValue) {
    138             $customFields[] = (new CustomField())->setId($fieldId)->setValue($fieldValue);
     140            $cf = new CustomField();
     141            $cf
     142                ->setId($fieldId)
     143                ->setValue($fieldValue);
     144            $customFields[] = $cf;
    139145        }
    140146
  • mgrt/trunk/Mgrt/Wordpress/Sync/ExportSyncProcessor.php

    r988019 r1000678  
    5454        $mailingLists = array();
    5555        foreach ($lists as $listId) {
    56             $mailingLists[] = (new MailingList())->setId($listId);
     56            $ml = new MailingList();
     57            $ml->setId($listId);
     58            $mailingLists[] = $ml;
    5759        }
    5860
     
    103105            $mailingLists = array();
    104106            foreach ($clists as $listId) {
    105                 $mailingLists[] = (new MailingList())->setId($listId);
     107                $ml = new MailingList();
     108                $ml->setId($listId);
     109                $mailingLists[] = $ml;
    106110            }
    107111
     
    165169        $mailingLists = array();
    166170        foreach ($lists as $listId) {
    167             $mailingLists[] = (new MailingList())->setId($listId);
     171            $m = new MailingList();
     172            $ml->setId($listId);
     173            $mailingLists[] = $ml;
    168174        }
    169175
     
    238244                }
    239245            }
    240 
    241             $customFields[] = (new CustomField())
     246            $cf = new CustomField();
     247            $cf
    242248                ->setId(intval($mgrt_field_id))
    243249                ->setValue($fields[$wp_field_name]);
     250            $customFields[] = $cf;
     251
    244252        }
    245253
     
    261269                }
    262270
    263                 $customFields[] = (new CustomField())
     271                $cf = new CustomField();
     272                $cf
    264273                    ->setId(intval($fieldId))
    265274                    ->setValue($fields[$viewKey][Profile::FIELD_KEY.$fieldId]);
     275                $customFields[] = $cf;
    266276            }
    267277        }
  • mgrt/trunk/Mgrt/Wordpress/Widget/NewsletterWidget.php

    r986149 r1000678  
    5454        $mailingLists = array();
    5555        foreach ($targets as $targetId) {
    56             $mailingLists[] = (new MailingList())->setId($targetId);
     56            $ml = new MailingList();
     57            $ml->setId($targetId);
     58            $mailingLists[] = $ml;
    5759        }
    5860
  • mgrt/trunk/mgrt.php

    r988019 r1000678  
    44 * Plugin URI: https://wordpress.org/plugins/mgrt/
    55 * Description: Link your Mgrt account with your Wordpress website.
    6  * Version: 1.0
     6 * Version: 1.1
    77 * Author: Mgrt
    88 * Author URI: https://profiles.wordpress.org/mgrt
     
    8686});
    8787
    88 add_action('init', array(new \Mgrt\Wordpress\Bootstrap(), 'init'));
     88$MgrtBootstrap = new \Mgrt\Wordpress\Bootstrap();
     89add_action('init', array($MgrtBootstrap, 'init'));
    8990
  • mgrt/trunk/readme.txt

    r988019 r1000678  
    2323
    2424== Changelog ==
     251.1 Fixed compatibility with PHP 5.3.3
    25261.0 First release
  • mgrt/trunk/vendor/autoload.php

    r988019 r1000678  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1::getLoader();
     7return ComposerAutoloaderInit1f5d41660b8df351eee1b81bc3e12ebb::getLoader();
  • mgrt/trunk/vendor/composer/autoload_real.php

    r988019 r1000678  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1
     5class ComposerAutoloaderInit1f5d41660b8df351eee1b81bc3e12ebb
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit1f5d41660b8df351eee1b81bc3e12ebb', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitdea41aaff7a9ac591f8543b489dce4c1', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit1f5d41660b8df351eee1b81bc3e12ebb', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4545}
    4646
    47 function composerRequiredea41aaff7a9ac591f8543b489dce4c1($file)
     47function composerRequire1f5d41660b8df351eee1b81bc3e12ebb($file)
    4848{
    4949    require $file;
  • mgrt/trunk/vendor/composer/installed.json

    r986149 r1000678  
    22    {
    33        "name": "symfony/yaml",
    4         "version": "v2.5.4",
    5         "version_normalized": "2.5.4.0",
     4        "version": "v2.5.5",
     5        "version_normalized": "2.5.5.0",
    66        "target-dir": "Symfony/Component/Yaml",
    77        "source": {
    88            "type": "git",
    99            "url": "https://github.com/symfony/Yaml.git",
    10             "reference": "01a7695bcfb013d0a15c6757e15aae120342986f"
    11         },
    12         "dist": {
    13             "type": "zip",
    14             "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f",
    15             "reference": "01a7695bcfb013d0a15c6757e15aae120342986f",
     10            "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96"
     11        },
     12        "dist": {
     13            "type": "zip",
     14            "url": "https://api.github.com/repos/symfony/Yaml/zipball/b1dbc53593b98c2d694ebf383660ac9134d30b96",
     15            "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96",
    1616            "shasum": ""
    1717        },
     
    1919            "php": ">=5.3.3"
    2020        },
    21         "time": "2014-08-31 03:22:04",
     21        "time": "2014-09-22 09:14:18",
    2222        "type": "library",
    2323        "extra": {
     
    117117    {
    118118        "name": "symfony/event-dispatcher",
    119         "version": "v2.5.4",
    120         "version_normalized": "2.5.4.0",
     119        "version": "v2.5.5",
     120        "version_normalized": "2.5.5.0",
    121121        "target-dir": "Symfony/Component/EventDispatcher",
    122122        "source": {
    123123            "type": "git",
    124124            "url": "https://github.com/symfony/EventDispatcher.git",
    125             "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b"
    126         },
    127         "dist": {
    128             "type": "zip",
    129             "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
    130             "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
     125            "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46"
     126        },
     127        "dist": {
     128            "type": "zip",
     129            "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f6281337bf5f985f585d1db6a83adb05ce531f46",
     130            "reference": "f6281337bf5f985f585d1db6a83adb05ce531f46",
    131131            "shasum": ""
    132132        },
     
    137137            "psr/log": "~1.0",
    138138            "symfony/config": "~2.0",
    139             "symfony/dependency-injection": "~2.0",
     139            "symfony/dependency-injection": "~2.0,<2.6.0",
    140140            "symfony/stopwatch": "~2.2"
    141141        },
     
    144144            "symfony/http-kernel": ""
    145145        },
    146         "time": "2014-07-28 13:20:46",
     146        "time": "2014-09-28 15:56:11",
    147147        "type": "library",
    148148        "extra": {
     
    270270    {
    271271        "name": "mgrt/mgrt-php",
    272         "version": "dev-master",
    273         "version_normalized": "9999999-dev",
     272        "version": "2.1.0",
     273        "version_normalized": "2.1.0.0",
    274274        "source": {
    275275            "type": "git",
    276276            "url": "https://github.com/mgrt/mgrt-php.git",
    277             "reference": "c945bf684a22dcc0277b671fa83024e82742647b"
    278         },
    279         "dist": {
    280             "type": "zip",
    281             "url": "https://api.github.com/repos/mgrt/mgrt-php/zipball/c945bf684a22dcc0277b671fa83024e82742647b",
    282             "reference": "c945bf684a22dcc0277b671fa83024e82742647b",
     277            "reference": "b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5"
     278        },
     279        "dist": {
     280            "type": "zip",
     281            "url": "https://api.github.com/repos/mgrt/mgrt-php/zipball/b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5",
     282            "reference": "b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5",
    283283            "shasum": ""
    284284        },
     
    289289            "symfony/yaml": "~2.1"
    290290        },
    291         "time": "2014-09-09 13:17:18",
     291        "time": "2014-10-02 14:33:25",
    292292        "type": "library",
    293293        "extra": {
     
    296296            }
    297297        },
    298         "installation-source": "source",
     298        "installation-source": "dist",
    299299        "autoload": {
    300300            "psr-0": {
  • mgrt/trunk/vendor/mgrt/mgrt-php/README.md

    r986149 r1000678  
    213213* ```$contact->getEmail()``` will return a ```string```.
    214214* ```$contact->getMailingLists()``` will return an array of ```MailingList``` objects.
     215* ```$contact->getMailingListsToArray()``` will return an array of ```integer```.
    215216* ```$contact->getCustomFields()``` will return an array of ```CustomField``` objects.
     217* ```$contact->getCustomFieldsToArray()``` will return an array of CustomFields, formatted as an array of {id, value}.
    216218* ```$contact->getLatitude()``` will return a ```string```.
    217219* ```$contact->getLongitude()``` will return a ```string```.
     
    226228* ```$contact->setMailingLists($mailingList)``` where ```$mailingList``` is an array of ```MailingList``` objects.
    227229* ```$contact->setCustomFields($customFields)``` where ```$customFields``` is an array of ```CustomField``` objects.
     230
     231_Other methods_
     232
     233* ```$contact->addMailingLists($mailingList)``` where ```$mailingList``` is an array of ```MailingList``` objects.
     234* ```$contact->removeMailingLists($mailingList)``` where ```$mailingList``` is an array of ```MailingList``` objects.
     235* ```$contact->addMailingList($mailingList)``` where ```$mailingList``` is a ```MailingList``` object.
     236* ```$contact->removeMailingList($mailingList)``` where ```$mailingList``` is a ```MailingList``` object.
     237* ```$contact->addCustomFields($customFields)``` where ```$customFields``` is an array of ```CustomField``` objects.
     238* ```$contact->removeCustomFields($customFields)``` where ```$customFields``` is an array of ```CustomField``` objects.
     239* ```$contact->addCustomField($customFields)``` where ```$customFields``` is a ```CustomField``` object.
     240* ```$contact->removeCustomField($customFields)``` where ```$customFields``` is a ```CustomField``` object.
    228241
    229242
  • mgrt/trunk/vendor/mgrt/mgrt-php/src/Mgrt/Model/Contact.php

    r986149 r1000678  
    4747    }
    4848
     49    public function removeMailingList(MailingList $mailingList)
     50    {
     51        return $this->removeMailingLists(array($mailingList));
     52    }
     53
     54    public function removeMailingLists(array $datas)
     55    {
     56        $filter = array();
     57        foreach ($datas as $key => $value) {
     58            if ($value instanceof MailingList) {
     59                $filter = $value->getId();
     60            } else {
     61                $filter = is_array($value) ? $value['id'] : $value;
     62            }
     63
     64            if (isset($this->mailing_lists[$filter])) {
     65                unset($this->mailing_lists[$filter]);
     66            }
     67        }
     68
     69        return $this;
     70    }
     71
    4972    public function addCustomField(CustomField $customField)
    5073    {
     
    7396       
    7497        return $this->addCustomFields($datas);
     98    }
     99
     100    public function removeCustomField(CustomField $customField)
     101    {
     102        return $this->removeCustomFields(array($customField));
     103    }
     104
     105    public function removeCustomFields(array $datas)
     106    {
     107        $filter = array();
     108        foreach ($datas as $key => $value) {
     109            if ($value instanceof CustomField) {
     110                $filter = $value->getId();
     111            } else {
     112                $filter = is_array($value) ? $value['id'] : $value;
     113            }
     114
     115            if (isset($this->custom_fields[$filter])) {
     116                unset($this->custom_fields[$filter]);
     117            }
     118        }
     119
     120        return $this;
    75121    }
    76122
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

    r986149 r1000678  
    272272            $info += array(
    273273                'type' => 'Closure',
    274                 'pretty' => 'closure'
     274                'pretty' => 'closure',
    275275            );
    276276        } elseif (is_string($listener)) {
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php

    r986149 r1000678  
    2525        $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
    2626
    27         $tdispatcher->addListener('foo', $listener = function () { ; });
     27        $tdispatcher->addListener('foo', $listener = function () {; });
    2828        $listeners = $dispatcher->getListeners('foo');
    2929        $this->assertCount(1, $listeners);
     
    3939        $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
    4040
    41         $tdispatcher->addListener('foo', $listener = function () { ; });
     41        $tdispatcher->addListener('foo', $listener = function () {; });
    4242        $this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo'));
    4343    }
     
    5151        $this->assertFalse($tdispatcher->hasListeners('foo'));
    5252
    53         $tdispatcher->addListener('foo', $listener = function () { ; });
     53        $tdispatcher->addListener('foo', $listener = function () {; });
    5454        $this->assertTrue($dispatcher->hasListeners('foo'));
    5555        $this->assertTrue($tdispatcher->hasListeners('foo'));
     
    7676        $dispatcher = new EventDispatcher();
    7777        $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
    78         $tdispatcher->addListener('foo', $listener = function () { ; });
     78        $tdispatcher->addListener('foo', $listener = function () {; });
    7979
    8080        $this->assertEquals(array(), $tdispatcher->getCalledListeners());
     
    9393        $dispatcher = new EventDispatcher();
    9494        $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
    95         $tdispatcher->addListener('foo', $listener1 = function () { ; });
    96         $tdispatcher->addListener('foo', $listener2 = function () { ; });
     95        $tdispatcher->addListener('foo', $listener1 = function () {; });
     96        $tdispatcher->addListener('foo', $listener2 = function () {; });
    9797
    9898        $logger->expects($this->at(0))->method('debug')->with("Notified event \"foo\" to listener \"closure\".");
     
    109109        $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
    110110        $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
    111         $tdispatcher->addListener('foo', $listener2 = function () { ; });
     111        $tdispatcher->addListener('foo', $listener2 = function () {; });
    112112
    113113        $logger->expects($this->at(0))->method('debug')->with("Notified event \"foo\" to listener \"closure\".");
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php

    r986149 r1000678  
    137137class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
    138138{
    139     public static function getSubscribedEvents() {}
     139    public static function getSubscribedEvents()
     140    {
     141    }
    140142}
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php

    r986149 r1000678  
    363363        return array('pre.foo' => array(
    364364            array('preFoo1'),
    365             array('preFoo2', 10)
     365            array('preFoo2', 10),
    366366        ));
    367367    }
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php

    r986149 r1000678  
    1919class GenericEventTest extends \PHPUnit_Framework_TestCase
    2020{
    21 
    2221    /**
    2322     * @var GenericEvent
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json

    r986149 r1000678  
    2020    },
    2121    "require-dev": {
    22         "symfony/dependency-injection": "~2.0",
     22        "symfony/dependency-injection": "~2.0,<2.6.0",
    2323        "symfony/config": "~2.0",
    2424        "symfony/stopwatch": "~2.2",
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php

    r986149 r1000678  
    2727    // on the input arrays. This ordering of the characters avoids the use of strtr,
    2828    // which performs more slowly.
    29     private static $escapees = array('\\\\', '\\"', '"',
     29    private static $escapees = array('\\', '\\\\', '\\"', '"',
    3030                                     "\x00",  "\x01",  "\x02",  "\x03",  "\x04",  "\x05",  "\x06",  "\x07",
    3131                                     "\x08",  "\x09",  "\x0a",  "\x0b",  "\x0c",  "\x0d",  "\x0e",  "\x0f",
    3232                                     "\x10",  "\x11",  "\x12",  "\x13",  "\x14",  "\x15",  "\x16",  "\x17",
    3333                                     "\x18",  "\x19",  "\x1a",  "\x1b",  "\x1c",  "\x1d",  "\x1e",  "\x1f",
    34                                      "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9");
    35     private static $escaped  = array('\\"', '\\\\', '\\"',
     34                                     "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",);
     35    private static $escaped  = array('\\\\', '\\"', '\\\\', '\\"',
    3636                                     "\\0",   "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a",
    3737                                     "\\b",   "\\t",   "\\n",   "\\v",   "\\f",   "\\r",   "\\x0e", "\\x0f",
    3838                                     "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17",
    3939                                     "\\x18", "\\x19", "\\x1a", "\\e",   "\\x1c", "\\x1d", "\\x1e", "\\x1f",
    40                                      "\\N", "\\_", "\\L", "\\P");
     40                                     "\\N", "\\_", "\\L", "\\P",);
    4141
    4242    /**
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php

    r986149 r1000678  
    411411     * @return string A YAML string
    412412     *
    413      * @throws ParseException when object parsing support was disabled and the parser detected a PHP object
     413     * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved
    414414     */
    415415    private static function evaluateScalar($scalar, $references = array())
     
    423423            } else {
    424424                $value = substr($scalar, 1);
     425            }
     426
     427            // an unquoted *
     428            if (false === $value || '' === $value) {
     429                throw new ParseException('A reference must contain at least one character.');
    425430            }
    426431
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php

    r986149 r1000678  
    9494                    $c = $this->getRealCurrentLineNb() + 1;
    9595                    $parser = new Parser($c);
    96                     $parser->refs =& $this->refs;
    97                     $data[] = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport);
     96                    $parser->refs = & $this->refs;
     97                    $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport);
    9898                } else {
    9999                    if (isset($values['leadspaces'])
     
    104104                        $c = $this->getRealCurrentLineNb();
    105105                        $parser = new Parser($c);
    106                         $parser->refs =& $this->refs;
     106                        $parser->refs = & $this->refs;
    107107
    108108                        $block = $values['value'];
     
    161161                        $c = $this->getRealCurrentLineNb() + 1;
    162162                        $parser = new Parser($c);
    163                         $parser->refs =& $this->refs;
     163                        $parser->refs = & $this->refs;
    164164                        $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport);
    165165
     
    212212                        $c = $this->getRealCurrentLineNb() + 1;
    213213                        $parser = new Parser($c);
    214                         $parser->refs =& $this->refs;
     214                        $parser->refs = & $this->refs;
    215215                        $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport);
    216216                        // Spec: Keys MUST be unique; first one wins.
     
    317317     * Returns the next embed block of YAML.
    318318     *
    319      * @param int     $indentation The indent level at which the block is to be read, or null for default
     319     * @param int  $indentation The indent level at which the block is to be read, or null for default
     320     * @param bool $inSequence  True if the enclosing data structure is a sequence
    320321     *
    321322     * @return string A YAML string
     
    323324     * @throws ParseException When indentation problem are detected
    324325     */
    325     private function getNextEmbedBlock($indentation = null)
    326     {
    327         $this->moveToNextLine();
     326    private function getNextEmbedBlock($indentation = null, $inSequence = false)
     327    {
     328        $oldLineIndentation = $this->getCurrentLineIndentation();
     329
     330        if (!$this->moveToNextLine()) {
     331            return;
     332        }
    328333
    329334        if (null === $indentation) {
     
    340345
    341346        $data = array(substr($this->currentLine, $newIndent));
     347
     348        if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) {
     349            // the previous line contained a dash but no item content, this line is a sequence item with the same indentation
     350            // and therefore no nested list or mapping
     351            $this->moveToPreviousLine();
     352
     353            return;
     354        }
    342355
    343356        $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine);
     
    670683        return (0 === strpos($this->currentLine, '- '));
    671684    }
    672 
    673685}
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php

    r986149 r1000678  
    5656        $this->dumper->setIndentation(7);
    5757
    58 $expected = <<<EOF
     58        $expected = <<<EOF
    5959'': bar
    6060foo: '#bar'
     
    109109{ '': bar, foo: '#bar', 'foo''bar': {  }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
    110110EOF;
    111 $this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
    112 $this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
    113 
    114 $expected = <<<EOF
     111        $this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
     112        $this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
     113
     114        $expected = <<<EOF
    115115'': bar
    116116foo: '#bar'
     
    200200        $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true, false);
    201201    }
     202
     203    /**
     204     * @dataProvider getEscapeSequences
     205     */
     206    public function testEscapedEscapeSequencesInQuotedScalar($input, $expected)
     207    {
     208        $this->assertEquals($expected, $this->dumper->dump($input));
     209    }
     210
     211    public function getEscapeSequences()
     212    {
     213        return array(
     214            'null' => array("\t\\0", '"\t\\\\0"'),
     215            'bell' => array("\t\\a", '"\t\\\\a"'),
     216            'backspace' => array("\t\\b", '"\t\\\\b"'),
     217            'horizontal-tab' => array("\t\\t", '"\t\\\\t"'),
     218            'line-feed' => array("\t\\n", '"\t\\\\n"'),
     219            'vertical-tab' => array("\t\\v", '"\t\\\\v"'),
     220            'form-feed' => array("\t\\f", '"\t\\\\f"'),
     221            'carriage-return' => array("\t\\r", '"\t\\\\r"'),
     222            'escape' => array("\t\\e", '"\t\\\\e"'),
     223            'space' => array("\t\\ ", '"\t\\\\ "'),
     224            'double-quote' => array("\t\\\"", '"\t\\\\\\""'),
     225            'slash' => array("\t\\/", '"\t\\\\/"'),
     226            'backslash' => array("\t\\\\", '"\t\\\\\\\\"'),
     227            'next-line' => array("\t\\N", '"\t\\\\N"'),
     228            'non-breaking-space' => array("\t\\�", '"\t\\\\�"'),
     229            'line-separator' => array("\t\\L", '"\t\\\\L"'),
     230            'paragraph-separator' => array("\t\\P", '"\t\\\\P"'),
     231        );
     232    }
    202233}
    203234
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml

    r986149 r1000678  
    1111php: |
    1212    array('apple', 'banana', 'carrot')
     13---
     14test: Sequence With Item Being Null In The Middle
     15brief: |
     16    You can specify a list in YAML by placing each
     17    member of the list on a new line with an opening
     18    dash. These lists are called sequences.
     19yaml: |
     20    - apple
     21    -
     22    - carrot
     23php: |
     24    array('apple', null, 'carrot')
     25---
     26test: Sequence With Last Item Being Null
     27brief: |
     28    You can specify a list in YAML by placing each
     29    member of the list on a new line with an opening
     30    dash. These lists are called sequences.
     31yaml: |
     32    - apple
     33    - banana
     34    -
     35php: |
     36    array('apple', 'banana', null)
    1337---
    1438test: Nested Sequences
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php

    r986149 r1000678  
    146146        );
    147147        $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, array('foo' => $foo)));
     148    }
     149
     150    /**
     151     * @expectedException \Symfony\Component\Yaml\Exception\ParseException
     152     * @expectedExceptionMessage A reference must contain at least one character.
     153     */
     154    public function testParseUnquotedAsterisk()
     155    {
     156        Inline::parse('{ foo: * }');
     157    }
     158
     159    /**
     160     * @expectedException \Symfony\Component\Yaml\Exception\ParseException
     161     * @expectedExceptionMessage A reference must contain at least one character.
     162     */
     163    public function testParseUnquotedAsteriskFollowedByAComment()
     164    {
     165        Inline::parse('{ foo: * #foo }');
    148166    }
    149167
     
    211229
    212230            '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))),
    213             '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',),
     231            '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container'),
    214232        );
    215233    }
     
    258276            '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))),
    259277
    260             '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',),
     278            '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container'),
    261279        );
    262280    }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php

    r986149 r1000678  
    406406EOF;
    407407        $expected = array(
    408             'foo' => "\n\nbar"
     408            'foo' => "\n\nbar",
    409409        );
    410410
     
    450450            iconv("UTF-8", "ISO-8859-1", "foo: 'äöüß'"),
    451451            iconv("UTF-8", "ISO-8859-15", "euro: '€'"),
    452             iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'")
     452            iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'"),
    453453        );
    454454
     
    459459                $this->fail('charsets other than UTF-8 are rejected.');
    460460            } catch (\Exception $e) {
    461                  $this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.');
     461                $this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.');
    462462            }
    463463        }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php

    r986149 r1000678  
    131131        }
    132132        if (0x800 > $c) {
    133             return chr(0xC0 | $c>>6).chr(0x80 | $c & 0x3F);
     133            return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
    134134        }
    135135        if (0x10000 > $c) {
    136             return chr(0xE0 | $c>>12).chr(0x80 | $c>>6 & 0x3F).chr(0x80 | $c & 0x3F);
     136            return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
    137137        }
    138138
    139         return chr(0xF0 | $c>>18).chr(0x80 | $c>>12 & 0x3F).chr(0x80 | $c>>6 & 0x3F).chr(0x80 | $c & 0x3F);
     139        return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
    140140    }
    141141}
Note: See TracChangeset for help on using the changeset viewer.