diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d262513a05f14862939b5d5b3d3dd45dc890a2ec..9ac30a3ac3f77341c6b2874ffd995a3e0a802165 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -32,6 +32,15 @@ - Die Bibliothek `opis/json-schema` wurde auf Version 2.3.0 aktualisiert ([Issue #4173](https://gitlab.studip.de/studip/studip/-/issues/4173)). Dadurch ergeben sich die folgenden Änderungen für Komponenten aus Courseware (siehe auch [Migration Guide](https://opis.io/json-schema/2.x/php-migration.html#validator)): - Instanzen von `Courseware\ContainerTypes\BlockType` müssen die Methode `getJsonSchema` anpassen. Der Return Type ist nun `string` und es muss der Inhalt der Schema-Datei zurückgegeben werden ohne Aufruf von `Schema::fromJsonString()`. - Instanzen von `Courseware\ContainerTypes\ContainerType` müssen die Methode `getJsonSchema` anpassen. Der Return Type ist nun `string` und es muss der Inhalt der Schema-Datei zurückgegeben werden ohne Aufruf von `Schema::fromJsonString()`. +- Die von Stud.IP verwendete Template-Bibliothek "Flexi Templates" wurde vollständig in den Kern integriert. + Obwohl die Umstellung abwärtskompatibel sein sollte, sollten die Klassen folgendermassen ersetzt werden: + - `Flexi_TemplateFactory` > `Flexi\Factory` + - `Flexi_Template` > `Flexi\Template` + - `Flexi_PhpTemplate` > `Flexi\PhpTemplate` + - `Flexi_TemplateNotFoundException` > `Flexi\TemplateNotFoundException` + + Sollte ein Plugin manuell Flexi einbinden, so wird dies zu einem Fehler führen. Jegliches Einbinden von Dateien + unterhalb von `vendor/flexi` muss ersatzlos entfernt werden. ## Security related issues diff --git a/app/controllers/admin/courses.php b/app/controllers/admin/courses.php index 82c389b7a4d7055cda6025f15c0a584683124cb7..27b6ca6bd5035ff02f83f192e4e288f845406dbf 100644 --- a/app/controllers/admin/courses.php +++ b/app/controllers/admin/courses.php @@ -22,6 +22,7 @@ * @category Stud.IP * @since 3.1 */ + require_once 'lib/meine_seminare_func.inc.php'; require_once 'lib/object.inc.php'; require_once 'lib/archiv.inc.php'; //for lastActivity in getCourses() method @@ -420,7 +421,7 @@ class Admin_CoursesController extends AuthenticatedController } } } - $tf = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $tf = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); switch ($GLOBALS['user']->cfg->MY_COURSES_ACTION_AREA) { case 1: case 2: @@ -495,7 +496,7 @@ class Admin_CoursesController extends AuthenticatedController $multimode = $plugin->useMultimode(); if ($multimode) { $data['buttons_top'] = '<label>'._('Alle auswählen').'<input type="checkbox" data-proxyfor=".course-admin td:last-child :checkbox"></label>'; - if ($multimode instanceof Flexi_Template) { + if ($multimode instanceof Flex\Template) { $data['buttons_bottom'] = $multimode->render(); } elseif ($multimode instanceof \Studip\Button) { $data['buttons_bottom'] = (string) $multimode; @@ -715,11 +716,14 @@ class Admin_CoursesController extends AuthenticatedController foreach ($plugin->adminAvailableContents() as $index => $label) { if (in_array($plugin->getPluginId() . '_' . $index, $activated_fields)) { $content = $plugin->adminAreaGetCourseContent($course, $index); - $d[$plugin->getPluginId()."_".$index] = $content instanceof Flexi_Template ? $content->render() : $content; + if ($content instanceof Flexi\Template) { + $content = $content->render(); + } + $d[$plugin->getPluginId()."_".$index] = $content; } } } - $tf = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views'); + $tf = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views'); switch ($GLOBALS['user']->cfg->MY_COURSES_ACTION_AREA) { case 1: @@ -840,7 +844,10 @@ class Admin_CoursesController extends AuthenticatedController foreach (PluginManager::getInstance()->getPlugins(AdminCourseAction::class) as $plugin) { if ($GLOBALS['user']->cfg->MY_COURSES_ACTION_AREA === get_class($plugin)) { $output = $plugin->getAdminCourseActionTemplate($course->getId()); - $d['action'] = $output instanceof Flexi_Template ? $output->render() : (string) $output; + if ($output instanceof Flexi\Template) { + $output = $output->render(); + } + $d['action'] = (string) $output; break; } } @@ -1033,10 +1040,10 @@ class Admin_CoursesController extends AuthenticatedController foreach ($plugin->adminAvailableContents() as $index => $label) { if (in_array($plugin->getPluginId() . "_" . $index, $filter_config)) { $content = $plugin->adminAreaGetCourseContent($course, $index); - $row[$plugin->getPluginId() . "_" . $index] = strip_tags(is_a($content, 'Flexi_Template') - ? $content->render() - : $content - ); + if ($content instanceof Flexi\Template) { + $content = $content->render(); + } + $row[$plugin->getPluginId() . "_" . $index] = strip_tags($content); } } } diff --git a/app/controllers/calendar/schedule.php b/app/controllers/calendar/schedule.php index 88c4304ab48ea957f1611276df270417fc6e1cb0..5d9a26ef6e9bd45e863fbcad3e833d18dae32d60 100644 --- a/app/controllers/calendar/schedule.php +++ b/app/controllers/calendar/schedule.php @@ -143,7 +143,7 @@ class Calendar_ScheduleController extends AuthenticatedController 'entry_height' => $this->calendar_view->getHeight() ]; - $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views'); + $factory = new Flexi\Factory($this->dispatcher->trails_root . '/views'); PageLayout::addStyle($factory->render('calendar/schedule/stylesheet', $style_parameters), 'screen, print'); if (Request::option('printview')) { diff --git a/app/controllers/file.php b/app/controllers/file.php index 11b1949f7d09062fe33ae1f500cb73874b3e1f2c..095e295ce64273e370d04f87f7c5781f58c6a079 100644 --- a/app/controllers/file.php +++ b/app/controllers/file.php @@ -980,7 +980,7 @@ class FileController extends AuthenticatedController ); } else { $this->top_folder = $this->filesystemplugin->getFolder($folder_id, true); - if (is_a($this->top_folder, 'Flexi_Template')) { + if ($this->top_folder instanceof Flexi\Template) { $this->top_folder->select = true; $this->top_folder->to_folder = $this->to_folder; $this->render_text($this->top_folder); @@ -1505,7 +1505,7 @@ class FileController extends AuthenticatedController $folder_id = substr($folder_id, 0, strpos($folder_id, "?")); } $this->top_folder = $this->filesystemplugin->getFolder($folder_id, true); - if (is_a($this->top_folder, 'Flexi_Template')) { + if ($this->top_folder instanceof Flexi\Template) { $this->top_folder->select = true; $this->top_folder->to_folder = $this->to_folder; $this->render_text($this->top_folder->render()); diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php index 294aeaa6aa101072c4bfaae5f4831e2c0ca603fc..45ccb16fa7e25d5d9e801f4906a59bda7a79d39d 100644 --- a/app/controllers/resources/booking.php +++ b/app/controllers/resources/booking.php @@ -242,9 +242,7 @@ class Resources_BookingController extends AuthenticatedController return true; } - $template_factory = new Flexi_TemplateFactory( - $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' - ); + $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); $derived_resource = $booking->resource->getDerivedClassInstance(); $system_lang = $_SESSION['_language']; diff --git a/app/controllers/room_management/planning.php b/app/controllers/room_management/planning.php index 1484bbbb6a434d9077eaacfc588a4446ec6366e4..3da7904324039a3fbdde1aad3c691db783cd06d9 100644 --- a/app/controllers/room_management/planning.php +++ b/app/controllers/room_management/planning.php @@ -1371,7 +1371,7 @@ class RoomManagement_PlanningController extends AuthenticatedController $export = Request::get('export'); if ($export == 'html') { //Load the export template: - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/app/views/room_management/planning/' ); diff --git a/app/controllers/shared/download.php b/app/controllers/shared/download.php index 92d15d9102e1a89e7d5821adbfe750e05e515f1e..f94bc86f10001e11f1f109b92ca8d20178d7686f 100644 --- a/app/controllers/shared/download.php +++ b/app/controllers/shared/download.php @@ -158,7 +158,7 @@ class Shared_DownloadController extends AuthenticatedController } $path = $GLOBALS['STUDIP_BASE_PATH'] . '/app/views/shared/modul/'; - $factory = new Flexi_TemplateFactory($path); + $factory = new Flexi\Factory($path); $template = $factory->open('_modul'); $template->_ = function ($string) { return $this->_($string); }; @@ -166,7 +166,7 @@ class Shared_DownloadController extends AuthenticatedController $template->display_language = $display_language; $content = $template->render(); - $factory = new \Flexi_TemplateFactory($path); + $factory = new Flexi\Factory($path); $type = 1; if (count($modul->modulteile) == 1) { $modulteil = $modul->modulteile->first(); diff --git a/app/controllers/start.php b/app/controllers/start.php index 87c493e9406586c1f6d427b583d5f6c5a03edd9a..3040d588a4944f0e7933703d0f66d0f1286e40af 100644 --- a/app/controllers/start.php +++ b/app/controllers/start.php @@ -53,6 +53,8 @@ class StartController extends AuthenticatedController } } + $this->widget_layout = $this->get_template_factory()->open('start/_widget.php'); + $sidebar = Sidebar::get(); $nav = $sidebar->addWidget(new NavigationWidget()); diff --git a/app/views/file/file_details.php b/app/views/file/file_details.php index 76f996a7bfe4cb667927d297e872f79c84b0db0d..ddbd7e41d02a5e3fd0cca7ae1da524499b6d0bd2 100644 --- a/app/views/file/file_details.php +++ b/app/views/file/file_details.php @@ -1,21 +1,21 @@ <?php /** - * @var Flexi_Template $this - * @var FileController $controller - * @var Flexi_Template|null $file_info_template - * @var array $fullpath - * @var FileType $file - * @var string|null $previous_file_ref_id - * @var string|null $next_file_ref_id - * @var string|null $from_plugin - * @var bool $include_navigation + * @var Flexi\Template $this + * @var FileController $controller + * @var Flexi\Template|null $file_info_template + * @var array $fullpath + * @var FileType $file + * @var string|null $previous_file_ref_id + * @var string|null $next_file_ref_id + * @var string|null $from_plugin + * @var bool $include_navigation */ ?> <div id="file_details_window"> <?= $this->render_partial('file/_file_aside.php') ?> <div id="preview_container"> - <? if ($file_info_template instanceof Flexi_Template) : ?> + <? if ($file_info_template instanceof Flexi\Template) : ?> <?= $file_info_template->render() ?> <? endif ?> <h3><?=_('Pfad')?></h3> diff --git a/app/views/file/folder_details.php b/app/views/file/folder_details.php index 5bd65749bf0d4fde83390ff988e514e21bfed646..7d1fe046b0c4ab50d50094cf38e0adc972b07f02 100644 --- a/app/views/file/folder_details.php +++ b/app/views/file/folder_details.php @@ -10,7 +10,7 @@ $folder_template = $folder->getDescriptionTemplate(); <? if (!empty($folder_template)) : ?> <h3><?= _('Beschreibung') ?></h3> <article> - <? if ($folder_template instanceof Flexi_Template): ?> + <? if ($folder_template instanceof Flexi\Template): ?> <?= $folder_template->render() ?> <? else: ?> <?= $folder_template ?> diff --git a/app/views/file/new_edit_folder_form.php b/app/views/file/new_edit_folder_form.php index d2dd9315fe81ec9fa8a72e5a935dec2ac2a30d26..32b9800453fb54a139a7596af51409ed539c98fa 100644 --- a/app/views/file/new_edit_folder_form.php +++ b/app/views/file/new_edit_folder_form.php @@ -32,7 +32,7 @@ <div class="text"> <?= htmlReady($folder_type['name']) ?> <? if ($template = $folder_type['instance']->getDescriptionTemplate()): ?> - <?= tooltipIcon($template instanceof Flexi_Template ? $template->render() : $template, false, true) ?> + <?= tooltipIcon($template instanceof Flexi\Template ? $template->render() : $template, false, true) ?> <? endif ?> </div> <div class="icon"> diff --git a/app/views/files/_fileref_tr.php b/app/views/files/_fileref_tr.php index f282f7924f13dc726b721e6229a899654b9c6f44..fc486aef207d2c85538a424c698e3873c66f3be4 100644 --- a/app/views/files/_fileref_tr.php +++ b/app/views/files/_fileref_tr.php @@ -75,7 +75,7 @@ if ($file->isDownloadable($GLOBALS['user']->id)) { data-sort-value="<?= htmlReady($file->getAdditionalColumnOrderWeigh($index)) ?>"> <? $content = $file->getContentForAdditionalColumn($index) ?> <? if ($content) : ?> - <?= is_a($content, "Flexi_Template") ? $content->render() : $content ?> + <?= $content instanceof Flexi\Template ? $content->render() : $content ?> <? endif ?> </td> <? endforeach ?> diff --git a/app/views/files/_folder_tr.php b/app/views/files/_folder_tr.php index 09cd2959a9087bc1eeebad31e8acd7ce88e4a75b..c3f77f6653d8c4539114e5ee3068ce721a6bc50b 100644 --- a/app/views/files/_folder_tr.php +++ b/app/views/files/_folder_tr.php @@ -61,7 +61,7 @@ if ($folder->isReadable($GLOBALS['user']->id)) { data-sort-value="<?= htmlReady($folder->getAdditionalColumnOrderWeigh($index)) ?>"> <? $content = $folder->getContentForAdditionalColumn($index) ?> <? if ($content) : ?> - <?= is_a($content, "Flexi_Template") ? $content->render() : $content ?> + <?= $content instanceof Flexi\Template ? $content->render() : $content ?> <? endif ?> </td> <? endforeach ?> diff --git a/app/views/files/flat.php b/app/views/files/flat.php index a7d0c93fc900f1ad8c4e8a17b21680d74af78915..1440117efed4fbaa22add0fbf2dfbcb7cd1a89da 100644 --- a/app/views/files/flat.php +++ b/app/views/files/flat.php @@ -13,7 +13,7 @@ $vue_topFolder = [ 'description' => $topFolder->getDescriptionTemplate(), 'additionalColumns' => $topFolder->getAdditionalColumns(), ]; -if (is_a($vue_topFolder['description'], "Flexi_Template")) { +if ($vue_topFolder['description'] instanceof Flexi\Template) { $vue_topFolder['description'] = $vue_topFolder['description']->render(); } $vue_topFolder['buttons'] = '<span class="multibuttons">'; diff --git a/app/views/files/index.php b/app/views/files/index.php index 94ae3f4defbc007855a7be7d19af4f408d253a15..6bf28f7c99e356b3d6d57d9d741b1b6c924d5750 100644 --- a/app/views/files/index.php +++ b/app/views/files/index.php @@ -23,7 +23,7 @@ 'additionalColumns' => $topFolder->getAdditionalColumns(), 'buttons' => null ]; - if (is_a($vue_topFolder['description'], "Flexi_Template")) { + if ($vue_topFolder['description'] instanceof Flexi\Template) { $vue_topFolder['description'] = $vue_topFolder['description']->render(); } $vue_files = []; diff --git a/app/views/start/index.php b/app/views/start/index.php index f4e7fcc7c4262f844e59baae54a026732d711791..1fa65ca641e3084337bb34eae4bfdb069ccc741f 100644 --- a/app/views/start/index.php +++ b/app/views/start/index.php @@ -1,6 +1,7 @@ <?php /** * @var array $columns + * @var Flexi\Template $widget_layout */ ?> <h1 class="sr-only"> @@ -29,7 +30,7 @@ if (Config::get()->BANNER_ADS_ENABLE) { <li class="studip-widget-wrapper" id="<?= $widget->getPluginId() ?>"> <div class="ui-widget-content studip-widget"> <? if ($template = $widget->getPortalTemplate()): ?> - <? $template->set_layout($this->_factory->open('start/_widget')) ?> + <? $template->set_layout($widget_layout) ?> <?= $this->render_partial($template, compact('widget')) ?> <? else: ?> <?= $this->render_partial('start/_widget', compact('widget')) ?> diff --git a/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php b/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php index 63275f06c729be8692481e197408a3794adfbdca..7fdbc00429efb53211a38c0662597390ca077c32 100644 --- a/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php +++ b/lib/admissionrules/conditionaladmission/ConditionalAdmission.class.php @@ -207,7 +207,7 @@ class ConditionalAdmission extends AdmissionRule // Open generic admission rule template. $tpl = $GLOBALS['template_factory']->open('admission/rules/configure'); $tpl->set_attribute('rule', $this); - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(__DIR__ . '/templates/'); // Now open specific template for this rule and insert base template. $tpl2 = $factory->open('configure'); $tpl2->set_attribute('rule', $this); @@ -471,7 +471,7 @@ class ConditionalAdmission extends AdmissionRule */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(__DIR__ . '/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php b/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php index a502971f0bb07b5daf0f59e458c4a3273cb4c07e..a3309e84cfa0d503895fea44253c8f897c77b490 100644 --- a/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php +++ b/lib/admissionrules/coursememberadmission/CourseMemberAdmission.class.php @@ -253,8 +253,8 @@ class CourseMemberAdmission extends AdmissionRule return ''; } - private function getTemplateFactory(): Flexi_TemplateFactory + private function getTemplateFactory(): Flexi\Factory { - return new Flexi_TemplateFactory(__DIR__ . '/templates/'); + return new Flexi\Factory(__DIR__ . '/templates/'); } } diff --git a/lib/admissionrules/limitedadmission/LimitedAdmission.class.php b/lib/admissionrules/limitedadmission/LimitedAdmission.class.php index b0cb1ca68a900c6843406cf7b9c920e326dbcad7..a193bda823a4c4df622315f232c25670f43a4ad8 100644 --- a/lib/admissionrules/limitedadmission/LimitedAdmission.class.php +++ b/lib/admissionrules/limitedadmission/LimitedAdmission.class.php @@ -126,7 +126,7 @@ class LimitedAdmission extends AdmissionRule // Open generic admission rule template. $tpl = $GLOBALS['template_factory']->open('admission/rules/configure'); $tpl->set_attribute('rule', $this); - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); // Now open specific template for this rule and insert base template. $tpl2 = $factory->open('configure'); $tpl2->set_attribute('rule', $this); @@ -248,7 +248,7 @@ class LimitedAdmission extends AdmissionRule * @return String */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/admissionrules/lockedadmission/LockedAdmission.class.php b/lib/admissionrules/lockedadmission/LockedAdmission.class.php index c313d55d405a0347d6e81be6e7951fd39b7ee4b6..0ca324b41f9cc1423876e1ac38e9470ece4723fb 100644 --- a/lib/admissionrules/lockedadmission/LockedAdmission.class.php +++ b/lib/admissionrules/lockedadmission/LockedAdmission.class.php @@ -72,7 +72,7 @@ class LockedAdmission extends AdmissionRule * @return String */ public function getTemplate() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); // Now open specific template for this rule and insert base template. $tpl = $factory->open('configure'); $tpl->set_attribute('rule', $this); @@ -125,7 +125,7 @@ class LockedAdmission extends AdmissionRule * @return String */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); @@ -133,4 +133,4 @@ class LockedAdmission extends AdmissionRule } /* end of class LockedAdmission */ -?> \ No newline at end of file +?> diff --git a/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php b/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php index a64b88a368981d91e49b10b7a695cb35a15c3710..28a910dab8c9b5f4026013825547617f113708e7 100644 --- a/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php +++ b/lib/admissionrules/participantrestrictedadmission/ParticipantRestrictedAdmission.class.php @@ -107,7 +107,7 @@ class ParticipantRestrictedAdmission extends AdmissionRule */ public function getTemplate() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); // Open specific template for this rule and insert base template. $tpl = $factory->open('configure'); $tpl->set_attribute('rule', $this); @@ -199,7 +199,7 @@ class ParticipantRestrictedAdmission extends AdmissionRule */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php index 6a99066faf9c981fc843de61b6435ef7a863cae1..06506306ccc0134eb33d6caba3b350867203c2f4 100644 --- a/lib/admissionrules/passwordadmission/PasswordAdmission.class.php +++ b/lib/admissionrules/passwordadmission/PasswordAdmission.class.php @@ -80,7 +80,7 @@ class PasswordAdmission extends AdmissionRule * @return String A template-based input form. */ public function getInput() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('input'); $tpl->set_attribute('rule', $this); return $tpl->render(); @@ -111,7 +111,7 @@ class PasswordAdmission extends AdmissionRule // Open generic admission rule template. $tpl = $GLOBALS['template_factory']->open('admission/rules/configure'); $tpl->set_attribute('rule', $this); - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); // Now open specific template for this rule and insert base template. $tpl2 = $factory->open('configure'); $tpl2->set_attribute('rule', $this); @@ -214,7 +214,7 @@ class PasswordAdmission extends AdmissionRule * @return String */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php b/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php index 6bb6cebf4c7ee7e2c4e784247ebbf57a1c52da98..bee3e1996c69506da6f910c3b0e960be1209b5df 100644 --- a/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php +++ b/lib/admissionrules/preferentialadmission/PreferentialAdmission.class.php @@ -338,7 +338,7 @@ class PreferentialAdmission extends AdmissionRule */ public function getTemplate() { - $factory = new Flexi_TemplateFactory(__DIR__.'/templates/'); + $factory = new Flexi\Factory(__DIR__.'/templates/'); // Now open specific template for this rule and insert base template. $tpl = $factory->open('configure'); $tpl->set_attribute('rule', $this); @@ -503,7 +503,7 @@ class PreferentialAdmission extends AdmissionRule */ public function toString() { - $factory = new Flexi_TemplateFactory(__DIR__.'/templates/'); + $factory = new Flexi\Factory(__DIR__.'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/admissionrules/termsadmission/TermsAdmission.class.php b/lib/admissionrules/termsadmission/TermsAdmission.class.php index 112a12e84990e226d8665cc2bda44dd5859ca95e..50c87128cc38b24ebee79745c0619ac58d61e830 100644 --- a/lib/admissionrules/termsadmission/TermsAdmission.class.php +++ b/lib/admissionrules/termsadmission/TermsAdmission.class.php @@ -61,16 +61,16 @@ class TermsAdmission extends AdmissionRule /** * Shows an input form * - * @return String A template-based input form. - * @throws Flexi_TemplateNotFoundException + * @return string A template-based input form. + * @throws Flexi\TemplateNotFoundException */ public function getInput() { - $factory = new Flexi_TemplateFactory(__DIR__ . '/templates'); + $factory = new Flexi\Factory(__DIR__ . '/templates'); $template = $factory->open('input'); $template->rule = $this; - return MessageBox::info($template->render())->hideClose(true); + return (string) MessageBox::info($template->render())->hideClose(); } /** @@ -84,11 +84,11 @@ class TermsAdmission extends AdmissionRule * Gets the template that provides a configuration GUI for this rule. * * @return String - * @throws Flexi_TemplateNotFoundException + * @throws Flexi\TemplateNotFoundException */ public function getTemplate() { - $factory = new Flexi_TemplateFactory(__DIR__ . '/templates'); + $factory = new Flexi\Factory(__DIR__ . '/templates'); $template = $factory->open('configure'); $template->rule = $this; @@ -158,11 +158,11 @@ class TermsAdmission extends AdmissionRule * A textual description of the current rule. * * @return String - * @throws Flexi_TemplateNotFoundException + * @throws Flexi\TemplateNotFoundException */ public function toString() { - $factory = new Flexi_TemplateFactory(__DIR__ . '/templates/'); + $factory = new Flexi\Factory(__DIR__ . '/templates/'); $template = $factory->open('info'); $template->rule = $this; diff --git a/lib/admissionrules/timedadmission/TimedAdmission.class.php b/lib/admissionrules/timedadmission/TimedAdmission.class.php index 735fdee9972e2b5168f264bdb63185f9afba743e..e167bd83fe6e6fd30ce095a213e56a6872740495 100644 --- a/lib/admissionrules/timedadmission/TimedAdmission.class.php +++ b/lib/admissionrules/timedadmission/TimedAdmission.class.php @@ -101,7 +101,7 @@ class TimedAdmission extends AdmissionRule * @return String */ public function getTemplate() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); // Open specific template for this rule and insert base template. $tpl = $factory->open('configure'); $tpl->set_attribute('rule', $this); @@ -213,7 +213,7 @@ class TimedAdmission extends AdmissionRule */ public function toString() { - $factory = new Flexi_TemplateFactory(dirname(__FILE__).'/templates/'); + $factory = new Flexi\Factory(dirname(__FILE__).'/templates/'); $tpl = $factory->open('info'); $tpl->set_attribute('rule', $this); return $tpl->render(); diff --git a/lib/bootstrap-autoload.php b/lib/bootstrap-autoload.php index 1f3f6d462b77bc3c7188d5573b9e1fe39a177ba8..0bbad8187c6d26620b7ddbc30342a8eb058a37f0 100644 --- a/lib/bootstrap-autoload.php +++ b/lib/bootstrap-autoload.php @@ -51,11 +51,18 @@ StudipAutoloader::addAutoloadPath('lib/raumzeit'); StudipAutoloader::addAutoloadPath('lib/resources'); StudipAutoloader::addAutoloadPath('lib/activities', 'Studip\\Activity'); -StudipAutoloader::addAutoloadPath('lib/extern'); StudipAutoloader::addAutoloadPath('lib/calendar/lib'); StudipAutoloader::addAutoloadPath('lib/elearning'); +StudipAutoloader::addAutoloadPath('lib/extern'); StudipAutoloader::addAutoloadPath('lib/ilias_interface'); +// Flexi +StudipAutoloader::addAutoloadPath('lib/flexi', 'Flexi'); +class_alias(Flexi\PhpTemplate::class, 'Flexi_PhpTemplate'); +class_alias(Flexi\Template::class, 'Flexi_Template'); +class_alias(Flexi\Factory::class, 'Flexi_TemplateFactory'); +class_alias(Flexi\TemplateNotFoundException::class, 'Flexi_TemplateNotFoundException'); + // Messy file names StudipAutoloader::addClassLookups([ 'email_validation_class' => 'lib/phplib/email_validation.class.php', diff --git a/lib/bootstrap.php b/lib/bootstrap.php index 0c66a971841476f8d928ec8c0afc475f4e4f792f..e9c9bb5c702d677863a78dc9d32417a43843cd6d 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php @@ -54,7 +54,7 @@ $ABSOLUTE_URI_STUDIP = ""; if (isset($_SERVER['SERVER_NAME'])) { // work around possible bug in lighttpd if (mb_strpos($_SERVER['SERVER_NAME'], ':') !== false) { - list($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']) = + [$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']] = explode(':', $_SERVER['SERVER_NAME']); } @@ -125,8 +125,7 @@ Assets::set_assets_url($GLOBALS['ASSETS_URL']); Assets::set_assets_path($GLOBALS['ASSETS_PATH']); // globale template factory anlegen -require_once 'vendor/flexi/lib/flexi.php'; -$GLOBALS['template_factory'] = new Flexi_TemplateFactory("{$STUDIP_BASE_PATH}/templates"); +$GLOBALS['template_factory'] = new Flexi\Factory("{$STUDIP_BASE_PATH}/templates"); // set default pdo connection try { diff --git a/lib/calendar/CalendarView.class.php b/lib/calendar/CalendarView.class.php index fc69127247a2fad95430364d794a4bba3c051929..3d89ef19261b4b0424999d2a0d4a2d13de6a68ce 100644 --- a/lib/calendar/CalendarView.class.php +++ b/lib/calendar/CalendarView.class.php @@ -214,7 +214,7 @@ class CalendarView 'whole_height' => $this->getOverallHeight(), 'entry_height' => $this->getHeight() ]; - $factory = new Flexi_TemplateFactory(dirname(__file__).'/../../app/views'); + $factory = new Flexi\Factory(dirname(__file__).'/../../app/views'); PageLayout::addStyle($factory->render('calendar/schedule/stylesheet', $style_parameters)); $template = $GLOBALS['template_factory']->open("calendar/calendar_view.php"); diff --git a/lib/classes/Fullcalendar.class.php b/lib/classes/Fullcalendar.class.php index 467b5839cf0f9f69fa078970b2f141676e03241f..db8364adb1808410f594275c33f5a87dc031de37 100644 --- a/lib/classes/Fullcalendar.class.php +++ b/lib/classes/Fullcalendar.class.php @@ -64,7 +64,7 @@ class Fullcalendar public function render() { - $factory = new \Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); + $factory = new \Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); $template = $factory->open('studip-fullcalendar.php'); $real_data_name = sprintf('data-%s', $this->data_name); return $template->render( diff --git a/lib/classes/I18N.php b/lib/classes/I18N.php index d34ed0b3ce7ffce2b50ab6e2e7a861356f447031..44252f31761c4146239937156a60f3c761988be6 100644 --- a/lib/classes/I18N.php +++ b/lib/classes/I18N.php @@ -61,10 +61,10 @@ class I18N /** * Protected constructor in order to always force a specific input type. * - * @param string|Flexi_Template $template Template to use + * @param string|Flexi\Template $template Template to use * @param string $name Name of the element * @param string|I18NString $value Value of the element - * @param array $attributes Additional variables for the + * @param array $attributes Additional variables for the * element */ final protected function __construct($template, $name, $value, array $attributes) diff --git a/lib/classes/QuestionType.interface.php b/lib/classes/QuestionType.interface.php index ada600549260540c0e87a6a94a4eed7d913a1606..03019feff372c43e1ea27a6f5b2736caa709630e 100644 --- a/lib/classes/QuestionType.interface.php +++ b/lib/classes/QuestionType.interface.php @@ -60,7 +60,8 @@ interface QuestionType { * * Try to prefix all your input variables at least with the id of the question, * so that they will never conflict with other variables. - * @return Flexi_Template + * + * @return Flexi\Template */ public function getDisplayTemplate(); @@ -82,11 +83,13 @@ interface QuestionType { /** * Returns a template with the results of this question. + * * @param $only_user_ids : array\null array of user_ids that the results should be restricted to. * this is used to show only a subset of results to the user for * visible evaluation of the results. If the questionnaire is anonymous * just do nothing. - * @return Flexi_Template + * + * @return Flexi\Template */ public function getResultTemplate($only_user_ids = null); diff --git a/lib/classes/Seminar.class.php b/lib/classes/Seminar.class.php index 8aa3d412b7594899be3c54a1d5e12e1656cb2265..a2d69eaf0943637bf8189faca906ab598e85b746 100644 --- a/lib/classes/Seminar.class.php +++ b/lib/classes/Seminar.class.php @@ -1735,7 +1735,7 @@ class Seminar */ public function getDatesTemplate($template, $params = []) { - if (!$template instanceof Flexi_Template && is_string($template)) { + if (!$template instanceof Flexi\Template && is_string($template)) { $template = $GLOBALS['template_factory']->open($template); } diff --git a/lib/classes/Siteinfo.php b/lib/classes/Siteinfo.php index 0d849ca07d962ca2710e0c45e80bbe8ac1a6bb8e..4a969eee1fb63fb1c46161b4b7f8d470eaf7a3bc 100644 --- a/lib/classes/Siteinfo.php +++ b/lib/classes/Siteinfo.php @@ -281,7 +281,7 @@ class SiteinfoMarkupEngine { function __construct() { $this->db = DBManager::get(); - $this->template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/siteinfo/markup/'); + $this->template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/siteinfo/markup/'); $this->siteinfoMarkup("/\(:version:\)/", [$this, 'version']); $this->siteinfoMarkup("/\(:uniname:\)/", [$this, 'uniName']); $this->siteinfoMarkup("/\(:unicontact:\)/", [$this, 'uniContact']); @@ -659,7 +659,7 @@ function language_filter($input) { } function stripforeignlanguage($language, $text) { - list($primary, $sub) = explode('_',$_SESSION['_language']); + [$primary, $sub] = explode('_',$_SESSION['_language']); if ($language === $primary || $language === $_SESSION['_language']) { return str_replace('\"', '"', $text); } else { diff --git a/lib/classes/StudipFileloader.php b/lib/classes/StudipFileloader.php index 661c0629196ed8a5f7d71ef46ef11569d6c0995e..aab0b316a588da7083da25209152e9eb1d5859fe 100644 --- a/lib/classes/StudipFileloader.php +++ b/lib/classes/StudipFileloader.php @@ -31,7 +31,7 @@ class StudipFileloader !file_exists($file) && !stream_resolve_include_path($file) ) { - continue; + throw new Exception('Missing file '. $file); } include $file; } diff --git a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php index 780f837fd1fe42bd28bd6564a852825177a39489..cd33fd35df1e8041b17320065756b380f3fef947 100644 --- a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php @@ -36,7 +36,7 @@ class AdvancedBasicDataWizardStep extends BasicDataWizardStep } // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); $template = $factory->open('advancedbasicdata/index'); $template = $this->setupTemplateAttributes($template, $values, $stepnumber, $temp_id); diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php index 6a1438fe1a88b6ae31c6ff78b10c78fecebd3205..d47c4f3a34132ed62aba1d44574aa9ed7d8505fe 100644 --- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php @@ -28,7 +28,7 @@ class BasicDataWizardStep implements CourseWizardStep public function getStepTemplate($values, $stepnumber, $temp_id) { // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); if (!empty($values[__CLASS__]['studygroup'])) { $tpl = $factory->open('basicdata/index_studygroup'); $values[__CLASS__]['lecturers'][$GLOBALS['user']->id] = 1; diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php index f3437308e3cf28996a078cda3b18cc08ab89301f..e79e1bde1dea6570ea00b272269aeae4d9c1abba 100644 --- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php +++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php @@ -39,7 +39,7 @@ class LVGroupsWizardStep implements CourseWizardStep $values = $values[__CLASS__] ?? []; // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); $tpl = $factory->open('lvgroups/index'); $tpl->set_attribute('values', $values); @@ -226,7 +226,7 @@ class LVGroupsWizardStep implements CourseWizardStep continue; } - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_searchentry', compact('area')); $data = [ 'id' => $area->id, @@ -288,7 +288,7 @@ class LVGroupsWizardStep implements CourseWizardStep 'Studiengang']); $pathes = ModuleManagementModelTreeItem::getPathes($trails); - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/lvgselector/entry_trails', compact('area', 'pathes')); @@ -308,7 +308,7 @@ class LVGroupsWizardStep implements CourseWizardStep $mvvid = explode('-', $id); $area = Lvgruppe::find($mvvid[0]); - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_entry', ['area' => $area, 'locked' => false, 'course_id' => '']); $data = [ diff --git a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php index 29de61730d7736834ad4d2a31a287df98bd8904c..eac7e3732546467969fb30a2ad5f903eab44e1c0 100644 --- a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php +++ b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php @@ -30,7 +30,7 @@ class StudyAreasWizardStep implements CourseWizardStep // We only need our own stored values here. $values = $values[get_class($this)] ?? []; // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); $tpl = $factory->open('studyareas/index'); if (!empty($values['studyareas'])) { $tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas']))); diff --git a/lib/classes/forms/Form.php b/lib/classes/forms/Form.php index 8977a3732a09db9fd54906c6954617acafc06541..36a2e7d0fb2c4be9ca468dc17ecf057d6fcae364 100644 --- a/lib/classes/forms/Form.php +++ b/lib/classes/forms/Form.php @@ -492,7 +492,7 @@ class Form extends Part /** * Renders the whole form as a string. * @return string - * @throws \Flexi_TemplateNotFoundException + * @throws \Flexi\TemplateNotFoundException */ public function render() { diff --git a/lib/classes/librarysearch/LibraryDocument.class.php b/lib/classes/librarysearch/LibraryDocument.class.php index 4c90e0b4595450e1dcd24cfe7af05cde5b113042..46e11b251fb11ec724afcaee3c3a956f48b9800a 100644 --- a/lib/classes/librarysearch/LibraryDocument.class.php +++ b/lib/classes/librarysearch/LibraryDocument.class.php @@ -14,7 +14,6 @@ * @since 4.6 */ - /** * This class represents a document from a library. */ @@ -386,12 +385,12 @@ class LibraryDocument /** - * @returns Flexi_Template A template containing information about the + * @returns Flexi\Template A template containing information about the * the document. */ public function getInfoTemplate($format = 'short') { - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/templates/library/' ); $template = $factory->open('library_document_info'); diff --git a/lib/classes/sidebar/TemplateWidget.php b/lib/classes/sidebar/TemplateWidget.php index c937c3b69de99b0b521f1aea2f0da6a176430c3b..2ca2d704c44bd12f9e9377411e851b425b5b0337 100644 --- a/lib/classes/sidebar/TemplateWidget.php +++ b/lib/classes/sidebar/TemplateWidget.php @@ -15,10 +15,10 @@ class TemplateWidget extends SidebarWidget * Constructor of the widget. * * @param String $title Title of the widget - * @param Flexi_Template $template Template for the widget + * @param Flexi\Template $template Template for the widget * @param array $variables Associated variables for the template */ - public function __construct($title, Flexi_Template $template, array $variables = []) + public function __construct($title, Flexi\Template $template, array $variables = []) { parent::__construct(); diff --git a/lib/filesystem/CourseDateFolder.php b/lib/filesystem/CourseDateFolder.php index 2ab043586aca684a4c256116d3a9730392532569..7c91c87a7d363417ac51e31d331f4e4c6baf903c 100644 --- a/lib/filesystem/CourseDateFolder.php +++ b/lib/filesystem/CourseDateFolder.php @@ -92,7 +92,7 @@ class CourseDateFolder extends PermissionEnabledFolder implements FolderType /** * This method returns the special part for the edit template * - * @return Flexi_Template edit template + * @return Flexi\Template edit template */ public function getEditTemplate() { @@ -126,7 +126,7 @@ class CourseDateFolder extends PermissionEnabledFolder implements FolderType /** * Returns the description template * - * @return Flexi_Template description template + * @return Flexi\Template description template */ public function getDescriptionTemplate() { diff --git a/lib/filesystem/CoursePublicFolder.php b/lib/filesystem/CoursePublicFolder.php index 463fe19940e96cfa324211845472d4fc74d73899..6fa722dc1bd6ffb719feb15b8fe9d56bbbfa735f 100644 --- a/lib/filesystem/CoursePublicFolder.php +++ b/lib/filesystem/CoursePublicFolder.php @@ -112,7 +112,7 @@ class CoursePublicFolder extends StandardFolder /** * Returns the edit template for this folder type. * - * @return Flexi_Template + * @return Flexi\Template */ public function getEditTemplate() { diff --git a/lib/filesystem/FileType.php b/lib/filesystem/FileType.php index 5a53896fdc911328b1865869d5146009d7685fc5..3dcd32f6c67bb217fb64232bed554d054d95057c 100644 --- a/lib/filesystem/FileType.php +++ b/lib/filesystem/FileType.php @@ -177,10 +177,12 @@ interface FileType public function convertToStandardFile(); /** - * Returns the content for that additional column, if it exists. You can return null a string - * or a Flexi_Template as the content. + * Returns the content for that additional column, if it exists. You can + * return null, a string or a Flexi\Template as the content. + * * @param string $column_index - * @return null|string|Flexi_Template + * + * @return null|string|Flexi\Template */ public function getContentForAdditionalColumn($column_index); @@ -194,14 +196,14 @@ interface FileType /** - * Generates a Flexi_Template containing additional information that are + * Generates a Flexi\Template containing additional information that are * displayes in the information dialog of a file. * * @param bool $include_downloadable_infos Whether to include information * like file previews that can be downloaded (true) or to not * include them (false). Defaults to false. * - * @returns Flexi_Template|null Either a Flexi_Template containing + * @returns Flexi\Template|null Either a Flexi\Template containing * additional information or null if no such information shall be * displayed in the information dialog. */ diff --git a/lib/filesystem/FolderType.php b/lib/filesystem/FolderType.php index 94d86679b8c80afdccf7df28756f62bea919cb4c..69dae303c1a4cb5e31b04237ed7314b3af66e913 100644 --- a/lib/filesystem/FolderType.php +++ b/lib/filesystem/FolderType.php @@ -119,7 +119,7 @@ interface FolderType /** * returns description of the folder * - * @return Flexi_Template | string + * @return Flexi\Template | string */ public function getDescriptionTemplate(); @@ -144,7 +144,7 @@ interface FolderType /** * returns template form, must not contain opening and closing <form> tags * - * @return Flexi_Template | string + * @return Flexi\Template | string */ public function getEditTemplate(); @@ -243,10 +243,12 @@ interface FolderType public function getAdditionalColumns(); /** - * Returns the content for that additional column, if it exists. You can return null a string - * or a Flexi_Template as the content. + * Returns the content for that additional column, if it exists. You can + * return null, a string or a Flexi\Template as the content. + * * @param string $column_index - * @return null|string|Flexi_Template + * + * @return null|string|Flexi\Template */ public function getContentForAdditionalColumn($column_index); diff --git a/lib/filesystem/HiddenFolder.php b/lib/filesystem/HiddenFolder.php index b29f5fb57a72e3cfc9d36eaf1401955853091bcf..4daee0b61fa61511de0cc1e8ba9ca3bcfbe4e82e 100644 --- a/lib/filesystem/HiddenFolder.php +++ b/lib/filesystem/HiddenFolder.php @@ -78,7 +78,7 @@ class HiddenFolder extends PermissionEnabledFolder /** * Returns the edit template for this folder type. * - * @return Flexi_Template + * @return Flexi\Template */ public function getEditTemplate() { diff --git a/lib/filesystem/InboxOutboxFolder.php b/lib/filesystem/InboxOutboxFolder.php index 9386be426da44a418c630d6d9f518c01862dbe0c..6a8f2fd1581237ac45efd09f4f4756955a82d0ed 100644 --- a/lib/filesystem/InboxOutboxFolder.php +++ b/lib/filesystem/InboxOutboxFolder.php @@ -269,10 +269,12 @@ class InboxOutboxFolder implements FolderType } /** - * Returns the content for that additional column, if it exists. You can return null a string - * or a Flexi_Template as the content. + * Returns the content for that additional column, if it exists. You can + * return null, a string or a Flexi\Template as the content. + * * @param string $column_index - * @return null|string|Flexi_Template + * + * @return null|string|Flexi\Template */ public function getContentForAdditionalColumn($column_index) { diff --git a/lib/filesystem/PublicFolder.php b/lib/filesystem/PublicFolder.php index 6b06ac905a42ce67410f49e39d64207691f6d8cc..2dc484713038ddf293e6f902405acb441c5bd2e8 100644 --- a/lib/filesystem/PublicFolder.php +++ b/lib/filesystem/PublicFolder.php @@ -160,7 +160,7 @@ class PublicFolder extends StandardFolder /** * Returns the edit template for this folder type. * - * @return Flexi_Template + * @return Flexi\Template */ public function getEditTemplate() { diff --git a/lib/filesystem/RootFolder.php b/lib/filesystem/RootFolder.php index 0727770c5b29e4eacf92c5f5a118406c2e45c4b1..9771c32faf02a42692dd6bafd62f54347c7b6ee1 100644 --- a/lib/filesystem/RootFolder.php +++ b/lib/filesystem/RootFolder.php @@ -86,7 +86,7 @@ class RootFolder extends StandardFolder } /** - * @return Flexi_Template + * @return Flexi\Template */ public function getEditTemplate() { diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php index 9d2d35c93e3822ebd760d74171f67a3a759ff962..4eb31408402efb8ba3b71f56899b88d996fd59d7 100644 --- a/lib/filesystem/StandardFile.php +++ b/lib/filesystem/StandardFile.php @@ -460,9 +460,11 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface /** * Returns the content for that additional column, if it exists. You can return null a string - * or a Flexi_Template as the content. + * or a Flexi\Template as the content. + * * @param string $column_index - * @return null|string|Flexi_Template + * + * @return null|string|Flexi\Template */ public function getContentForAdditionalColumn($column_index) { @@ -497,7 +499,7 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface return null; } - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/templates/filesystem/file_types/' ); $template = $factory->open('standard_file_info'); diff --git a/lib/filesystem/StandardFolder.php b/lib/filesystem/StandardFolder.php index a34ca4ae820d1037c260a901bb8d448367875463..bbbb1fcb3935f6e7c3ff210d82cdf7857f036e2b 100644 --- a/lib/filesystem/StandardFolder.php +++ b/lib/filesystem/StandardFolder.php @@ -186,7 +186,7 @@ class StandardFolder implements FolderType } /** - * @return string|Flexi_Template + * @return string|Flexi\Template */ public function getDescriptionTemplate() { @@ -194,7 +194,7 @@ class StandardFolder implements FolderType } /** - * @return string|Flexi_Template + * @return string|Flexi\Template */ public function getEditTemplate() { @@ -509,9 +509,11 @@ class StandardFolder implements FolderType /** * Returns the content for that additional column, if it exists. You can return null a string - * or a Flexi_Template as the content. + * or a Flexi\Template as the content. + * * @param string $column_index - * @return null|string|Flexi_Template + * + * @return null|string|Flexi\Template */ public function getContentForAdditionalColumn($column_index) { diff --git a/lib/filesystem/TimedFolder.php b/lib/filesystem/TimedFolder.php index 442c084aa1b8ac7c18a313782955ae3e23f1546f..d5f933b4edaaa5eb768353b5103103ea67223cc7 100644 --- a/lib/filesystem/TimedFolder.php +++ b/lib/filesystem/TimedFolder.php @@ -132,7 +132,7 @@ class TimedFolder extends PermissionEnabledFolder /** * Returns the description template for a instance of a TimedFolder type. * - * @return Flexi_Template A description template for a instance of the type TimedFolder + * @return Flexi\Template A description template for a instance of the type TimedFolder */ public function getDescriptionTemplate() { @@ -155,7 +155,7 @@ class TimedFolder extends PermissionEnabledFolder /** * Returns the edit template for this folder type. * - * @return Flexi_Template + * @return Flexi\Template */ public function getEditTemplate() { diff --git a/lib/flexi/Factory.php b/lib/flexi/Factory.php new file mode 100644 index 0000000000000000000000000000000000000000..b6c30fd531a9d85d9a2fe0a05bf06c74e919fec9 --- /dev/null +++ b/lib/flexi/Factory.php @@ -0,0 +1,243 @@ +<?php +/** + * Using this factory you can create new Template objects. + * + * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de> + * @author Marcus Lunzenauer <mlunzena@uos.de> + * @license MIT + */ + +namespace Flexi; + +class Factory +{ + /** + * mapping of file extensions to supported template classes + */ + protected array $handlers = [ + 'php' => [PhpTemplate::class, []], + ]; + + /** + * Constructor of TemplateFactory. + * + * @param string $path the template include path + */ + public function __construct(protected string $path) + { + $this->set_path($path); + } + + /** + * Sets a new include path for the factory and returns the old one. + * + * @param string $path the new path + * + * @return string the old path + */ + public function set_path(string $path): string + { + $old_path = $this->get_path(); + + if (!str_ends_with($path, '/')) { + $path .= '/'; + } + + $this->path = $path; + + return $old_path; + } + + /** + * Returns the include path of the factory + * + * @return string the current include path + */ + public function get_path(): string + { + return $this->path; + } + + /** + * Open a template of the given name using the factory method pattern. + * If a string was given, the path of the factory is searched for a matching + * template. + * If this string starts with a slash or with /\w+:\/\//, the string is + * interpreted as an absolute path. Otherwise the path of the factory will be + * prepended. + * After that the factory searches for a file extension in this string. If + * there is none, the directory where the template is supposed to live is + * searched for a file starting with the template string and a supported + * file extension. + * At last the factory instantiates a template object of the matching template + * class. + * + * Examples: + * + * $factory->open('/path/to/template') + * does not prepend the factory's path but searches for "template.*" in + * "/path/to" + * + * $factory->open('template') + * prepends the factory's path and searches there for "template.*" + * + * $factory->open('template.php') + * prepends the factory's path but does not search and instantiates a + * PHPTemplate instead + * + * This method returns it's parameter, if it is not a string. This + * functionality is useful for helper methods like #render_partial + * + * @param Template|string $template A name of a template. + * @return Template the factored object + * @throws TemplateNotFoundException if the template could not be found + */ + public function open(Template|string $template): Template + { + # if it is not a string, this method behaves like identity + if ($template instanceof Template) { + return $template; + } + + # get file + $file = $this->get_template_file($template); + + # retrieve handler + [$class, $options] = $this->get_template_handler($file); + + return new $class($file, $this, $options); + } + + /** + * This method returns the absolute filename of the template + * + * @param string $template0 a template string + * + * @return string an absolute filename + * + * @throws TemplateNotFoundException if the template could not be found + */ + public function get_template_file(string $template0): string + { + $template = $this->get_absolute_path($template0); + $extension = $this->get_extension($template); + + # extension defined, is there a matching template class? + if ($extension !== null) { + if (file_exists($template)) { + return $template; + } + } # no extension defined, find it + else { + $file = $this->find_template($template); + if ($file !== null) { + return $file; + } + } + + # falling through to throw exception + throw new TemplateNotFoundException(sprintf( + 'Missing template "%s" in "%s".', + $template0, + $this->path + )); + } + + /** + * Matches an extension to a template handler. + * + * @param string $template the template + * + * @return array|null an array containing the class name and an array of + * options of the matched extension; + * or NULL if the extension did not match + */ + public function get_template_handler(string $template): ?array + { + $extension = $this->get_extension($template); + return $this->handlers[$extension] ?? null; + } + + /** + * Registers a handler for templates with a matching extension. + * + * @param string $extension the extension of the templates to handle + * @param class-string<Template> $class the name of the already loaded class + * @param array $options optional; an array of options which is used + * when constructing a new instance + */ + public function add_handler( + string $extension, + string $class, + array $options = [] + ): void { + $this->handlers[$extension] = [$class, $options]; + } + + /** + * Returns the absolute path to the template. If the given argument starts + * with a slash or with a protocoll, this method just returns its arguments. + * + * @param string $template an incomplete template name + * + * @return string an absolute path to the incomplete template name + */ + public function get_absolute_path(string $template): string + { + return preg_match('#^(/|\w+://)#', $template) + ? $template + : $this->get_path() . $template; + } + + + /** + * Find template given w/o extension. + * + * @param string $template the template's filename w/o extension + * @return string|null null if there no such file could be found, a string + * containing the complete file name otherwise + */ + public function find_template(string $template): ?string + { + foreach ($this->handlers as $ext => $handler) { + $file = "$template.$ext"; + if (file_exists($file)) { + return $file; + } + } + return null; + } + + /** + * Returns the file extension if there is one. + * + * @param string $file an possibly incomplete template file name + * @return string|null a string containing the file extension if there is one, + * NULL otherwise + */ + public function get_extension(string $file): ?string + { + return pathinfo($file, PATHINFO_EXTENSION) ?: null; + } + + /** + * Class method to parse, render and return the presentation of a + * template. + * + * @param Template|string $template A name of a template or a template + * @param array $attributes An associative array of attributes and their + * associated values. + * @param string|null $layout A name of a layout template. + * + * @return string A string representing the rendered presentation. + * + * @throws TemplateNotFoundException + */ + public function render( + Template|string $template, + array $attributes = [], + ?string $layout = null + ): string { + return $this->open($template)->render($attributes, $layout); + } +} diff --git a/lib/flexi/PhpTemplate.php b/lib/flexi/PhpTemplate.php new file mode 100644 index 0000000000000000000000000000000000000000..8110b50dff5cdea1be346a51c8e61ba8c156ceb5 --- /dev/null +++ b/lib/flexi/PhpTemplate.php @@ -0,0 +1,111 @@ +<?php +/** + * A template engine that uses PHP to render templates. + * + * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de> + * @author Marcus Lunzenauer <mlunzena@uos.de> + * @license MIT + */ + +namespace Flexi; + +class PhpTemplate extends Template +{ + /** + * Parse, render and return the presentation. + * + * @return string A string representing the rendered presentation. + * @throws TemplateNotFoundException + */ + public function _render(): string + { + extract($this->get_attributes()); + + # include template, parse it and get output + try { + ob_start(); + require $this->template; + $content_for_layout = ob_get_contents(); + } catch (\Error $e) { + throw new TemplateNotFoundException(previous: $e); + } finally { + ob_end_clean(); + } + + # include layout, parse it and get output + if (isset($this->layout)) { + $defined = get_defined_vars(); + unset($defined['this']); + $content_for_layout = $this->layout->render($defined); + } + + return $content_for_layout; + } + + /** + * Parse, render and return the presentation of a partial template. + * + * @param Template|string $partial A partial name or template + * @param array $attributes An optional associative array of attributes + * and their associated values. + * @return string A string representing the rendered presentation. + * @throws TemplateNotFoundException + */ + public function render_partial(Template|string $partial, array $attributes = []): string + { + return $this->factory->render($partial, $attributes + $this->attributes); + } + + /** + * Renders a partial template with every member of a collection. This member + * can be accessed by a template variable with the same name as the name of + * the partial template. + * + * Example: + * + * # template entry.php contains: + * <li><?= $entry ?></li> + * + * + * $entries = ['lorem', 'ipsum']; + * $template->render_partial_collection('entry', $entries); + * + * # results in: + * <li>lorem</li> + * <li>ipsum</li> + * + * If you want to use specific content between the rendered partials, you + * may define a spacer partial that will be used for that. The spacer will + * be rendered with the given attributes. + * + * @param string $partial A name of a partial template. + * @param array $collection The collection to be rendered. + * @param Template|string|null $spacer Optional a name of a partial template + * used as spacer. + * @param array $attributes An optional associative array of attributes + * and their associated values. + * + * @return string A string representing the rendered presentation. + * @throws TemplateNotFoundException + */ + public function render_partial_collection( + string $partial, + array $collection, + Template|string|null $spacer = null, + array $attributes = [] + ): string { + $template = $this->factory->open($partial); + $template->set_attributes($this->attributes); + $template->set_attributes($attributes); + + $collected = []; + $iterator_name = pathinfo($partial, PATHINFO_FILENAME); + foreach ($collection as $element) { + $collected[] = $template->render([$iterator_name => $element]); + } + + $spacer = isset($spacer) ? $this->render_partial($spacer, $attributes) : ''; + + return implode($spacer, $collected); + } +} diff --git a/lib/flexi/Template.php b/lib/flexi/Template.php new file mode 100644 index 0000000000000000000000000000000000000000..de2547efe098267a26bad70c5c25a465bbd949a1 --- /dev/null +++ b/lib/flexi/Template.php @@ -0,0 +1,208 @@ +<?php +/** + * Abstract template class representing the presentation layer of an action. + * Output can be customized by supplying attributes, which a template can + * manipulate and display. + * + * @copyright 2008 Marcus Lunzenauer <mlunzena@uos.de> + * @author Marcus Lunzenauer <mlunzena@uos.de> + * @license MIT + */ + +namespace Flexi; + +abstract class Template +{ + /** + * Parse, render and return the presentation. + * + * @return string A string representing the rendered presentation. + */ + abstract public function _render(): string; + + protected array $attributes = []; + protected Template|null $layout = null; + + /** + * Constructor + * + * @param string $template the path of the template. + * @param Factory $factory the factory creating this template + * @param array $options optional array of options + */ + public function __construct( + protected string $template, + protected Factory $factory, + protected array $options = [] + ) { + } + + /** + * __set() is a magic method run when writing data to inaccessible members. + * In this class it is used to set attributes for the template in a + * comfortable way. + * + * @param string $name the name of the member field + * @param mixed $value the value for the member field + * + * @see http://php.net/__set + */ + public function __set(string $name, mixed $value): void + { + $this->set_attribute($name, $value); + } + + /** + * __get() is a magic method utilized for reading data from inaccessible + * members. + * In this class it is used to get attributes for the template in a + * comfortable way. + * + * @param string $name the name of the member field + * + * @return mixed the value for the member field + * @see http://php.net/__get + */ + public function __get(string $name): mixed + { + return $this->get_attribute($name); + } + + /** + * __isset() is a magic method triggered by calling isset() or empty() on + * inaccessible members. + * In this class it is used to check for attributes for the template in a + * comfortable way. + * + * @param string $name the name of the member field + * + * @return bool TRUE if that attribute exists, FALSE otherwise + * @see http://php.net/__isset + */ + public function __isset(string $name): bool + { + return isset($this->attributes[$name]); + } + + /** + * __unset() is a magic method invoked when unset() is used on inaccessible + * members. + * In this class it is used to check for attributes for the template in a + * comfortable way. + * + * @param string $name the name of the member field + * + * @see http://php.net/__set + */ + public function __unset(string $name): void + { + $this->clear_attribute($name); + } + + /** + * Parse, render and return the presentation. + * + * @param array $attributes An optional associative array of attributes and + * their associated values. + * @param string|Template|null $layout A name of a layout template. + * + * @return string A string representing the rendered presentation. + * @throws TemplateNotFoundException + */ + public function render(array $attributes = [], string|Template $layout = null): string + { + if (isset($layout)) { + $this->set_layout($layout); + } + + # merge attributes + $this->set_attributes($attributes); + + return $this->_render(); + } + + /** + * Returns the value of an attribute. + * + * @param string $name An attribute name. + * @return mixed An attribute value. + */ + public function get_attribute(string $name) + { + return $this->attributes[$name] ?? null; + } + + /** + * Set an array of attributes. + * + * @return array An associative array of attributes and their associated + * values. + */ + public function get_attributes(): array + { + return $this->attributes; + } + + /** + * Set an attribute. + * + * @param string $name An attribute name. + * @param mixed $value An attribute value. + */ + public function set_attribute(string $name, mixed $value): void + { + $this->attributes[$name] = $value; + } + + /** + * Set an array of attributes. + * + * @param array $attributes An associative array of attributes and their + * associated values. + */ + public function set_attributes(array $attributes): void + { + $this->attributes = $attributes + $this->attributes; + } + + + /** + * Clear all attributes associated with this template. + */ + public function clear_attributes(): void + { + $this->attributes = []; + } + + /** + * Clear an attribute associated with this template. + * + * @param string $name The name of the attribute to be cleared. + */ + public function clear_attribute(string $name): void + { + unset($this->attributes[$name]); + } + + /** + * Set the template's layout. + * + * @param Template|string|null $layout A name of a layout template or a + * layout template. + * @throws TemplateNotFoundException + */ + public function set_layout(Template|string|null $layout): void + { + $this->layout = $this->factory->open($layout); + } + + /** + * Returns the template's layout. + * + * @return Template|null + */ + public function get_layout(): ?Template + { + return $this->layout; + } +} diff --git a/lib/flexi/TemplateNotFoundException.php b/lib/flexi/TemplateNotFoundException.php new file mode 100644 index 0000000000000000000000000000000000000000..dbef2c6ab8b580c5bc8328db205f487152a07b87 --- /dev/null +++ b/lib/flexi/TemplateNotFoundException.php @@ -0,0 +1,12 @@ +<?php +/** + * @copyright 2009 Marcus Lunzenauer <mlunzena@uos.de> + * @author Marcus Lunzenauer <mlunzena@uos.de> + * @license MIT + */ + +namespace Flexi; + +class TemplateNotFoundException extends \Exception +{ +} diff --git a/lib/models/Courseware/BlockTypes/BlockType.php b/lib/models/Courseware/BlockTypes/BlockType.php index b87a219fbadab02a8f05d3a18cc05df96d52c23e..37e617b8fce13eb8b9531e5c72af9de51bdc2f97 100644 --- a/lib/models/Courseware/BlockTypes/BlockType.php +++ b/lib/models/Courseware/BlockTypes/BlockType.php @@ -438,9 +438,9 @@ abstract class BlockType * It turns the classname into snakecase in order to find the * template file in templates/courseware/block_types. * - * @return mixed the \Flexi_Template instance if exists, otherwise null. + * @return \Flexi\Template|null the \Flexi\Template instance if exists, otherwise null. */ - public function getPdfHtmlTemplate(): ?\Flexi_Template + public function getPdfHtmlTemplate(): ?\Flexi\Template { $template = null; try { diff --git a/lib/models/Courseware/ContainerTypes/ContainerType.php b/lib/models/Courseware/ContainerTypes/ContainerType.php index baddaabf5c01b99b6517187e29b146e0e6e28d0b..4e816bef762fa5b4780a8f735feb4a45505dea47 100644 --- a/lib/models/Courseware/ContainerTypes/ContainerType.php +++ b/lib/models/Courseware/ContainerTypes/ContainerType.php @@ -249,9 +249,9 @@ abstract class ContainerType * It turns the classname into snakecase in order to find the * template file in templates/courseware/container_types. * - * @return mixed the \Flexi_Template instance if exists, otherwise null. + * @return \Flexi\Template|null the \Flexi\Template instance if exists, otherwise null. */ - public function getPdfHtmlTemplate(): ?\Flexi_Template + public function getPdfHtmlTemplate(): ?\Flexi\Template { $template = null; try { diff --git a/lib/models/Freetext.php b/lib/models/Freetext.php index 52182de05510b1ef09dbe0a08f751225275ee502..66b93c5d3f802b5d762e8bebaa6c6ac739349f33 100644 --- a/lib/models/Freetext.php +++ b/lib/models/Freetext.php @@ -65,12 +65,13 @@ class Freetext extends QuestionnaireQuestion implements QuestionType /** * Returns the template of this question to answer the question. - * @return Flexi_Template - * @throws Flexi_TemplateNotFoundException if there is no template. + * + * @return Flexi\Template + * @throws Flexi\TemplateNotFoundException if there is no template. */ public function getDisplayTemplate() { - $factory = new Flexi_TemplateFactory(realpath(__DIR__ . '/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__ . '/../../app/views')); $template = $factory->open('questionnaire/question_types/freetext/freetext_answer.php'); $template->vote = $this; return $template; @@ -97,9 +98,11 @@ class Freetext extends QuestionnaireQuestion implements QuestionType /** * Returns the template with the answers of the question so far. + * * @param null $only_user_ids : array of user_ids - * @return Flexi_Template - * @throws Flexi_TemplateNotFoundException if there is no template. + * + * @return Flexi\Template + * @throws Flexi\TemplateNotFoundException if there is no template. */ public function getResultTemplate($only_user_ids = null) { @@ -111,7 +114,7 @@ class Freetext extends QuestionnaireQuestion implements QuestionType } } } - $factory = new Flexi_TemplateFactory(realpath(__DIR__ . '/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__ . '/../../app/views')); $template = $factory->open('questionnaire/question_types/freetext/freetext_evaluation.php'); $template->vote = $this; $template->set_attribute('answers', $answers); diff --git a/lib/models/LikertScale.php b/lib/models/LikertScale.php index 8ac782310095a24082c58bbb1b78153c72bc4520..833d794b7f53cbd935ee003f4ce444eb36a49990 100644 --- a/lib/models/LikertScale.php +++ b/lib/models/LikertScale.php @@ -53,7 +53,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType public function getDisplayTemplate() { - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/likert/likert_answer'); $template->set_attribute('vote', $this); return $template; @@ -73,7 +73,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType public function getUserIdsOfFilteredAnswer($answer_option) { $user_ids = []; - list($statement_key, $options_key) = explode('_', $answer_option); + [$statement_key, $options_key] = explode('_', $answer_option); foreach ($this->answers as $answer) { $answerData = $answer['answerdata']->getArrayCopy(); if ($answerData['answers'][$statement_key] == $options_key) { @@ -93,7 +93,7 @@ class LikertScale extends QuestionnaireQuestion implements QuestionType } } } - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/likert/likert_evaluation'); $template->set_attribute('vote', $this); $template->set_attribute('answers', $answers); diff --git a/lib/models/OERMaterial.php b/lib/models/OERMaterial.php index 8411d149d84a2bee9884f6729704fe8e085ba69a..604f845e39126121cc70b1dddf0587cc8d53c40c 100644 --- a/lib/models/OERMaterial.php +++ b/lib/models/OERMaterial.php @@ -198,7 +198,7 @@ class OERMaterial extends SimpleORMap return $output; } - $tf = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH']."/app/views"); + $tf = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH']."/app/views"); if ($material->hasValidPreviewUrl() || $material->isPDF()) { $template = $tf->open("oer/embed/url"); } elseif ($material->isVideo()) { diff --git a/lib/models/QuestionnaireInfo.php b/lib/models/QuestionnaireInfo.php index fc6efc7bbefed26176bb59ea7e1cb40ca5b9a883..2bcf25d6ff6c5388344b2ac3bdc404a75bb6bee5 100644 --- a/lib/models/QuestionnaireInfo.php +++ b/lib/models/QuestionnaireInfo.php @@ -50,7 +50,7 @@ class QuestionnaireInfo extends QuestionnaireQuestion implements QuestionType public function getDisplayTemplate() { - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/info/info'); $template->set_attribute('vote', $this); return $template; @@ -68,7 +68,7 @@ class QuestionnaireInfo extends QuestionnaireQuestion implements QuestionType public function getResultTemplate($only_user_ids = null) { - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/info/info'); $template->set_attribute('vote', $this); return $template; diff --git a/lib/models/RangeScale.php b/lib/models/RangeScale.php index 78bc65b12ac12ff8499ef52dd1c3f19b205a27f5..44b946beb802f269e55444ee09781d097eb51515 100644 --- a/lib/models/RangeScale.php +++ b/lib/models/RangeScale.php @@ -53,7 +53,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType public function getDisplayTemplate() { - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/rangescale/rangescale_answer'); $template->set_attribute('vote', $this); return $template; @@ -72,7 +72,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType public function getUserIdsOfFilteredAnswer($answer_option) { $user_ids = []; - list($statement_key, $options_key) = explode('_', $answer_option); + [$statement_key, $options_key] = explode('_', $answer_option); foreach ($this->answers as $answer) { $answerData = $answer['answerdata']->getArrayCopy(); if ($answerData['answers'][$statement_key] == $options_key) { @@ -92,7 +92,7 @@ class RangeScale extends QuestionnaireQuestion implements QuestionType } } } - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/rangescale/rangescale_evaluation'); $template->set_attribute('vote', $this); $template->set_attribute('answers', $answers); diff --git a/lib/models/Vote.php b/lib/models/Vote.php index 0520401296f3a24a850df3af10ab27ecc15cc01e..ede0ceafab43d64af10eadf36fc04cc0ab1c8229 100644 --- a/lib/models/Vote.php +++ b/lib/models/Vote.php @@ -53,7 +53,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType public function getDisplayTemplate() { - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/vote/vote_answer'); $template->set_attribute('vote', $this); return $template; @@ -100,7 +100,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType } } } - $factory = new Flexi_TemplateFactory(realpath(__DIR__.'/../../app/views')); + $factory = new Flexi\Factory(realpath(__DIR__.'/../../app/views')); $template = $factory->open('questionnaire/question_types/vote/vote_evaluation'); $template->set_attribute('vote', $this); $template->set_attribute('answers', $answers); diff --git a/lib/models/calendar/CalendarDate.class.php b/lib/models/calendar/CalendarDate.class.php index 7026ece1d8a2dad5d54f0b2fa4a1227c13a35ea2..d901cf18b219961526342c222637f1e4ae314907 100644 --- a/lib/models/calendar/CalendarDate.class.php +++ b/lib/models/calendar/CalendarDate.class.php @@ -114,7 +114,7 @@ class CalendarDate extends SimpleORMap implements PrivacyObject public function cbSendDateModificationMail() { - $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); + $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); foreach ($this->calendars as $calendar) { if ($calendar->range_id === $this->editor_id) { diff --git a/lib/models/calendar/CalendarDateAssignment.class.php b/lib/models/calendar/CalendarDateAssignment.class.php index bd99dd3335b7bcd36b7bd8256d86f78ec6899111..e0bf467fe86ad7ef4a298c9bc52e53e076363120 100644 --- a/lib/models/calendar/CalendarDateAssignment.class.php +++ b/lib/models/calendar/CalendarDateAssignment.class.php @@ -79,7 +79,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event return; } - $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); + $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); setTempLanguage($this->range_id); $lang_path = getUserLanguagePath($this->range_id); @@ -112,7 +112,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event return; } - $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); + $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); setTempLanguage($this->range_id); $lang_path = getUserLanguagePath($this->range_id); @@ -160,7 +160,7 @@ class CalendarDateAssignment extends SimpleORMap implements Event return; } - $template_factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); + $template_factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/locale/'); setTempLanguage($this->range_id); $lang_path = getUserLanguagePath($this->range_id); diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php index f55b3b372fc38f4cf2d6c73280892ffcf9ceaf35..fadf92fd9429e8fcbd82b14dc5d0a05b3f106fa7 100644 --- a/lib/models/resources/ResourceBooking.class.php +++ b/lib/models/resources/ResourceBooking.class.php @@ -876,7 +876,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen $deleted_c = 0; - $template_factory = new Flexi_TemplateFactory( + $template_factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); @@ -1917,7 +1917,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen return; } - $template_factory = new Flexi_TemplateFactory( + $template_factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); setTempLanguage($booking_user->id); diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php index 82d29c91907a6ab6853d176e17fa920ad467eef5..450ec001e12396a38fce94f8de0e18d89dc504ae 100644 --- a/lib/models/resources/ResourcePropertyDefinition.class.php +++ b/lib/models/resources/ResourcePropertyDefinition.class.php @@ -221,7 +221,7 @@ class ResourcePropertyDefinition extends SimpleORMap ); } } elseif ($type === 'position') { - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH']); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH']); $template = $factory->open('templates/resources/position_attribute_form_part.php'); $template->set_attribute( 'input_name', diff --git a/lib/models/resources/ResourceRequest.class.php b/lib/models/resources/ResourceRequest.class.php index 6b22b443cfa763910b5a8d67028936d41e35f3c0..9cad900a4c95fa1e622f2258db08b84fbfb800b3 100644 --- a/lib/models/resources/ResourceRequest.class.php +++ b/lib/models/resources/ResourceRequest.class.php @@ -1963,7 +1963,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen return; } - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); @@ -2020,7 +2020,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen */ public function sendCloseRequestMailToRequester($bookings = []) { - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); @@ -2110,7 +2110,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen ); if ($lecturers) { - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); @@ -2199,7 +2199,7 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen } //Load the mail template: - $factory = new Flexi_TemplateFactory( + $factory = new Flexi\Factory( $GLOBALS['STUDIP_BASE_PATH'] . '/locale/' ); $user_lang_path = getUserLanguagePath($user->id); diff --git a/lib/modules/ScheduleWidget.php b/lib/modules/ScheduleWidget.php index 5adc8017c38f3fc3c47440e34679696604608a32..c4ab769fe5d2c7a502c3fb1baded55b5c99b1b80 100644 --- a/lib/modules/ScheduleWidget.php +++ b/lib/modules/ScheduleWidget.php @@ -35,7 +35,7 @@ class ScheduleWidget extends CorePlugin implements PortalPlugin /** * Return the template for the widget. * - * @return Flexi_PhpTemplate The template containing the widget contents + * @return Flexi\PhpTemplate The template containing the widget contents */ public function getPortalTemplate() { diff --git a/lib/modules/StudipModule.class.php b/lib/modules/StudipModule.class.php index 6cbcaf9a8e3b16726ad4a7fa1fd9481ee0d2c6fc..c281d29fb83ef7050fc7dff29da9c772bf1cb298 100644 --- a/lib/modules/StudipModule.class.php +++ b/lib/modules/StudipModule.class.php @@ -54,7 +54,7 @@ interface StudipModule public function getMetadata(); /** - * Return a template (an instance of the Flexi_Template class) + * Return a template (an instance of the Flexi\Template class) * to be rendered on the course summary page. Return NULL to * render nothing for this plugin. * @@ -66,7 +66,7 @@ interface StudipModule * admin_url admin link for this plugin (if any) * admin_title title for admin link (default: Administration) * - * @return object template object to render or NULL + * @return Flexi\Template|null template object to render or NULL */ public function getInfoTemplate($course_id); } diff --git a/lib/plugins/core/AdminCourseContents.class.php b/lib/plugins/core/AdminCourseContents.class.php index 065cc9ee663f86e8dc6e2fc2f1745deac0f39e1b..0e07b587b2e5c1cd2458b4949f3e8f0768e47c11 100644 --- a/lib/plugins/core/AdminCourseContents.class.php +++ b/lib/plugins/core/AdminCourseContents.class.php @@ -15,9 +15,11 @@ interface AdminCourseContents /** * Returns the value of the additional column for the course-overview table in the admin-area. + * * @param Course $course : A Course-object of the given ... course * @param string $index : the index that comes from adminAvailableContents to identify the column. - * @return Flexi_Template | String : Either one will do, but string is preferred, because it can exported as CSV-file more easily. + * + * @return Flexi\Template | String : Either one will do, but string is preferred, because it can exported as CSV-file more easily. */ public function adminAreaGetCourseContent($course, $index); } diff --git a/lib/plugins/core/DetailspagePlugin.class.php b/lib/plugins/core/DetailspagePlugin.class.php index 15eda095d01ca738c7e9c03fa1aa4eba3be4ca1e..36e6efa9d7ef4f38163047fbc5fe08020579cef8 100644 --- a/lib/plugins/core/DetailspagePlugin.class.php +++ b/lib/plugins/core/DetailspagePlugin.class.php @@ -12,7 +12,7 @@ interface DetailspagePlugin { /** - * Return a template (an instance of the Flexi_Template class) + * Return a template (an instance of the Flexi\Template class) * to be rendered on the details page. Return NULL to * render nothing for this plugin or this course. * @@ -21,7 +21,7 @@ interface DetailspagePlugin * * title title to display, defaults to plugin name * - * @return object template object to render or NULL + * @return Flexi\Template|null template object to render or NULL */ public function getDetailspageTemplate($course); } diff --git a/lib/plugins/core/ExternPagePlugin.php b/lib/plugins/core/ExternPagePlugin.php index 5b407758d51cfc9253e5150db8794c3a43cb1b58..d12efc577a0f2c208067a9e586b88ce01bf4bf70 100644 --- a/lib/plugins/core/ExternPagePlugin.php +++ b/lib/plugins/core/ExternPagePlugin.php @@ -42,10 +42,10 @@ interface ExternPagePlugin public function getExternPage(ExternPageConfig $config): ExternPage; /** - * Returns a Flexi_Template or a path to the template file. This template contains the form + * Returns a Flexi\Template or a path to the template file. This template contains the form * to configure the external page. * - * @return string|Flexi_Template + * @return string|Flexi\Template */ public function getConfigurationFormTemplate(); diff --git a/lib/plugins/core/FilesystemPlugin.class.php b/lib/plugins/core/FilesystemPlugin.class.php index 6d4c46cb04c95300c0f6242f30c1e7ee81ebf6f0..31b4b5bf313bd81df56b5b8fcb87c92ad02e288f 100644 --- a/lib/plugins/core/FilesystemPlugin.class.php +++ b/lib/plugins/core/FilesystemPlugin.class.php @@ -34,11 +34,12 @@ interface FilesystemPlugin /** * This method is used to get a folder-object for this plugin. - * Not recommended but still possible is to return a Flexi_Template for the folder, if you want to + * Not recommended but still possible is to return a Flexi\Template for the folder, if you want to * take care of the frontend of displaying the folder as well. * * @param null $folder_id : folder_id of folder to get or null if you want the top-folder - * @return FolderType|Flexi_Template + * + * @return FolderType|Flexi\Template */ public function getFolder($folder_id = null); diff --git a/lib/plugins/core/HomepagePlugin.class.php b/lib/plugins/core/HomepagePlugin.class.php index 74d0204965182e6f52ca0d47e351c823623f39da..37efb54e66e3a01cd58d642d469203bbee009019 100644 --- a/lib/plugins/core/HomepagePlugin.class.php +++ b/lib/plugins/core/HomepagePlugin.class.php @@ -15,7 +15,7 @@ interface HomepagePlugin { /** - * Return a template (an instance of the Flexi_Template class) + * Return a template (an instance of the Flexi\Template class) * to be rendered on the given user's home page. Return NULL to * render nothing for this plugin. * @@ -27,7 +27,7 @@ interface HomepagePlugin * admin_url admin link for this plugin (if any) * admin_title title for admin link (default: Administration) * - * @return object template object to render or NULL + * @return Flexi\Template|null template object to render or NULL */ function getHomepageTemplate($user_id); } diff --git a/lib/plugins/core/PortalPlugin.class.php b/lib/plugins/core/PortalPlugin.class.php index dce5774f96576fce5b2ea36ca3d9bf943f3bb7a8..cb5aca434623738229a547a12b5d46b34f04c2fe 100644 --- a/lib/plugins/core/PortalPlugin.class.php +++ b/lib/plugins/core/PortalPlugin.class.php @@ -15,7 +15,7 @@ interface PortalPlugin { /** - * Return a template (an instance of the Flexi_Template class) + * Return a template (an instance of the Flexi\Template class) * to be rendered on the start or portal page. Return NULL to * render nothing for this plugin. * @@ -27,7 +27,7 @@ interface PortalPlugin * admin_url admin link for this plugin (if any) * admin_title title for admin link (default: Administration) * - * @return ?Flexi_Template template object to render or NULL + * @return ?Flexi\Template template object to render or NULL */ function getPortalTemplate(); } diff --git a/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php b/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php index 6892f8a1ea7fb71f84820d77e6bedc7492c9756f..cadaf521b5660efec29f2dca2682fe84bb494554 100644 --- a/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php +++ b/lib/plugins/core/QuestionnaireAssignmentPlugin.class.php @@ -39,8 +39,10 @@ interface QuestionnaireAssignmentPlugin * This template will get displayed when someone at tools -> questionnaires * wants to edit the contexts of the questionnaire. Maybe you don't want to provide a * template here, so return null or just a readonly html-snippet. + * * @param Questionnaire $questionnaire - * @return null|Flexi_Template + * + * @return null|Flexi\Template */ public function getQuestionnaireAssignmentEditTemplate(Questionnaire $questionnaire); diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php index 1a58695bd28b55c7167e84096c75bae740b08e25..3268935d6278b9b0051022efc964948ed229c5c7 100644 --- a/lib/raumzeit/SingleDate.class.php +++ b/lib/raumzeit/SingleDate.class.php @@ -861,7 +861,7 @@ class SingleDate */ function getDatesTemplate($template) { - if (!$template instanceof Flexi_Template && is_string($template)) { + if (!$template instanceof Flexi\Template && is_string($template)) { $template = $GLOBALS['template_factory']->open($template); } diff --git a/public/install.php b/public/install.php index 6d719699c9538dae137752e4f8378a96ea13f995..24725c3b046525354c2a8b472ffc2fabb38216ae 100644 --- a/public/install.php +++ b/public/install.php @@ -41,7 +41,7 @@ if (!function_exists('_')) { require_once 'lib/language.inc.php'; foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) { - list($lang, ) = explode(';', $lang); + [$lang, ] = explode(';', $lang); $lang = substr($lang, 0, 2); if (!in_array($lang, ['de', 'en'])) { @@ -53,7 +53,7 @@ if (!function_exists('_')) { } } -$GLOBALS['template_factory'] = new Flexi_TemplateFactory('../templates/'); +$GLOBALS['template_factory'] = new Flexi\Factory('../templates/'); # get plugin class from request $dispatch_to = ltrim(Request::pathInfo(), '/'); diff --git a/public/web_migrate.php b/public/web_migrate.php index 79fba05449e67548b81baeb30790543ae27fe9fc..c01c6002074336731a6951f05327f7c67be2cf68 100644 --- a/public/web_migrate.php +++ b/public/web_migrate.php @@ -31,7 +31,7 @@ if (empty($_SESSION['_language'])) { $_language_path = init_i18n($_SESSION['_language']); -$GLOBALS['template_factory'] = new Flexi_TemplateFactory('../templates/'); +$GLOBALS['template_factory'] = new Flexi\Factory('../templates/'); # get plugin class from request $dispatch_to = Request::pathInfo() ?: ''; diff --git a/templates/contentbar/contentbar.php b/templates/contentbar/contentbar.php index fef7fd8c0f4bc46fc0bc563d6956ce148757fdda..f9b42edc6b2c41e31eae9728d9e9bbf9e9ada06d 100644 --- a/templates/contentbar/contentbar.php +++ b/templates/contentbar/contentbar.php @@ -1,11 +1,11 @@ <?php /** - * @var TOCItem $toc - * @var Icon $icon - * @var Flexi_Template $breadcrumbs - * @var string $info - * @var ActionMenu $actionMenu - * @var Flexi_Template $ttpl + * @var TOCItem $toc + * @var Icon $icon + * @var Flexi\Template $breadcrumbs + * @var string $info + * @var ActionMenu $actionMenu + * @var Flexi\Template $ttpl */ ?> <section> diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php index 8a9125b45a43e57c2d0c47054354a470a347a174..1745a1a0b7db55138af6270c4ae14c82fd51dcfc 100644 --- a/tests/functional/_bootstrap.php +++ b/tests/functional/_bootstrap.php @@ -34,6 +34,7 @@ StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/classes/cache'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/classes/cache', 'Studip'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/exceptions'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/exceptions/resources'); +StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/flexi', 'Flexi'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/filesystem'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/migrations'); StudipAutoloader::addAutoloadPath($STUDIP_BASE_PATH . '/lib/models'); @@ -64,8 +65,7 @@ require 'vendor/email_message/email_message.php'; require 'vendor/email_message/debug_message.php'; StudipMail::setDefaultTransporter(new debug_message_class()); -require_once 'vendor/flexi/lib/flexi.php'; -$GLOBALS['template_factory'] = new Flexi_TemplateFactory(dirname(dirname(__DIR__)) . '/templates'); +$GLOBALS['template_factory'] = new Flexi\Factory(dirname(dirname(__DIR__)) . '/templates'); // Disable caching to fallback to memory cache $GLOBALS['CACHING_ENABLE'] = false; diff --git a/tests/jsonapi/BlubberThreadsCreateTest.php b/tests/jsonapi/BlubberThreadsCreateTest.php index 17846f891a47258d91dffa3c508d4593ffa63a81..d2bdaea1a7eaa64b9beab279d3b0fa5c6885d5c4 100644 --- a/tests/jsonapi/BlubberThreadsCreateTest.php +++ b/tests/jsonapi/BlubberThreadsCreateTest.php @@ -22,7 +22,7 @@ class BlubberThreadsCreateTest extends \Codeception\Test\Unit // Create global template factory if neccessary $has_template_factory = isset($GLOBALS['template_factory']); if (!$has_template_factory) { - $GLOBALS['template_factory'] = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); + $GLOBALS['template_factory'] = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); } } diff --git a/tests/jsonapi/BlubberThreadsIndexTest.php b/tests/jsonapi/BlubberThreadsIndexTest.php index ab6d200fd2ff6b1f15a1f9f208c655a1146c9ea8..14173d3278ad3eb738b96b12bcdaec2cc584caa2 100644 --- a/tests/jsonapi/BlubberThreadsIndexTest.php +++ b/tests/jsonapi/BlubberThreadsIndexTest.php @@ -1,6 +1,5 @@ <?php -use JsonApi\Errors\RecordNotFoundException; use JsonApi\Routes\Blubber\ThreadsIndex; require_once 'BlubberTestHelper.php'; @@ -21,7 +20,7 @@ class BlubberThreadsIndexTest extends \Codeception\Test\Unit // Create global template factory if neccessary $has_template_factory = isset($GLOBALS['template_factory']); if (!$has_template_factory) { - $GLOBALS['template_factory'] = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); + $GLOBALS['template_factory'] = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); } } diff --git a/tests/jsonapi/BlubberThreadsShowTest.php b/tests/jsonapi/BlubberThreadsShowTest.php index 932b7684c62d2e0b36d891d1e6d44fcc7a2fb3dd..875fc8c87d770d2320e94cfc17a1c506986c407d 100644 --- a/tests/jsonapi/BlubberThreadsShowTest.php +++ b/tests/jsonapi/BlubberThreadsShowTest.php @@ -23,7 +23,7 @@ class BlubberThreadsShowTest extends \Codeception\Test\Unit // Create global template factory if neccessary $has_template_factory = isset($GLOBALS['template_factory']); if (!$has_template_factory) { - $GLOBALS['template_factory'] = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); + $GLOBALS['template_factory'] = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); } } diff --git a/tests/jsonapi/ConsultationHelper.php b/tests/jsonapi/ConsultationHelper.php index a46cb473ed865d616fad5eeafa044acc43455fb1..673174e13660e96451c72e3301d54e7fb25ea52f 100644 --- a/tests/jsonapi/ConsultationHelper.php +++ b/tests/jsonapi/ConsultationHelper.php @@ -3,9 +3,6 @@ use WoohooLabs\Yang\JsonApi\Response\JsonApiResponse; use WoohooLabs\Yang\JsonApi\Schema\Document; use WoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject; -// Required for consultation mailer -require_once 'vendor/flexi/flexi.php'; - trait ConsultationHelper { /** @@ -96,7 +93,7 @@ trait ConsultationHelper // Create global template factory if neccessary $has_template_factory = isset($GLOBALS['template_factory']); if (!$has_template_factory) { - $GLOBALS['template_factory'] = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); + $GLOBALS['template_factory'] = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/templates'); } $result = $this->tester->withPHPLib($credentials, $fn); diff --git a/tests/jsonapi/_bootstrap.php b/tests/jsonapi/_bootstrap.php index cb6df0444fe939dbdd7f3912f8603b1005a8900a..dea1c813910a6ac5f9aaceb86dbbcd0298df35c0 100644 --- a/tests/jsonapi/_bootstrap.php +++ b/tests/jsonapi/_bootstrap.php @@ -45,6 +45,7 @@ StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/models/cale StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/models/resources'); StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/classes'); StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/classes', 'Studip'); +StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/flexi', 'Flexi'); // Plugins StudipAutoloader::addAutoloadPath($GLOBALS['STUDIP_BASE_PATH'].'/lib/plugins/core'); diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php index af956074d8511d123290bd9e95e47f802231b67b..a1dbdd1deb73056f0b1c46f05b1dc4200a4b2b6a 100644 --- a/tests/unit/_bootstrap.php +++ b/tests/unit/_bootstrap.php @@ -53,12 +53,12 @@ StudipAutoloader::addAutoloadPath('lib/activities', 'Studip\\Activity'); StudipAutoloader::addAutoloadPath('lib/models'); StudipAutoloader::addAutoloadPath('lib/classes'); StudipAutoloader::addAutoloadPath('lib/classes', 'Studip'); -StudipAutoloader::addAutoloadPath('lib/exTpl', 'exTpl'); -StudipAutoloader::addAutoloadPath('lib/classes/cache'); StudipAutoloader::addAutoloadPath('lib/classes/cache', 'Studip'); -StudipAutoloader::addAutoloadPath('lib/exceptions'); StudipAutoloader::addAutoloadPath('lib/classes/sidebar'); StudipAutoloader::addAutoloadPath('lib/classes/helpbar'); +StudipAutoloader::addAutoloadPath('lib/exTpl', 'exTpl'); +StudipAutoloader::addAutoloadPath('lib/exceptions'); +StudipAutoloader::addAutoloadPath('lib/flexi', 'Flexi'); StudipAutoloader::addAutoloadPath('lib/plugins/engine'); StudipAutoloader::addAutoloadPath('lib/plugins/core'); StudipAutoloader::addAutoloadPath('lib/plugins/db'); diff --git a/tests/unit/lib/classes/StudipFileloaderTest.php b/tests/unit/lib/classes/StudipFileloaderTest.php index 62c5e0491d48679e1b18d8ae36e30f9b39b01c6a..102aaacfaddb3cfe04ca371890b388dc81041c5b 100644 --- a/tests/unit/lib/classes/StudipFileloaderTest.php +++ b/tests/unit/lib/classes/StudipFileloaderTest.php @@ -20,7 +20,7 @@ class StudipFileloaderTestCase extends \Codeception\Test\Unit ]); if (!stream_wrapper_register('var', 'ArrayFileStream')) { - new Exception('Failed to register protocol'); + throw new Exception('Failed to register protocol'); } } diff --git a/tests/unit/lib/flexi/FactoryTest.php b/tests/unit/lib/flexi/FactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2df9f6aaae74177281b5f14988dfd39517c14f8c --- /dev/null +++ b/tests/unit/lib/flexi/FactoryTest.php @@ -0,0 +1,119 @@ +<?php + +use Flexi\Factory; +use Flexi\TemplateNotFoundException; +use Flexi\PhpTemplate; + +final class FactoryTestCase extends \Codeception\Test\Unit +{ + private Factory $factory; + + public function setUp(): void + { + $this->setUpFS(); + + $this->factory = new Factory('var://templates'); + } + + public function tearDown(): void + { + unset($this->factory); + stream_wrapper_unregister('var'); + } + + public function setUpFS(): void + { + ArrayFileStream::set_filesystem([ + 'templates' => [ + 'foo.php' => 'some content', + 'baz.unknown' => 'some content', + 'multiplebasenames' => [ + 'foo.txt' => 'there is no matching template class', + 'foo.php' => 'some content', + 'bar.txt' => 'there is no matching template class', + ], + 'baz.known-ext' => 'some content', + ], + ]); + if (!stream_wrapper_register('var', ArrayFileStream::class)) { + die('Failed to register protocol'); + } + } + + public function testShouldCreateFactory() + { + $factory = new Factory('.'); + $this->assertNotNull($factory); + } + + public function testShouldCreateFactoryUsingPath() + { + $path = 'var://'; + $factory = new Factory($path); + $this->assertNotNull($factory); + } + + public function testShouldOpenTemplateUsingRelativePath() + { + $foo = $this->factory->open('foo'); + $this->assertNotNull($foo); + } + + public function testShouldOpenTemplateUsingAbsolutePath() + { + $foo = $this->factory->open('var://templates/foo'); + $this->assertNotNull($foo); + } + + public function testShouldThrowAnExceptionOpeningAMissingTemplateWithoutFileExtension() + { + $this->expectException(TemplateNotFoundException::class); + $this->factory->open('bar'); + } + + public function testShouldThrowAnExceptionOpeningAMissingTemplateWithFileExtension() + { + $this->expectException(TemplateNotFoundException::class); + $this->factory->open('bar.php'); + } + + public function testShouldOpenTemplateUsingExtension() + { + $this->assertInstanceOf( + PhpTemplate::class, + $this->factory->open('foo.php') + ); + } + + public function testShouldThrowAnExceptionWhenOpeningATemplateWithUnknownExtension() + { + $this->expectException(TemplateNotFoundException::class); + $this->factory->open('baz'); + } + + public function testShouldThrowAnExceptionOpeningATemplateInANonExistingDirectory() + { + $this->expectException(TemplateNotFoundException::class); + $this->factory->open('doesnotexist/foo'); + } + + public function testShouldSearchForASupportedTemplate() + { + $this->assertInstanceOf( + PhpTemplate::class, + $this->factory->open('multiplebasenames/foo') + ); + } + + public function testShouldRespondToAddedHandlers() + { + $handler = new class('', $this->factory) extends Flexi\Template { + public function _render(): string + { + return ''; + } + }; + $this->factory->add_handler('known-ext', $handler::class); + $this->factory->open('baz.known-ext'); + } +} diff --git a/tests/unit/lib/flexi/PHPTemplatePartialBugTest.php b/tests/unit/lib/flexi/PHPTemplatePartialBugTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ef265cf22c43d8f173f7e9642ada7a35051a25f9 --- /dev/null +++ b/tests/unit/lib/flexi/PHPTemplatePartialBugTest.php @@ -0,0 +1,45 @@ +<?php + +use Flexi\Factory; + +final class PhpTemplatePartialBugTestCase extends Codeception\Test\Unit +{ + public function setUp(): void + { + $this->setUpFS(); + $this->factory = new Factory('var://templates/'); + } + + public function tearDown(): void + { + unset($this->factory); + + stream_wrapper_unregister("var"); + } + + public function setUpFS(): void + { + ArrayFileStream::set_filesystem([ + 'templates' => [ + 'layout.php' => + '<? $do_not_echo_this = $this->render_partial_collection("partial", range(1, 5));' . + 'echo $content_for_layout;', + 'partial.php' => + 'partial', + 'template.php' => + 'template', + ] + ]); + if (!stream_wrapper_register('var', ArrayFileStream::class)) { + die('Failed to register protocol'); + } + } + + public function testPartialBug() + { + $template = $this->factory->open('template'); + $template->set_layout('layout'); + $result = $template->render(); + $this->assertEquals($result, "template"); + } +} diff --git a/tests/unit/lib/flexi/PHPTemplateTest.php b/tests/unit/lib/flexi/PHPTemplateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5dfd2470532506b5fa503fa5599f7e287bfcfa61 --- /dev/null +++ b/tests/unit/lib/flexi/PHPTemplateTest.php @@ -0,0 +1,136 @@ +<?php + +use Flexi\Factory; +use Flexi\TemplateNotFoundException; + +final class PhpTemplateTestCase extends Codeception\Test\Unit +{ + private Factory $factory; + + public function setUp(): void + { + $this->setUpFS(); + $this->factory = new Factory('var://templates/'); + } + + + public function tearDown(): void + { + unset($this->factory); + + stream_wrapper_unregister('var'); + } + + public function setUpFS() + { + ArrayFileStream::set_filesystem([ + 'templates' => [ + 'foo_using_partial.php' => + 'Hello, <?= $this->render_partial("foos_partial") ?>!', + + 'foos_partial.php' => + '<h1><?= $whom ?> at <?= $when ?></h1>', + + 'foo_with_partial_collection.php' => + '[<?= $this->render_partial_collection("item", $items, "spacer") ?>]', + + 'item.php' => + '"<?= $item ?>"', + + 'spacer.php' => + ', ', + + 'attributes.php' => + '<? foreach (get_defined_vars() as $name => $value) : ?>' . + '<?= $name ?><?= $value ?>' . + '<? endforeach ?>', + + 'foo.php' => + 'Hello, <?= $whom ?>!', + + 'layout.php' => + '[<?= $content_for_layout ?>]', + ] + ]); + if (!stream_wrapper_register('var', ArrayFileStream::class)) { + die('Failed to register protocol'); + } + } + + public function testRenderPartial() + { + $template = $this->factory->open('foo_using_partial'); + $template->set_attribute('whom', 'bar'); + $this->assertEquals( + 'Hello, <h1>bar at now</h1>!', + $template->render(['when' => 'now']) + ); + } + + public function testRenderPartialCollection() + { + $template = $this->factory->open('foo_with_partial_collection'); + $result = $template->render_partial_collection( + 'item', + range(1, 3), + 'spacer' + ); + $this->assertEquals('"1", "2", "3"', $result); + } + + public function testShouldOverrideAttributesWithThosePassedToRender() + { + $template = $this->factory->open('attributes'); + $template->set_attribute('foo', 'baz'); + + $template->render(['foo' => 'bar']); + $this->assertEquals('bar', $template->get_attribute('foo')); + + $template->render(); + $this->assertEquals('bar', $template->get_attribute('foo')); + } + + public function testRenderWithoutLayout() + { + $foo = $this->factory->open('foo'); + $foo->set_attribute('whom', 'bar'); + $this->assertEquals('Hello, bar!', $foo->render()); + } + + public function testRenderWithLayout() + { + $foo = $this->factory->open('foo'); + $foo->set_attribute('whom', 'bar'); + $foo->set_layout('layout'); + $out = $foo->render(); + $this->assertEquals('[Hello, bar!]', $out); + } + + public function testRenderWithLayoutInline() + { + $this->assertEquals( + '[Hello, bar!]', + $this->factory->render('foo', ['whom' => 'bar'], 'layout') + ); + } + + public function testRenderWithMissingLayout() + { + $foo = $this->factory->open('foo'); + $this->expectException(TemplateNotFoundException::class); + $foo->set_layout('nosuchlayout'); + } + + public function testRenderWithAttributes() + { + $foo = $this->factory->open('foo'); + $foo->set_attribute('whom', 'bar'); + $foo->set_layout('layout'); + $foo_out = $foo->render(); + + $bar = $this->factory->open('foo'); + $bar_out = $bar->render(['whom' => 'bar'], 'layout'); + + $this->assertEquals($foo_out, $bar_out); + } +} diff --git a/tests/unit/lib/flexi/TemplateEmptyTest.php b/tests/unit/lib/flexi/TemplateEmptyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c5ebd79e4a7954179fb6f730752af5f3d320a995 --- /dev/null +++ b/tests/unit/lib/flexi/TemplateEmptyTest.php @@ -0,0 +1,44 @@ +<?php + +use Flexi\Factory; +use Flexi\Template; + +final class TemplateEmptyTestCase extends \Codeception\Test\Unit +{ + private Factory $factory; + + public function setUp(): void + { + $this->factory = $this->make(Factory::class, [ + 'open' => $this->make(Template::class), + ]); + } + + public function tearDown(): void + { + unset($this->factory); + } + + public function testShouldHaveNoAttributes() + { + $template = $this->factory->open(''); + $this->assertCount(0, $template->get_attributes()); + } + + public function testShouldNotBeEmptyAfterSettingAnAttribute() + { + $template = $this->factory->open(''); + $template->set_attribute('foo', 'bar'); + $this->assertNotEmpty($template->get_attributes()); + } + + public function testShouldBeEmptyAfterClear() + { + $template = $this->factory->open('foo'); + + $this->assertEmpty($template->get_attributes()); + + $template->clear_attributes(); + $this->assertEmpty($template->get_attributes()); + } +} diff --git a/tests/unit/lib/flexi/TemplateMagicMethodsTest.php b/tests/unit/lib/flexi/TemplateMagicMethodsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ad2690a743064d061c6a4860d31fa659889f577c --- /dev/null +++ b/tests/unit/lib/flexi/TemplateMagicMethodsTest.php @@ -0,0 +1,78 @@ +<?php + +use Flexi\Factory; +use Flexi\Template; + +final class TemplateMagicMethodsTestCase extends \Codeception\Test\Unit +{ + private Factory $factory; + + public function setUp(): void + { + $this->factory = $this->make(Factory::class, [ + 'open' => $this->make(Template::class), + ]); + $this->template = $this->factory->open(''); + } + + public function tearDown(): void + { + unset($this->factory); + unset($this->template); + } + + public function testShouldSetAnAttributeUsingTheMagicMethods() + { + $this->template->foo = 'bar'; + $this->assertEquals('bar', $this->template->get_attribute('foo')); + } + + public function testShouldNotSetAProtectedMemberFieldAsAnAttribute() + { + $this->template->layout = 'bar'; + $this->assertEquals('bar', $this->template->layout); + $this->assertNotEquals('bar', $this->template->get_layout()); + } + + public function testShouldOverwriteAnAttribute() + { + $this->template->set_attribute('foo', 'bar'); + $this->template->foo = 'baz'; + $this->assertEquals('baz', $this->template->get_attribute('foo')); + } + + public function testShouldReturnAnExistingAttributeUsingTheMagicMethods() + { + $this->template->set_attribute('foo', 'bar'); + $this->assertEquals('bar', $this->template->foo); + } + + public function testShouldReturnNullForANonExistingAttributeUsingTheMagicMethods() + { + $this->assertNull($this->template->foo); + } + + public function testShouldUnsetAnAttributeUsingTheMagicMethods() + { + $this->template->foo = 'bar'; + unset($this->template->foo); + $this->assertNull($this->template->foo); + } + + public function testShouldReturnNullOnUnsettingANonAttribute() + { + unset($this->template->foo); + $this->assertNull($this->template->foo); + } + + public function testShouldReturnTrueOnIssetForAnAttribute() + { + $this->template->foo = 'bar'; + $this->assertTrue(isset($this->template->foo)); + } + + public function testShouldReturnFalseOnIssetForANonExistingAttribute() + { + $this->assertFalse(isset($this->template->foo)); + } +} diff --git a/tests/unit/lib/flexi/TemplateTest.php b/tests/unit/lib/flexi/TemplateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..95e91458b177a178808ee29fa847c6f28e6602dc --- /dev/null +++ b/tests/unit/lib/flexi/TemplateTest.php @@ -0,0 +1,68 @@ +<?php + +use Flexi\Factory; +use Flexi\Template; + +final class TemplateTestCase extends \Codeception\Test\Unit +{ + private Factory $factory; + + public function setUp(): void + { + $this->factory = $this->make(Factory::class, [ + 'open' => $this->make(Template::class), + ]); + } + + public function tearDown(): void + { + unset($this->factory); + } + + public function testShouldReturnAPreviouslySetAttribute() + { + $template = $this->factory->open('foo'); + $template->set_attribute('whom', 'bar'); + $this->assertEquals('bar', $template->get_attribute('whom')); + } + + public function testShouldReturnPreviouslySetAttributes() + { + $template = $this->factory->open('foo'); + $template->set_attributes(['whom' => 'bar', 'foo' => 'baz']); + + $attributes = $template->get_attributes(); + $this->assertIsArray($attributes); + $this->assertCount(2, $attributes); + $this->assertEquals('bar', $attributes['whom']); + $this->assertEquals('baz', $attributes['foo']); + } + + public function testShouldMergeAttributesWithSetAttributes() + { + $template = $this->factory->open('foo'); + $template->set_attributes(['a' => 1, 'b' => 2]); + + $this->assertCount(2, $template->get_attributes()); + $this->assertEquals(1, $template->get_attribute('a')); + $this->assertEquals(2, $template->get_attribute('b')); + + $template->set_attributes(['b' => 8, 'c' => 9]); + + $this->assertCount(3, $template->get_attributes()); + $this->assertEquals(1, $template->get_attribute('a')); + $this->assertEquals(8, $template->get_attribute('b')); + $this->assertEquals(9, $template->get_attribute('c')); + } + + public function testShouldBeEmptyAfterClear() + { + $template = $this->factory->open('foo'); + + $template->set_attributes(['a' => 1, 'b' => 2]); + $this->assertNotEmpty($template->get_attributes()); + + $template->clear_attributes(); + $this->assertCount(0, $template->get_attributes()); + } +} diff --git a/tests/unit/varstream.php b/tests/unit/varstream.php index 9a3acb55c776e5f7e4589fd8ad5d949fa8b59419..d2047c07395b413a5acd511f6f6363ed302c145c 100644 --- a/tests/unit/varstream.php +++ b/tests/unit/varstream.php @@ -7,15 +7,17 @@ class ArrayFileStream private static $fs; - static function set_filesystem(array $fs) { + static function set_filesystem(array $fs) + { ArrayFileStream::$fs = $fs; } - private static function &get_element($path) { + private static function &get_element($path) + { $result =& ArrayFileStream::$fs; foreach (preg_split('/\//', $path, -1, PREG_SPLIT_NO_EMPTY) as $element) { if (!isset($result[$element])) { - $null = NULL; + $null = null; return $null; } $result =& $result[$element]; @@ -23,9 +25,10 @@ class ArrayFileStream return $result; } - private static function &get_file($path) { + private static function &get_file($path) + { $url = parse_url($path); - $file =& self::get_element($url['host'] . $url['path']); + $file =& self::get_element($url['host'] . ($url['path'] ?? '')); if (is_null($file)) { throw new Exception("file not found."); @@ -33,15 +36,18 @@ class ArrayFileStream return $file; } - public function stream_close() { + public function stream_close() + { # nothing to do } - public function stream_flush() { + public function stream_flush() + { # nothing to do } - public function stream_open($path, $mode, $options, $opened_path) { + public function stream_open($path, $mode, $options, $opened_path) + { try { $this->open_file =& self::get_file($path); $this->position = 0; @@ -51,37 +57,41 @@ class ArrayFileStream } } - public function stream_read($count) { + public function stream_read($count) + { $ret = mb_substr($this->open_file, $this->position, $count); $this->position += mb_strlen($ret); return $ret; } - public function stream_write($data) { - $left = mb_substr($this->open_file, 0, $this->position); + public function stream_write($data) + { + $left = mb_substr($this->open_file, 0, $this->position); $right = mb_substr($this->open_file, $this->position + mb_strlen($data)); $this->open_file = $left . $data . $right; $this->position += mb_strlen($data); return mb_strlen($data); } - public function stream_tell() { + public function stream_tell() + { return $this->position; } - public function stream_eof() { + public function stream_eof() + { return $this->position >= mb_strlen($this->open_file); } - public function stream_seek($offset, $whence) { + public function stream_seek($offset, $whence) + { switch ($whence) { case SEEK_SET: if ($offset < mb_strlen($this->open_file) && $offset >= 0) { $this->position = $offset; return true; - } - else { + } else { return false; } break; @@ -90,8 +100,7 @@ class ArrayFileStream if ($offset >= 0) { $this->position += $offset; return true; - } - else { + } else { return false; } break; @@ -100,8 +109,7 @@ class ArrayFileStream if (mb_strlen($this->open_file) + $offset >= 0) { $this->position = mb_strlen($this->open_file) + $offset; return true; - } - else { + } else { return false; } break; @@ -115,44 +123,61 @@ class ArrayFileStream { } - public function stream_stat() { - return array('size' => is_array($this->open_file) - ? sizeof($this->open_file) - : mb_strlen($this->open_file)); + public function stream_stat() + { + return [ + 'size' => is_array($this->open_file) + ? sizeof($this->open_file) + : mb_strlen($this->open_file), + ]; } - public function unlink($path) { + public function unlink($path) + { $parent =& self::get_file(dirname($path)); if (is_array($parent) && isset($parent[basename($path)])) { unset($parent[basename($path)]); - return TRUE; + return true; } - return FALSE; + return false; } - public function rename($path_from, $path_to) { + public function rename($path_from, $path_to) + { throw new Exception('not implemented yet'); } - public function mkdir($path, $mode, $options) { + public function mkdir($path, $mode, $options) + { throw new Exception('not implemented yet'); } - public function rmdir($path, $options) { + public function rmdir($path, $options) + { throw new Exception('not implemented yet'); } - public function dir_opendir($path, $options) { + public function dir_opendir($path, $options) + { throw new Exception('not implemented yet'); } - public function url_stat($path, $flags) { + public function url_stat($path, $flags) + { + try { + if (!self::get_file($path)) { + return false; + } + } catch (Exception $e) { + return false; + } + $time = time(); - $keys = array( + $keys = [ 'dev' => 0, 'ino' => 0, 'mode' => 33216, // chmod 700 @@ -161,25 +186,28 @@ class ArrayFileStream 'gid' => function_exists('posix_getgid') ? posix_getgid() : 0, 'rdev' => 0, 'size' => $flags & STREAM_URL_STAT_QUIET - ? @mb_strlen($this->open_file) : mb_strlen($this->open_file), + ? @mb_strlen($this->open_file) : mb_strlen($this->open_file), 'atime' => $time, 'mtime' => $time, 'ctime' => $time, 'blksize' => 0, - 'blocks' => 0 - ); + 'blocks' => 0, + ]; return array_merge(array_values($keys), $keys); } - public function dir_readdir() { + public function dir_readdir() + { throw new Exception('not implemented yet'); } - public function dir_rewinddir() { + public function dir_rewinddir() + { throw new Exception('not implemented yet'); } - public function dir_closedir() { + public function dir_closedir() + { throw new Exception('not implemented yet'); } } diff --git a/vendor/flexi/LICENSE b/vendor/flexi/LICENSE deleted file mode 100644 index e8453666ce90b57457dce166c2b09e742197fee8..0000000000000000000000000000000000000000 --- a/vendor/flexi/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2007 Marcus Lunzenauer <mlunzena@uos.de> - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/flexi/README b/vendor/flexi/README deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/vendor/flexi/Rakefile b/vendor/flexi/Rakefile deleted file mode 100644 index 5c951fc709654ce32e25997a2fdbef70c2e1abd9..0000000000000000000000000000000000000000 --- a/vendor/flexi/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake/clean' -require 'rake/contrib/sys' - -SRC = FileList['lib/**/*'] -CLEAN.include('doc') - -desc 'Create documentation' -file 'doc' => SRC do - sh "phpdoc --sourcecode on -t `pwd`/doc -d `pwd`/lib -ti 'trails documentation' -o 'HTML:frames:earthli'" -end - -desc 'Run all unit tests' -task 'test' do - sh "php test/all_tests.php" -end - -desc 'Run coverage' -task 'coverage' do - Sys.indir "test" do - sh "php coverage.php" - end -end diff --git a/vendor/flexi/examples/01_hello_world/index.php b/vendor/flexi/examples/01_hello_world/index.php deleted file mode 100644 index 1d041368c3625fc1300dad8ab761eb08af2f1067..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/01_hello_world/index.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# load flexi lib -require_once dirname(__FILE__) . '/../../lib/flexi.php'; - -# where are the templates -$path_to_the_templates = dirname(__FILE__) . '/templates'; - -# we need a template factory -$factory = new Flexi_TemplateFactory($path_to_the_templates); - -# open template -$template = $factory->open('hello_world'); - -# set name of the greetee -$template->set_attribute('name', 'Axel'); - -# render template -echo $template->render(); diff --git a/vendor/flexi/examples/01_hello_world/templates/hello_world.php b/vendor/flexi/examples/01_hello_world/templates/hello_world.php deleted file mode 100644 index 95609152f8269590accb5b4cc69648f6b48c6602..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/01_hello_world/templates/hello_world.php +++ /dev/null @@ -1 +0,0 @@ -<h1>Hello, <?= $name ?>!</h1> diff --git a/vendor/flexi/examples/02_quotes/index.php b/vendor/flexi/examples/02_quotes/index.php deleted file mode 100644 index 8b6e1344dbff9d184358d64ce9bb7a1732b9c73e..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/02_quotes/index.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# load flexi lib -require_once dirname(__FILE__) . '/../../lib/flexi.php'; - -# where are the templates -$path_to_the_templates = dirname(__FILE__) . '/templates'; - -# we need a template factory -$factory = new Flexi_TemplateFactory($path_to_the_templates); - -# open template -$template = $factory->open('quotes'); - - -# set quotes -$quotes = array( - array('author' => 'August Strindberg', - 'quote' => 'Der Mensch ist ein wunderliches Tier.'), - array('author' => 'Pierre Reverdy', - 'quote' => 'Der Mensch ist ein Tier, das sich selbst gezähmt hat.'), - array('author' => 'Thomas Niederreuther', - 'quote' => 'Der Mensch ist das einzige Tier, das sich für einen Menschen hält.'), - array('author' => 'Durs Grünbein', - 'quote' => 'Der Mensch ist das Tier, das Kaugummi kaut.'), - array('author' => 'Mark Twain', - 'quote' => 'Der Mensch ist das einzige Tier, das erröten kann - oder sollte.')); - -# select one randomly -shuffle($quotes); -$quote_of_the_day = array_shift($quotes); - -$template->set_attributes(array('quotes' => $quotes, - 'quote_of_the_day' => $quote_of_the_day)); - - -# set current time -$time = time(); -$template->set_attribute('time', $time); - - -# render template -echo $template->render(); diff --git a/vendor/flexi/examples/02_quotes/templates/quotes.php b/vendor/flexi/examples/02_quotes/templates/quotes.php deleted file mode 100644 index b494cca325ee22d77ff08f452cf54ff2d1b4d31a..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/02_quotes/templates/quotes.php +++ /dev/null @@ -1,23 +0,0 @@ -<? $title = 'Zitate'; ?> -<div id="header">Zitate <span class="amp">&</span> mehr</div> - -<h2>Zitat des Tages (<?= date('d.m.Y', $time) ?>)</h2> -<p> - <em> - „<?= $quote_of_the_day['quote'] ?>“ - </em> - (<?= $quote_of_the_day['author'] ?>) -</p> - - -<? if (sizeof($quotes)) : ?> - <h2>Mehr Zitate</h2> - <? foreach ($quotes as $quote) : ?> - <p> - <em> - „<?= $quote['quote'] ?>“ - </em> - (<?= $quote['author'] ?>) - </p> - <? endforeach ?> -<? endif ?> diff --git a/vendor/flexi/examples/03_layout/bgbody.gif b/vendor/flexi/examples/03_layout/bgbody.gif deleted file mode 100644 index d868c7128cebde47cf9830f1972591b4ce52543d..0000000000000000000000000000000000000000 Binary files a/vendor/flexi/examples/03_layout/bgbody.gif and /dev/null differ diff --git a/vendor/flexi/examples/03_layout/index.php b/vendor/flexi/examples/03_layout/index.php deleted file mode 100644 index 34f94493d8c1e36ed98d6217343d0ab2711a5341..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/03_layout/index.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# load flexi lib -require_once dirname(__FILE__) . '/../../lib/flexi.php'; - -# where are the templates -$path_to_the_templates = dirname(__FILE__) . '/templates'; - -# we need a template factory -$factory = new Flexi_TemplateFactory($path_to_the_templates); - -# open template -$template = $factory->open('quotes'); - - -# set layout -$template->set_layout('layout'); - -# set quotes -$quotes = array( - array('author' => 'August Strindberg', - 'quote' => 'Der Mensch ist ein wunderliches Tier.'), - array('author' => 'Pierre Reverdy', - 'quote' => 'Der Mensch ist ein Tier, das sich selbst gezähmt hat.'), - array('author' => 'Thomas Niederreuther', - 'quote' => 'Der Mensch ist das einzige Tier, das sich für einen Menschen hält.'), - array('author' => 'Durs Grünbein', - 'quote' => 'Der Mensch ist das Tier, das Kaugummi kaut.'), - array('author' => 'Mark Twain', - 'quote' => 'Der Mensch ist das einzige Tier, das erröten kann - oder sollte.')); - -# select one randomly -shuffle($quotes); -$quote_of_the_day = array_shift($quotes); - -$template->set_attributes(array('quotes' => $quotes, - 'quote_of_the_day' => $quote_of_the_day)); - - -# set current time -$time = time(); -$template->set_attribute('time', $time); - - -# render template -echo $template->render(); diff --git a/vendor/flexi/examples/03_layout/style.css b/vendor/flexi/examples/03_layout/style.css deleted file mode 100644 index e8f2bfb17dfe6ff42ca223cb02de19b965796fa6..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/03_layout/style.css +++ /dev/null @@ -1,18 +0,0 @@ -body { - background: white url("bgbody.gif") repeat-x; - color: #555; - font: 1.5em Verdana, Arial, 'Bitstream Vera Sans', sans-serif; -} - -#header { - font: 1.8em Verdana, Arial, 'Bitstream Vera Sans', sans-serif; - color: white; - height: 101px; - width: 100%; - margin-bottom: 1em; -} - -.amp { - font-style: italic; - font-family: 'Goudy Old Style', 'Palatino', 'Book Antiqua', serif; -} diff --git a/vendor/flexi/examples/03_layout/templates/layout.php b/vendor/flexi/examples/03_layout/templates/layout.php deleted file mode 100644 index 3d025aa0990d1edba3fb3e406cad5696d2d7300e..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/03_layout/templates/layout.php +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> - <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> - <title><?= $title ?></title> - <link rel="stylesheet" type="text/css" href="style.css" media="screen"/> -</head> -<body> - <?= $content_for_layout ?> -</body> -</html> diff --git a/vendor/flexi/examples/03_layout/templates/quotes.php b/vendor/flexi/examples/03_layout/templates/quotes.php deleted file mode 100644 index 9d9b96d3050ec74be31ae6036b03d0fce20c7c4e..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/03_layout/templates/quotes.php +++ /dev/null @@ -1,20 +0,0 @@ -<h2>Zitat des Tages (<?= date('d.m.Y', $time) ?>)</h2> -<p> - <em> - „<?= $quote_of_the_day['quote'] ?>“ - </em> - (<?= $quote_of_the_day['author'] ?>) -</p> - - -<? if (sizeof($quotes)) : ?> - <h2>Mehr Zitate</h2> - <? foreach ($quotes as $quote) : ?> - <p> - <em> - „<?= $quote['quote'] ?>“ - </em> - (<?= $quote['author'] ?>) - </p> - <? endforeach ?> -<? endif ?> diff --git a/vendor/flexi/examples/04_handler_plugin/mustache.php b/vendor/flexi/examples/04_handler_plugin/mustache.php deleted file mode 100644 index 604c99436a26a4bd95f397cb94a16b5e945b5e40..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/04_handler_plugin/mustache.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -error_reporting(E_ALL ^ E_NOTICE); - -// load flexi lib -require_once dirname(__FILE__) . '/../../lib/flexi.php'; - -// where are the templates -$path_to_the_templates = dirname(__FILE__) . '/templates'; - -// we need a template factory -$factory = new Flexi_TemplateFactory($path_to_the_templates); - -// load haml plugin - -require_once dirname(__FILE__) . '/../../lib/mustache_template.php'; -$factory->add_handler('mustache', 'Flexi_MustacheTemplate'); - -// open template -$template = $factory->open('mustache'); - -$template->set_attributes(array( - "name" => "Chris", - "value" => 10000, - "taxed_value" => 10000 - (10000 * 0.4), - "in_ca" => true -)); - -// test mix of different template engines -$template->set_layout("layout"); - -// render template -echo $template->render(); diff --git a/vendor/flexi/examples/04_handler_plugin/templates/layout.php b/vendor/flexi/examples/04_handler_plugin/templates/layout.php deleted file mode 100644 index 60d102c952119444367323bb5b82bc9a5f6278fa..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/04_handler_plugin/templates/layout.php +++ /dev/null @@ -1,3 +0,0 @@ -<layout> -<?= $content_for_layout ?> -</layout> diff --git a/vendor/flexi/examples/04_handler_plugin/templates/mustache.mustache b/vendor/flexi/examples/04_handler_plugin/templates/mustache.mustache deleted file mode 100644 index de4a2be789565756b689ca967e9de2c1d8559331..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/04_handler_plugin/templates/mustache.mustache +++ /dev/null @@ -1,5 +0,0 @@ -Hello {{name}} -You have just won ${{value}}! -{{#in_ca}} -Well, ${{taxed_value}}, after taxes. -{{/in_ca}} diff --git a/vendor/flexi/examples/xx_js_templates/index.php b/vendor/flexi/examples/xx_js_templates/index.php deleted file mode 100644 index b158f82115b2c0a466c04dd755bb89b0674f17eb..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/xx_js_templates/index.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# load flexi lib -require_once dirname(__FILE__) . '/../../lib/flexi.php'; - -# where are the templates -$path_to_the_templates = dirname(__FILE__) . '/templates'; - -# we need a template factory -$factory = new Flexi_TemplateFactory($path_to_the_templates); - -# open template -$template = $factory->open('js_template'); - -# set name of the greetee -$template->set_attribute('name', 'Axel'); - -# render template -echo $template->render(); diff --git a/vendor/flexi/examples/xx_js_templates/templates/js_template.pjs b/vendor/flexi/examples/xx_js_templates/templates/js_template.pjs deleted file mode 100644 index 56ab8a3747db1d9eae687ec9da0645bd562c44d0..0000000000000000000000000000000000000000 --- a/vendor/flexi/examples/xx_js_templates/templates/js_template.pjs +++ /dev/null @@ -1,3 +0,0 @@ -<? -$update_page->append(var_export(get_defined_vars(), 1)); - diff --git a/vendor/flexi/flexi.php b/vendor/flexi/flexi.php deleted file mode 100644 index 22c21d8bcd21d8451aa5375b97012d5c3ef3515b..0000000000000000000000000000000000000000 --- a/vendor/flexi/flexi.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -# Copyright (c) 2012 - <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# Stud.IP workaround for legacy plugins -require_once 'lib/flexi.php'; diff --git a/vendor/flexi/lib/exceptions.php b/vendor/flexi/lib/exceptions.php deleted file mode 100644 index befb78908cec60c5f19d09d74ef89c64a13ad64f..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/exceptions.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -# Copyright (c) 2009 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -class Flexi_TemplateNotFoundException extends Exception {} diff --git a/vendor/flexi/lib/flexi.php b/vendor/flexi/lib/flexi.php deleted file mode 100644 index ab94661673d00b25e322d942589658bb18029fc5..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/flexi.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -define('FLEXI_VERSION', '0.5.0'); - -/** - * Bootstrapping file for flexi. Just include this to get going. - * - * @package flexi - */ - -require_once 'exceptions.php'; -require_once 'template.php'; -require_once 'template_factory.php'; -require_once 'php_template.php'; -require_once 'js_template.php'; - -require_once 'helper/js_helper.php'; -require_once 'helper/prototype_helper.php'; -require_once 'helper/scriptaculous_helper.php'; -require_once 'helper/tag_helper.php'; -require_once 'helper/text_helper.php'; diff --git a/vendor/flexi/lib/helper/js_helper.php b/vendor/flexi/lib/helper/js_helper.php deleted file mode 100644 index b641f4ee860a5cbe2751986b316e4e363f3803cd..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/helper/js_helper.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * Provides functionality for working with JavaScript in your views. - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @author David Heinemeier Hansson - * @copyright (c) Authors - * @version $Id: js_helper.php 3437 2006-05-27 11:38:58Z mlunzena $ - */ - -class JsHelper { - - /** - * Returns a link that'll trigger a javascript function using the - * onclick handler and return false after the fact. - * - * Example: - * JsHelper::link_to_function('Greeting', "alert('Hello world!')"); - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function link_to_function($name, $function, $html = array()) { - $html['href'] = isset($html['href']) ? $html['href'] : '#'; - $html['onclick'] = $function.'; return false;'; - return TagHelper::content_tag('a', $name, $html); - } - - /** - * Returns a link that'll trigger a JavaScript function using the onclick - * handler. - * - * Examples: - * JsHelper::button_to_function("Greeting", "alert('Hello world!')"); - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function button_to_function($name, $function, $html_options = array()) { - - $html_options['type'] = 'button'; - $html_options['value'] = $name; - $html_options['onclick'] = sprintf('%s%s;', - isset($html_options['onclick']) ? $html_options['onclick'] . '; ' : '', - $function); - return TagHelper::tag('input', $html_options); - } - - /** - * Escape carrier returns and single and double quotes for Javascript - * segments. - * - * @param type <description> - * - * @return type <description> - */ - function escape_javascript($javascript = '') { - $pattern = array(); $replace = array(); - $pattern[] = '/\\\\/'; $replace[] = '\\\\\\'; - $pattern[] = '/<\//'; $replace[] = '<\\/'; - $pattern[] = "/\r\n/"; $replace[] = '\n'; - $pattern[] = "/\n/"; $replace[] = '\n'; - $pattern[] = "/\r/"; $replace[] = '\n'; - $pattern[] = '/"/'; $replace[] = '\\"'; - $pattern[] = "/'/"; $replace[] = "\\'"; - - $javascript = preg_replace($pattern, $replace, $javascript); - return $javascript; - } - - /** - * Returns a JavaScript tag with the '$content' inside. - * Example: - * JsHelper::javascript_tag("alert('All is good')"); - * => <script type="text/javascript">alert('All is good')</script> - * - * @param type <description> - * - * @return type <description> - */ - function javascript_tag($content) { - return TagHelper::content_tag('script', - JsHelper::js_cdata_section($content), - array('type' => 'text/javascript')); - } - - /** - * @ignore - */ - function js_cdata_section($content) { - return "\n//".TagHelper::cdata_section("\n$content\n//")."\n"; - } - - /** - * @ignore - */ - function options_for_javascript($opt) { - $opts = array(); - foreach ($opt as $key => $value) - $opts[] = "$key:$value"; - sort($opts); - - return '{'.join(', ', $opts).'}'; - } -} diff --git a/vendor/flexi/lib/helper/prototype_helper.php b/vendor/flexi/lib/helper/prototype_helper.php deleted file mode 100644 index 33f88211d8129bffb7b81be6a3d30b7732cb703c..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/helper/prototype_helper.php +++ /dev/null @@ -1,764 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * PrototypeHelper. - * - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @author David Heinemeier Hansson - * @copyright (c) Authors - * @version $Id: prototype_helper.php 3437 2006-05-27 11:38:58Z mlunzena $ - */ - -class PrototypeHelper { - - /** - * Returns a link to a remote action defined by 'url' (using the 'url_for()' - * format) that's called in the background using XMLHttpRequest. The result of - * that request can then be inserted into a DOM object whose id can be - * specified with 'update'. - * - * Examples: - * link_to_remote('Delete this post', - * array('update' => 'posts', 'url' => 'destroy?id='.$id)) - * - * You can also specify a hash for 'update' to allow for - * easy redirection of output to an other DOM element if a server-side error - * occurs: - * - * Example: - * link_to_remote('Delete this post', - * array('update' => array('success' => 'posts', - * 'failure' => 'error'), - * 'url' => 'destroy?id='.$id)) - * - * Optionally, you can use the 'position' parameter to influence - * how the target DOM element is updated. It must be one of 'before', 'top', - * 'bottom', or 'after'. - * - * By default, these remote requests are processed asynchronous during - * which various JavaScript callbacks can be triggered (for progress - * indicators and the likes). All callbacks get access to the 'request' - * object, which holds the underlying XMLHttpRequest. - * - * The callbacks that may be specified are (in order): - * - * 'loading' Called when the remote document is being - * loaded with data by the browser. - * 'loaded' Called when the browser has finished loading - * the remote document. - * 'interactive' Called when the user can interact with the - * remote document, even though it has not - * finished loading. - * 'success' Called when the XMLHttpRequest is completed, - * and the HTTP status code is in the 2XX range. - * 'failure' Called when the XMLHttpRequest is completed, - * and the HTTP status code is not in the 2XX - * range. - * 'complete' Called when the XMLHttpRequest is complete - * (fires after success/failure if present). - * - * You can further refine 'success' and 'failure' by adding additional - * callbacks for specific status codes: - * - * Example: - * link_to_remote($word, array('url' => $rule, - * '404' => "alert('Not found...?')", - * 'failure' => "alert('HTTPError!')")) - * - * A status code callback overrides the success/failure handlers if present. - * - * If you for some reason or another need synchronous processing (that'll - * block the browser while the request is happening), you can specify - * 'type' => 'synchronous'. - * - * You can customize further browser side call logic by passing - * in JavaScript code snippets via some optional parameters. In - * their order of use these are: - * - * 'confirm' Adds confirmation dialog. - * 'condition' Perform remote request conditionally - * by this expression. Use this to - * describe browser-side conditions when - * request should not be initiated. - * 'before' Called before request is initiated. - * 'after' Called immediately after request was - * initiated and before 'loading'. - * 'submit' Specifies the DOM element ID that's used - * as the parent of the form elements. By - * default this is the current form, but - * it could just as well be the ID of a - * table row or any other DOM element. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function link_to_remote($name, $options = array(), $html_options = array()) { - return JsHelper::link_to_function($name, - PrototypeHelper::remote_function($options), $html_options); - } - - /** - * Periodically calls the specified url ['url'] every ['frequency'] seconds - * (default is 10). Usually used to update a specified div ['update'] with the - * results of the remote call. The options for specifying the target with - * 'url' and defining callbacks is the same as 'link_to_remote()'. - * - * @param type <description> - * - * @return type <description> - */ - function periodically_call_remote($options = array()) { - $frequency = isset($options['frequency']) ? $options['frequency'] : 10; - $code = sprintf('new PeriodicalExecuter(function() {%s}, %d)', - PrototypeHelper::remote_function($options), $frequency); - return JsHelper::javascript_tag($code); - } - - /** - * Returns a form tag that will submit using XMLHttpRequest in the background - * instead of the regular reloading POST arrangement. Even though it's using - * JavaScript to serialize the form elements, the form submission will work - * just like a regular submission as viewed by the receiving side - * (all elements available in 'params'). The options for specifying the target - * with 'url' and defining callbacks are the same as 'link_to_remote()'. - * - * A "fall-through" target for browsers that don't do JavaScript can be - * specified with the 'action' and 'method' options on '$html_options'. - * - * Example: - * form_remote_tag(array( - * 'url' => 'tag_add', - * 'update' => 'question_tags', - * 'loading' => "Element.show('indicator'); tag.value = ''", - * 'complete' => "Element.hide('indicator');". - * visual_effect('highlight', 'question_tags'))) - * - * The hash passed as a second argument is equivalent to the options (2nd) - * argument in the form_tag() helper. - * - * @param type <description> - * - * @return type <description> - */ - function form_remote_tag($options = array(), $html_options = array()) { - - $options = TagHelper::_parse_attributes($options); - $html_options = TagHelper::_parse_attributes($html_options); - - $options['form'] = TRUE; - - $html_options['onsubmit'] = PrototypeHelper::remote_function($options). - '; return false;'; - $html_options['action'] = isset($html_options['action']) - ? $html_options['action'] - : $options['url']; - - $html_options['method'] = isset($html_options['method']) - ? $html_options['method'] - : 'post'; - - return TagHelper::tag('form', $html_options, TRUE); - } - - /** - * Returns a button input tag that will submit form using XMLHttpRequest in - * the background instead of regular reloading POST arrangement. The '$opt' - * argument is the same as in 'form_remote_tag()'. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function submit_to_remote($name, $value, $options = array()) { - - if (!isset($options['with'])) - $options['with'] = 'Form.serialize(this.form)'; - - if (!isset($options['html'])) - $options['html'] = array(); - - $options['html']['type'] = 'button'; - $options['html']['onclick'] = PrototypeHelper::remote_function($options). - '; return false;'; - $options['html']['name'] = $name; - $options['html']['value'] = $value; - - return TagHelper::tag('input', $options['html']); - } - - /** - * Returns a Javascript function (or expression) that will update a DOM - * element '$element_id' according to the '$opt' passed. - * - * Possible '$opt' are: - * 'content' The content to use for updating. - * 'action' Valid options are 'update' (default), 'empty', 'remove' - * 'position' If the 'action' is 'update', you can optionally specify one of - * the following positions: 'before', 'top', 'bottom', 'after'. - * - * Example: - * update_element_function('products', - * array('position' => 'bottom', - * 'content' => "<p>New product!</p>")); - * - * - * This method can also be used in combination with remote method call - * where the result is evaluated afterwards to cause multiple updates on a - * page. - * - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function update_element_function($element_id, $options = array()) { - - $content = JsHelper::escape_javascript(isset($options['content']) - ? $options['content'] - : ''); - - $value = isset($options['action']) ? $options['action'] : 'update'; - - switch ($value) { - - case 'update': - $js_func = $options['position'] - ? sprintf("new Insertion.%s('%s','%s')", - TextHelper::camelize($options['position']), - $element_id, $content) - : "\$('$element_id').innerHTML = '$content'"; - break; - - case 'empty': - $js_func = "\$('$element_id').innerHTML = ''"; - break; - - case 'remove': - $js_func = "Element.remove('$element_id')"; - break; - - default: - trigger_error('Invalid action, choose one of update, remove, empty'); - exit; - } - - $js_func .= ";\n"; - - return isset($options['binding']) ? $js_func.$options['binding'] : $js_func; - } - - /** - * Returns 'eval(request.responseText)', which is the Javascript function that - * 'form_remote_tag()' can call in 'complete' to evaluate a multiple update - * return document using 'update_element_function()' calls. - * - * @return type <description> - */ - function evaluate_remote_response() { - return 'eval(request.responseText)'; - } - - /** - * Returns the javascript needed for a remote function. - * Takes the same arguments as 'link_to_remote()'. - * - * Example: - * <select id="options" onchange="<?= - * remote_function(array('update' => 'options', - * 'url' => '@update_options')) ?>"> - * <option value="0">Hello</option> - * <option value="1">World</option> - * </select> - * - * @param type <description> - * - * @return type <description> - */ - function remote_function($options) { - $javascript_options = PrototypeHelper::options_for_ajax($options); - - $update = ''; - if (isset($options['update']) && is_array($options['update'])) { - - $update = array(); - if (isset($options['update']['success'])) - $update[] = "success:'".$options['update']['success']."'"; - - if (isset($options['update']['failure'])) - $update[] = "failure:'".$options['update']['failure']."'"; - - $update = '{'.join(',', $update).'}'; - - } else if (isset($options['update'])) { - $update .= "'".$options['update']."'"; - } - - $function = sprintf("new Ajax.%s(%s'%s', %s)", - $update ? 'Updater' : 'Request', - $update ? "$update, " : '', - $options['url'], - $javascript_options); - - if (isset($options['before'])) - $function = $options['before'].'; '.$function; - - if (isset($options['after'])) - $function = $function.'; '.$options['after']; - - if (isset($options['condition'])) - $function = 'if ('.$options['condition'].') { '.$function.'; }'; - - if (isset($options['confirm'])) { - $function = "if (confirm('" . - JsHelper::escape_javascript($options['confirm']) . - "')) { $function; }"; - if (isset($options['cancel'])) - $function .= ' else { '.$options['cancel'].' }'; - } - - return $function; - } - - /** - * Observes the field with the DOM ID specified by '$field_id' and makes - * an AJAX call when its contents have changed. - * - * Required '$options' are: - * 'url' 'url_for()'-style options for the action to call - * when the field has changed. - * - * Additional options are: - * 'frequency' The frequency (in seconds) at which changes to - * this field will be detected. Not setting this - * option at all or to a value equal to or less than - * zero will use event based observation instead of - * time based observation. - * 'update' Specifies the DOM ID of the element whose - * innerHTML should be updated with the - * XMLHttpRequest response text. - * 'with' A JavaScript expression specifying the - * parameters for the XMLHttpRequest. This defaults - * to 'value', which in the evaluated context - * refers to the new field value. - * - * Additionally, you may specify any of the options documented in - * link_to_remote(). - * - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function observe_field($field_id, $options = array()) { - $name = isset($options['frequency']) && $options['frequency'] > 0 - ? 'Form.Element.Observer' - : 'Form.Element.EventObserver'; - return PrototypeHelper::build_observer($name, $field_id, $options); - } - - /** - * Like 'observe_field()', but operates on an entire form identified by the - * DOM ID '$form_id'. '$options' are the same as 'observe_field()', except - * the default value of the 'with' option evaluates to the - * serialized (request string) value of the form. - * - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function observe_form($form_id, $options = array()) { - $name = isset($options['frequency']) && $options['frequency'] > 0 - ? 'Form.Observer' - : 'Form.EventObserver'; - return PrototypeHelper::build_observer($name, $form_id, $options); - } - - /** - * @ignore - */ - function options_for_ajax($options) { - $js_opt = PrototypeHelper::build_callbacks($options); - - $js_opt['asynchronous'] = isset($options['type']) - ? $options['type'] != 'synchronous' : 'true'; - - if (isset($options['method'])) - $js_opt['method'] = PrototypeHelper::method_option_to_s($options['method']); - - if (isset($options['position'])) - $js_opt['insertion'] = 'Insertion.'.TextHelper::camelize($options['position']); - - $js_opt['evalScripts'] = !isset($options['script']) || - $options['script'] == '0' || - $options['script'] == 'false' - ? 'false' : 'true'; - - if (isset($options['form'])) - $js_opt['parameters'] = 'Form.serialize(this)'; - else if (isset($options['submit'])) - $js_opt['parameters'] = "Form.serialize(document.getElementById('{$options['submit']}'))"; - else if (isset($options['with'])) - $js_opt['parameters'] = $options['with']; - - return JsHelper::options_for_javascript($js_opt); - } - - /** - * @ignore - */ - function method_option_to_s($method) { - return is_string($method) && $method[0] == "'" ? $method : "'$method'"; - } - - /** - * @ignore - */ - function build_observer($klass, $name, $options = array()) { - if (!isset($options['with']) && $options['update']) - $options['with'] = 'value'; - - $callback = PrototypeHelper::remote_function($options); - - $javascript = 'new '.$klass.'("'.$name.'", '; - if (isset($options['frequency'])) - $javascript .= $options['frequency'].", "; - - $javascript .= 'function(element, value) {'; - $javascript .= $callback.'});'; - - return JsHelper::javascript_tag($javascript); - } - - /** - * @ignore - */ - function build_callbacks($options) { - $callbacks = array(); - foreach (PrototypeHelper::get_callbacks() as $callback) { - if (isset($options[$callback])) { - $name = 'on'.ucfirst($callback); - $code = $options[$callback]; - $callbacks[$name] = 'function(request, json){'.$code.'}'; - } - } - - return $callbacks; - } - - /** - * @ignore - */ - function get_callbacks() { - static $callbacks; - if (!$callbacks) - $callbacks = array_merge(range(100, 599), - array('uninitialized', 'loading', 'loaded', - 'interactive', 'complete', 'failure', - 'success')); - return $callbacks; - } - - /** - * @ignore - */ - function get_ajax_options() { - static $ajax_options; - if (!$ajax_options) - $ajax_options = array('before', 'after', 'condition', 'url', - 'asynchronous', 'method', 'insertion', 'position', - 'form', 'with', 'update', 'script') - + PrototypeHelper::get_callbacks(); - return $ajax_options; - } -} - -/** - * JavaScriptGenerator generates blocks of JavaScript code that allow you to - * change the content and presentation of multiple DOM elements. Use this in - * your Ajax response bodies, either in a <script> tag or as plain JavaScript - * sent with a Content-type of "text/javascript". - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id: prototype_helper.php 3437 2006-05-27 11:38:58Z mlunzena $ - */ - -class Flexi_JavascriptGenerator { - - /** - * internal variables - * @ignore - */ - var $lines = array(); - - /** - * @ignore - */ - function to_s() { - $javascript = implode("\n", $this->lines); - return "try {\n".$javascript."\n} catch (e) { ". - "alert('JS error:\\n\\n' + e.toString()); throw e }"; - } - -################################################################################ -# function [] -# function select -# function draggable -# function drop_receiving -# function sortable -################################################################################ - - /** - * Inserts HTML at the specified 'position' relative to the DOM element - * identified by the given 'id'. - * - * 'position' may be one of: - * - * 'top':: HTML is inserted inside the element, before the - * element's existing content. - * 'bottom':: HTML is inserted inside the element, after the - * element's existing content. - * 'before':: HTML is inserted immediately preceeding the element. - * 'after':: HTML is inserted immediately following the element. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function insert_html($position, $id, $content) { - $insertion = TextHelper::camelize($position); - $this->call('new Insertion.'.$insertion, $id, $content); - } - - /** - * Replaces the inner HTML of the DOM element with the given 'id'. - * - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function replace_html($id, $content) { - $this->call('Element.update', $id, $content); - } - - /** - * Replaces the "outer HTML" (i.e., the entire element, not just its - * contents) of the DOM element with the given 'id'. - * - * @param type <description> - * @param type <description> - * - * @return void - */ - function replace($id, $content) { - $this->call('Element.replace', $id, $content); - } - - /** - * Removes the DOM elements with the given 'ids' from the page. - * - * @param type <description> - * - * @return void - */ - function remove($ids) { - $ids = func_get_args(); - $this->record($this->javascript_object_for($ids).".each(Element.remove)"); - } - - /** - * Shows hidden DOM elements with the given 'ids'. - * - * @param type <description> - * - * @return void - */ - function show($ids) { - $ids = func_get_args(); - array_unshift($ids, 'Element.show'); - call_user_func_array(array(&$this, 'call'), $ids); - } - - /** - * Hides the visible DOM elements with the given 'ids'. - * - * @param type <description> - * - * @return void - */ - function hide($ids) { - $ids = func_get_args(); - array_unshift($ids, 'Element.hide'); - call_user_func_array(array(&$this, 'call'), $ids); - } - - /** - * Toggles the visibility of the DOM elements with the given 'ids'. - * - * @param type <description> - * - * @return void - */ - function toggle($ids) { - $ids = func_get_args(); - array_unshift($ids, 'Element.toggle'); - call_user_func_array(array(&$this, 'call'), $ids); - } - - /** - * Displays an alert dialog with the given 'message'. - * - * @param string the given message. - * - * @return void - */ - function alert($message) { - $this->call('alert', $message); - } - - /** - * Redirects the browser to the given 'location'. - * - * @param type <description> - * - * @return void - */ - function redirect_to($location) { - $this->assign('window.location.href', $location); - } - - /** - * Calls the JavaScript 'function', optionally with the given 'arguments'. - * - * @param type <description> - * - * @return void - */ - function call($function) { - $arguments = func_get_args(); - array_shift($arguments); - $this->record($function.'('.$this->arguments_for_call($arguments).')'); - } - - /** - * Assigns the JavaScript 'variable' the given 'value'. - * - * @param type <description> - * @param type <description> - * - * @return void - */ - function assign($variable, $value) { - $this->record($variable.' = '.$this->javascript_object_for($value)); - } - - /** - * Writes raw JavaScript to the page. - * - * @param string the raw JavaScript - * - * @return void - */ - function append($javascript) { - $this->lines[] = $javascript; - } - - /** - * Executes the given javascript after a delay of 'seconds'. - * - * # TODO (mlunzena) this function has side effects and has to be explained or deleted - * - * @param type <description> - * - * @return void - */ - function delay($seconds = 1) { - static $in_delay = FALSE; - - if (!$in_delay) { - $in_delay = TRUE; - $this->record("setTimeout(function() {\n\n"); - } - - else { - $in_delay = FALSE; - $this->record(sprintf("\n}, %d)", $seconds * 1000)); - } - - return $in_delay; - } - - /** - * Starts a script.aculo.us visual effect. See - * ScriptaculousHelper for more information. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return void - */ - function visual_effect($name, $id = FALSE, $js_opt = array()) { - $this->record(ScriptaculousHelper::visual_effect($name, $id, $js_opt)); - } - - /** - * @ignore - */ - function record($line) { - $line = preg_replace('/\;$/', '', rtrim($line)) . ';'; - $this->append($line); - } - - /** - * @ignore - */ - function javascript_object_for($object) { - return json_encode($object); - } - - /** - * @ignore - */ - function arguments_for_call($arguments) { - $mapped = array(); - foreach ($arguments as $argument) - $mapped[] = $this->javascript_object_for($argument); - return join(',', $mapped); - } -} diff --git a/vendor/flexi/lib/helper/scriptaculous_helper.php b/vendor/flexi/lib/helper/scriptaculous_helper.php deleted file mode 100644 index 643ad2403aa8fe0e16e2a55d84d793511326e556..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/helper/scriptaculous_helper.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * ScriptaculousHelper. - * - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @author David Heinemeier Hansson - * @copyright (c) Authors - * @version $Id: scriptaculous_helper.php 3437 2006-05-27 11:38:58Z mlunzena $ - */ - -class ScriptaculousHelper { - - /** - * Returns a JavaScript snippet to be used on the AJAX callbacks for starting - * visual effects. - * - * Example: - * ScriptaculousHelper::visual_effect('highlight', 'posts', - * array('duration' => 0.5 )); - * - * If no '$element_id' is given, it assumes "element" which should be a local - * variable in the generated JavaScript execution context. This can be used - * for example with drop_receiving_element(): - * - * ScriptaculousHelper::drop_receving_element(..., array(... - * 'loading' => ScriptaculousHelper::visual_effect('fade'))); - * - * This would fade the element that was dropped on the drop receiving element. - * - * You can change the behaviour with various options, see - * http://script.aculo.us for more documentation. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return string <description> - */ - function visual_effect($name, $element_id = FALSE, $js_opt = array()) { - - $element = $element_id ? "'$element_id'" : 'element'; - - switch ($name) { - case 'toggle_appear': - case 'toggle_blind': - case 'toggle_slide': - return sprintf("new Effect.toggle(%s, '%s', %s)", - $element, substr($name, 7), - JsHelper::options_for_javascript($js_opt)); - } - - return sprintf("new Effect.%s(%s, %s)", - TextHelper::camelize($name), - $element, JsHelper::options_for_javascript($js_opt)); - } - - - /** - * Makes the elements with the DOM ID specified by '$element_id' sortable - * by drag-and-drop and make an AJAX call whenever the sort order has - * changed. By default, the action called gets the serialized sortable - * element as parameters. - * - * Example: - * <php echo sortable_element($my_list, array( - * 'url' => '@order', - * )) ?> - * - * In the example, the action gets a '$my_list' array parameter - * containing the values of the ids of elements the sortable consists - * of, in the current order. - * - * You can change the behaviour with various options, see - * http://script.aculo.us for more documentation. - */ - function sortable_element($element_id, $options = array()) { - - if (!isset($options['with'])) - $options['with'] = "Sortable.serialize('$element_id')"; - - if (!isset($options['onUpdate'])) - $options['onUpdate'] = - sprintf('function(){%s}', PrototypeHelper::remote_function($options)); - - foreach (PrototypeHelper::get_ajax_options() as $key) - unset($options[$key]); - - foreach (array('tag', 'overlap', 'constraint', 'handle') as $option) - if (isset($options[$option])) - $options[$option] = "'{$options[$option]}'"; - - if (isset($options['containment'])) - $options['containment'] = self::array_or_string_for_javascript($options['containment']); - - if (isset($options['hoverclass'])) - $options['hoverclass'] = "'{$options['hoverclass']}'"; - - if (isset($options['only'])) - $options['only'] = self::array_or_string_for_javascript($options['only']); - - return JsHelper::javascript_tag( - sprintf("Sortable.create('%s', %s)", - $element_id, JsHelper::options_for_javascript($options))); - } - - - /** - * @ignore - */ - function array_or_string_for_javascript($option) { - if (is_array($option)) { - return "['".join("','", $option)."']"; - } else if ($option) { - return "'$option'"; - } - } -} diff --git a/vendor/flexi/lib/helper/tag_helper.php b/vendor/flexi/lib/helper/tag_helper.php deleted file mode 100644 index 673c5c13b5b74e86d5db4a3ee10809df85ab2838..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/helper/tag_helper.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * TagHelper defines some base helpers to construct html tags. - * This is poor man’s Builder for the rare cases where you need to - * programmatically make tags but can’t use Builder. - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @author Fabien Potencier <fabien.potencier@symfony-project.com> - * @author David Heinemeier Hansson - * @copyright (c) Authors - * @version $Id: tag_helper.php 3437 2006-05-27 11:38:58Z mlunzena $ - */ - -class TagHelper { - - /** - * Constructs an html tag. - * - * @param $name string tag name - * @param $options array tag options - * @param $open boolean true to leave tag open - * - * @return string - */ - function tag($name, $options = array(), $open = false) { - if (!$name) return ''; - return '<'.$name.TagHelper::_tag_options($options).($open ? '>' : ' />'); - } - - /** - * Helper function for content tags. - * - * @param type <description> - * @param type <description> - * @param type <description> - * - * @return type <description> - */ - function content_tag($name, $content = '', $options = array()) { - if (!$name) return ''; - return '<'.$name.TagHelper::_tag_options($options).'>'.$content.'</'.$name.'>'; - } - - /** - * Helper function for CDATA sections. - * - * @param type <description> - * - * @return type <description> - */ - function cdata_section($content) { - return '<![CDATA['.$content.']]>'; - } - - /** - * @ignore - */ - function _tag_options($options = array()) { - $options = TagHelper::_parse_attributes($options); - $html = ''; - foreach ($options as $key => $value) - $html .= ' '.$key.'="'.$value.'"'; - return $html; - } - - /** - * @ignore - */ - function _parse_attributes($string) { - return is_array($string) ? $string : TagHelper::string_to_array($string); - } - - /** - * <MethodDescription> - * - * @param string <description> - * - * @return array <description> - */ - function string_to_array($string) { - preg_match_all('/ - \s*(\w+) # key \\1 - \s*=\s* # = - (\'|")? # values may be included in \' or " \\2 - (.*?) # value \\3 - (?(2) \\2) # matching \' or " if needed \\4 - \s*(?: - (?=\w+\s*=) | \s*$ # followed by another key= or the end of the string - ) - /x', $string, $matches, PREG_SET_ORDER); - - $attributes = array(); - foreach ($matches as $val) - $attributes[$val[1]] = $val[3]; - - return $attributes; - } -} diff --git a/vendor/flexi/lib/helper/text_helper.php b/vendor/flexi/lib/helper/text_helper.php deleted file mode 100644 index c5967277eacc76943653a3a8e69f1ffd81d8bfd3..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/helper/text_helper.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * TextHelper. - * - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class TextHelper { - - /** - * Holds the internal cycles. - * - * @ignore - */ - private static $cycles = array(); - - - /** - * Returns a camelized string from a lower case and underscored string by - * replacing slash with underscore and upper-casing each letter preceded - * by an underscore. - * - * @param string String to camelize. - * - * @return string Camelized string. - */ - function camelize($word) { - return str_replace(' ', '', - ucwords(str_replace(array('_', '/'), - array(' ', ' '), $word))); - } - - - /** - * Creates a Cycle object whose +__toString method cycles through elements of - * an array every time it is called. This can be used for example, to - * alternate classes for table rows: - * - * <? foreach ($items as $item) : ?> - * <tr class="<?= TextHelper::cycle('odd', 'even') ?>"> - * <td><?= item ?></td> - * </tr> - * <? endforeach ?> - * - * You can use named cycles to allow nesting in loops. Passing a single array - * as the only parameter with a <tt>name</tt> key will create a named cycle. - * You can manually reset a cycle by calling reset_cycle and passing the - * name of the cycle. - * - * <? foreach($items as $item) : ?> - * <tr class="<?= TextHelper::cycle(array("even", "odd", "name" => "row_class")) ?>"> - * <td> - * <? foreach ($item->values as $value) : ?> - * <span style="color:<?= TextHelper::cycle(array("red", "green", "blue", "name" => "colors")) : ?>"> - * <?= $value ?> - * </span> - * <? endforeach ?> - * <? TextHelper::reset_cycle("colors") ?> - * </td> - * </tr> - * <? endforeach ?> - */ - static function cycle($first_value) { - - $values = func_get_args(); - - - if (sizeof($values) == 1 && is_array($values[0])) { - $values = $values[0]; - $name = isset($values['name']) ? $values['name'] : 'default'; - unset($values['name']); - } - else { - $name = 'default'; - } - - $cycle = self::get_cycle($name); - if (is_null($cycle) || $cycle->values !== $values) { - $cycle = self::set_cycle($name, new TextHelperCycle($values)); - } - - return (string) $cycle; - } - - - /** - * Resets a cycle so that it starts from the first element the next time - * it is called. Pass in +name+ to reset a named cycle. - * - * @param string an optional name of a cycle - * - * @return void - */ - public static function reset_cycle($name = 'default') { - $cycle = self::get_cycle($name); - if (isset($cycle)) { - $cycle->reset(); - } - } - - - /** - * @ignore - */ - private static function get_cycle($name) { - return isset(self::$cycles[$name]) ? self::$cycles[$name] : NULL; - } - - /** - * @ignore - */ - private static function set_cycle($name, $cycle) { - return self::$cycles[$name] = $cycle; - } -} - - -/** - * This class holds an array of string and cycles through them. - * - * @package flexi - * @subpackage helper - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class TextHelperCycle { - - - public $values; - - - function __construct($values) { - $this->values = (array) $values; - } - - - function cycle() { - $result = current($this->values); - if (next($this->values) === FALSE) - $this->reset(); - return $result; - } - - - function reset() { - reset($this->values); - } - - - function __toString() { - return $this->cycle(); - } -} diff --git a/vendor/flexi/lib/js_template.php b/vendor/flexi/lib/js_template.php deleted file mode 100644 index d2113a685342673bac8812df3dcc82bd6d5c75e2..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/js_template.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * A template engine that renders Javascript templates. - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class Flexi_JsTemplate extends Flexi_PhpTemplate { - - /** - * Parse, render and return the presentation. - * - * @return string A string representing the rendered presentation. - */ - function _render() { - - # put attributes into scope - extract($this->_attributes); - - # get generator object - $update_page = new Flexi_JavascriptGenerator(); - - # include template, parse it and remove output - ob_start(); - require $this->_template; - ob_end_clean(); - - return $update_page->to_s(); - } -} diff --git a/vendor/flexi/lib/mustache_template.php b/vendor/flexi/lib/mustache_template.php deleted file mode 100644 index 2051a2e4029d069e37dd0c731fc23bce80229e76..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/mustache_template.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../vendor/mustache.php/Mustache.php'; - -/** - * A template engine that uses PHP to render templates. - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class Flexi_MustacheTemplate extends Flexi_Template { - - /** - * Parse, render and return the presentation. - * - * @return string A string representing the rendered presentation. - */ - function _render() { - ${0} = new MyMustache($this); - $content_for_layout = ${0}->render(); - - // include layout, parse it and get output - if (isset($this->_layout)) { - $defined = get_defined_vars(); - unset($defined['this'], $defined['0']); - $content_for_layout = $this->_layout->render($defined); - } - - return $content_for_layout; - } - - function getPartial($tag_name) { - $file = dirname($this->_template) . '/' . $tag_name . '.mustache'; - var_dump($file); - if (file_exists($file)) { - return file_get_contents($file); - } - return ''; - } -} - -class MyMustache extends Mustache { - - public function __construct($flexi) { - parent::__construct(file_get_contents($flexi->_template), $flexi->_attributes); - $this->_flexi = $flexi; - } - - protected function _getPartial($tag_name) { - - if ($partial = $this->_flexi->getPartial($tag_name)) { - return $partial; - } - - if ($this->_throwsException(MustacheException::UNKNOWN_PARTIAL)) { - throw new MustacheException('Unknown partial: ' . $tag_name, MustacheException::UNKNOWN_PARTIAL); - } else { - return ''; - } - } -} diff --git a/vendor/flexi/lib/php_template.php b/vendor/flexi/lib/php_template.php deleted file mode 100644 index af808b4d5334309edc7fdd19dcd67aa64f46ccca..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/php_template.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * A template engine that uses PHP to render templates. - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class Flexi_PhpTemplate extends Flexi_Template { - - /** - * Parse, render and return the presentation. - * - * @return string A string representing the rendered presentation. - */ - function _render() { - - extract($this->_attributes); - - # include template, parse it and get output - ob_start(); - require $this->_template; - $content_for_layout = ob_get_clean(); - - - # include layout, parse it and get output - if (isset($this->_layout)) { - $defined = get_defined_vars(); - unset($defined['this']); - $content_for_layout = $this->_layout->render($defined); - } - - return $content_for_layout; - } - - - /** - * Parse, render and return the presentation of a partial template. - * - * @param string A name of a partial template. - * @param array An optional associative array of attributes and their - * associated values. - * - * @return string A string representing the rendered presentation. - */ - function render_partial($partial, $attributes = array()) { - return $this->_factory->render($partial, $attributes + $this->_attributes); - } - - - /** - * Renders a partial template with every member of a collection. This member - * can be accessed by a template variable with the same name as the name of - * the partial template. - * - * Example: - * - * # template entry.php contains: - * <li><?= $entry ?></li> - * - * - * $entries = array('lorem', 'ipsum'); - * $template->render_partial_collection('entry', $entries); - * - * # results in: - * <li>lorem</li> - * <li>ipsum</li> - * - * TODO (mlunzena) spacer and attributes must be described - * - * @param string A name of a partial template. - * @param array The collection to be rendered. - * @param string Optional a name of a partial template used as spacer. - * @param array An optional associative array of attributes and their - * associated values. - * - * @return string A string representing the rendered presentation. - */ - function render_partial_collection($partial, $collection, - $spacer = NULL, $attributes = array()) { - - $template = $this->_factory->open($partial); - $template->set_attributes($this->_attributes); - $template->set_attributes($attributes); - - $collected = array(); - $iterator_name = pathinfo($partial, PATHINFO_FILENAME); - foreach ($collection as $element) - $collected[] = $template->render(array($iterator_name => $element)); - - $spacer = isset($spacer) ? $this->render_partial($spacer, $attributes) : ''; - - return join($spacer, $collected); - } -} diff --git a/vendor/flexi/lib/template.php b/vendor/flexi/lib/template.php deleted file mode 100644 index b4d97e845e719081eddd8ae18fae0b9b2cca8cd2..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/template.php +++ /dev/null @@ -1,251 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * Abstract template class representing the presentation layer of an action. - * Output can be customized by supplying attributes, which a template can - * manipulate and display. - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -abstract class Flexi_Template { - - /** - * @ignore - */ - public $_attributes, $_factory, $_options, $_layout, $_template; - - - /** - * Constructor - * - * @param string the path of the template. - * @param Flexi_TemplateFactory the factory creating this template - * @param array optional array of options - * - * @return void - */ - function __construct($template, &$factory, $options = array()) { - - # set template - $this->_template = $template; - - # set factory - $this->_factory = $factory; - - # set options - $this->_options = $options; - - # init attributes - $this->clear_attributes(); - - # set layout - $this->set_layout(NULL); - } - - - /** - * __set() is a magic method run when writing data to inaccessible members. - * In this class it is used to set attributes for the template in a - * comfortable way. - * - * @see http://php.net/__set - * - * @param string the name of the member field - * @param mixed the value for the member field - * - * @return void - */ - function __set($name, $value) { - $this->set_attribute($name, $value); - } - - - /** - * __get() is a magic method utilized for reading data from inaccessible - * members. - * In this class it is used to get attributes for the template in a - * comfortable way. - * - * @see http://php.net/__set - * - * @param string the name of the member field - * - * @return mixed the value for the member field - */ - function __get($name) { - return $this->get_attribute($name); - } - - - /** - * __isset() is a magic method triggered by calling isset() or empty() on - * inaccessible members. - * In this class it is used to check for attributes for the template in a - * comfortable way. - * - * @see http://php.net/__set - * - * @param string the name of the member field - * - * @return bool TRUE if that attribute exists, FALSE otherwise - */ - function __isset($name) { - return isset($this->_attributes[$name]); - } - - - /** - * __unset() is a magic method invoked when unset() is used on inaccessible - * members. - * In this class it is used to check for attributes for the template in a - * comfortable way. - * - * @see http://php.net/__set - * - * @param string the name of the member field - * - * @return void - */ - function __unset($name) { - $this->clear_attribute($name); - } - - - /** - * Parse, render and return the presentation. - * - * @param array An optional associative array of attributes and their - * associated values. - * @param string A name of a layout template. - * - * @return string A string representing the rendered presentation. - */ - function render($attributes = null, $layout = null) { - - if (isset($layout)) { - $this->set_layout($layout); - } - - # merge attributes - $this->set_attributes($attributes); - - return $this->_render(); - } - - - /** - * Parse, render and return the presentation. - * - * @return string A string representing the rendered presentation. - */ - abstract function _render(); - - - /** - * Returns the value of an attribute. - * - * @param string An attribute name. - * @param mixed An attribute value. - * - * @return mixed An attribute value. - */ - function get_attribute($name) { - return isset($this->_attributes[$name]) ? $this->_attributes[$name] : NULL; - } - - - /** - * Set an array of attributes. - * - * @return array An associative array of attributes and their associated - * values. - */ - function get_attributes() { - return $this->_attributes; - } - - - /** - * Set an attribute. - * - * @param string An attribute name. - * @param mixed An attribute value. - * - * @return void - */ - function set_attribute($name, $value) { - $this->_attributes[$name] = $value; - } - - - /** - * Set an array of attributes. - * - * @param array An associative array of attributes and their associated - * values. - * - * @return void - */ - function set_attributes($attributes) { - $this->_attributes = (array)$attributes + (array)$this->_attributes; - } - - - /** - * Clear all attributes associated with this template. - * - * @return void - */ - function clear_attributes() { - $this->_attributes = array(); - } - - - /** - * Clear an attribute associated with this template. - * - * @param string The name of the attribute to be cleared. - * - * @return void - */ - function clear_attribute($name) { - unset($this->_attributes[$name]); - } - - - /** - * Set the template's layout. - * - * @param mixed A name of a layout template or a layout template. - * - * @return void - */ - function set_layout($layout) { - $this->_layout = $this->_factory->open($layout); - } -} diff --git a/vendor/flexi/lib/template_factory.php b/vendor/flexi/lib/template_factory.php deleted file mode 100644 index dfdc74ebbc85bf25a6a95ff40c9abdb9cd463670..0000000000000000000000000000000000000000 --- a/vendor/flexi/lib/template_factory.php +++ /dev/null @@ -1,281 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -/** - * Using this factory you can create new Template objects. - * - * @package flexi - * - * @author Marcus Lunzenauer (mlunzena@uos.de) - * @copyright (c) Authors - * @version $Id$ - */ - -class Flexi_TemplateFactory { - - - /** - * include path for templates - * - * @var string - */ - protected $path; - - - /** - * mapping of file extensions to supported template classes - * - * @var array - */ - protected $handlers = array( - 'php' => array('Flexi_PhpTemplate', array()), - 'pjs' => array('Flexi_JsTemplate', array()) - ); - - - /** - * Constructor of TemplateFactory. - * - * @param string the template include path - * - * @return void - */ - function __construct($path) { - $this->set_path($path); - } - - - /** - * Sets a new include path for the factory and returns the old one. - * - * @param string the new path - * - * @return string the old path - */ - function set_path($path) { - - $old_path = $this->get_path(); - - if (substr($path, -1) != '/') - $path .= '/'; - - $this->path = $path; - - return $old_path; - } - - - /** - * Returns the include path of the factory - * - * @return string the current include path - */ - function get_path() { - return $this->path; - } - - - /** - * Open a template of the given name using the factory method pattern. - * If a string was given, the path of the factory is searched for a matching - * template. - * If this string starts with a slash or with /\w+:\/\//, the string is - * interpreted as an absolute path. Otherwise the path of the factory will be - * prepended. - * After that the factory searches for a file extension in this string. If - * there is none, the directory where the template is supposed to live is - * searched for a file starting with the template string and a supported - * file extension. - * At last the factory instantiates a template object of the matching template - * class. - * - * Examples: - * - * $factory->open('/path/to/template') - * does not prepend the factory's path but searches for "template.*" in - * "/path/to" - * - * $factory->open('template') - * prepends the factory's path and searches there for "template.*" - * - * $factory->open('template.php') - * prepends the factory's path but does not search and instantiates a - * PHPTemplate instead - * - * This method returns it's parameter, if it is not a string. This - * functionality is useful for helper methods like #render_partial - * - * @throws Flexi_TemplateNotFoundException - * - * @param string A name of a template. - * - * @return mixed the factored object - * - * @throws Flexi_TemplateNotFoundException if the template could not be found - */ - function open($template) { - - # if it is not a string, this method behaves like identity - if (!is_string($template)) { - return $template; - } - - # get file - $file = $this->get_template_file($template); - - # retrieve handler - list($class, $options) = $this->get_template_handler($file); - - return new $class($file, $this, $options); - } - - - /** - * This method returns the absolute filename of the template - * - * @param string a template string - * - * @return string an absolute filename - * - * @throws Flexi_TemplateNotFoundException if the template could not be found - */ - function get_template_file($template0) { - - $template = $this->get_absolute_path($template0); - $extension = $this->get_extension($template); - - # extension defined, is there a matching template class? - if ($extension !== NULL) { - if (file_exists($template)) { - return $template; - } - } - - # no extension defined, find it - else { - $file = $this->find_template($template); - if ($file !== NULL) { - return $file; - } - } - - # falling through to throw exception - throw new Flexi_TemplateNotFoundException( - sprintf('Missing template "%s" in "%s".', $template0, $this->path)); - } - - - /** - * Matches an extension to a template handler. - * - * @param string the template - * - * @return array an array containing the class name and an array of - * options of the matched extension; - * or NULL if the extension did not match - */ - function get_template_handler($template) { - $extension = $this->get_extension($template); - return isset($this->handlers[$extension]) - ? $this->handlers[$extension] - : NULL; - } - - - /** - * Registers a handler for templates with a matching extension. - * - * @param string the extension of the templates to handle - * @param string the name of the already loaded class - * @param array optional; an array of options which is used - * when constructing a new instance - */ - function add_handler($extension, $class, $options = array()) - { - $this->handlers[$extension] = array($class, $options); - } - - - /** - * Returns the absolute path to the template. If the given argument starts - * with a slash or with a protocoll, this method just returns its arguments. - * - * @param string an incomplete template name - * - * @return string an absolute path to the incomplete template name - */ - function get_absolute_path($template) { - return preg_match('#^(/|\w+://)#', $template) - ? $template - : $this->get_path() . $template; - } - - - /** - * Find template given w/o extension. - * - * @param string the template's filename w/o extension - * - * @return mixed NULL if there no such file could be found, a string - * containing the complete file name otherwise - */ - function find_template($template) { - foreach ($this->handlers as $ext => $handler) { - $file = "$template.$ext"; - if (file_exists($file)) { - return $file; - } - } - return NULL; - } - - - /** - * Returns the file extension if there is one. - * - * @param string an possibly incomplete template file name - * - * @return mixed a string containing the file extension if there is one, - * NULL otherwise - */ - function get_extension($file) { - $matches = array(); - $matched = preg_match('/\.([^\/.]+)$/', $file, $matches); - return $matched ? $matches[1] : NULL; - } - - - /** - * Class method to parse, render and return the presentation of a - * template. - * - * @param string A name of a template. - * @param array An associative array of attributes and their associated - * values. - * @param string A name of a layout template. - * - * @return string A string representing the rendered presentation. - */ - function render($name, $attributes = null, $layout = null) { - return $this->open($name)->render($attributes, $layout); - } -} diff --git a/vendor/flexi/test/all_tests.php b/vendor/flexi/test/all_tests.php deleted file mode 100644 index 939413ae3df3517e504357667a17ed383b7b7d00..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/all_tests.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# load required files -require_once 'simpletest/unit_tester.php'; -require_once 'simpletest/reporter.php'; -require_once 'simpletest/collector.php'; - - -# collect all tests -$all = new TestSuite('All tests'); - -$all->collect(dirname(__FILE__).'/lib', new SimplePatternCollector('/test.php$/')); -$all->collect(dirname(__FILE__).'/lib/helper', new SimplePatternCollector('/test.php$/')); - -# use text reporter if cli -if (sizeof($_SERVER['argv'])) - $all->run(new TextReporter()); - -# use html reporter if cgi -else - $all->run(new HtmlReporter()); diff --git a/vendor/flexi/test/coverage.php b/vendor/flexi/test/coverage.php deleted file mode 100644 index cbf694a7d77fbceda4ddf6275503b6912f7d3bf0..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/coverage.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -# Copyright (c) 2007 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -$PHPCOVERAGE_HOME = '/usr/share/php/spikephpcoverage/src/'; -$PHPCOVERAGE_REPORT_DIR = '/tmp/report/'; -$PHPCOVERAGE_APPBASE_PATH = '/tmp/report/'; - -require_once $PHPCOVERAGE_HOME . 'phpcoverage.inc.php'; -require_once $PHPCOVERAGE_HOME . 'CoverageRecorder.php'; -require_once $PHPCOVERAGE_HOME . 'reporter/HtmlCoverageReporter.php'; - -$reporter = new HtmlCoverageReporter('Code Coverage Report', '', $PHPCOVERAGE_REPORT_DIR); - -$includePaths = array('../lib'); -$excludePaths = array(); -$cov = new CoverageRecorder($includePaths, $excludePaths, $reporter); - -$cov->startInstrumentation(); -include 'all_tests.php'; -$cov->stopInstrumentation(); - -$cov->generateReport(); -$reporter->printTextSummary(); diff --git a/vendor/flexi/test/flexi_tests.php b/vendor/flexi/test/flexi_tests.php deleted file mode 100644 index d012ffc7010cb790584fe28796abcae05347045b..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/flexi_tests.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once 'simpletest/unit_tester.php'; -require_once 'simpletest/mock_objects.php'; -require_once 'simpletest/autorun.php'; - -require_once 'varstream.php'; - -/** - * Setting up tests for flexi. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id$ - */ - -class Flexi_Tests { - - /** - * Calling this function initializes everything necessary to test flexi. - * - * @return void - */ - function setup() { - static $once; - - if (!$once) { - - # define TEST_DIR - define('TEST_DIR', dirname(__FILE__)); - - # load required files - require_once TEST_DIR . '/../lib/flexi.php'; - - $once = TRUE; - } - } -} diff --git a/vendor/flexi/test/lib/helper/js_helper_test.php b/vendor/flexi/test/lib/helper/js_helper_test.php deleted file mode 100644 index f7c36ff28bb922b0e9a3704fab8b0e24565e82f2..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/helper/js_helper_test.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../../flexi_tests.php'; -Flexi_Tests::setup(); -require_once dirname(__FILE__) . '/../../../lib/helper/js_helper.php'; - -/** - * Testcase for JsHelper. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id: js_helper_test.php 4194 2006-10-24 14:52:31Z mlunzena $ - */ - -class JsHelperTestCase extends UnitTestCase { - - function setUp() { - } - - function tearDown() { - } - - - function test_link_to_function() { - $foo = JsHelper::link_to_function('Greeting', "alert('Hello world!')", - array('title' => 'hello')); - $exp = '<a title="hello" href="#" onclick="alert(\'Hello world!\'); '. - 'return false;">Greeting</a>'; - $this->assertEqual($exp, $foo); - } - - function test_button_to_function() { - $foo = JsHelper::button_to_function("Greeting", "alert('Hello world!')"); - $exp = '<input type="button" value="Greeting" '. - 'onclick="alert(\'Hello world!\');" />'; - $this->assertEqual($exp, $foo); - - $foo = JsHelper::button_to_function("Greeting", "alert('Hello world!')", - array('onclick' => 'alert(\'One\')')); - $exp = '<input onclick="alert(\'One\'); alert(\'Hello world!\');" '. - 'type="button" value="Greeting" />'; - $this->assertEqual($exp, $foo); - } - - function test_escape_javascript() { - $strings = array( - "\r" => '\n', - "\n" => '\n', - '\\' => '\\\\', - '</' => '<\\/', - '"' => '\\"', - "'" => "\\'" - ); - foreach ($strings as $string => $expect) { - $this->assertEqual(JsHelper::escape_javascript($string), $expect); - } - } - - function test_javascript_tag() { - $foo = JsHelper::javascript_tag("alert('All is good')"); - $exp = <<<EXPECTED -<script type="text/javascript"> -//<![CDATA[ -alert('All is good') -//]]> -</script> -EXPECTED; - $this->assertEqual($exp, $foo); - } -} diff --git a/vendor/flexi/test/lib/helper/prototype_helper_test.php b/vendor/flexi/test/lib/helper/prototype_helper_test.php deleted file mode 100644 index 3307f6a96eb9789b89c09dceb7b9da84986bc0e3..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/helper/prototype_helper_test.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../../flexi_tests.php'; -Flexi_Tests::setup(); -require_once dirname(__FILE__) . '/../../../lib/helper/prototype_helper.php'; - -/** - * Testcase for JsHelper. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id: prototype_helper_test.php 4194 2006-10-24 14:52:31Z mlunzena $ - */ - -class PrototypeHelperTestCase extends UnitTestCase { - - function setUp() { - } - - function tearDown() { - } - - function test_link_to_remote() { - - $foo = PrototypeHelper::link_to_remote('Delete this post', - array('update' => 'posts', - 'url' => 'http://destroy?id=1')); - $exp = '<a href="#" onclick="new Ajax.Updater(\'posts\', \'http://destroy?id=1\', {asynchronous:true, evalScripts:false}); return false;">Delete this post</a>'; - $this->assertEqual($exp, $foo); - - - $foo = PrototypeHelper::link_to_remote('Delete this post', - array('update' => array('success' => 'posts', - 'failure' => 'error'), - 'url' => 'http://destroy?id=1')); - $exp = '<a href="#" onclick="new Ajax.Updater({success:\'posts\',failure:\'error\'}, \'http://destroy?id=1\', {asynchronous:true, evalScripts:false}); return false;">Delete this post</a>'; - $this->assertEqual($exp, $foo); - - - $foo = PrototypeHelper::link_to_remote('Delete this post', - array('url' => 'http://destroy?id=1', - 404 => "alert('Not found...?')", - 'failure' => "alert('HTTPError!')")); - $exp = '<a href="#" onclick="new Ajax.Request(\'http://destroy?id=1\', {asynchronous:true, evalScripts:false, on404:function(request, json){alert(\'Not found...?\')}, onFailure:function(request, json){alert(\'HTTPError!\')}}); return false;">Delete this post</a>'; - $this->assertEqual($exp, $foo); - } - - function test_periodically_call_remote() { - $foo = PrototypeHelper::periodically_call_remote( - array('url' => 'http://clock', - 'frequency' => 2, - 'update' => 'clock')); - $exp = <<<EXPECTED -<script type="text/javascript"> -//<![CDATA[ -new PeriodicalExecuter(function() {new Ajax.Updater('clock', 'http://clock', {asynchronous:true, evalScripts:false})}, 2) -//]]> -</script> -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_form_remote_tag() { - - $foo = PrototypeHelper::form_remote_tag(array( - 'url' => 'http://tag_add', - 'update' => 'question_tags', - 'loading' => "Element.show('indicator'); tag.value = '';", - 'complete' => "Element.hide('indicator');")); - $exp = <<<EXPECTED -<form onsubmit="new Ajax.Updater('question_tags', 'http://tag_add', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('indicator');}, onLoading:function(request, json){Element.show('indicator'); tag.value = '';}, parameters:Form.serialize(this)}); return false;" action="http://tag_add" method="post"> -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_submit_to_remote() { - $foo = PrototypeHelper::submit_to_remote('name', 'value', - array( - 'url' => 'http://tag_add', - 'update' => 'question_tags', - 'loading' => "Element.show('indicator'); tag.value = '';", - 'complete' => "Element.hide('indicator');")); - $exp = <<<EXPECTED -<input type="button" onclick="new Ajax.Updater('question_tags', 'http://tag_add', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide('indicator');}, onLoading:function(request, json){Element.show('indicator'); tag.value = '';}, parameters:Form.serialize(this.form)}); return false;" name="name" value="value" /> -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_update_element_function() { - $foo = PrototypeHelper::update_element_function('element_id', - array('position' => 'bottom', 'content' => "<p>New product!</p>")); - $exp = "new Insertion.Bottom('element_id','<p>New product!<\/p>');\n"; - $this->assertEqual($exp, $foo); - } - - function test_evaluate_remote_response() { - $foo = PrototypeHelper::evaluate_remote_response(); - $exp = 'eval(request.responseText)'; - $this->assertEqual($exp, $foo); - } - - function test_remote_function() { - $foo = PrototypeHelper::remote_function(array('update' => 'options', - 'url' => 'http://update')); - $exp = <<<EXPECTED -new Ajax.Updater('options', 'http://update', {asynchronous:true, evalScripts:false}) -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_observe_field() { - $foo = PrototypeHelper::observe_field('element_id', - array('url' => 'http://update', - 'frequency' => 0, - 'update' => 'update_id')); - $exp = <<<EXPECTED -<script type="text/javascript"> -//<![CDATA[ -new Form.Element.EventObserver("element_id", 0, function(element, value) {new Ajax.Updater('update_id', 'http://update', {asynchronous:true, evalScripts:false, parameters:value})}); -//]]> -</script> -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_observe_form() { - $foo = PrototypeHelper::observe_form('form_id', - array('url' => 'http://update', - 'frequency' => 0, - 'update' => 'update_id')); - $exp = <<<EXPECTED -<script type="text/javascript"> -//<![CDATA[ -new Form.EventObserver("form_id", 0, function(element, value) {new Ajax.Updater('update_id', 'http://update', {asynchronous:true, evalScripts:false, parameters:value})}); -//]]> -</script> -EXPECTED; - $this->assertEqual($exp, $foo); - } - - function test_jsgen() { - $page = new Flexi_JavascriptGenerator(); - $page->insert_html('bottom', 'list', '<li>Last item</li>'); - $page->replace_html('person-45', 'Deleted.'); - $page->replace('person-45', 'Deleted.'); - $page->remove('id-1', 'id-2', 'id-3'); - $page->show('id-1', 'id-2', 'id-3'); - $page->hide('id-1', 'id-2', 'id-3'); - $page->toggle('id-1', 'id-2', 'id-3'); - $page->alert('Some "Message"!\/'); - $page->redirect_to('http://www.google.com'); - $page->delay('alert("Hallo Welt")', 23); - $page->visual_effect('highlight', 'id-42'); - # TODO (mlunzena) no asserts - # var_dump($page->to_s()); - } -} diff --git a/vendor/flexi/test/lib/helper/scriptaculous_helper_test.php b/vendor/flexi/test/lib/helper/scriptaculous_helper_test.php deleted file mode 100644 index 30531f94a83954145e17051ad5d465529aa6d585..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/helper/scriptaculous_helper_test.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../../flexi_tests.php'; -Flexi_Tests::setup(); -require_once dirname(__FILE__) . '/../../../lib/helper/scriptaculous_helper.php'; - -/** - * Testcase for ScriptaculousHelper. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id$ - */ - -class ScriptaculousHelperTestCase extends UnitTestCase { - - function setUp() { - } - - function tearDown() { - } - - function test_visual_effect() { - $result = ScriptaculousHelper::visual_effect('toggle_blind', 'id'); - $expected = 'new Effect.toggle(\'id\', \'blind\', {})'; - $this->assertEqual($result, $expected); - } - - function test_sortable_element() { - $result = ScriptaculousHelper::sortable_element('list', array( - 'url' => '/', - 'containment' => array('left', 'right'), - 'only' => 'middle', - )); - $expected = <<<SCRIPT -<script type="text/javascript"> -//<![CDATA[ -Sortable.create('list', {containment:['left','right'], onUpdate:function(){new Ajax.Request('/', {asynchronous:true, evalScripts:false, parameters:Sortable.serialize('list')})}, only:'middle'}) -//]]> -</script> -SCRIPT; - $this->assertEqual($result, $expected); - } -} diff --git a/vendor/flexi/test/lib/helper/tag_helper_test.php b/vendor/flexi/test/lib/helper/tag_helper_test.php deleted file mode 100644 index bd872f7eb215d58eae1189223fb88e6a49ef719f..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/helper/tag_helper_test.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../../flexi_tests.php'; -Flexi_Tests::setup(); -require_once dirname(__FILE__) . '/../../../lib/helper/tag_helper.php'; - -/** - * Testcase for TagHelper. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id: tag_helper_test.php 4194 2006-10-24 14:52:31Z mlunzena $ - */ - -class TagHelperTestCase extends UnitTestCase { - - function setUp() { - } - - function tearDown() { - } - - function test_tag() { - $foo = TagHelper::tag('img', array('src' => 'test.gif')); - $this->assertEqual('<img src="test.gif" />', $foo); - } - - function test_content_tag() { - $foo = TagHelper::content_tag('a', '#', array('href' => '#')); - $this->assertEqual('<a href="#">#</a>', $foo); - } - - function test_cdata_section() { - $foo = TagHelper::cdata_section('foo'); - $this->assertEqual('<![CDATA[foo]]>', $foo); - } - - function test_string_to_array() { - $array = TagHelper::string_to_array('id="anId" class=\'aClass\''); - $this->assertEqual(array('id' => 'anId', 'class' => 'aClass'), $array); - } -} diff --git a/vendor/flexi/test/lib/helper/text_helper_test.php b/vendor/flexi/test/lib/helper/text_helper_test.php deleted file mode 100644 index 1ac7834dba44be29cb31b4c95e35033d87283776..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/helper/text_helper_test.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../../flexi_tests.php'; -Flexi_Tests::setup(); -require_once dirname(__FILE__) . '/../../../lib/helper/text_helper.php'; - -/** - * Testcase for TextHelper. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id$ - */ - -class TextHelperTestCase extends UnitTestCase { - - function setUp() { - } - - function tearDown() { - TextHelper::reset_cycle(); - } - - function test_camelize() { - $foo = TextHelper::camelize('foo_bar_baz/FOO is great'); - $this->assertEqual('FooBarBazFOOIsGreat', $foo); - } - - function test_simple_cycle() { - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - $this->assertEqual('even', TextHelper::cycle('odd', 'even')); - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - $this->assertEqual('even', TextHelper::cycle('odd', 'even')); - } - - function test_reset_cycle() { - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - $this->assertEqual('even', TextHelper::cycle('odd', 'even')); - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - TextHelper::reset_cycle(); - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - } - - function test_double_cycle_should_reset_each_time() { - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - $this->assertEqual('red', TextHelper::cycle('red', 'black')); - $this->assertEqual('odd', TextHelper::cycle('odd', 'even')); - $this->assertEqual('red', TextHelper::cycle('red', 'black')); - } - - function test_named_cycles() { - $this->assertEqual('odd', TextHelper::cycle(array('odd', 'even', 'name' => '1st'))); - $this->assertEqual('red', TextHelper::cycle('red', 'black')); - $this->assertEqual('even', TextHelper::cycle(array('odd', 'even', 'name' => '1st'))); - $this->assertEqual('black', TextHelper::cycle('red', 'black')); - } -} diff --git a/vendor/flexi/test/lib/js_template_test.php b/vendor/flexi/test/lib/js_template_test.php deleted file mode 100644 index 77f577b2ba9c7defee9ed63c8867d2eb9798b6fc..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/js_template_test.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../flexi_tests.php'; -Flexi_Tests::setup(); - -class JsTemplateTestCase extends UnitTestCase { - - var $factory; - - function setUp() { - $this->setUpFS(); - $this->factory = new Flexi_TemplateFactory('var://templates/'); - } - - function tearDown() { - unset($this->factory); - - stream_wrapper_unregister("var"); - } - - function setUpFS() { - ArrayFileStream::set_filesystem(array( - 'templates' => array( - 'foo.pjs' => '', - 'layout.pjs' => '' - ))); - stream_wrapper_register("var", "ArrayFileStream") or die("Failed to register protocol"); - } - - - function test_something() { - $template = $this->factory->open('foo'); - $template->render(array('whom' => 'world'), 'layout'); - } -} - diff --git a/vendor/flexi/test/lib/php_template_test.php b/vendor/flexi/test/lib/php_template_test.php deleted file mode 100644 index 1c6d85ce7b06dc9d63ab13f793098a235ed8822d..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/php_template_test.php +++ /dev/null @@ -1,182 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../flexi_tests.php'; -Flexi_Tests::setup(); - -class PhpTemplateTestCase extends UnitTestCase { - - var $factory; - - - function setUp() { - $this->setUpFS(); - $this->factory = new Flexi_TemplateFactory('var://templates/'); - } - - - function tearDown() { - unset($this->factory); - - stream_wrapper_unregister("var"); - } - - function setUpFS() { - ArrayFileStream::set_filesystem(array( - 'templates' => array( - - 'foo_using_partial.php' => - 'Hello, <?= $this->render_partial("foos_partial") ?>!', - - 'foos_partial.php' => - '<h1><?= $whom ?> at <?= $when ?></h1>', - - 'foo_with_partial_collection.php' => - '[<?= $this->render_partial_collection("item", $items, "spacer") ?>]', - - 'item.php' => - '"<?= $item ?>"', - - 'spacer.php' => - ', ', - - 'attributes.php' => - '<? foreach (get_defined_vars() as $name => $value) : ?>' . - '<?= $name ?><?= $value ?>'. - '<? endforeach ?>', - - 'foo.php' => - 'Hello, <?= $whom ?>!', - - 'layout.php' => - '[<?= $content_for_layout ?>]', - ))); - stream_wrapper_register("var", "ArrayFileStream") or die("Failed to register protocol"); - } - - function test_render_partial() { - $template = $this->factory->open('foo_using_partial'); - $template->set_attribute('whom', 'bar'); - $output = $template->render(array('when' => 'now')); - $spec = "Hello, <h1>bar at now</h1>!"; - $this->assertEqual($output, $spec); - } - - - function test_render_partial_collection() { - $template = $this->factory->open('foo_with_partial_collection'); - $result = $template->render_partial_collection('item', - range(1, 3), - 'spacer'); - $this->assertEqual('"1", "2", "3"', $result); - } - - - function test_should_override_attributes_with_those_passed_to_render() { - - $template = $this->factory->open('attributes'); - $template->set_attribute('foo', 'baz'); - - $template->render(array('foo' => 'bar')); - - $bar = $template->get_attribute('foo'); - $this->assertEqual($bar, 'bar'); - - $out = $template->render(); - - $bar = $template->get_attribute('foo'); - $this->assertEqual($bar, 'bar'); - } - - function test_render_without_layout() { - $foo = $this->factory->open('foo'); - $foo->set_attribute('whom', 'bar'); - $out = $foo->render(); - $this->assertEqual('Hello, bar!', $out); - } - - function test_render_with_layout() { - $foo = $this->factory->open('foo'); - $foo->set_attribute('whom', 'bar'); - $foo->set_layout('layout'); - $out = $foo->render(); - $this->assertEqual('[Hello, bar!]', $out); - } - - function test_render_with_layout_inline() { - $out = $this->factory->render('foo', array('whom' => 'bar'), 'layout'); - $this->assertEqual('[Hello, bar!]', $out); - } - - function test_render_with_missing_layout() { - $foo = $this->factory->open('foo'); - $this->expectException("Flexi_TemplateNotFoundException"); - $foo->set_layout('nosuchlayout'); - } - - function test_render_with_attributes() { - $foo = $this->factory->open('foo'); - $foo->set_attribute('whom', 'bar'); - $foo->set_layout('layout'); - $foo_out = $foo->render(); - - $bar = $this->factory->open('foo'); - $bar_out = $bar->render(array('whom' => 'bar'), 'layout'); - - $this->assertEqual($foo_out, $bar_out); - } -} - - -class PhpTemplatePartialBugTestCase extends UnitTestCase { - function setUp() { - $this->setUpFS(); - $this->factory = new Flexi_TemplateFactory('var://templates/'); - } - - function tearDown() { - unset($this->factory); - - stream_wrapper_unregister("var"); - } - - function setUpFS() { - ArrayFileStream::set_filesystem(array( - 'templates' => array( - 'layout.php' => - '<? $do_not_echo_this = $this->render_partial_collection("partial", range(1, 5));'. - 'echo $content_for_layout;', - 'partial.php' => - 'partial', - 'template.php' => - 'template', - ))); - stream_wrapper_register("var", "ArrayFileStream") or die("Failed to register protocol"); - } - - function test_partial_bug() { - $template = $this->factory->open('template'); - $template->set_layout('layout'); - $result = $template->render(); - $this->assertEqual($result, "template"); - } -} diff --git a/vendor/flexi/test/lib/template_factory_test.php b/vendor/flexi/test/lib/template_factory_test.php deleted file mode 100644 index c2166da954fc8d65afab406e107544ff11d19500..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/template_factory_test.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../flexi_tests.php'; -Flexi_Tests::setup(); - -/** - * Testcase for TemplateFactory.php. - * - * @package flexi - * @subpackage test - * - * @author mlunzena - * @copyright (c) Authors - * @version $Id: template_test.php 4194 2006-10-24 14:52:31Z mlunzena $ - */ - -class TemplateFactoryTestCase extends UnitTestCase { - - var $factory; - - function setUp() { - $this->setUpFS(); - $this->factory = new Flexi_TemplateFactory('var://templates'); - } - - function tearDown() { - unset($this->factory); - stream_wrapper_unregister("var"); - } - - function setUpFS() { - ArrayFileStream::set_filesystem(array( - 'templates' => array( - 'foo.php' => 'some content', - 'baz.unknown' => 'some content', - 'multiplebasenames' => array( - 'foo.txt' => 'there is no matching template class', - 'foo.php' => 'some content', - 'bar.txt' => 'there is no matching template class' - ) - ) - )); - stream_wrapper_register("var", "ArrayFileStream") - or die("Failed to register protocol"); - } - - function test_should_create_factory() { - $factory = new Flexi_TemplateFactory('.'); - $this->assertNotNull($factory); - } - - function test_should_create_factory_using_path() { - $path = 'var://'; - $factory = new Flexi_TemplateFactory($path); - $this->assertNotNull($factory); - } - - function test_should_open_template_using_relative_path() { - $foo = $this->factory->open('foo'); - $this->assertNotNull($foo); - } - - function test_should_open_template_using_absolute_path() { - $foo = $this->factory->open('var://templates/foo'); - $this->assertNotNull($foo); - } - - function test_should_throw_an_exception_opening_a_missing_template_without_file_extension() { - $this->expectException('Flexi_TemplateNotFoundException'); - $bar = $this->factory->open('bar'); - } - - function test_should_throw_an_exception_opening_a_missing_template_with_file_extension() { - $this->expectException('Flexi_TemplateNotFoundException'); - $bar = $this->factory->open('bar.php'); - } - - function test_should_open_template_using_extension() { - $foo = $this->factory->open('foo.php'); - $this->assertIsA($foo, 'Flexi_PhpTemplate'); - } - - function test_should_throw_an_exception_when_opening_a_template_with_unknown_extension() { - $this->expectException('Flexi_TemplateNotFoundException'); - $baz = $this->factory->open('baz'); - } - - function test_should_throw_an_exception_opening_a_template_in_a_non_existing_directory() { - $this->expectException('Flexi_TemplateNotFoundException'); - $this->factory->open('doesnotexist/foo'); - } - - function test_should_search_for_a_supported_template() { - $template = $this->factory->open('multiplebasenames/foo'); - $this->assertIsA($template, 'Flexi_PhpTemplate'); - } -} diff --git a/vendor/flexi/test/lib/template_test.php b/vendor/flexi/test/lib/template_test.php deleted file mode 100644 index e0f2e0b86b5b06a129abc94394bfcdb06690e419..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/lib/template_test.php +++ /dev/null @@ -1,215 +0,0 @@ -<?php - -# Copyright (c) 2008 - Marcus Lunzenauer <mlunzena@uos.de> -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -require_once dirname(__FILE__) . '/../flexi_tests.php'; -Flexi_Tests::setup(); - -Mock::generate('Flexi_TemplateFactory'); -Mock::generatePartial('Flexi_Template', 'MockTemplate', array('_render')); - -class AnEmptyTemplate extends UnitTestCase { - - - var $factory; - - - function setUp() { - $this->factory = new MockFlexi_TemplateFactory(TEST_DIR . '/templates/template_tests'); - $template = new MockTemplate(); - $template->__construct('foo', $this->factory); - $this->factory->setReturnValue('open', $template); - } - - - function tearDown() { - unset($this->factory); - } - - - function test_should_have_no_attributes() { - $template = $this->factory->open(''); - $this->assertEqual(0, sizeof($template->get_attributes())); - } - - - function test_should_not_be_empty_after_setting_an_attribute() { - $template = $this->factory->open(''); - $template->set_attribute('foo', 'bar'); - $this->assertNotEqual(0, sizeof($template->get_attributes())); - } - - - function test_should_be_empty_after_clear() { - - $template = $this->factory->open('foo'); - - $this->assertEqual(0, sizeof($template->get_attributes())); - - $template->clear_attributes(); - $this->assertEqual(0, sizeof($template->get_attributes())); - } -} - - -class ATemplate extends UnitTestCase { - - - var $factory; - - - function setUp() { - $this->factory = new MockFlexi_TemplateFactory(TEST_DIR . '/templates/template_tests'); - $template = new MockTemplate(); - $template->__construct('foo', $this->factory); - $this->factory->setReturnValue('open', $template); - } - - - function tearDown() { - unset($this->factory); - } - - - function test_should_return_an_previously_set_attribute() { - $template = $this->factory->open('foo'); - $template->set_attribute('whom', 'bar'); - $this->assertEqual('bar', $template->get_attribute('whom')); - } - - - function test_should_return_previously_set_attributes() { - - $template = $this->factory->open('foo'); - $template->set_attributes(array('whom' => 'bar', 'foo' => 'baz')); - - $attributes = $template->get_attributes(); - $this->assertIsA($attributes, 'array'); - $this->assertEqual(2, sizeof($attributes)); - $this->assertEqual('bar', $attributes['whom']); - $this->assertEqual('baz', $attributes['foo']); - } - - - function test_should_merge_attributes_with_set_attributes() { - - $template = $this->factory->open('foo'); - $template->set_attributes(array('a' => 1, 'b' => 2)); - - $this->assertEqual(2, sizeof($template->get_attributes())); - $this->assertEqual(1, $template->get_attribute('a')); - $this->assertEqual(2, $template->get_attribute('b')); - - $template->set_attributes(array('b' => 8, 'c' => 9)); - - $this->assertEqual(3, sizeof($template->get_attributes())); - $this->assertEqual(1, $template->get_attribute('a')); - $this->assertEqual(8, $template->get_attribute('b')); - $this->assertEqual(9, $template->get_attribute('c')); - } - - - function test_should_be_empty_after_clear() { - - $template = $this->factory->open('foo'); - - $template->set_attributes(array('a' => 1, 'b' => 2)); - $this->assertNotEqual(0, sizeof($template->get_attributes())); - - $template->clear_attributes(); - $this->assertEqual(0, sizeof($template->get_attributes())); - } -} - - - -class MagicMethodsTemplate extends UnitTestCase { - - - var $factory; - - - function setUp() { - $this->factory = new MockFlexi_TemplateFactory(TEST_DIR . '/templates/template_tests'); - $this->template = new MockTemplate(); - $this->template->__construct('foo', $this->factory); - } - - - function tearDown() { - unset($this->factory); - unset($this->template); - } - - - function test_should_set_an_attribute_using_the_magic_methods() { - $this->template->foo = 'bar'; - $this->assertEqual('bar', $this->template->get_attribute('foo')); - } - - - function test_should_not_set_a_protected_member_field_as_an_attribute() { - $this->template->_layout = 'bar'; - $this->assertNull($this->template->get_attribute('_layout')); - $this->assertEqual('bar', $this->template->_layout); - } - - function test_should_overwrite_an_attribute() { - $this->template->set_attribute('foo', 'bar'); - $this->template->foo = 'baz'; - $this->assertEqual('baz', $this->template->get_attribute('foo')); - } - - function test_should_return_an_existing_attribute_using_the_magic_methods() { - $this->template->set_attribute('foo', 'bar'); - $this->assertEqual('bar', $this->template->foo); - } - - - function test_should_return_null_for_a_non_existing_attribute_using_the_magic_methods() { - $this->assertNull($this->template->foo); - } - - - function test_should_unset_an_attribute_using_the_magic_methods() { - $this->template->foo = 'bar'; - unset($this->template->foo); - $this->assertNull($this->template->foo); - } - - - function test_should_return_null_on_unsetting_a_non_attribute() { - unset($this->template->foo); - $this->assertNull($this->template->foo); - } - - - function test_should_return_true_on_isset_for_an_attribute() { - $this->template->foo = 'bar'; - $this->assertTrue(isset($this->template->foo)); - } - - - function test_should_return_false_on_isset_for_a_non_existing_attribute() { - $this->assertFalse(isset($this->template->foo)); - } -} - diff --git a/vendor/flexi/test/templates/factory_tests/baz.unknown_extension b/vendor/flexi/test/templates/factory_tests/baz.unknown_extension deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/vendor/flexi/test/templates/factory_tests/foo.php b/vendor/flexi/test/templates/factory_tests/foo.php deleted file mode 100644 index 01503556d3b61bd62e77600596eb47871309564c..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/factory_tests/foo.php +++ /dev/null @@ -1 +0,0 @@ -Hallo, <?= $whom ?>! \ No newline at end of file diff --git a/vendor/flexi/test/templates/layout_with_partials/layout.php b/vendor/flexi/test/templates/layout_with_partials/layout.php deleted file mode 100644 index a037f25925514a16709e9827989a0cd9cd559a15..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/layout_with_partials/layout.php +++ /dev/null @@ -1,3 +0,0 @@ -<? -$do_not_echo_this = $this->render_partial_collection('partial', range(1, 5)); -echo $content_for_layout ?> diff --git a/vendor/flexi/test/templates/layout_with_partials/partial.php b/vendor/flexi/test/templates/layout_with_partials/partial.php deleted file mode 100644 index b648ac92333301658c4f49b315f21130c689c819..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/layout_with_partials/partial.php +++ /dev/null @@ -1 +0,0 @@ -partial diff --git a/vendor/flexi/test/templates/layout_with_partials/template.php b/vendor/flexi/test/templates/layout_with_partials/template.php deleted file mode 100644 index 3236cba6d6ebe89a13ca485fe17c890548d23da5..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/layout_with_partials/template.php +++ /dev/null @@ -1 +0,0 @@ -template diff --git a/vendor/flexi/test/templates/template_tests/attributes.php b/vendor/flexi/test/templates/template_tests/attributes.php deleted file mode 100644 index 8ee269aa55d4a9e772bcfee3238aa18053ac8d82..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/attributes.php +++ /dev/null @@ -1,3 +0,0 @@ -<? foreach (get_defined_vars() as $name => $value) : ?> -<?= $name ?><?= $value ?> -<? endforeach ?> diff --git a/vendor/flexi/test/templates/template_tests/foo.php b/vendor/flexi/test/templates/template_tests/foo.php deleted file mode 100644 index 01503556d3b61bd62e77600596eb47871309564c..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/foo.php +++ /dev/null @@ -1 +0,0 @@ -Hallo, <?= $whom ?>! \ No newline at end of file diff --git a/vendor/flexi/test/templates/template_tests/foo_using_partial.php b/vendor/flexi/test/templates/template_tests/foo_using_partial.php deleted file mode 100644 index 813a0b6d1fa8d66936a99f103b5d0dce211958cb..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/foo_using_partial.php +++ /dev/null @@ -1 +0,0 @@ -Hallo, <?= $this->render_partial('foos_partial') ?>! diff --git a/vendor/flexi/test/templates/template_tests/foo_with_partial_collection.php b/vendor/flexi/test/templates/template_tests/foo_with_partial_collection.php deleted file mode 100644 index 3deeeed59ac44bcdbc9f7041d7b15cdd06ffa4b0..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/foo_with_partial_collection.php +++ /dev/null @@ -1 +0,0 @@ -[<?= $this->render_partial_collection('item', $items, 'spacer') ?>] diff --git a/vendor/flexi/test/templates/template_tests/foos_partial.php b/vendor/flexi/test/templates/template_tests/foos_partial.php deleted file mode 100644 index 8746c07b03b1c505acfe8bc5b510b4446057d326..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/foos_partial.php +++ /dev/null @@ -1 +0,0 @@ -<h1><?= $whom ?> at <?= $when ?></h1> diff --git a/vendor/flexi/test/templates/template_tests/item.php b/vendor/flexi/test/templates/template_tests/item.php deleted file mode 100644 index 6cf541802efad9e07e41ede6644df316d5902e51..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/item.php +++ /dev/null @@ -1 +0,0 @@ -"<?= $item ?>" diff --git a/vendor/flexi/test/templates/template_tests/layouts/layout.php b/vendor/flexi/test/templates/template_tests/layouts/layout.php deleted file mode 100644 index 860be85e669b06d843c368d66cd290286b34d28d..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/layouts/layout.php +++ /dev/null @@ -1 +0,0 @@ -[<?=$content_for_layout?>] \ No newline at end of file diff --git a/vendor/flexi/test/templates/template_tests/spacer.php b/vendor/flexi/test/templates/template_tests/spacer.php deleted file mode 100644 index 41622b472098a6142f0225b50140189cfbd51779..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/templates/template_tests/spacer.php +++ /dev/null @@ -1 +0,0 @@ -, \ No newline at end of file diff --git a/vendor/flexi/test/varstream.php b/vendor/flexi/test/varstream.php deleted file mode 100644 index 2dd7c680df9703fb24aa0321852c51a498b2d7c7..0000000000000000000000000000000000000000 --- a/vendor/flexi/test/varstream.php +++ /dev/null @@ -1,244 +0,0 @@ -<?php - -class ArrayFileStream { - - private $open_file, $position; - - private static $fs; - - static function set_filesystem(array $fs) { - ArrayFileStream::$fs = $fs; - } - - private static function &get_element($path) { - $result =& ArrayFileStream::$fs; - foreach (preg_split('/\//', $path, -1, PREG_SPLIT_NO_EMPTY) as $element) { - if (!isset($result[$element])) { - $null = NULL; - return $null; - } - $result =& $result[$element]; - } - return $result; - } - - private static function &get_file($path) { - $url = parse_url($path); - $file =& self::get_element($url['host'] . $url['path']); - - if (is_null($file)) { - throw new Exception("file not found."); - } - return $file; - } - - function stream_close() { - - # nothing to do - } - - function stream_flush() { - - # nothing to do - } - - function stream_open($path, $mode, $options, $opened_path) { - - try { - $this->open_file =& self::get_file($path); - $this->position = 0; - return true; - } catch (Exception $e) { - return false; - } - } - - function stream_read($count) { - - $ret = substr($this->open_file, $this->position, $count); - $this->position += strlen($ret); - return $ret; - } - - function stream_write($data) { - - $left = substr($this->open_file, 0, $this->position); - $right = substr($this->open_file, $this->position + strlen($data)); - $this->open_file = $left . $data . $right; - $this->position += strlen($data); - return strlen($data); - } - - function stream_tell() { - - return $this->position; - } - - function stream_eof() { - - return $this->position >= strlen($this->open_file); - } - - function stream_seek($offset, $whence) { - - switch ($whence) { - case SEEK_SET: - if ($offset < strlen($this->open_file) && $offset >= 0) { - $this->position = $offset; - return true; - } - else { - return false; - } - break; - - case SEEK_CUR: - if ($offset >= 0) { - $this->position += $offset; - return true; - } - else { - return false; - } - break; - - case SEEK_END: - if (strlen($this->open_file) + $offset >= 0) { - $this->position = strlen($this->open_file) + $offset; - return true; - } - else { - return false; - } - break; - - default: - return false; - } - } - - function stream_stat() { - - return array('size' => is_array($this->open_file) - ? sizeof($this->open_file) - : strlen($this->open_file)); - } - - function unlink($path) { - - $parent =& self::get_file(dirname($path)); - - if (is_array($parent) && isset($parent[basename($path)])) { - unset($parent[basename($path)]); - return TRUE; - } - - return FALSE; - } - - function rename($path_from, $path_to) { - - throw new Exception('not implemented yet'); - } - - function mkdir($path, $mode, $options) { - - throw new Exception('not implemented yet'); - } - - function rmdir($path, $options) { - - throw new Exception('not implemented yet'); - } - - function dir_opendir($path, $options) { - try { - $this->open_file =& self::get_file($path); - } catch (Exception $e) { - return FALSE; - } - - return is_array($this->open_file); - } - - function url_stat($path, $flags) { - - try { - $file =& self::get_file($path); - } catch (Exception $e) { - return FALSE; - } - - $time = time(); - $keys = array( - 'dev' => 0, - 'ino' => 0, - 'mode' => is_array($file) ? 16832 : 33216, // chmod 700 - 'nlink' => 0, - 'uid' => function_exists('posix_getuid') ? posix_getuid() : 0, - 'gid' => function_exists('posix_getgid') ? posix_getgid() : 0, - 'rdev' => 0, - 'size' => $flags & STREAM_URL_STAT_QUIET - ? @strlen($file) : strlen($file), - 'atime' => $time, - 'mtime' => $time, - 'ctime' => $time, - 'blksize' => 0, - 'blocks' => 0 - ); - return array_merge(array_values($keys), $keys); - } - - function dir_readdir() { - if (!is_array($this->open_file)) { - return FALSE; - } - $result = key($this->open_file); - if ($result === NULL) { - return FALSE; - } - next($this->open_file); - return $result; - } - - function dir_rewinddir() { - - throw new Exception('not implemented yet'); - } - - function dir_closedir() { - reset($this->open_file); - unset($this->open_file); - } -} - - -#ArrayFileStream::set_filesystem( -# array('tmp' => -# array('a' => 'my content', -# 'b' => '<? echo "hallo welt!";'))); - - -#stream_wrapper_register("var", "ArrayFileStream") -# or die("Failed to register protocol"); - -#$fp = fopen("var://tmp/a", "rw+"); - - -#while (!feof($fp)) { -# var_dump(fgets($fp)); -#} - -#fwrite($fp, "line1\n"); -#fwrite($fp, "line2\n"); -#fwrite($fp, "line3\n"); - -#rewind($fp); - -#var_dump(file_get_contents('var://tmp/a')); - -#fclose($fp); -#unlink('var://tmp/a'); - -#var_dump(include 'var://tmp/b'); - diff --git a/vendor/flexi/vendor/mustache.php/LICENSE b/vendor/flexi/vendor/mustache.php/LICENSE deleted file mode 100644 index 63c95aceb003d513f1b35d4715a2543a5d54e695..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2010 Justin Hileman - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/flexi/vendor/mustache.php/Mustache.php b/vendor/flexi/vendor/mustache.php/Mustache.php deleted file mode 100644 index 18236aa2eb43b4cc074dbaaecdc3a64088a980d8..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/Mustache.php +++ /dev/null @@ -1,931 +0,0 @@ -<?php - -/** - * A Mustache implementation in PHP. - * - * {@link http://defunkt.github.com/mustache} - * - * Mustache is a framework-agnostic logic-less templating language. It enforces separation of view - * logic from template files. In fact, it is not even possible to embed logic in the template. - * - * This is very, very rad. - * - * @author Justin Hileman {@link http://justinhileman.com} - */ -class Mustache { - - const VERSION = '1.1.0'; - const SPEC_VERSION = '1.1.2'; - - /** - * Should this Mustache throw exceptions when it finds unexpected tags? - * - * @see self::_throwsException() - */ - protected $_throwsExceptions = array( - MustacheException::UNKNOWN_VARIABLE => false, - MustacheException::UNCLOSED_SECTION => true, - MustacheException::UNEXPECTED_CLOSE_SECTION => true, - MustacheException::UNKNOWN_PARTIAL => false, - MustacheException::UNKNOWN_PRAGMA => true, - ); - - // Override the escaper function. Defaults to `htmlspecialchars`. - protected $_escape; - - // Override charset passed to htmlentities() and htmlspecialchars(). Defaults to UTF-8. - protected $_charset = 'UTF-8'; - - /** - * Pragmas are macro-like directives that, when invoked, change the behavior or - * syntax of Mustache. - * - * They should be considered extremely experimental. Most likely their implementation - * will change in the future. - */ - - /** - * The {{%UNESCAPED}} pragma swaps the meaning of the {{normal}} and {{{unescaped}}} - * Mustache tags. That is, once this pragma is activated the {{normal}} tag will not be - * escaped while the {{{unescaped}}} tag will be escaped. - * - * Pragmas apply only to the current template. Partials, even those included after the - * {{%UNESCAPED}} call, will need their own pragma declaration. - * - * This may be useful in non-HTML Mustache situations. - */ - const PRAGMA_UNESCAPED = 'UNESCAPED'; - - /** - * Constants used for section and tag RegEx - */ - const SECTION_TYPES = '\^#\/'; - const TAG_TYPES = '#\^\/=!<>\\{&'; - - protected $_otag = '{{'; - protected $_ctag = '}}'; - - protected $_tagRegEx; - - protected $_template = ''; - protected $_context = array(); - protected $_partials = array(); - protected $_pragmas = array(); - - protected $_pragmasImplemented = array( - self::PRAGMA_UNESCAPED - ); - - protected $_localPragmas = array(); - - /** - * Mustache class constructor. - * - * This method accepts a $template string and a $view object. Optionally, pass an associative - * array of partials as well. - * - * Passing an $options array allows overriding certain Mustache options during instantiation: - * - * $options = array( - * // `escape` -- custom escaper callback; must be callable. - * 'escape' => function($text) { - * return htmlspecialchars($text, ENT_COMPAT, 'UTF-8'); - * }, - * - * // `charset` -- must be supported by `htmlspecialentities()`. defaults to 'UTF-8' - * 'charset' => 'ISO-8859-1', - * - * // opening and closing delimiters, as an array or a space-separated string - * 'delimiters' => '<% %>', - * - * // an array of pragmas to enable/disable - * 'pragmas' => array( - * Mustache::PRAGMA_UNESCAPED => true - * ), - * - * // an array of thrown exceptions to enable/disable - * 'throws_exceptions' => array( - * MustacheException::UNKNOWN_VARIABLE => false, - * MustacheException::UNCLOSED_SECTION => true, - * MustacheException::UNEXPECTED_CLOSE_SECTION => true, - * MustacheException::UNKNOWN_PARTIAL => false, - * MustacheException::UNKNOWN_PRAGMA => true, - * ), - * ); - * - * @access public - * @param string $template (default: null) - * @param mixed $view (default: null) - * @param array $partials (default: null) - * @param array $options (default: array()) - * @return void - */ - public function __construct($template = null, $view = null, $partials = null, array $options = null) { - if ($template !== null) $this->_template = $template; - if ($partials !== null) $this->_partials = $partials; - if ($view !== null) $this->_context = array($view); - if ($options !== null) $this->_setOptions($options); - } - - /** - * Helper function for setting options from constructor args. - * - * @access protected - * @param array $options - * @return void - */ - protected function _setOptions(array $options) { - if (isset($options['escape'])) { - if (!is_callable($options['escape'])) { - throw new InvalidArgumentException('Mustache constructor "escape" option must be callable'); - } - $this->_escape = $options['escape']; - } - - if (isset($options['charset'])) { - $this->_charset = $options['charset']; - } - - if (isset($options['delimiters'])) { - $delims = $options['delimiters']; - if (!is_array($delims)) { - $delims = array_map('trim', explode(' ', $delims, 2)); - } - $this->_otag = $delims[0]; - $this->_ctag = $delims[1]; - } - - if (isset($options['pragmas'])) { - foreach ($options['pragmas'] as $pragma_name => $pragma_value) { - if (!in_array($pragma_name, $this->_pragmasImplemented, true)) { - throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA); - } - } - $this->_pragmas = $options['pragmas']; - } - - if (isset($options['throws_exceptions'])) { - foreach ($options['throws_exceptions'] as $exception => $value) { - $this->_throwsExceptions[$exception] = $value; - } - } - } - - /** - * Mustache class clone method. - * - * A cloned Mustache instance should have pragmas, delimeters and root context - * reset to default values. - * - * @access public - * @return void - */ - public function __clone() { - $this->_otag = '{{'; - $this->_ctag = '}}'; - $this->_localPragmas = array(); - - if ($keys = array_keys($this->_context)) { - $last = array_pop($keys); - if ($this->_context[$last] instanceof Mustache) { - $this->_context[$last] =& $this; - } - } - } - - /** - * Render the given template and view object. - * - * Defaults to the template and view passed to the class constructor unless a new one is provided. - * Optionally, pass an associative array of partials as well. - * - * @access public - * @param string $template (default: null) - * @param mixed $view (default: null) - * @param array $partials (default: null) - * @return string Rendered Mustache template. - */ - public function render($template = null, $view = null, $partials = null) { - if ($template === null) $template = $this->_template; - if ($partials !== null) $this->_partials = $partials; - - $otag_orig = $this->_otag; - $ctag_orig = $this->_ctag; - - if ($view) { - $this->_context = array($view); - } else if (empty($this->_context)) { - $this->_context = array($this); - } - - $template = $this->_renderPragmas($template); - $template = $this->_renderTemplate($template); - - $this->_otag = $otag_orig; - $this->_ctag = $ctag_orig; - - return $template; - } - - /** - * Wrap the render() function for string conversion. - * - * @access public - * @return string - */ - public function __toString() { - // PHP doesn't like exceptions in __toString. - // catch any exceptions and convert them to strings. - try { - $result = $this->render(); - return $result; - } catch (Exception $e) { - return "Error rendering mustache: " . $e->getMessage(); - } - } - - /** - * Internal render function, used for recursive calls. - * - * @access protected - * @param string $template - * @return string Rendered Mustache template. - */ - protected function _renderTemplate($template) { - if ($section = $this->_findSection($template)) { - list($before, $type, $tag_name, $content, $after) = $section; - - $rendered_before = $this->_renderTags($before); - - $rendered_content = ''; - $val = $this->_getVariable($tag_name); - switch($type) { - // inverted section - case '^': - if (empty($val)) { - $rendered_content = $this->_renderTemplate($content); - } - break; - - // regular section - case '#': - // higher order sections - if ($this->_varIsCallable($val)) { - $rendered_content = $this->_renderTemplate(call_user_func($val, $content)); - } else if ($this->_varIsIterable($val)) { - foreach ($val as $local_context) { - $this->_pushContext($local_context); - $rendered_content .= $this->_renderTemplate($content); - $this->_popContext(); - } - } else if ($val) { - if (is_array($val) || is_object($val)) { - $this->_pushContext($val); - $rendered_content = $this->_renderTemplate($content); - $this->_popContext(); - } else { - $rendered_content = $this->_renderTemplate($content); - } - } - break; - } - - return $rendered_before . $rendered_content . $this->_renderTemplate($after); - } - - return $this->_renderTags($template); - } - - /** - * Prepare a section RegEx string for the given opening/closing tags. - * - * @access protected - * @param string $otag - * @param string $ctag - * @return string - */ - protected function _prepareSectionRegEx($otag, $ctag) { - return sprintf( - '/(?:(?<=\\n)[ \\t]*)?%s(?:(?P<type>[%s])(?P<tag_name>.+?)|=(?P<delims>.*?)=)%s\\n?/s', - preg_quote($otag, '/'), - self::SECTION_TYPES, - preg_quote($ctag, '/') - ); - } - - /** - * Extract the first section from $template. - * - * @access protected - * @param string $template - * @return array $before, $type, $tag_name, $content and $after - */ - protected function _findSection($template) { - $regEx = $this->_prepareSectionRegEx($this->_otag, $this->_ctag); - - $section_start = null; - $section_type = null; - $content_start = null; - - $search_offset = 0; - - $section_stack = array(); - $matches = array(); - while (preg_match($regEx, $template, $matches, PREG_OFFSET_CAPTURE, $search_offset)) { - if (isset($matches['delims'][0])) { - list($otag, $ctag) = explode(' ', $matches['delims'][0]); - $regEx = $this->_prepareSectionRegEx($otag, $ctag); - $search_offset = $matches[0][1] + strlen($matches[0][0]); - continue; - } - - $match = $matches[0][0]; - $offset = $matches[0][1]; - $type = $matches['type'][0]; - $tag_name = trim($matches['tag_name'][0]); - - $search_offset = $offset + strlen($match); - - switch ($type) { - case '^': - case '#': - if (empty($section_stack)) { - $section_start = $offset; - $section_type = $type; - $content_start = $search_offset; - } - array_push($section_stack, $tag_name); - break; - case '/': - if (empty($section_stack) || ($tag_name !== array_pop($section_stack))) { - if ($this->_throwsException(MustacheException::UNEXPECTED_CLOSE_SECTION)) { - throw new MustacheException('Unexpected close section: ' . $tag_name, MustacheException::UNEXPECTED_CLOSE_SECTION); - } - } - - if (empty($section_stack)) { - // $before, $type, $tag_name, $content, $after - return array( - substr($template, 0, $section_start), - $section_type, - $tag_name, - substr($template, $content_start, $offset - $content_start), - substr($template, $search_offset), - ); - } - break; - } - } - - if (!empty($section_stack)) { - if ($this->_throwsException(MustacheException::UNCLOSED_SECTION)) { - throw new MustacheException('Unclosed section: ' . $section_stack[0], MustacheException::UNCLOSED_SECTION); - } - } - } - - /** - * Prepare a pragma RegEx for the given opening/closing tags. - * - * @access protected - * @param string $otag - * @param string $ctag - * @return string - */ - protected function _preparePragmaRegEx($otag, $ctag) { - return sprintf( - '/%s%%\\s*(?P<pragma_name>[\\w_-]+)(?P<options_string>(?: [\\w]+=[\\w]+)*)\\s*%s\\n?/s', - preg_quote($otag, '/'), - preg_quote($ctag, '/') - ); - } - - /** - * Initialize pragmas and remove all pragma tags. - * - * @access protected - * @param string $template - * @return string - */ - protected function _renderPragmas($template) { - $this->_localPragmas = $this->_pragmas; - - // no pragmas - if (strpos($template, $this->_otag . '%') === false) { - return $template; - } - - $regEx = $this->_preparePragmaRegEx($this->_otag, $this->_ctag); - return preg_replace_callback($regEx, array($this, '_renderPragma'), $template); - } - - /** - * A preg_replace helper to remove {{%PRAGMA}} tags and enable requested pragma. - * - * @access protected - * @param mixed $matches - * @return void - * @throws MustacheException unknown pragma - */ - protected function _renderPragma($matches) { - $pragma = $matches[0]; - $pragma_name = $matches['pragma_name']; - $options_string = $matches['options_string']; - - if (!in_array($pragma_name, $this->_pragmasImplemented)) { - if ($this->_throwsException(MustacheException::UNKNOWN_PRAGMA)) { - throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA); - } else { - return ''; - } - } - - $options = array(); - foreach (explode(' ', trim($options_string)) as $o) { - if ($p = trim($o)) { - $p = explode('=', $p); - $options[$p[0]] = $p[1]; - } - } - - if (empty($options)) { - $this->_localPragmas[$pragma_name] = true; - } else { - $this->_localPragmas[$pragma_name] = $options; - } - - return ''; - } - - /** - * Check whether this Mustache has a specific pragma. - * - * @access protected - * @param string $pragma_name - * @return bool - */ - protected function _hasPragma($pragma_name) { - if (array_key_exists($pragma_name, $this->_localPragmas) && $this->_localPragmas[$pragma_name]) { - return true; - } else { - return false; - } - } - - /** - * Return pragma options, if any. - * - * @access protected - * @param string $pragma_name - * @return mixed - * @throws MustacheException Unknown pragma - */ - protected function _getPragmaOptions($pragma_name) { - if (!$this->_hasPragma($pragma_name)) { - if ($this->_throwsException(MustacheException::UNKNOWN_PRAGMA)) { - throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA); - } - } - - return (is_array($this->_localPragmas[$pragma_name])) ? $this->_localPragmas[$pragma_name] : array(); - } - - /** - * Check whether this Mustache instance throws a given exception. - * - * Expects exceptions to be MustacheException error codes (i.e. class constants). - * - * @access protected - * @param mixed $exception - * @return void - */ - protected function _throwsException($exception) { - return (isset($this->_throwsExceptions[$exception]) && $this->_throwsExceptions[$exception]); - } - - /** - * Prepare a tag RegEx for the given opening/closing tags. - * - * @access protected - * @param string $otag - * @param string $ctag - * @return string - */ - protected function _prepareTagRegEx($otag, $ctag, $first = false) { - return sprintf( - '/(?P<leading>(?:%s\\r?\\n)[ \\t]*)?%s(?P<type>[%s]?)(?P<tag_name>.+?)(?:\\2|})?%s(?P<trailing>\\s*(?:\\r?\\n|\\Z))?/s', - ($first ? '\\A|' : ''), - preg_quote($otag, '/'), - self::TAG_TYPES, - preg_quote($ctag, '/') - ); - } - - /** - * Loop through and render individual Mustache tags. - * - * @access protected - * @param string $template - * @return void - */ - protected function _renderTags($template) { - if (strpos($template, $this->_otag) === false) { - return $template; - } - - $first = true; - $this->_tagRegEx = $this->_prepareTagRegEx($this->_otag, $this->_ctag, true); - - $html = ''; - $matches = array(); - while (preg_match($this->_tagRegEx, $template, $matches, PREG_OFFSET_CAPTURE)) { - $tag = $matches[0][0]; - $offset = $matches[0][1]; - $modifier = $matches['type'][0]; - $tag_name = trim($matches['tag_name'][0]); - - if (isset($matches['leading']) && $matches['leading'][1] > -1) { - $leading = $matches['leading'][0]; - } else { - $leading = null; - } - - if (isset($matches['trailing']) && $matches['trailing'][1] > -1) { - $trailing = $matches['trailing'][0]; - } else { - $trailing = null; - } - - $html .= substr($template, 0, $offset); - - $next_offset = $offset + strlen($tag); - if ((substr($html, -1) == "\n") && (substr($template, $next_offset, 1) == "\n")) { - $next_offset++; - } - $template = substr($template, $next_offset); - - $html .= $this->_renderTag($modifier, $tag_name, $leading, $trailing); - - if ($first == true) { - $first = false; - $this->_tagRegEx = $this->_prepareTagRegEx($this->_otag, $this->_ctag); - } - } - - return $html . $template; - } - - /** - * Render the named tag, given the specified modifier. - * - * Accepted modifiers are `=` (change delimiter), `!` (comment), `>` (partial) - * `{` or `&` (don't escape output), or none (render escaped output). - * - * @access protected - * @param string $modifier - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @throws MustacheException Unmatched section tag encountered. - * @return string - */ - protected function _renderTag($modifier, $tag_name, $leading, $trailing) { - switch ($modifier) { - case '=': - return $this->_changeDelimiter($tag_name, $leading, $trailing); - break; - case '!': - return $this->_renderComment($tag_name, $leading, $trailing); - break; - case '>': - case '<': - return $this->_renderPartial($tag_name, $leading, $trailing); - break; - case '{': - // strip the trailing } ... - if ($tag_name[(strlen($tag_name) - 1)] == '}') { - $tag_name = substr($tag_name, 0, -1); - } - case '&': - if ($this->_hasPragma(self::PRAGMA_UNESCAPED)) { - return $this->_renderEscaped($tag_name, $leading, $trailing); - } else { - return $this->_renderUnescaped($tag_name, $leading, $trailing); - } - break; - case '#': - case '^': - case '/': - // remove any leftover section tags - return $leading . $trailing; - break; - default: - if ($this->_hasPragma(self::PRAGMA_UNESCAPED)) { - return $this->_renderUnescaped($modifier . $tag_name, $leading, $trailing); - } else { - return $this->_renderEscaped($modifier . $tag_name, $leading, $trailing); - } - break; - } - } - - /** - * Returns true if any of its args contains the "\r" character. - * - * @access protected - * @param string $str - * @return boolean - */ - protected function _stringHasR($str) { - foreach (func_get_args() as $arg) { - if (strpos($arg, "\r") !== false) { - return true; - } - } - return false; - } - - /** - * Escape and return the requested tag. - * - * @access protected - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @return string - */ - protected function _renderEscaped($tag_name, $leading, $trailing) { - $value = $this->_renderUnescaped($tag_name, '', ''); - if (isset($this->_escape)) { - $rendered = call_user_func($this->_escape, $value); - } else { - $rendered = htmlentities($value, ENT_COMPAT, $this->_charset); - } - - return $leading . $rendered . $trailing; - } - - /** - * Render a comment (i.e. return an empty string). - * - * @access protected - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @return string - */ - protected function _renderComment($tag_name, $leading, $trailing) { - if ($leading !== null && $trailing !== null) { - if (strpos($leading, "\n") === false) { - return ''; - } - return $this->_stringHasR($leading, $trailing) ? "\r\n" : "\n"; - } - return $leading . $trailing; - } - - /** - * Return the requested tag unescaped. - * - * @access protected - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @return string - */ - protected function _renderUnescaped($tag_name, $leading, $trailing) { - $val = $this->_getVariable($tag_name); - - if ($this->_varIsCallable($val)) { - $val = $this->_renderTemplate(call_user_func($val)); - } - - return $leading . $val . $trailing; - } - - /** - * Render the requested partial. - * - * @access protected - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @return string - */ - protected function _renderPartial($tag_name, $leading, $trailing) { - $partial = $this->_getPartial($tag_name); - if ($leading !== null && $trailing !== null) { - $whitespace = trim($leading, "\r\n"); - $partial = preg_replace('/(\\r?\\n)(?!$)/s', "\\1" . $whitespace, $partial); - } - - $view = clone($this); - - if ($leading !== null && $trailing !== null) { - return $leading . $view->render($partial); - } else { - return $leading . $view->render($partial) . $trailing; - } - } - - /** - * Change the Mustache tag delimiter. This method also replaces this object's current - * tag RegEx with one using the new delimiters. - * - * @access protected - * @param string $tag_name - * @param string $leading Whitespace - * @param string $trailing Whitespace - * @return string - */ - protected function _changeDelimiter($tag_name, $leading, $trailing) { - list($otag, $ctag) = explode(' ', $tag_name); - $this->_otag = $otag; - $this->_ctag = $ctag; - - $this->_tagRegEx = $this->_prepareTagRegEx($this->_otag, $this->_ctag); - - if ($leading !== null && $trailing !== null) { - if (strpos($leading, "\n") === false) { - return ''; - } - return $this->_stringHasR($leading, $trailing) ? "\r\n" : "\n"; - } - return $leading . $trailing; - } - - /** - * Push a local context onto the stack. - * - * @access protected - * @param array &$local_context - * @return void - */ - protected function _pushContext(&$local_context) { - $new = array(); - $new[] =& $local_context; - foreach (array_keys($this->_context) as $key) { - $new[] =& $this->_context[$key]; - } - $this->_context = $new; - } - - /** - * Remove the latest context from the stack. - * - * @access protected - * @return void - */ - protected function _popContext() { - $new = array(); - - $keys = array_keys($this->_context); - array_shift($keys); - foreach ($keys as $key) { - $new[] =& $this->_context[$key]; - } - $this->_context = $new; - } - - /** - * Get a variable from the context array. - * - * If the view is an array, returns the value with array key $tag_name. - * If the view is an object, this will check for a public member variable - * named $tag_name. If none is available, this method will execute and return - * any class method named $tag_name. Failing all of the above, this method will - * return an empty string. - * - * @access protected - * @param string $tag_name - * @throws MustacheException Unknown variable name. - * @return string - */ - protected function _getVariable($tag_name) { - if ($tag_name === '.') { - return $this->_context[0]; - } else if (strpos($tag_name, '.') !== false) { - $chunks = explode('.', $tag_name); - $first = array_shift($chunks); - - $ret = $this->_findVariableInContext($first, $this->_context); - foreach ($chunks as $next) { - // Slice off a chunk of context for dot notation traversal. - $c = array($ret); - $ret = $this->_findVariableInContext($next, $c); - } - return $ret; - } else { - return $this->_findVariableInContext($tag_name, $this->_context); - } - } - - /** - * Get a variable from the context array. Internal helper used by getVariable() to abstract - * variable traversal for dot notation. - * - * @access protected - * @param string $tag_name - * @param array $context - * @throws MustacheException Unknown variable name. - * @return string - */ - protected function _findVariableInContext($tag_name, $context) { - foreach ($context as $view) { - if (is_object($view)) { - if (method_exists($view, $tag_name)) { - return $view->$tag_name(); - } else if (isset($view->$tag_name)) { - return $view->$tag_name; - } - } else if (is_array($view) && array_key_exists($tag_name, $view)) { - return $view[$tag_name]; - } - } - - if ($this->_throwsException(MustacheException::UNKNOWN_VARIABLE)) { - throw new MustacheException("Unknown variable: " . $tag_name, MustacheException::UNKNOWN_VARIABLE); - } else { - return ''; - } - } - - /** - * Retrieve the partial corresponding to the requested tag name. - * - * Silently fails (i.e. returns '') when the requested partial is not found. - * - * @access protected - * @param string $tag_name - * @throws MustacheException Unknown partial name. - * @return string - */ - protected function _getPartial($tag_name) { - if ((is_array($this->_partials) || $this->_partials instanceof ArrayAccess) && isset($this->_partials[$tag_name])) { - return $this->_partials[$tag_name]; - } - - if ($this->_throwsException(MustacheException::UNKNOWN_PARTIAL)) { - throw new MustacheException('Unknown partial: ' . $tag_name, MustacheException::UNKNOWN_PARTIAL); - } else { - return ''; - } - } - - /** - * Check whether the given $var should be iterated (i.e. in a section context). - * - * @access protected - * @param mixed $var - * @return bool - */ - protected function _varIsIterable($var) { - return $var instanceof Traversable || (is_array($var) && !array_diff_key($var, array_keys(array_keys($var)))); - } - - /** - * Higher order sections helper: tests whether the section $var is a valid callback. - * - * In Mustache.php, a variable is considered 'callable' if the variable is: - * - * 1. an anonymous function. - * 2. an object and the name of a public function, i.e. `array($SomeObject, 'methodName')` - * 3. a class name and the name of a public static function, i.e. `array('SomeClass', 'methodName')` - * - * @access protected - * @param mixed $var - * @return bool - */ - protected function _varIsCallable($var) { - return !is_string($var) && is_callable($var); - } -} - - -/** - * MustacheException class. - * - * @extends Exception - */ -class MustacheException extends Exception { - - // An UNKNOWN_VARIABLE exception is thrown when a {{variable}} is not found - // in the current context. - const UNKNOWN_VARIABLE = 0; - - // An UNCLOSED_SECTION exception is thrown when a {{#section}} is not closed. - const UNCLOSED_SECTION = 1; - - // An UNEXPECTED_CLOSE_SECTION exception is thrown when {{/section}} appears - // without a corresponding {{#section}} or {{^section}}. - const UNEXPECTED_CLOSE_SECTION = 2; - - // An UNKNOWN_PARTIAL exception is thrown whenever a {{>partial}} tag appears - // with no associated partial. - const UNKNOWN_PARTIAL = 3; - - // An UNKNOWN_PRAGMA exception is thrown whenever a {{%PRAGMA}} tag appears - // which can't be handled by this Mustache instance. - const UNKNOWN_PRAGMA = 4; - -} diff --git a/vendor/flexi/vendor/mustache.php/MustacheLoader.php b/vendor/flexi/vendor/mustache.php/MustacheLoader.php deleted file mode 100644 index 9c4b3864a606049fee057763b535b33af728806e..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/MustacheLoader.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -/** - * A Mustache Partial filesystem loader. - * - * @author Justin Hileman {@link http://justinhileman.com} - */ -class MustacheLoader implements ArrayAccess { - - protected $baseDir; - protected $partialsCache = array(); - protected $extension; - - /** - * MustacheLoader constructor. - * - * @access public - * @param string $baseDir Base template directory. - * @param string $extension File extension for Mustache files (default: 'mustache') - * @return void - */ - public function __construct($baseDir, $extension = 'mustache') { - if (!is_dir($baseDir)) { - throw new InvalidArgumentException('$baseDir must be a valid directory, ' . $baseDir . ' given.'); - } - - $this->baseDir = $baseDir; - $this->extension = $extension; - } - - /** - * @param string $offset Name of partial - * @return boolean - */ - public function offsetExists($offset) { - return (isset($this->partialsCache[$offset]) || file_exists($this->pathName($offset))); - } - - /** - * @throws InvalidArgumentException if the given partial doesn't exist - * @param string $offset Name of partial - * @return string Partial template contents - */ - public function offsetGet($offset) { - if (!$this->offsetExists($offset)) { - throw new InvalidArgumentException('Partial does not exist: ' . $offset); - } - - if (!isset($this->partialsCache[$offset])) { - $this->partialsCache[$offset] = file_get_contents($this->pathName($offset)); - } - - return $this->partialsCache[$offset]; - } - - /** - * MustacheLoader is an immutable filesystem loader. offsetSet throws a LogicException if called. - * - * @throws LogicException - * @return void - */ - public function offsetSet($offset, $value) { - throw new LogicException('Unable to set offset: MustacheLoader is an immutable ArrayAccess object.'); - } - - /** - * MustacheLoader is an immutable filesystem loader. offsetUnset throws a LogicException if called. - * - * @throws LogicException - * @return void - */ - public function offsetUnset($offset) { - throw new LogicException('Unable to unset offset: MustacheLoader is an immutable ArrayAccess object.'); - } - - /** - * An internal helper for generating path names. - * - * @param string $file Partial name - * @return string File path - */ - protected function pathName($file) { - return $this->baseDir . '/' . $file . '.' . $this->extension; - } -} diff --git a/vendor/flexi/vendor/mustache.php/README.markdown b/vendor/flexi/vendor/mustache.php/README.markdown deleted file mode 100644 index 989ff97276483a60235851884c1501886b8c6a13..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/README.markdown +++ /dev/null @@ -1,98 +0,0 @@ -Mustache.php -============ - -A [Mustache](http://defunkt.github.com/mustache/) implementation in PHP. - - -Usage ------ - -A quick example: - -```php -<?php -include('Mustache.php'); -$m = new Mustache; -echo $m->render('Hello {{planet}}', array('planet' => 'World!')); -// "Hello World!" -``` - - -And a more in-depth example--this is the canonical Mustache template: - -``` -Hello {{name}} -You have just won ${{value}}! -{{#in_ca}} -Well, ${{taxed_value}}, after taxes. -{{/in_ca}} -``` - - -Along with the associated Mustache class: - -```php -<?php -class Chris extends Mustache { - public $name = "Chris"; - public $value = 10000; - - public function taxed_value() { - return $this->value - ($this->value * 0.4); - } - - public $in_ca = true; -} -``` - - -Render it like so: - -```php -<?php -$chris = new Chris; -echo $chris->render($template); -``` - - -Here's the same thing, a different way: - -Create a view object--which could also be an associative array, but those don't do functions quite as well: - -```php -<?php -class Chris { - public $name = "Chris"; - public $value = 10000; - - public function taxed_value() { - return $this->value - ($this->value * 0.4); - } - - public $in_ca = true; -} -``` - - -And render it: - -```php -<?php -$chris = new Chris; -$m = new Mustache; -echo $m->render($template, $chris); -``` - - -Known Issues ------------- - - * As of Mustache spec v1.1.2, there are a couple of whitespace bugs around section tags... Despite these failing tests, this - version is actually *closer* to correct than previous releases. - - -See Also --------- - - * [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md). - * [mustache(1)](http://mustache.github.com/mustache.1.html) and [mustache(5)](http://mustache.github.com/mustache.5.html) man pages. diff --git a/vendor/flexi/vendor/mustache.php/bin/create_example.php b/vendor/flexi/vendor/mustache.php/bin/create_example.php deleted file mode 100644 index 1f0b894bae1201a1d2a6974af6dc8424aeecc22f..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/bin/create_example.php +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env php -<?php - -/** - * A commandline script to create an example and the needed files: - * - * $ bin/create_example.php my_new_example - * - * ... and the folder my_new_example will be created in the examples/ folder containing 3 files: - * - * my_new_example/my_new_example.mustache - * my_new_example/my_new_example.txt - * my_new_example/MyNewExample.php - */ - -// some constants -define('USAGE', <<<USAGE -USAGE: {$argv[0]} example_name - -This creates a new example and the corresponding files in the examples/ directory - -USAGE -); - -define('DS', DIRECTORY_SEPARATOR); -define('EXAMPLE_PATH', realpath(dirname(__FILE__) . DS . ".." . DS . "examples")); - - -/** - * transform a string to lowercase using underlines. - * Examples: - * String -> string - * AString -> a_string - * SomeStrings -> some_strings - * AStringMore -> a_string_more - * - * @param string $name - * @access public - * @return string - */ -function getLowerCaseName($name) { - return preg_replace_callback("/([A-Z])/", create_function ( - '$match', - 'return "_" . strtolower($match[1]);' - ), lcfirst($name)); -} - -/** - * transform a string to Uppercase (camelcase) - * Examples - * string -> String - * a_string -> AString - * some_strings -> SomeStrings - * a_string_more -> AStringMore -> a_string_more - * - * @param string $name - * @access public - * @return string - */ -function getUpperCaseName($name) { - return preg_replace_callback("/_([a-z])/", create_function ( - '$match', - 'return strtoupper($match{1});' - ), ucfirst($name)); -} - - -/** - * return the given value and echo it out appending "\n" - * - * @param mixed $value - * @access public - * @return mixed - */ -function out($value) { - echo $value . "\n"; - return $value; -} - -/** - * create Path for certain files in an example - * returns the directory name if only $directory is given. - * if an extension is given a complete filename is returned. - * the returned filename will be echoed out - * - * @param string $directory directory without / at the end - * @param string $filename filename without path and extension - * @param string $extension extension of the file without "." - * @access public - * @return string - */ -function buildPath($directory, $filename = null, $extension = null) { - return out(EXAMPLE_PATH . DS . $directory. - ($extension !== null && $filename !== null ? DS . $filename. "." . $extension : "")); -} - -/** - * creates the directory for the example - * the script die()'s if mkdir() fails - * - * @param string $directory - * @access public - * @return void - */ -function createDirectory($directory) { - if(!@mkdir(buildPath($directory))) { - die("FAILED to create directory\n"); - } -} - -/** - * create a file for the example with the given $content - * the script die()'s if fopen() fails - * - * @param string $directory directory without / at the end - * @param string $filename filename without path and extension - * @param string $extension extension of the file without "." - * @param string $content the content of the file - * @access public - * @return void - */ -function createFile($directory, $filename, $extension, $content = "") { - $handle = @fopen(buildPath($directory, $filename, $extension), "w"); - if($handle) { - fwrite($handle, $content); - fclose($handle); - } else { - die("FAILED to create file\n"); - } -} - - -/** - * routine to create the example directory and 3 files - * - * if the $example_name is "SomeThing" the following files will be created - * examples/some_thing - * examples/some_thing/some_thing.mustache - * examples/some_thing/some_thing.txt - * examples/some_thing/SomeThing.php - * - * @param mixed $example_name - * @access public - * @return void - */ -function main($example_name) { - $lowercase = getLowerCaseName($example_name); - $uppercase = getUpperCaseName($example_name); - createDirectory($lowercase); - createFile($lowercase, $lowercase, "mustache"); - createFile($lowercase, $lowercase, "txt"); - createFile($lowercase, $uppercase, "php", <<<CONTENT -<?php - -class {$uppercase} extends Mustache { - -} - -CONTENT - ); -} - -// check if enougth arguments are given -if(count($argv) > 1) { - // get the name of the example - $example_name = $argv[1]; - - main($example_name); - -} else { - echo USAGE; -} diff --git a/vendor/flexi/vendor/mustache.php/examples/child_context/ChildContext.php b/vendor/flexi/vendor/mustache.php/examples/child_context/ChildContext.php deleted file mode 100644 index b652356dbc71728d73482ca45d070b4c5ed6cf04..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/child_context/ChildContext.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class ChildContext extends Mustache { - public $parent = array( - 'child' => 'child works', - ); - - public $grandparent = array( - 'parent' => array( - 'child' => 'grandchild works', - ), - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.mustache b/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.mustache deleted file mode 100644 index e1f2ebcb61351657d9c8b106f9534cbcb74e1e60..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.mustache +++ /dev/null @@ -1,2 +0,0 @@ -<h1>{{#parent}}{{child}}{{/parent}}</h1> -<h2>{{#grandparent}}{{#parent}}{{child}}{{/parent}}{{/grandparent}}</h2> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.txt b/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.txt deleted file mode 100644 index cfb76bf764e2e51bd9d6bb705300c49164c3d4dd..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/child_context/child_context.txt +++ /dev/null @@ -1,2 +0,0 @@ -<h1>child works</h1> -<h2>grandchild works</h2> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/comments/Comments.php b/vendor/flexi/vendor/mustache.php/examples/comments/Comments.php deleted file mode 100644 index 7f028ba0821bf62753974cccdb2bcdf38011be77..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/comments/Comments.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Comments extends Mustache { - public function title() { - return 'A Comedy of Errors'; - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/comments/comments.mustache b/vendor/flexi/vendor/mustache.php/examples/comments/comments.mustache deleted file mode 100644 index 846e449af5f7bea7b859337450dace40ef7a490c..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/comments/comments.mustache +++ /dev/null @@ -1 +0,0 @@ -<h1>{{title}}{{! just something interesting... #or ^not... }}</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/comments/comments.txt b/vendor/flexi/vendor/mustache.php/examples/comments/comments.txt deleted file mode 100644 index 9f40e77b585080c6b97f766f2791c3fd0beb82d1..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/comments/comments.txt +++ /dev/null @@ -1 +0,0 @@ -<h1>A Comedy of Errors</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/complex/complex.mustache b/vendor/flexi/vendor/mustache.php/examples/complex/complex.mustache deleted file mode 100644 index 807c201e5e6fca5a3b643ad513b0dc2c37ce0bb5..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/complex/complex.mustache +++ /dev/null @@ -1,16 +0,0 @@ -<h1>{{header}}</h1> -{{#notEmpty}} -<ul> -{{#item}} -{{#current}} - <li><strong>{{name}}</strong></li> -{{/current}} -{{^current}} - <li><a href="{{url}}">{{name}}</a></li> -{{/current}} -{{/item}} -</ul> -{{/notEmpty}} -{{#isEmpty}} -<p>The list is empty.</p> -{{/isEmpty}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/complex/complex.php b/vendor/flexi/vendor/mustache.php/examples/complex/complex.php deleted file mode 100644 index 32b091700523b70a69cef96ed7d4e93c256106c0..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/complex/complex.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -class Complex extends Mustache { - public $header = 'Colors'; - - public $item = array( - array('name' => 'red', 'current' => true, 'url' => '#Red'), - array('name' => 'green', 'current' => false, 'url' => '#Green'), - array('name' => 'blue', 'current' => false, 'url' => '#Blue'), - ); - - public function notEmpty() { - return !($this->isEmpty()); - } - - public function isEmpty() { - return count($this->item) === 0; - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/complex/complex.txt b/vendor/flexi/vendor/mustache.php/examples/complex/complex.txt deleted file mode 100644 index facee6df83b00a02b1e7868dca0280faa62c06ee..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/complex/complex.txt +++ /dev/null @@ -1,6 +0,0 @@ -<h1>Colors</h1> -<ul> - <li><strong>red</strong></li> - <li><a href="#Green">green</a></li> - <li><a href="#Blue">blue</a></li> -</ul> diff --git a/vendor/flexi/vendor/mustache.php/examples/delimiters/Delimiters.php b/vendor/flexi/vendor/mustache.php/examples/delimiters/Delimiters.php deleted file mode 100644 index be372fa599da934073feb674302f0fe1ea982c19..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/delimiters/Delimiters.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -class Delimiters extends Mustache { - public $start = "It worked the first time."; - - public function middle() { - return array( - array('item' => "And it worked the second time."), - array('item' => "As well as the third."), - ); - } - - public $final = "Then, surprisingly, it worked the final time."; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.mustache b/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.mustache deleted file mode 100644 index e9b0332bd7a905738c18f40c10a7acffd0f4ad65..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.mustache +++ /dev/null @@ -1,8 +0,0 @@ -{{=<% %>=}} -* <% start %> -<%=| |=%> -|# middle | -* | item | -|/ middle | -|={{ }}=| -* {{ final }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.txt b/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.txt deleted file mode 100644 index e6b2d7af877e5b4b1be6c2956a86273237306c27..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/delimiters/delimiters.txt +++ /dev/null @@ -1,4 +0,0 @@ -* It worked the first time. -* And it worked the second time. -* As well as the third. -* Then, surprisingly, it worked the final time. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/dot_notation/DotNotation.php b/vendor/flexi/vendor/mustache.php/examples/dot_notation/DotNotation.php deleted file mode 100644 index 7dd0a4ed0d058bc716c063b3e06a81332bd2ec90..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/dot_notation/DotNotation.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/** - * DotNotation example class. Uses DOT_NOTATION pragma. - * - * @extends Mustache - */ -class DotNotation extends Mustache { - public $person = array( - 'name' => array('first' => 'Chris', 'last' => 'Firescythe'), - 'age' => 24, - 'hobbies' => array('Cycling', 'Fishing'), - 'hometown' => array( - 'city' => 'Cincinnati', - 'state' => 'OH', - ), - ); - - public $normal = 'Normal'; -} diff --git a/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.mustache b/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.mustache deleted file mode 100644 index 0135a2aee9f3be257d4a32acf2675303c66bd0ae..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.mustache +++ /dev/null @@ -1,5 +0,0 @@ -* {{person.name.first}} {{person.name.last}} -* {{person.age}} -* {{person.hobbies.0}}, {{person.hobbies.1}} -* {{person.hometown.city}}, {{person.hometown.state}} -* {{normal}} diff --git a/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.txt b/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.txt deleted file mode 100644 index e5c1ed94b6e8cefb8bc1140a3a43844fdbcfe875..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/dot_notation/dot_notation.txt +++ /dev/null @@ -1,5 +0,0 @@ -* Chris Firescythe -* 24 -* Cycling, Fishing -* Cincinnati, OH -* Normal diff --git a/vendor/flexi/vendor/mustache.php/examples/double_section/DoubleSection.php b/vendor/flexi/vendor/mustache.php/examples/double_section/DoubleSection.php deleted file mode 100644 index f9d3dbbff3ff85b94e20c65d81c29bc18c58b884..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/double_section/DoubleSection.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class DoubleSection extends Mustache { - public function t() { - return true; - } - - public $two = "second"; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.mustache b/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.mustache deleted file mode 100644 index c8316451eb7ace75ab6ffa215ddd1791e4580fe4..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.mustache +++ /dev/null @@ -1,7 +0,0 @@ -{{#t}} -* first -{{/t}} -* {{two}} -{{#t}} -* third -{{/t}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.txt b/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.txt deleted file mode 100644 index 54336888a727df5ceccd0cfa120b2b09dc8c3078..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/double_section/double_section.txt +++ /dev/null @@ -1,3 +0,0 @@ -* first -* second -* third diff --git a/vendor/flexi/vendor/mustache.php/examples/escaped/Escaped.php b/vendor/flexi/vendor/mustache.php/examples/escaped/Escaped.php deleted file mode 100644 index 28521961ffa5265f42e63b6f4fe7b3ed0fd534dc..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/escaped/Escaped.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class Escaped extends Mustache { - public $title = '"Bear" > "Shark"'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.mustache b/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.mustache deleted file mode 100644 index 8be4ccb62a2c033520162b11d1c01b87cf33ef77..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.mustache +++ /dev/null @@ -1 +0,0 @@ -<h1>{{title}}</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.txt b/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.txt deleted file mode 100644 index 6ba3657edc1cfeb60132630e07d8a2d4db8daa6e..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/escaped/escaped.txt +++ /dev/null @@ -1 +0,0 @@ -<h1>"Bear" > "Shark"</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/GrandParentContext.php b/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/GrandParentContext.php deleted file mode 100644 index 5a59ed9d2d918eef995eb125e0ae53824d6d64c1..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/GrandParentContext.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -class GrandParentContext extends Mustache { - public $grand_parent_id = 'grand_parent1'; - public $parent_contexts = array(); - - public function __construct() { - parent::__construct(); - - $this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array( - array('child_id' => 'parent1-child1'), - array('child_id' => 'parent1-child2') - )); - - $parent2 = new stdClass(); - $parent2->parent_id = 'parent2'; - $parent2->child_contexts = array( - array('child_id' => 'parent2-child1'), - array('child_id' => 'parent2-child2') - ); - - $this->parent_contexts[] = $parent2; - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.mustache b/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.mustache deleted file mode 100644 index 6d03ddf65a27c0adbb00a7710187f0a8cb1945e2..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.mustache +++ /dev/null @@ -1,7 +0,0 @@ -{{grand_parent_id}} -{{#parent_contexts}} - {{parent_id}} ({{grand_parent_id}}) - {{#child_contexts}} - {{child_id}} ({{parent_id}} << {{grand_parent_id}}) - {{/child_contexts}} -{{/parent_contexts}} diff --git a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.txt b/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.txt deleted file mode 100644 index 2687f849f20032cee818fa9433326d5af727bd76..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/grand_parent_context/grand_parent_context.txt +++ /dev/null @@ -1,7 +0,0 @@ -grand_parent1 - parent1 (grand_parent1) - parent1-child1 (parent1 << grand_parent1) - parent1-child2 (parent1 << grand_parent1) - parent2 (grand_parent1) - parent2-child1 (parent2 << grand_parent1) - parent2-child2 (parent2 << grand_parent1) diff --git a/vendor/flexi/vendor/mustache.php/examples/i18n/I18n.php b/vendor/flexi/vendor/mustache.php/examples/i18n/I18n.php deleted file mode 100644 index 7e0fcce312617e5f002fa48ed2b8e89b58fa09fb..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/i18n/I18n.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -class I18n extends Mustache { - - // Variable to be interpolated - public $name = 'Bob'; - - // Add a {{#__}} lambda for i18n - public $__ = array(__CLASS__, '__trans'); - - // A *very* small i18n dictionary :) - private static $dictionary = array( - 'Hello.' => 'Hola.', - 'My name is {{ name }}.' => 'Me llamo {{ name }}.', - ); - - public static function __trans($text) { - return isset(self::$dictionary[$text]) ? self::$dictionary[$text] : $text; - } -} diff --git a/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.mustache b/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.mustache deleted file mode 100644 index eef169b48d8caee2afa0c478c39d84a6fcb16761..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#__}}Hello.{{/__}} {{#__}}My name is {{ name }}.{{/__}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.txt b/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.txt deleted file mode 100644 index 650a71ac92dd884e1a905fa7f3b9b81c9000b5b6..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/i18n/i18n.txt +++ /dev/null @@ -1 +0,0 @@ -Hola. Me llamo Bob. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/ImplicitIterator.php b/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/ImplicitIterator.php deleted file mode 100644 index c01fef06f27227e821980f4447a3ad9490a3cd07..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/ImplicitIterator.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class ImplicitIterator extends Mustache { - protected $data = array('Donkey Kong', 'Luigi', 'Mario', 'Peach', 'Yoshi'); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.mustache b/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.mustache deleted file mode 100644 index b8d58ff09bc38d683e5d5d35d9c9f876664c6b31..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.mustache +++ /dev/null @@ -1,3 +0,0 @@ -{{#data}} -* {{.}} -{{/data}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.txt b/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.txt deleted file mode 100644 index bd7e94522c5dc8ebd2677d6a9e2d3d958e767b8f..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/implicit_iterator/implicit_iterator.txt +++ /dev/null @@ -1,5 +0,0 @@ -* Donkey Kong -* Luigi -* Mario -* Peach -* Yoshi diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/InvertedDoubleSection.php b/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/InvertedDoubleSection.php deleted file mode 100644 index 3dc223123599b1c0663c7210609b94e16c5df70d..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/InvertedDoubleSection.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class InvertedDoubleSection extends Mustache { - public $t = false; - public $two = 'second'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.mustache b/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.mustache deleted file mode 100644 index acc3ae05f4306a9874bc1aabfd07a4cc8f195352..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.mustache +++ /dev/null @@ -1,7 +0,0 @@ -{{^t}} -* first -{{/t}} -* {{two}} -{{^t}} -* third -{{/t}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.txt b/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.txt deleted file mode 100644 index 54336888a727df5ceccd0cfa120b2b09dc8c3078..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_double_section/inverted_double_section.txt +++ /dev/null @@ -1,3 +0,0 @@ -* first -* second -* third diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_section/InvertedSection.php b/vendor/flexi/vendor/mustache.php/examples/inverted_section/InvertedSection.php deleted file mode 100644 index 18eeb863d93570ce608321888e169d6e5f924434..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_section/InvertedSection.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class InvertedSection extends Mustache { - public $repo = array(); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.mustache b/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.mustache deleted file mode 100644 index bee60fff4b77321505a1314982e67242009149cf..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.mustache +++ /dev/null @@ -1,2 +0,0 @@ -{{#repo}}<b>{{name}}</b>{{/repo}} -{{^repo}}No repos :({{/repo}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.txt b/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.txt deleted file mode 100644 index 2b9ed3fa23041139b75fd5234e2f65f7f1efeeba..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/inverted_section/inverted_section.txt +++ /dev/null @@ -1 +0,0 @@ -No repos :( \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/partials/Partials.php b/vendor/flexi/vendor/mustache.php/examples/partials/Partials.php deleted file mode 100644 index 093257b94d2e75a2717503db11c6ab442db123c6..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials/Partials.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Partials extends Mustache { - public $name = 'ilmich'; - public $data = array( - array('name' => 'federica', 'age' => 27, 'gender' => 'female'), - array('name' => 'marco', 'age' => 32, 'gender' => 'male'), - ); - - protected $_partials = array( - 'children' => "{{#data}}{{name}} - {{age}} - {{gender}}\n{{/data}}", - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/partials/partials.mustache b/vendor/flexi/vendor/mustache.php/examples/partials/partials.mustache deleted file mode 100644 index 037e1b381c0c9aad021c49f4d251fe595f07b437..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials/partials.mustache +++ /dev/null @@ -1,2 +0,0 @@ -Children of {{name}}: -{{>children}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/partials/partials.txt b/vendor/flexi/vendor/mustache.php/examples/partials/partials.txt deleted file mode 100644 index d967e15fdb473445d064e26671e8bddf449e1847..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials/partials.txt +++ /dev/null @@ -1,3 +0,0 @@ -Children of ilmich: -federica - 27 - female -marco - 32 - male diff --git a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/PartialsWithViewClass.php b/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/PartialsWithViewClass.php deleted file mode 100644 index 56e0d86e601174a3d5cd8292759c75cad0d64d5e..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/PartialsWithViewClass.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -class PartialsWithViewClass extends Mustache { - public function __construct($template = null, $view = null, $partials = null) { - // Use an object of an arbitrary class as a View for this Mustache instance: - $view = new StdClass(); - $view->name = 'ilmich'; - $view->data = array( - array('name' => 'federica', 'age' => 27, 'gender' => 'female'), - array('name' => 'marco', 'age' => 32, 'gender' => 'male'), - ); - - $partials = array( - 'children' => "{{#data}}{{name}} - {{age}} - {{gender}}\n{{/data}}", - ); - - parent::__construct($template, $view, $partials); - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.mustache b/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.mustache deleted file mode 100644 index 037e1b381c0c9aad021c49f4d251fe595f07b437..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.mustache +++ /dev/null @@ -1,2 +0,0 @@ -Children of {{name}}: -{{>children}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.txt b/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.txt deleted file mode 100644 index d967e15fdb473445d064e26671e8bddf449e1847..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/partials_with_view_class/partials_with_view_class.txt +++ /dev/null @@ -1,3 +0,0 @@ -Children of ilmich: -federica - 27 - female -marco - 32 - male diff --git a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/PragmaUnescaped.php b/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/PragmaUnescaped.php deleted file mode 100644 index b4e0e21adee18aabaa4dd1a0c641a5664fcd35e2..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/PragmaUnescaped.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class PragmaUnescaped extends Mustache { - public $vs = 'Bear > Shark'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.mustache b/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.mustache deleted file mode 100644 index 76095d7277ce0ef7b176999d92a2e010570adc8f..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.mustache +++ /dev/null @@ -1,3 +0,0 @@ -{{%UNESCAPED}} -{{vs}} -{{{vs}}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.txt b/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.txt deleted file mode 100644 index 2860f61a6bbfcb41854ff5294b003296148bdecf..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragma_unescaped/pragma_unescaped.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bear > Shark -Bear > Shark \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/PragmasInPartials.php b/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/PragmasInPartials.php deleted file mode 100644 index 7458289329e4d6443c9d1f32005bb9d30850aadf..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/PragmasInPartials.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -class PragmasInPartials extends Mustache { - public $say = '< RAWR!! >'; - protected $_partials = array( - 'dinosaur' => '{{say}}' - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.mustache b/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.mustache deleted file mode 100644 index abd6ef49cc748fea1ae7819db3354a051ca4c184..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.mustache +++ /dev/null @@ -1,3 +0,0 @@ -{{%UNESCAPED}} -{{say}} -{{>dinosaur}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.txt b/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.txt deleted file mode 100644 index c8e77e317599d688c355e9be7e23e505cfa56c80..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/pragmas_in_partials/pragmas_in_partials.txt +++ /dev/null @@ -1,2 +0,0 @@ -< RAWR!! > -< RAWR!! > \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/RecursivePartials.php b/vendor/flexi/vendor/mustache.php/examples/recursive_partials/RecursivePartials.php deleted file mode 100644 index 04e8af8b990987434598e1db9ac5a1b81c2dbf99..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/RecursivePartials.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class RecursivePartials extends Mustache { - protected $_partials = array( - 'child' => " > {{ name }}{{#child}}{{>child}}{{/child}}", - ); - - public $name = 'George'; - public $child = array( - 'name' => 'Dan', - 'child' => array( - 'name' => 'Justin', - 'child' => false, - ) - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.mustache b/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.mustache deleted file mode 100644 index 0bc5d03de99ec66f3e75fd8bd94f2fc955a7bd55..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.mustache +++ /dev/null @@ -1 +0,0 @@ -{{name}}{{#child}}{{>child}}{{/child}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.txt b/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.txt deleted file mode 100644 index 681cdef63d0be3ce7886024f7ea5320f8306ff46..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/recursive_partials/recursive_partials.txt +++ /dev/null @@ -1 +0,0 @@ -George > Dan > Justin \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/SectionIteratorObjects.php b/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/SectionIteratorObjects.php deleted file mode 100644 index 7b6559703b2b88b4f4509eef0fb76ee3227f1dfe..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/SectionIteratorObjects.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class SectionIteratorObjects extends Mustache { - public $start = "It worked the first time."; - - protected $_data = array( - array('item' => 'And it worked the second time.'), - array('item' => 'As well as the third.'), - ); - - public function middle() { - return new ArrayIterator($this->_data); - } - - public $final = "Then, surprisingly, it worked the final time."; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.mustache b/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.mustache deleted file mode 100644 index 44dfce480d530bbe29dcf3070d5c50b6e353b3b1..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.mustache +++ /dev/null @@ -1,5 +0,0 @@ -* {{ start }} -{{# middle }} -* {{ item }} -{{/ middle }} -* {{ final }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.txt b/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.txt deleted file mode 100644 index e6b2d7af877e5b4b1be6c2956a86273237306c27..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_iterator_objects/section_iterator_objects.txt +++ /dev/null @@ -1,4 +0,0 @@ -* It worked the first time. -* And it worked the second time. -* As well as the third. -* Then, surprisingly, it worked the final time. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/SectionMagicObjects.php b/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/SectionMagicObjects.php deleted file mode 100644 index ebb003187a5087a6660a2c05b999079ee28a0786..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/SectionMagicObjects.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -class SectionMagicObjects extends Mustache { - public $start = "It worked the first time."; - - public function middle() { - return new MagicObject(); - } - - public $final = "Then, surprisingly, it worked the final time."; -} - -class MagicObject { - protected $_data = array( - 'foo' => 'And it worked the second time.', - 'bar' => 'As well as the third.' - ); - - public function __get($key) { - return isset($this->_data[$key]) ? $this->_data[$key] : NULL; - } - - public function __isset($key) { - return isset($this->_data[$key]); - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.mustache b/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.mustache deleted file mode 100644 index 91196085bcdd966fa0398f7b54905022a493b23b..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.mustache +++ /dev/null @@ -1,6 +0,0 @@ -* {{ start }} -{{# middle }} -* {{ foo }} -* {{ bar }} -{{/ middle }} -* {{ final }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.txt b/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.txt deleted file mode 100644 index e6b2d7af877e5b4b1be6c2956a86273237306c27..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_magic_objects/section_magic_objects.txt +++ /dev/null @@ -1,4 +0,0 @@ -* It worked the first time. -* And it worked the second time. -* As well as the third. -* Then, surprisingly, it worked the final time. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_objects/SectionObjects.php b/vendor/flexi/vendor/mustache.php/examples/section_objects/SectionObjects.php deleted file mode 100644 index 41b7d844def88d8f3970ff074892ef27a003f4b0..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_objects/SectionObjects.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class SectionObjects extends Mustache { - public $start = "It worked the first time."; - - public function middle() { - return new SectionObject; - } - - public $final = "Then, surprisingly, it worked the final time."; -} - -class SectionObject { - public $foo = 'And it worked the second time.'; - public $bar = 'As well as the third.'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.mustache b/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.mustache deleted file mode 100644 index 91196085bcdd966fa0398f7b54905022a493b23b..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.mustache +++ /dev/null @@ -1,6 +0,0 @@ -* {{ start }} -{{# middle }} -* {{ foo }} -* {{ bar }} -{{/ middle }} -* {{ final }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.txt b/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.txt deleted file mode 100644 index e6b2d7af877e5b4b1be6c2956a86273237306c27..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/section_objects/section_objects.txt +++ /dev/null @@ -1,4 +0,0 @@ -* It worked the first time. -* And it worked the second time. -* As well as the third. -* Then, surprisingly, it worked the final time. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections/Sections.php b/vendor/flexi/vendor/mustache.php/examples/sections/Sections.php deleted file mode 100644 index fb783549198154effd75abc8a9956dfbc6e9437f..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections/Sections.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -class Sections extends Mustache { - public $start = "It worked the first time."; - - public function middle() { - return array( - array('item' => "And it worked the second time."), - array('item' => "As well as the third."), - ); - } - - public $final = "Then, surprisingly, it worked the final time."; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections/sections.mustache b/vendor/flexi/vendor/mustache.php/examples/sections/sections.mustache deleted file mode 100644 index 44dfce480d530bbe29dcf3070d5c50b6e353b3b1..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections/sections.mustache +++ /dev/null @@ -1,5 +0,0 @@ -* {{ start }} -{{# middle }} -* {{ item }} -{{/ middle }} -* {{ final }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections/sections.txt b/vendor/flexi/vendor/mustache.php/examples/sections/sections.txt deleted file mode 100644 index e6b2d7af877e5b4b1be6c2956a86273237306c27..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections/sections.txt +++ /dev/null @@ -1,4 +0,0 @@ -* It worked the first time. -* And it worked the second time. -* As well as the third. -* Then, surprisingly, it worked the final time. \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections_nested/SectionsNested.php b/vendor/flexi/vendor/mustache.php/examples/sections_nested/SectionsNested.php deleted file mode 100644 index ec01b75e5db27ad02f2173182270c4b854eb5f65..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections_nested/SectionsNested.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -class SectionsNested extends Mustache { - public $name = 'Little Mac'; - - public function enemies() { - return array( - array( - 'name' => 'Von Kaiser', - 'enemies' => array( - array('name' => 'Super Macho Man'), - array('name' => 'Piston Honda'), - array('name' => 'Mr. Sandman'), - ) - ), - array( - 'name' => 'Mike Tyson', - 'enemies' => array( - array('name' => 'Soda Popinski'), - array('name' => 'King Hippo'), - array('name' => 'Great Tiger'), - array('name' => 'Glass Joe'), - ) - ), - array( - 'name' => 'Don Flamenco', - 'enemies' => array( - array('name' => 'Bald Bull'), - ) - ), - ); - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.mustache b/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.mustache deleted file mode 100644 index 9f8007dbdd5980e396ea8a04c0123a7161dc6acc..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.mustache +++ /dev/null @@ -1,7 +0,0 @@ -Enemies of {{ name }}: -{{# enemies }} -{{ name }} ... who also has enemies: -{{# enemies }} ---> {{ name }} -{{/ enemies }} -{{/ enemies }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.txt b/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.txt deleted file mode 100644 index 72c44d06cf2a454e9ffb74b9f42dc8d1c1f2b2fb..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/sections_nested/sections_nested.txt +++ /dev/null @@ -1,12 +0,0 @@ -Enemies of Little Mac: -Von Kaiser ... who also has enemies: ---> Super Macho Man ---> Piston Honda ---> Mr. Sandman -Mike Tyson ... who also has enemies: ---> Soda Popinski ---> King Hippo ---> Great Tiger ---> Glass Joe -Don Flamenco ... who also has enemies: ---> Bald Bull diff --git a/vendor/flexi/vendor/mustache.php/examples/simple/Simple.php b/vendor/flexi/vendor/mustache.php/examples/simple/Simple.php deleted file mode 100644 index 6d07daccb65feb35da9ce0cbe46cd9000fd42188..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/simple/Simple.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class Simple extends Mustache { - public $name = "Chris"; - public $value = 10000; - - public function taxed_value() { - return $this->value - ($this->value * 0.4); - } - - public $in_ca = true; -}; \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/simple/simple.mustache b/vendor/flexi/vendor/mustache.php/examples/simple/simple.mustache deleted file mode 100644 index 03df2068605e5a31f77319fff704f2ffce5319ac..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/simple/simple.mustache +++ /dev/null @@ -1,5 +0,0 @@ -Hello {{name}} -You have just won ${{value}}! -{{#in_ca}} -Well, ${{ taxed_value }}, after taxes. -{{/in_ca}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/simple/simple.txt b/vendor/flexi/vendor/mustache.php/examples/simple/simple.txt deleted file mode 100644 index 5d75d656296a3ae3e1acc557403961169ba02bb7..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/simple/simple.txt +++ /dev/null @@ -1,3 +0,0 @@ -Hello Chris -You have just won $10000! -Well, $6000, after taxes. diff --git a/vendor/flexi/vendor/mustache.php/examples/unescaped/Unescaped.php b/vendor/flexi/vendor/mustache.php/examples/unescaped/Unescaped.php deleted file mode 100644 index 41b10cb89fe80030791d5b906c7a2dc47355660d..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/unescaped/Unescaped.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class Unescaped extends Mustache { - public $title = "Bear > Shark"; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.mustache b/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.mustache deleted file mode 100644 index 9982708a721e77d9a37b42b3e3ea357410f97ed3..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.mustache +++ /dev/null @@ -1 +0,0 @@ -<h1>{{{title}}}</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.txt b/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.txt deleted file mode 100644 index 01fa404805beeefbff5c4c5cff13b9daf07e3aa0..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/unescaped/unescaped.txt +++ /dev/null @@ -1 +0,0 @@ -<h1>Bear > Shark</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8/UTF8.php b/vendor/flexi/vendor/mustache.php/examples/utf8/UTF8.php deleted file mode 100644 index 7843f53179942553a634cda2899ded497f104401..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8/UTF8.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class UTF8Unescaped extends Mustache { - public $test = '中文又来啦'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.mustache b/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.mustache deleted file mode 100644 index 6954d47bd6240fa148a09f8c4c9288443bb01556..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.mustache +++ /dev/null @@ -1 +0,0 @@ -<h1>中文 {{test}}</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.txt b/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.txt deleted file mode 100644 index bf17971be2b308fa2a143022f4e13cea73e19ba5..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8/utf8.txt +++ /dev/null @@ -1 +0,0 @@ -<h1>中文 中文又来啦</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/UTF8Unescaped.php b/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/UTF8Unescaped.php deleted file mode 100644 index d097cbe0fccbfba840038c0abb246aecc487394d..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/UTF8Unescaped.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class UTF8 extends Mustache { - public $test = '中文又来啦'; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.mustache b/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.mustache deleted file mode 100644 index fd7fe4b80efc9fe5244a5a5e2fb6f14ce0215fc3..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.mustache +++ /dev/null @@ -1 +0,0 @@ -<h1>中文 {{{test}}}</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.txt b/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.txt deleted file mode 100644 index bf17971be2b308fa2a143022f4e13cea73e19ba5..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/utf8_unescaped/utf8_unescaped.txt +++ /dev/null @@ -1 +0,0 @@ -<h1>中文 中文又来啦</h1> \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/whitespace/Whitespace.php b/vendor/flexi/vendor/mustache.php/examples/whitespace/Whitespace.php deleted file mode 100644 index 3be9689254588e2bfc0b538579d2d7818865fa04..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/whitespace/Whitespace.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/** - * Whitespace test for tag names. - * - * Per http://github.com/janl/mustache.js/issues/issue/34/#comment_244396 - * tags should strip leading and trailing whitespace in key names. - * - * `{{> tag }}` and `{{> tag}}` and `{{>tag}}` should all be equivalent. - * - * @extends Mustache - */ -class Whitespace extends Mustache { - public $foo = 'alpha'; - - public $bar = 'beta'; - - public function baz() { - return 'gamma'; - } - - public function qux() { - return array( - array('key with space' => 'A'), - array('key with space' => 'B'), - array('key with space' => 'C'), - array('key with space' => 'D'), - array('key with space' => 'E'), - array('key with space' => 'F'), - array('key with space' => 'G'), - ); - } - - protected $_partials = array( - 'alphabet' => " * {{.}}\n", - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.mustache b/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.mustache deleted file mode 100644 index 0b3ba000c543002e293d1c4bba655f170c433f90..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.mustache +++ /dev/null @@ -1,10 +0,0 @@ -{{^ inverted section test }} -These are some things: -{{/inverted section test }} -* {{ foo }} -* {{ bar}} -* {{ baz }} -{{# qux }} -* {{ key with space }} -{{/ qux }} -{{#qux}}.{{/qux}} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.txt b/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.txt deleted file mode 100644 index 5226c69802c1d773c856e611d64a21581d465448..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/examples/whitespace/whitespace.txt +++ /dev/null @@ -1,12 +0,0 @@ -These are some things: -* alpha -* beta -* gamma -* A -* B -* C -* D -* E -* F -* G -....... \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheCallTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheCallTest.php deleted file mode 100644 index 366d2c48fc4695ee9a59dd0dbc8e37262fddb41a..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheCallTest.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -class MustacheCallTest extends PHPUnit_Framework_TestCase { - - public function testCallEatsContext() { - $foo = new ClassWithCall(); - $foo->name = 'Bob'; - - $template = '{{# foo }}{{ label }}: {{ name }}{{/ foo }}'; - $data = array('label' => 'name', 'foo' => $foo); - $m = new Mustache($template, $data); - - $this->assertEquals('name: Bob', $m->render()); - } -} - -class ClassWithCall { - public $name; - public function __call($method, $args) { - return 'unknown value'; - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheExceptionTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheExceptionTest.php deleted file mode 100644 index 2a40223d1d0722fcea858b89ac33e50b4b28720a..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheExceptionTest.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -class MustacheExceptionTest extends PHPUnit_Framework_TestCase { - - const TEST_CLASS = 'Mustache'; - - protected $pickyMustache; - protected $slackerMustache; - - public function setUp() { - $this->pickyMustache = new PickyMustache(); - $this->slackerMustache = new SlackerMustache(); - } - - /** - * @group interpolation - * @expectedException MustacheException - */ - public function testThrowsUnknownVariableException() { - $this->pickyMustache->render('{{not_a_variable}}'); - } - - /** - * @group sections - * @expectedException MustacheException - */ - public function testThrowsUnclosedSectionException() { - $this->pickyMustache->render('{{#unclosed}}'); - } - - /** - * @group sections - * @expectedException MustacheException - */ - public function testThrowsUnclosedInvertedSectionException() { - $this->pickyMustache->render('{{^unclosed}}'); - } - - /** - * @group sections - * @expectedException MustacheException - */ - public function testThrowsUnexpectedCloseSectionException() { - $this->pickyMustache->render('{{/unopened}}'); - } - - /** - * @group partials - * @expectedException MustacheException - */ - public function testThrowsUnknownPartialException() { - $this->pickyMustache->render('{{>impartial}}'); - } - - /** - * @group pragmas - * @expectedException MustacheException - */ - public function testThrowsUnknownPragmaException() { - $this->pickyMustache->render('{{%SWEET-MUSTACHE-BRO}}'); - } - - /** - * @group sections - */ - public function testDoesntThrowUnclosedSectionException() { - $this->assertEquals('', $this->slackerMustache->render('{{#unclosed}}')); - } - - /** - * @group sections - */ - public function testDoesntThrowUnexpectedCloseSectionException() { - $this->assertEquals('', $this->slackerMustache->render('{{/unopened}}')); - } - - /** - * @group partials - */ - public function testDoesntThrowUnknownPartialException() { - $this->assertEquals('', $this->slackerMustache->render('{{>impartial}}')); - } - - /** - * @group pragmas - * @expectedException MustacheException - */ - public function testGetPragmaOptionsThrowsExceptionsIfItThinksYouHaveAPragmaButItTurnsOutYouDont() { - $mustache = new TestableMustache(); - $mustache->testableGetPragmaOptions('PRAGMATIC'); - } - - public function testOverrideThrownExceptionsViaConstructorOptions() { - $exceptions = array( - MustacheException::UNKNOWN_VARIABLE, - MustacheException::UNCLOSED_SECTION, - MustacheException::UNEXPECTED_CLOSE_SECTION, - MustacheException::UNKNOWN_PARTIAL, - MustacheException::UNKNOWN_PRAGMA, - ); - - $one = new TestableMustache(null, null, null, array( - 'throws_exceptions' => array_fill_keys($exceptions, true) - )); - - $thrownExceptions = $one->getThrownExceptions(); - foreach ($exceptions as $exception) { - $this->assertTrue($thrownExceptions[$exception]); - } - - $two = new TestableMustache(null, null, null, array( - 'throws_exceptions' => array_fill_keys($exceptions, false) - )); - - $thrownExceptions = $two->getThrownExceptions(); - foreach ($exceptions as $exception) { - $this->assertFalse($thrownExceptions[$exception]); - } - } -} - -class PickyMustache extends Mustache { - protected $_throwsExceptions = array( - MustacheException::UNKNOWN_VARIABLE => true, - MustacheException::UNCLOSED_SECTION => true, - MustacheException::UNEXPECTED_CLOSE_SECTION => true, - MustacheException::UNKNOWN_PARTIAL => true, - MustacheException::UNKNOWN_PRAGMA => true, - ); -} - -class SlackerMustache extends Mustache { - protected $_throwsExceptions = array( - MustacheException::UNKNOWN_VARIABLE => false, - MustacheException::UNCLOSED_SECTION => false, - MustacheException::UNEXPECTED_CLOSE_SECTION => false, - MustacheException::UNKNOWN_PARTIAL => false, - MustacheException::UNKNOWN_PRAGMA => false, - ); -} - -class TestableMustache extends Mustache { - public function testableGetPragmaOptions($pragma_name) { - return $this->_getPragmaOptions($pragma_name); - } - - public function getThrownExceptions() { - return $this->_throwsExceptions; - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheHigherOrderSectionsTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheHigherOrderSectionsTest.php deleted file mode 100644 index 87e4142e200ff762855c8562b2bf8c95f09eb280..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheHigherOrderSectionsTest.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -class MustacheHigherOrderSectionsTest extends PHPUnit_Framework_TestCase { - - public function setUp() { - $this->foo = new Foo(); - } - - public function testAnonymousFunctionSectionCallback() { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - $this->markTestSkipped('Unable to test anonymous function section callbacks in PHP < 5.3'); - return; - } - - $this->foo->wrapper = function($text) { - return sprintf('<div class="anonymous">%s</div>', $text); - }; - - $this->assertEquals( - sprintf('<div class="anonymous">%s</div>', $this->foo->name), - $this->foo->render('{{#wrapper}}{{name}}{{/wrapper}}') - ); - } - - public function testSectionCallback() { - $this->assertEquals(sprintf('%s', $this->foo->name), $this->foo->render('{{name}}')); - $this->assertEquals(sprintf('<em>%s</em>', $this->foo->name), $this->foo->render('{{#wrap}}{{name}}{{/wrap}}')); - } - - public function testRuntimeSectionCallback() { - $this->foo->double_wrap = array($this->foo, 'wrapWithBoth'); - $this->assertEquals( - sprintf('<strong><em>%s</em></strong>', $this->foo->name), - $this->foo->render('{{#double_wrap}}{{name}}{{/double_wrap}}') - ); - } - - public function testStaticSectionCallback() { - $this->foo->trimmer = array(get_class($this->foo), 'staticTrim'); - $this->assertEquals($this->foo->name, $this->foo->render('{{#trimmer}} {{name}} {{/trimmer}}')); - } - - public function testViewArraySectionCallback() { - $data = array( - 'name' => 'Bob', - 'trim' => array(get_class($this->foo), 'staticTrim'), - ); - $this->assertEquals($data['name'], $this->foo->render('{{#trim}} {{name}} {{/trim}}', $data)); - } - - public function testViewArrayAnonymousSectionCallback() { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - $this->markTestSkipped('Unable to test anonymous function section callbacks in PHP < 5.3'); - return; - } - $data = array( - 'name' => 'Bob', - 'wrap' => function($text) { - return sprintf('[[%s]]', $text); - } - ); - $this->assertEquals( - sprintf('[[%s]]', $data['name']), - $this->foo->render('{{#wrap}}{{name}}{{/wrap}}', $data) - ); - } - - public function testMonsters() { - $frank = new Monster(); - $frank->title = 'Dr.'; - $frank->name = 'Frankenstein'; - $this->assertEquals('Dr. Frankenstein', $frank->render()); - - $dracula = new Monster(); - $dracula->title = 'Count'; - $dracula->name = 'Dracula'; - $this->assertEquals('Count Dracula', $dracula->render()); - } -} - -class Foo extends Mustache { - public $name = 'Justin'; - public $lorem = 'Lorem ipsum dolor sit amet,'; - public $wrap; - - public function __construct($template = null, $view = null, $partials = null) { - $this->wrap = array($this, 'wrapWithEm'); - parent::__construct($template, $view, $partials); - } - - public function wrapWithEm($text) { - return sprintf('<em>%s</em>', $text); - } - - public function wrapWithStrong($text) { - return sprintf('<strong>%s</strong>', $text); - } - - public function wrapWithBoth($text) { - return self::wrapWithStrong(self::wrapWithEm($text)); - } - - public static function staticTrim($text) { - return trim($text); - } -} - -class Monster extends Mustache { - public $_template = '{{#title}}{{title}} {{/title}}{{name}}'; - public $title; - public $name; -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheInjectionTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheInjectionTest.php deleted file mode 100644 index de74943c9acf20551798a46b0cb1320f36ac916e..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheInjectionTest.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -/** - * @group mustache_injection - */ -class MustacheInjectionSectionTest extends PHPUnit_Framework_TestCase { - - // interpolation - - public function testInterpolationInjection() { - $data = array( - 'a' => '{{ b }}', - 'b' => 'FAIL' - ); - $template = '{{ a }}'; - $output = '{{ b }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - public function testUnescapedInterpolationInjection() { - $data = array( - 'a' => '{{ b }}', - 'b' => 'FAIL' - ); - $template = '{{{ a }}}'; - $output = '{{ b }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - - // sections - - public function testSectionInjection() { - $data = array( - 'a' => true, - 'b' => '{{ c }}', - 'c' => 'FAIL' - ); - $template = '{{# a }}{{ b }}{{/ a }}'; - $output = '{{ c }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - public function testUnescapedSectionInjection() { - $data = array( - 'a' => true, - 'b' => '{{ c }}', - 'c' => 'FAIL' - ); - $template = '{{# a }}{{{ b }}}{{/ a }}'; - $output = '{{ c }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - - // partials - - public function testPartialInjection() { - $data = array( - 'a' => '{{ b }}', - 'b' => 'FAIL' - ); - $template = '{{> partial }}'; - $partials = array( - 'partial' => '{{ a }}', - ); - $output = '{{ b }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data, $partials)); - } - - public function testPartialUnescapedInjection() { - $data = array( - 'a' => '{{ b }}', - 'b' => 'FAIL' - ); - $template = '{{> partial }}'; - $partials = array( - 'partial' => '{{{ a }}}', - ); - $output = '{{ b }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data, $partials)); - } - - - // lambdas - - public function testLambdaInterpolationInjection() { - $data = array( - 'a' => array($this, 'interpolationLambda'), - 'b' => '{{ c }}', - 'c' => 'FAIL' - ); - $template = '{{ a }}'; - $output = '{{ c }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - public function interpolationLambda() { - return '{{ b }}'; - } - - public function testLambdaSectionInjection() { - $data = array( - 'a' => array($this, 'sectionLambda'), - 'b' => '{{ c }}', - 'c' => 'FAIL' - ); - $template = '{{# a }}b{{/ a }}'; - $output = '{{ c }}'; - $m = new Mustache(); - $this->assertEquals($output, $m->render($template, $data)); - } - - public function sectionLambda($content) { - return '{{ ' . $content . ' }}'; - } - -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheLoaderTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheLoaderTest.php deleted file mode 100644 index 2674a0f9097d4264055acfebf8dbd1a459f020de..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheLoaderTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -require_once '../Mustache.php'; -require_once '../MustacheLoader.php'; - -/** - * @group loader - */ -class MustacheLoaderTest extends PHPUnit_Framework_TestCase { - - public function testTheActualFilesystemLoader() { - $loader = new MustacheLoader(dirname(__FILE__).'/fixtures'); - $this->assertEquals(file_get_contents(dirname(__FILE__).'/fixtures/foo.mustache'), $loader['foo']); - $this->assertEquals(file_get_contents(dirname(__FILE__).'/fixtures/bar.mustache'), $loader['bar']); - } - - public function testMustacheUsesFilesystemLoader() { - $template = '{{> foo }} {{> bar }}'; - $data = array( - 'truthy' => true, - 'foo' => 'FOO', - 'bar' => 'BAR', - ); - $output = 'FOO BAR'; - $m = new Mustache(); - $partials = new MustacheLoader(dirname(__FILE__).'/fixtures'); - $this->assertEquals($output, $m->render($template, $data, $partials)); - } - - public function testMustacheUsesDifferentLoadersToo() { - $template = '{{> foo }} {{> bar }}'; - $data = array( - 'truthy' => true, - 'foo' => 'FOO', - 'bar' => 'BAR', - ); - $output = 'FOO BAR'; - $m = new Mustache(); - $partials = new DifferentMustacheLoader(); - $this->assertEquals($output, $m->render($template, $data, $partials)); - } -} - -class DifferentMustacheLoader implements ArrayAccess { - protected $partials = array( - 'foo' => '{{ foo }}', - 'bar' => '{{# truthy }}{{ bar }}{{/ truthy }}', - ); - - public function offsetExists($offset) { - return isset($this->partials[$offset]); - } - - public function offsetGet($offset) { - return $this->partials[$offset]; - } - - public function offsetSet($offset, $value) {} - public function offsetUnset($offset) {} -} diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheObjectSectionTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheObjectSectionTest.php deleted file mode 100644 index 82405d631c2fd79dfd0a21a18491049bd6e77c49..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheObjectSectionTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -/** - * @group sections - */ -class MustacheObjectSectionTest extends PHPUnit_Framework_TestCase { - public function testBasicObject() { - $alpha = new Alpha(); - $this->assertEquals('Foo', $alpha->render('{{#foo}}{{name}}{{/foo}}')); - } - - public function testObjectWithGet() { - $beta = new Beta(); - $this->assertEquals('Foo', $beta->render('{{#foo}}{{name}}{{/foo}}')); - } - - public function testSectionObjectWithGet() { - $gamma = new Gamma(); - $this->assertEquals('Foo', $gamma->render('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}')); - } - - public function testSectionObjectWithFunction() { - $alpha = new Alpha(); - $alpha->foo = new Delta(); - $this->assertEquals('Foo', $alpha->render('{{#foo}}{{name}}{{/foo}}')); - } -} - -class Alpha extends Mustache { - public $foo; - - public function __construct() { - $this->foo = new StdClass(); - $this->foo->name = 'Foo'; - $this->foo->number = 1; - } -} - -class Beta extends Mustache { - protected $_data = array(); - - public function __construct() { - $this->_data['foo'] = new StdClass(); - $this->_data['foo']->name = 'Foo'; - $this->_data['foo']->number = 1; - } - - public function __isset($name) { - return array_key_exists($name, $this->_data); - } - - public function __get($name) { - return $this->_data[$name]; - } -} - -class Gamma extends Mustache { - public $bar; - - public function __construct() { - $this->bar = new Beta(); - } -} - -class Delta extends Mustache { - protected $_name = 'Foo'; - - public function name() { - return $this->_name; - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustachePragmaTest.php b/vendor/flexi/vendor/mustache.php/test/MustachePragmaTest.php deleted file mode 100644 index c00441c338045b4926876620388eaba05ebf42f2..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustachePragmaTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -/** - * @group pragmas - */ -class MustachePragmaTest extends PHPUnit_Framework_TestCase { - - public function testUnknownPragmaException() { - $m = new Mustache(); - - try { - $m->render('{{%I-HAVE-THE-GREATEST-MUSTACHE}}'); - } catch (MustacheException $e) { - $this->assertEquals(MustacheException::UNKNOWN_PRAGMA, $e->getCode(), 'Caught exception code was not MustacheException::UNKNOWN_PRAGMA'); - return; - } - - $this->fail('Mustache should have thrown an unknown pragma exception'); - } - - public function testSuppressUnknownPragmaException() { - $m = new LessWhinyMustache(); - - try { - $this->assertEquals('', $m->render('{{%I-HAVE-THE-GREATEST-MUSTACHE}}')); - } catch (MustacheException $e) { - if ($e->getCode() == MustacheException::UNKNOWN_PRAGMA) { - $this->fail('Mustache should have thrown an unknown pragma exception'); - } else { - throw $e; - } - } - } - - public function testPragmaReplace() { - $m = new Mustache(); - $this->assertEquals('', $m->render('{{%UNESCAPED}}'), 'Pragma tag not removed'); - } - - public function testPragmaReplaceMultiple() { - $m = new Mustache(); - - $this->assertEquals('', $m->render('{{% UNESCAPED }}'), 'Pragmas should allow whitespace'); - $this->assertEquals('', $m->render('{{% UNESCAPED foo=bar }}'), 'Pragmas should allow whitespace'); - $this->assertEquals('', $m->render("{{%UNESCAPED}}\n{{%UNESCAPED}}"), 'Multiple pragma tags not removed'); - $this->assertEquals(' ', $m->render('{{%UNESCAPED}} {{%UNESCAPED}}'), 'Multiple pragma tags not removed'); - } - - public function testPragmaReplaceNewline() { - $m = new Mustache(); - $this->assertEquals('', $m->render("{{%UNESCAPED}}\n"), 'Trailing newline after pragma tag not removed'); - $this->assertEquals("\n", $m->render("\n{{%UNESCAPED}}\n"), 'Too many newlines removed with pragma tag'); - $this->assertEquals("1\n23", $m->render("1\n2{{%UNESCAPED}}\n3"), 'Wrong newline removed with pragma tag'); - } - - public function testPragmaReset() { - $m = new Mustache('', array('symbol' => '>>>')); - $this->assertEquals('>>>', $m->render('{{{symbol}}}')); - $this->assertEquals('>>>', $m->render('{{%UNESCAPED}}{{symbol}}')); - $this->assertEquals('>>>', $m->render('{{{symbol}}}')); - } -} - -class LessWhinyMustache extends Mustache { - protected $_throwsExceptions = array( - MustacheException::UNKNOWN_VARIABLE => false, - MustacheException::UNCLOSED_SECTION => true, - MustacheException::UNEXPECTED_CLOSE_SECTION => true, - MustacheException::UNKNOWN_PARTIAL => false, - MustacheException::UNKNOWN_PRAGMA => false, - ); -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustachePragmaUnescapedTest.php b/vendor/flexi/vendor/mustache.php/test/MustachePragmaUnescapedTest.php deleted file mode 100644 index df6d94c10cd69299c61991c2ab6a152a9898875b..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustachePragmaUnescapedTest.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -/** - * @group pragmas - */ -class MustachePragmaUnescapedTest extends PHPUnit_Framework_TestCase { - - public function testPragmaUnescaped() { - $m = new Mustache(null, array('title' => 'Bear > Shark')); - - $this->assertEquals('Bear > Shark', $m->render('{{%UNESCAPED}}{{title}}')); - $this->assertEquals('Bear > Shark', $m->render('{{title}}')); - $this->assertEquals('Bear > Shark', $m->render('{{%UNESCAPED}}{{{title}}}')); - $this->assertEquals('Bear > Shark', $m->render('{{{title}}}')); - } - -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheSpecTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheSpecTest.php deleted file mode 100644 index d3a3413a23347fa9aa4c01f6fc993d7cbcf354b2..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheSpecTest.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php - -require_once '../Mustache.php'; -require_once './lib/yaml/lib/sfYamlParser.php'; - -/** - * A PHPUnit test case wrapping the Mustache Spec - * - * @group mustache-spec - */ -class MustacheSpecTest extends PHPUnit_Framework_TestCase { - - /** - * For some reason data providers can't mark tests skipped, so this test exists - * simply to provide a 'skipped' test if the `spec` submodule isn't initialized. - */ - public function testSpecInitialized() { - $spec_dir = dirname(__FILE__) . '/spec/specs/'; - if (!file_exists($spec_dir)) { - $this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"'); - } - } - - /** - * @group comments - * @dataProvider loadCommentSpec - */ - public function testCommentSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * @group delimiters - * @dataProvider loadDelimitersSpec - */ - public function testDelimitersSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * @group interpolation - * @dataProvider loadInterpolationSpec - */ - public function testInterpolationSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * @group inverted-sections - * @dataProvider loadInvertedSpec - */ - public function testInvertedSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * @group lambdas - * @dataProvider loadLambdasSpec - */ - public function testLambdasSpec($desc, $template, $data, $partials, $expected) { - if (!version_compare(PHP_VERSION, '5.3.0', '>=')) { - $this->markTestSkipped('Unable to test Lambdas spec with PHP < 5.3.'); - } - - $data = $this->prepareLambdasSpec($data); - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * Extract and lambdafy any 'lambda' values found in the $data array. - */ - protected function prepareLambdasSpec($data) { - foreach ($data as $key => $val) { - if ($key === 'lambda') { - if (!isset($val['php'])) { - $this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.')); - } - - $func = $val['php']; - $data[$key] = function($text = null) use ($func) { return eval($func); }; - } else if (is_array($val)) { - $data[$key] = $this->prepareLambdasSpec($val); - } - } - return $data; - } - - /** - * @group partials - * @dataProvider loadPartialsSpec - */ - public function testPartialsSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - /** - * @group sections - * @dataProvider loadSectionsSpec - */ - public function testSectionsSpec($desc, $template, $data, $partials, $expected) { - $m = new Mustache($template, $data, $partials); - $this->assertEquals($expected, $m->render(), $desc); - } - - public function loadCommentSpec() { - return $this->loadSpec('comments'); - } - - public function loadDelimitersSpec() { - return $this->loadSpec('delimiters'); - } - - public function loadInterpolationSpec() { - return $this->loadSpec('interpolation'); - } - - public function loadInvertedSpec() { - return $this->loadSpec('inverted'); - } - - public function loadLambdasSpec() { - return $this->loadSpec('~lambdas'); - } - - public function loadPartialsSpec() { - return $this->loadSpec('partials'); - } - - public function loadSectionsSpec() { - return $this->loadSpec('sections'); - } - - /** - * Data provider for the mustache spec test. - * - * Loads YAML files from the spec and converts them to PHPisms. - * - * @access public - * @return array - */ - protected function loadSpec($name) { - $filename = dirname(__FILE__) . '/spec/specs/' . $name . '.yml'; - if (!file_exists($filename)) { - return array(); - } - - $data = array(); - $yaml = new sfYamlParser(); - $file = file_get_contents($filename); - - // @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain. - if ($name === '~lambdas') { - $file = str_replace(" !code\n", "\n", $file); - } - - $spec = $yaml->parse($file); - foreach ($spec['tests'] as $test) { - $data[] = array( - $test['name'] . ': ' . $test['desc'], - $test['template'], - $test['data'], - isset($test['partials']) ? $test['partials'] : array(), - $test['expected'], - ); - } - return $data; - } -} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/MustacheTest.php b/vendor/flexi/vendor/mustache.php/test/MustacheTest.php deleted file mode 100644 index 0c0bb13eab5a9b82c00422c4533c683cb7df8759..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/MustacheTest.php +++ /dev/null @@ -1,464 +0,0 @@ -<?php - -require_once '../Mustache.php'; - -/** - * A PHPUnit test case for Mustache.php. - * - * This is a very basic, very rudimentary unit test case. It's probably more important to have tests - * than to have elegant tests, so let's bear with it for a bit. - * - * This class assumes an example directory exists at `../examples` with the following structure: - * - * @code - * examples - * foo - * Foo.php - * foo.mustache - * foo.txt - * bar - * Bar.php - * bar.mustache - * bar.txt - * @endcode - * - * To use this test: - * - * 1. {@link http://www.phpunit.de/manual/current/en/installation.html Install PHPUnit} - * 2. run phpunit from the `test` directory: - * `phpunit MustacheTest` - * 3. Fix bugs. Lather, rinse, repeat. - * - * @extends PHPUnit_Framework_TestCase - */ -class MustacheTest extends PHPUnit_Framework_TestCase { - - const TEST_CLASS = 'Mustache'; - - protected $knownIssues = array( - // Just the whitespace ones... - ); - - /** - * Test Mustache constructor. - * - * @access public - * @return void - */ - public function test__construct() { - $template = '{{#mustaches}}{{#last}}and {{/last}}{{type}}{{^last}}, {{/last}}{{/mustaches}}'; - $data = array( - 'mustaches' => array( - array('type' => 'Natural'), - array('type' => 'Hungarian'), - array('type' => 'Dali'), - array('type' => 'English'), - array('type' => 'Imperial'), - array('type' => 'Freestyle', 'last' => 'true'), - ) - ); - $output = 'Natural, Hungarian, Dali, English, Imperial, and Freestyle'; - - $m1 = new Mustache(); - $this->assertEquals($output, $m1->render($template, $data)); - - $m2 = new Mustache($template); - $this->assertEquals($output, $m2->render(null, $data)); - - $m3 = new Mustache($template, $data); - $this->assertEquals($output, $m3->render()); - - $m4 = new Mustache(null, $data); - $this->assertEquals($output, $m4->render($template)); - } - - /** - * @dataProvider constructorOptions - */ - public function testConstructorOptions($options, $charset, $delimiters, $pragmas) { - $mustache = new MustacheExposedOptionsStub(null, null, null, $options); - $this->assertEquals($charset, $mustache->getCharset()); - $this->assertEquals($delimiters, $mustache->getDelimiters()); - $this->assertEquals($pragmas, $mustache->getPragmas()); - } - - public function constructorOptions() { - return array( - array( - array(), - 'UTF-8', - array('{{', '}}'), - array(), - ), - array( - array( - 'charset' => 'UTF-8', - 'delimiters' => '<< >>', - 'pragmas' => array(Mustache::PRAGMA_UNESCAPED => true) - ), - 'UTF-8', - array('<<', '>>'), - array(Mustache::PRAGMA_UNESCAPED => true), - ), - array( - array( - 'charset' => 'cp866', - 'delimiters' => array('[[[[', ']]]]'), - 'pragmas' => array(Mustache::PRAGMA_UNESCAPED => true) - ), - 'cp866', - array('[[[[', ']]]]'), - array(Mustache::PRAGMA_UNESCAPED => true), - ), - ); - } - - /** - * @expectedException MustacheException - */ - public function testConstructorInvalidPragmaOptionsThrowExceptions() { - $mustache = new Mustache(null, null, null, array('pragmas' => array('banana phone' => true))); - } - - /** - * Test __toString() function. - * - * @access public - * @return void - */ - public function test__toString() { - $m = new Mustache('{{first_name}} {{last_name}}', array('first_name' => 'Karl', 'last_name' => 'Marx')); - - $this->assertEquals('Karl Marx', $m->__toString()); - $this->assertEquals('Karl Marx', (string) $m); - - $m2 = $this->getMock(self::TEST_CLASS, array('render'), array()); - $m2->expects($this->once()) - ->method('render') - ->will($this->returnValue('foo')); - - $this->assertEquals('foo', $m2->render()); - } - - public function test__toStringException() { - $m = $this->getMock(self::TEST_CLASS, array('render'), array()); - $m->expects($this->once()) - ->method('render') - ->will($this->throwException(new Exception)); - - try { - $out = (string) $m; - } catch (Exception $e) { - $this->fail('__toString should catch all exceptions'); - } - } - - /** - * Test render(). - * - * @access public - * @return void - */ - public function testRender() { - $m = new Mustache(); - - $this->assertEquals('', $m->render('')); - $this->assertEquals('foo', $m->render('foo')); - $this->assertEquals('', $m->render(null)); - - $m2 = new Mustache('foo'); - $this->assertEquals('foo', $m2->render()); - - $m3 = new Mustache(''); - $this->assertEquals('', $m3->render()); - - $m3 = new Mustache(); - $this->assertEquals('', $m3->render(null)); - } - - /** - * Test render() with data. - * - * @group interpolation - */ - public function testRenderWithData() { - $m = new Mustache('{{first_name}} {{last_name}}'); - $this->assertEquals('Charlie Chaplin', $m->render(null, array('first_name' => 'Charlie', 'last_name' => 'Chaplin'))); - $this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa'))); - } - - /** - * @group partials - */ - public function testRenderWithPartials() { - $m = new Mustache('{{>stache}}', null, array('stache' => '{{first_name}} {{last_name}}')); - $this->assertEquals('Charlie Chaplin', $m->render(null, array('first_name' => 'Charlie', 'last_name' => 'Chaplin'))); - $this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa'))); - } - - /** - * @group interpolation - * @dataProvider interpolationData - */ - public function testDoubleRenderMustacheTags($template, $context, $expected) { - $m = new Mustache($template, $context); - $this->assertEquals($expected, $m->render()); - } - - public function interpolationData() { - return array( - array( - '{{#a}}{{=<% %>=}}{{b}} c<%={{ }}=%>{{/a}}', - array('a' => array(array('b' => 'Do Not Render'))), - '{{b}} c' - ), - array( - '{{#a}}{{b}}{{/a}}', - array('a' => array('b' => '{{c}}'), 'c' => 'FAIL'), - '{{c}}' - ), - ); - } - - /** - * Mustache should allow newlines (and other whitespace) in comments and all other tags. - * - * @group comments - */ - public function testNewlinesInComments() { - $m = new Mustache("{{! comment \n \t still a comment... }}"); - $this->assertEquals('', $m->render()); - } - - /** - * Mustache should return the same thing when invoked multiple times. - */ - public function testMultipleInvocations() { - $m = new Mustache('x'); - $first = $m->render(); - $second = $m->render(); - - $this->assertEquals('x', $first); - $this->assertEquals($first, $second); - } - - /** - * Mustache should return the same thing when invoked multiple times. - * - * @group interpolation - */ - public function testMultipleInvocationsWithTags() { - $m = new Mustache('{{one}} {{two}}', array('one' => 'foo', 'two' => 'bar')); - $first = $m->render(); - $second = $m->render(); - - $this->assertEquals('foo bar', $first); - $this->assertEquals($first, $second); - } - - /** - * Mustache should not use templates passed to the render() method for subsequent invocations. - */ - public function testResetTemplateForMultipleInvocations() { - $m = new Mustache('Sirve.'); - $this->assertEquals('No sirve.', $m->render('No sirve.')); - $this->assertEquals('Sirve.', $m->render()); - - $m2 = new Mustache(); - $this->assertEquals('No sirve.', $m2->render('No sirve.')); - $this->assertEquals('', $m2->render()); - } - - /** - * Test the __clone() magic function. - * - * @group examples - * @dataProvider getExamples - * - * @param string $class - * @param string $template - * @param string $output - */ - public function test__clone($class, $template, $output) { - if (isset($this->knownIssues[$class])) { - return $this->markTestSkipped($this->knownIssues[$class]); - } - - $m = new $class; - $n = clone $m; - - $n_output = $n->render($template); - - $o = clone $n; - - $this->assertEquals($m->render($template), $n_output); - $this->assertEquals($n_output, $o->render($template)); - - $this->assertNotSame($m, $n); - $this->assertNotSame($n, $o); - $this->assertNotSame($m, $o); - } - - /** - * Test everything in the `examples` directory. - * - * @group examples - * @dataProvider getExamples - * - * @param string $class - * @param string $template - * @param string $output - */ - public function testExamples($class, $template, $output) { - if (isset($this->knownIssues[$class])) { - return $this->markTestSkipped($this->knownIssues[$class]); - } - - $m = new $class; - $this->assertEquals($output, $m->render($template)); - } - - /** - * Data provider for testExamples method. - * - * Assumes that an `examples` directory exists inside parent directory. - * This examples directory should contain any number of subdirectories, each of which contains - * three files: one Mustache class (.php), one Mustache template (.mustache), and one output file - * (.txt). - * - * This whole mess will be refined later to be more intuitive and less prescriptive, but it'll - * do for now. Especially since it means we can have unit tests :) - * - * @return array - */ - public function getExamples() { - $basedir = dirname(__FILE__) . '/../examples/'; - - $ret = array(); - - $files = new RecursiveDirectoryIterator($basedir); - while ($files->valid()) { - - if ($files->hasChildren() && $children = $files->getChildren()) { - $example = $files->getSubPathname(); - $class = null; - $template = null; - $output = null; - - foreach ($children as $file) { - if (!$file->isFile()) continue; - - $filename = $file->getPathname(); - $info = pathinfo($filename); - - if (isset($info['extension'])) { - switch($info['extension']) { - case 'php': - $class = $info['filename']; - include_once($filename); - break; - - case 'mustache': - $template = file_get_contents($filename); - break; - - case 'txt': - $output = file_get_contents($filename); - break; - } - } - } - - if (!empty($class)) { - $ret[$example] = array($class, $template, $output); - } - } - - $files->next(); - } - return $ret; - } - - /** - * @group delimiters - */ - public function testCrazyDelimiters() { - $m = new Mustache(null, array('result' => 'success')); - $this->assertEquals('success', $m->render('{{=[[ ]]=}}[[ result ]]')); - $this->assertEquals('success', $m->render('{{=(( ))=}}(( result ))')); - $this->assertEquals('success', $m->render('{{={$ $}=}}{$ result $}')); - $this->assertEquals('success', $m->render('{{=<.. ..>=}}<.. result ..>')); - $this->assertEquals('success', $m->render('{{=^^ ^^}}^^ result ^^')); - $this->assertEquals('success', $m->render('{{=// \\\\}}// result \\\\')); - } - - /** - * @group delimiters - */ - public function testResetDelimiters() { - $m = new Mustache(null, array('result' => 'success')); - $this->assertEquals('success', $m->render('{{=[[ ]]=}}[[ result ]]')); - $this->assertEquals('success', $m->render('{{=<< >>=}}<< result >>')); - $this->assertEquals('success', $m->render('{{=<% %>=}}<% result %>')); - } - - /** - * @group delimiters - */ - public function testStickyDelimiters() { - $m = new Mustache(null, array('result' => 'FAIL')); - $this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}{{ result }}[[={{ }}=]]')); - $this->assertEquals('{{#result}}{{/result}}', $m->render('{{=[[ ]]=}}{{#result}}{{/result}}[[={{ }}=]]')); - $this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}[[#result]]{{ result }}[[/result]][[={{ }}=]]')); - $this->assertEquals('{{ result }}', $m->render('{{#result}}{{=[[ ]]=}}{{ result }}[[/result]][[^result]][[={{ }}=]][[ result ]]{{/result}}')); - } - - /** - * @group sections - * @dataProvider poorlyNestedSections - * @expectedException MustacheException - */ - public function testPoorlyNestedSections($template) { - $m = new Mustache($template); - $m->render(); - } - - public function poorlyNestedSections() { - return array( - array('{{#foo}}'), - array('{{#foo}}{{/bar}}'), - array('{{#foo}}{{#bar}}{{/foo}}'), - array('{{#foo}}{{#bar}}{{/foo}}{{/bar}}'), - array('{{#foo}}{{/bar}}{{/foo}}'), - ); - } - - /** - * Ensure that Mustache doesn't double-render sections (allowing mustache injection). - * - * @group sections - */ - public function testMustacheInjection() { - $template = '{{#foo}}{{bar}}{{/foo}}'; - $view = array( - 'foo' => true, - 'bar' => '{{win}}', - 'win' => 'FAIL', - ); - - $m = new Mustache($template, $view); - $this->assertEquals('{{win}}', $m->render()); - } -} - -class MustacheExposedOptionsStub extends Mustache { - public function getPragmas() { - return $this->_pragmas; - } - public function getCharset() { - return $this->_charset; - } - public function getDelimiters() { - return array($this->_otag, $this->_ctag); - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/fixtures/bar.mustache b/vendor/flexi/vendor/mustache.php/test/fixtures/bar.mustache deleted file mode 100644 index 139594d5d859ac0f0b097f57ba0b9d0b3801c82a..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/fixtures/bar.mustache +++ /dev/null @@ -1 +0,0 @@ -{{# truthy }}{{ bar }}{{/ truthy }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/fixtures/foo.mustache b/vendor/flexi/vendor/mustache.php/test/fixtures/foo.mustache deleted file mode 100644 index 008c7142f218339ec59d35f887cc1554d5920562..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/fixtures/foo.mustache +++ /dev/null @@ -1 +0,0 @@ -{{ foo }} \ No newline at end of file diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/LICENSE b/vendor/flexi/vendor/mustache.php/test/lib/yaml/LICENSE deleted file mode 100644 index 3cef853170eb7dfe46d7db3376a4d65154cc4615..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2008-2009 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/README.markdown b/vendor/flexi/vendor/mustache.php/test/lib/yaml/README.markdown deleted file mode 100644 index e4f80cfbac4bd0ead6ab4ae3b94c6b5591cdd0af..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/README.markdown +++ /dev/null @@ -1,15 +0,0 @@ -Symfony YAML: A PHP library that speaks YAML -============================================ - -Symfony YAML is a PHP library that parses YAML strings and converts them to -PHP arrays. It can also converts PHP arrays to YAML strings. Its official -website is at http://components.symfony-project.org/yaml/. - -The documentation is to be found in the `doc/` directory. - -Symfony YAML is licensed under the MIT license (see LICENSE file). - -The Symfony YAML library is developed and maintained by the -[symfony](http://www.symfony-project.org/) project team. It has been extracted -from symfony to be used as a standalone library. Symfony YAML is part of the -[symfony components project](http://components.symfony-project.org/). diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/00-Introduction.markdown b/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/00-Introduction.markdown deleted file mode 100644 index e5927587419c816fcd7304c8530b42ee39a972e9..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/00-Introduction.markdown +++ /dev/null @@ -1,143 +0,0 @@ -Introduction -============ - -This book is about *Symfony YAML*, a PHP library part of the Symfony -Components project. Its official website is at -http://components.symfony-project.org/yaml/. - ->**SIDEBAR** ->About the Symfony Components -> ->[Symfony Components](http://components.symfony-project.org/) are ->standalone PHP classes that can be easily used in any ->PHP project. Most of the time, they have been developed as part of the ->[Symfony framework](http://www.symfony-project.org/), and decoupled from the ->main framework later on. You don't need to use the Symfony MVC framework to use ->the components. - -What is it? ------------ - -Symfony YAML is a PHP library that parses YAML strings and converts them to -PHP arrays. It can also converts PHP arrays to YAML strings. - -[YAML](http://www.yaml.org/), YAML Ain't Markup Language, is a human friendly -data serialization standard for all programming languages. YAML is a great -format for your configuration files. YAML files are as expressive as XML files -and as readable as INI files. - -### Easy to use - -There is only one archive to download, and you are ready to go. No -configuration, No installation. Drop the files in a directory and start using -it today in your projects. - -### Open-Source - -Released under the MIT license, you are free to do whatever you want, even in -a commercial environment. You are also encouraged to contribute. - - -### Used by popular Projects - -Symfony YAML was initially released as part of the symfony framework, one of -the most popular PHP web framework. It is also embedded in other popular -projects like PHPUnit or Doctrine. - -### Documented - -Symfony YAML is fully documented, with a dedicated online book, and of course -a full API documentation. - -### Fast - -One of the goal of Symfony YAML is to find the right balance between speed and -features. It supports just the needed feature to handle configuration files. - -### Unit tested - -The library is fully unit-tested. With more than 400 unit tests, the library -is stable and is already used in large projects. - -### Real Parser - -It sports a real parser and is able to parse a large subset of the YAML -specification, for all your configuration needs. It also means that the parser -is pretty robust, easy to understand, and simple enough to extend. - -### Clear error messages - -Whenever you have a syntax problem with your YAML files, the library outputs a -helpful message with the filename and the line number where the problem -occurred. It eases the debugging a lot. - -### Dump support - -It is also able to dump PHP arrays to YAML with object support, and inline -level configuration for pretty outputs. - -### Types Support - -It supports most of the YAML built-in types like dates, integers, octals, -booleans, and much more... - - -### Full merge key support - -Full support for references, aliases, and full merge key. Don't repeat -yourself by referencing common configuration bits. - -### PHP Embedding - -YAML files are dynamic. By embedding PHP code inside a YAML file, you have -even more power for your configuration files. - -Installation ------------- - -Symfony YAML can be installed by downloading the source code as a -[tar](http://github.com/fabpot/yaml/tarball/master) archive or a -[zip](http://github.com/fabpot/yaml/zipball/master) one. - -To stay up-to-date, you can also use the official Subversion -[repository](http://svn.symfony-project.com/components/yaml/). - -If you are a Git user, there is an official -[mirror](http://github.com/fabpot/yaml), which is updated every 10 minutes. - -If you prefer to install the component globally on your machine, you can use -the symfony [PEAR](http://pear.symfony-project.com/) channel server. - -Support -------- - -Support questions and enhancements can be discussed on the -[mailing-list](http://groups.google.com/group/symfony-components). - -If you find a bug, you can create a ticket at the symfony -[trac](http://trac.symfony-project.org/newticket) under the *YAML* component. - -License -------- - -The Symfony YAML component is licensed under the *MIT license*: - ->Copyright (c) 2008-2009 Fabien Potencier -> ->Permission is hereby granted, free of charge, to any person obtaining a copy ->of this software and associated documentation files (the "Software"), to deal ->in the Software without restriction, including without limitation the rights ->to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ->copies of the Software, and to permit persons to whom the Software is furnished ->to do so, subject to the following conditions: -> ->The above copyright notice and this permission notice shall be included in all ->copies or substantial portions of the Software. -> ->THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ->IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ->FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ->AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ->LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ->OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ->THE SOFTWARE. diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/01-Usage.markdown b/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/01-Usage.markdown deleted file mode 100644 index 644cf11e934b3e62f7ae3448eae7977d24f2ee86..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/01-Usage.markdown +++ /dev/null @@ -1,110 +0,0 @@ -Using Symfony YAML -================== - -The Symfony YAML library is very simple and consists of two main classes: one -to parse YAML strings (`sfYamlParser`), and the other to dump a PHP array to -a YAML string (`sfYamlDumper`). - -On top of these two core classes, the main `sfYaml` class acts as a thin -wrapper and simplifies common uses. - -Reading YAML Files ------------------- - -The `sfYamlParser::parse()` method parses a YAML string and converts it to a -PHP array: - - [php] - $yaml = new sfYamlParser(); - $value = $yaml->parse(file_get_contents('/path/to/file.yaml')); - -If an error occurs during parsing, the parser throws an exception indicating -the error type and the line in the original YAML string where the error -occurred: - - [php] - try - { - $value = $yaml->parse(file_get_contents('/path/to/file.yaml')); - } - catch (InvalidArgumentException $e) - { - // an error occurred during parsing - echo "Unable to parse the YAML string: ".$e->getMessage(); - } - ->**TIP** ->As the parser is reentrant, you can use the same parser object to load ->different YAML strings. - -When loading a YAML file, it is sometimes better to use the `sfYaml::load()` -wrapper method: - - [php] - $loader = sfYaml::load('/path/to/file.yml'); - -The `sfYaml::load()` static method takes a YAML string or a file containing -YAML. Internally, it calls the `sfYamlParser::parse()` method, but with some -added bonuses: - - * It executes the YAML file as if it was a PHP file, so that you can embed - PHP commands in YAML files; - - * When a file cannot be parsed, it automatically adds the file name to the - error message, simplifying debugging when your application is loading - several YAML files. - -Writing YAML Files ------------------- - -The `sfYamlDumper` dumps any PHP array to its YAML representation: - - [php] - $array = array('foo' => 'bar', 'bar' => array('foo' => 'bar', 'bar' => 'baz')); - - $dumper = new sfYamlDumper(); - $yaml = $dumper->dump($array); - file_put_contents('/path/to/file.yaml', $yaml); - ->**NOTE** ->Of course, the Symfony YAML dumper is not able to dump resources. Also, ->even if the dumper is able to dump PHP objects, it is to be considered ->an alpha feature. - -If you only need to dump one array, you can use the `sfYaml::dump()` static -method shortcut: - - [php] - $yaml = sfYaml::dump($array, $inline); - -The YAML format supports two kind of representation for arrays, the expanded -one, and the inline one. By default, the dumper uses the inline -representation: - - [yml] - { foo: bar, bar: { foo: bar, bar: baz } } - -The second argument of the `dump()` method customizes the level at which the -output switches from the expanded representation to the inline one: - - [php] - echo $dumper->dump($array, 1); - -- - - [yml] - foo: bar - bar: { foo: bar, bar: baz } - -- - - [php] - echo $dumper->dump($array, 2); - -- - - [yml] - foo: bar - bar: - foo: bar - bar: baz diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/02-YAML.markdown b/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/02-YAML.markdown deleted file mode 100644 index a64c19e84e8acfe4b06bc08e119c15d2aaf6efab..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/02-YAML.markdown +++ /dev/null @@ -1,312 +0,0 @@ -The YAML Format -=============== - -According to the official [YAML](http://yaml.org/) website, YAML is "a human -friendly data serialization standard for all programming languages". - -Even if the YAML format can describe complex nested data structure, this -chapter only describes the minimum set of features needed to use YAML as a -configuration file format. - -YAML is a simple language that describes data. As PHP, it has a syntax for -simple types like strings, booleans, floats, or integers. But unlike PHP, it -makes a difference between arrays (sequences) and hashes (mappings). - -Scalars -------- - -The syntax for scalars is similar to the PHP syntax. - -### Strings - - [yml] - A string in YAML - -- - - [yml] - 'A singled-quoted string in YAML' - ->**TIP** ->In a single quoted string, a single quote `'` must be doubled: -> -> [yml] -> 'A single quote '' in a single-quoted string' - - [yml] - "A double-quoted string in YAML\n" - -Quoted styles are useful when a string starts or ends with one or more -relevant spaces. - ->**TIP** ->The double-quoted style provides a way to express arbitrary strings, by ->using `\` escape sequences. It is very useful when you need to embed a ->`\n` or a unicode character in a string. - -When a string contains line breaks, you can use the literal style, indicated -by the pipe (`|`), to indicate that the string will span several lines. In -literals, newlines are preserved: - - [yml] - | - \/ /| |\/| | - / / | | | |__ - -Alternatively, strings can be written with the folded style, denoted by `>`, -where each line break is replaced by a space: - - [yml] - > - This is a very long sentence - that spans several lines in the YAML - but which will be rendered as a string - without carriage returns. - ->**NOTE** ->Notice the two spaces before each line in the previous examples. They ->won't appear in the resulting PHP strings. - -### Numbers - - [yml] - # an integer - 12 - -- - - [yml] - # an octal - 014 - -- - - [yml] - # an hexadecimal - 0xC - -- - - [yml] - # a float - 13.4 - -- - - [yml] - # an exponential number - 1.2e+34 - -- - - [yml] - # infinity - .inf - -### Nulls - -Nulls in YAML can be expressed with `null` or `~`. - -### Booleans - -Booleans in YAML are expressed with `true` and `false`. - ->**NOTE** ->The symfony YAML parser also recognize `on`, `off`, `yes`, and `no` but ->it is strongly discouraged to use them as it has been removed from the ->1.2 YAML specifications. - -### Dates - -YAML uses the ISO-8601 standard to express dates: - - [yml] - 2001-12-14t21:59:43.10-05:00 - -- - - [yml] - # simple date - 2002-12-14 - -Collections ------------ - -A YAML file is rarely used to describe a simple scalar. Most of the time, it -describes a collection. A collection can be a sequence or a mapping of -elements. Both sequences and mappings are converted to PHP arrays. - -Sequences use a dash followed by a space (`- `): - - [yml] - - PHP - - Perl - - Python - -The previous YAML file is equivalent to the following PHP code: - - [php] - array('PHP', 'Perl', 'Python'); - -Mappings use a colon followed by a space (`: `) to mark each key/value pair: - - [yml] - PHP: 5.2 - MySQL: 5.1 - Apache: 2.2.20 - -which is equivalent to this PHP code: - - [php] - array('PHP' => 5.2, 'MySQL' => 5.1, 'Apache' => '2.2.20'); - ->**NOTE** ->In a mapping, a key can be any valid scalar. - -The number of spaces between the colon and the value does not matter: - - [yml] - PHP: 5.2 - MySQL: 5.1 - Apache: 2.2.20 - -YAML uses indentation with one or more spaces to describe nested collections: - - [yml] - "symfony 1.0": - PHP: 5.0 - Propel: 1.2 - "symfony 1.2": - PHP: 5.2 - Propel: 1.3 - -The following YAML is equivalent to the following PHP code: - - [php] - array( - 'symfony 1.0' => array( - 'PHP' => 5.0, - 'Propel' => 1.2, - ), - 'symfony 1.2' => array( - 'PHP' => 5.2, - 'Propel' => 1.3, - ), - ); - -There is one important thing you need to remember when using indentation in a -YAML file: *Indentation must be done with one or more spaces, but never with -tabulations*. - -You can nest sequences and mappings as you like: - - [yml] - 'Chapter 1': - - Introduction - - Event Types - 'Chapter 2': - - Introduction - - Helpers - -YAML can also use flow styles for collections, using explicit indicators -rather than indentation to denote scope. - -A sequence can be written as a comma separated list within square brackets -(`[]`): - - [yml] - [PHP, Perl, Python] - -A mapping can be written as a comma separated list of key/values within curly -braces (`{}`): - - [yml] - { PHP: 5.2, MySQL: 5.1, Apache: 2.2.20 } - -You can mix and match styles to achieve a better readability: - - [yml] - 'Chapter 1': [Introduction, Event Types] - 'Chapter 2': [Introduction, Helpers] - -- - - [yml] - "symfony 1.0": { PHP: 5.0, Propel: 1.2 } - "symfony 1.2": { PHP: 5.2, Propel: 1.3 } - -Comments --------- - -Comments can be added in YAML by prefixing them with a hash mark (`#`): - - [yml] - # Comment on a line - "symfony 1.0": { PHP: 5.0, Propel: 1.2 } # Comment at the end of a line - "symfony 1.2": { PHP: 5.2, Propel: 1.3 } - ->**NOTE** ->Comments are simply ignored by the YAML parser and do not need to be ->indented according to the current level of nesting in a collection. - -Dynamic YAML files ------------------- - -In symfony, a YAML file can contain PHP code that is evaluated just before the -parsing occurs: - - [php] - 1.0: - version: <?php echo file_get_contents('1.0/VERSION')."\n" ?> - 1.1: - version: "<?php echo file_get_contents('1.1/VERSION') ?>" - -Be careful to not mess up with the indentation. Keep in mind the following -simple tips when adding PHP code to a YAML file: - - * The `<?php ?>` statements must always start the line or be embedded in a - value. - - * If a `<?php ?>` statement ends a line, you need to explicitly output a new - line ("\n"). - -<div class="pagebreak"></div> - -A Full Length Example ---------------------- - -The following example illustrates most YAML notations explained in this -document: - - [yml] - "symfony 1.0": - end_of_maintainance: 2010-01-01 - is_stable: true - release_manager: "Grégoire Hubert" - description: > - This stable version is the right choice for projects - that need to be maintained for a long period of time. - latest_beta: ~ - latest_minor: 1.0.20 - supported_orms: [Propel] - archives: { source: [zip, tgz], sandbox: [zip, tgz] } - - "symfony 1.2": - end_of_maintainance: 2008-11-01 - is_stable: true - release_manager: 'Fabian Lange' - description: > - This stable version is the right choice - if you start a new project today. - latest_beta: null - latest_minor: 1.2.5 - supported_orms: - - Propel - - Doctrine - archives: - source: - - zip - - tgz - sandbox: - - zip - - tgz diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/A-License.markdown b/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/A-License.markdown deleted file mode 100644 index 49cdd7c7720bd72c4a052ac3a4950e7a3ce44e1e..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/doc/A-License.markdown +++ /dev/null @@ -1,108 +0,0 @@ -Appendix A - License -==================== - -Attribution-Share Alike 3.0 Unported License --------------------------------------------- - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - - a. **"Adaptation"** means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. - - b. **"Collection"** means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License. - - c. **"Creative Commons Compatible License"** means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License. - - d. **"Distribute"** means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. - - e. **"License Elements"** means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike. - - f. **"Licensor"** means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. - - g. **"Original Author"** means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. - - h. **"Work"** means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. - - i. **"You"** means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. - - j. **"Publicly Perform"** means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. - - k. **"Reproduce"** means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. - -2. Fair Dealing Rights - - Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. - -3. License Grant - - Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: - - a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; - - b. to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; - - c. to Distribute and Publicly Perform the Work including as incorporated in Collections; and, - - d. to Distribute and Publicly Perform Adaptations. - - e. For the avoidance of doubt: - - i. **Non-waivable Compulsory License Schemes**. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; - - ii. **Waivable Compulsory License Schemes**. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and, - - iii. **Voluntary License Schemes**. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License. - - The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved. - -4. Restrictions - - The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: - - a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested. - - b. You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License. - - c. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. - - d. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. - -5. Representations, Warranties and Disclaimer - - UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability - - EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - a. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. - - b. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. - -8. Miscellaneous - - a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. - - b. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. - - c. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - - d. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. - - e. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. - - f. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. - ->**SIDEBAR** ->Creative Commons Notice -> ->Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. -> ->Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License. -> ->Creative Commons may be contacted at http://creativecommons.org/. diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYaml.php b/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYaml.php deleted file mode 100644 index 1d89ccc973615e9d7f6b07ded11280d63c8dffe2..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYaml.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfYaml offers convenience methods to load and dump YAML. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier <fabien.potencier@symfony-project.com> - * @version SVN: $Id: sfYaml.class.php 8988 2008-05-15 20:24:26Z fabien $ - */ -class sfYaml -{ - static protected - $spec = '1.2'; - - /** - * Sets the YAML specification version to use. - * - * @param string $version The YAML specification version - */ - static public function setSpecVersion($version) - { - if (!in_array($version, array('1.1', '1.2'))) - { - throw new InvalidArgumentException(sprintf('Version %s of the YAML specifications is not supported', $version)); - } - - self::$spec = $version; - } - - /** - * Gets the YAML specification version to use. - * - * @return string The YAML specification version - */ - static public function getSpecVersion() - { - return self::$spec; - } - - /** - * Loads YAML into a PHP array. - * - * The load method, when supplied with a YAML stream (string or file), - * will do its best to convert YAML in a file into a PHP array. - * - * Usage: - * <code> - * $array = sfYaml::load('config.yml'); - * print_r($array); - * </code> - * - * @param string $input Path of YAML file or string containing YAML - * - * @return array The YAML converted to a PHP array - * - * @throws InvalidArgumentException If the YAML is not valid - */ - public static function load($input) - { - $file = ''; - - // if input is a file, process it - if (strpos($input, "\n") === false && is_file($input)) - { - $file = $input; - - ob_start(); - $retval = include($input); - $content = ob_get_clean(); - - // if an array is returned by the config file assume it's in plain php form else in YAML - $input = is_array($retval) ? $retval : $content; - } - - // if an array is returned by the config file assume it's in plain php form else in YAML - if (is_array($input)) - { - return $input; - } - - require_once dirname(__FILE__).'/sfYamlParser.php'; - - $yaml = new sfYamlParser(); - - try - { - $ret = $yaml->parse($input); - } - catch (Exception $e) - { - throw new InvalidArgumentException(sprintf('Unable to parse %s: %s', $file ? sprintf('file "%s"', $file) : 'string', $e->getMessage())); - } - - return $ret; - } - - /** - * Dumps a PHP array to a YAML string. - * - * The dump method, when supplied with an array, will do its best - * to convert the array into friendly YAML. - * - * @param array $array PHP array - * @param integer $inline The level where you switch to inline YAML - * - * @return string A YAML string representing the original PHP array - */ - public static function dump($array, $inline = 2) - { - require_once dirname(__FILE__).'/sfYamlDumper.php'; - - $yaml = new sfYamlDumper(); - - return $yaml->dump($array, $inline); - } -} - -/** - * Wraps echo to automatically provide a newline. - * - * @param string $string The string to echo with new line - */ -function echoln($string) -{ - echo $string."\n"; -} diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlDumper.php b/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlDumper.php deleted file mode 100644 index 0ada2b37d210986e6dadd7c40d2b4cf5b60d6564..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlDumper.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <fabien.potencier@symfony-project.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once(dirname(__FILE__).'/sfYamlInline.php'); - -/** - * sfYamlDumper dumps PHP variables to YAML strings. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier <fabien.potencier@symfony-project.com> - * @version SVN: $Id: sfYamlDumper.class.php 10575 2008-08-01 13:08:42Z nicolas $ - */ -class sfYamlDumper -{ - /** - * Dumps a PHP value to YAML. - * - * @param mixed $input The PHP value - * @param integer $inline The level where you switch to inline YAML - * @param integer $indent The level o indentation indentation (used internally) - * - * @return string The YAML representation of the PHP value - */ - public function dump($input, $inline = 0, $indent = 0) - { - $output = ''; - $prefix = $indent ? str_repeat(' ', $indent) : ''; - - if ($inline <= 0 || !is_array($input) || empty($input)) - { - $output .= $prefix.sfYamlInline::dump($input); - } - else - { - $isAHash = array_keys($input) !== range(0, count($input) - 1); - - foreach ($input as $key => $value) - { - $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); - - $output .= sprintf('%s%s%s%s', - $prefix, - $isAHash ? sfYamlInline::dump($key).':' : '-', - $willBeInlined ? ' ' : "\n", - $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + 2) - ).($willBeInlined ? "\n" : ''); - } - } - - return $output; - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlInline.php b/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlInline.php deleted file mode 100644 index a88cbb3d968342109b49e055a350e4c6a40d4600..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlInline.php +++ /dev/null @@ -1,442 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <fabien.potencier@symfony-project.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfYaml.php'; - -/** - * sfYamlInline implements a YAML parser/dumper for the YAML inline syntax. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier <fabien.potencier@symfony-project.com> - * @version SVN: $Id: sfYamlInline.class.php 16177 2009-03-11 08:32:48Z fabien $ - */ -class sfYamlInline -{ - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; - - /** - * Convert a YAML string to a PHP array. - * - * @param string $value A YAML string - * - * @return array A PHP array representing the YAML string - */ - static public function load($value) - { - $value = trim($value); - - if (0 == strlen($value)) - { - return ''; - } - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) - { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - switch ($value[0]) - { - case '[': - $result = self::parseSequence($value); - break; - case '{': - $result = self::parseMapping($value); - break; - default: - $result = self::parseScalar($value); - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return $result; - } - - /** - * Dumps a given PHP variable to a YAML string. - * - * @param mixed $value The PHP variable to convert - * - * @return string The YAML string representing the PHP array - */ - static public function dump($value) - { - if ('1.1' === sfYaml::getSpecVersion()) - { - $trueValues = array('true', 'on', '+', 'yes', 'y'); - $falseValues = array('false', 'off', '-', 'no', 'n'); - } - else - { - $trueValues = array('true'); - $falseValues = array('false'); - } - - switch (true) - { - case is_resource($value): - throw new InvalidArgumentException('Unable to dump PHP resources in a YAML file.'); - case is_object($value): - return '!!php/object:'.serialize($value); - case is_array($value): - return self::dumpArray($value); - case null === $value: - return 'null'; - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case ctype_digit($value): - return is_string($value) ? "'$value'" : (int) $value; - case is_numeric($value): - return is_infinite($value) ? str_ireplace('INF', '.Inf', strval($value)) : (is_string($value) ? "'$value'" : $value); - case false !== strpos($value, "\n") || false !== strpos($value, "\r"): - return sprintf('"%s"', str_replace(array('"', "\n", "\r"), array('\\"', '\n', '\r'), $value)); - case preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value): - return sprintf("'%s'", str_replace('\'', '\'\'', $value)); - case '' == $value: - return "''"; - case preg_match(self::getTimestampRegex(), $value): - return "'$value'"; - case in_array(strtolower($value), $trueValues): - return "'$value'"; - case in_array(strtolower($value), $falseValues): - return "'$value'"; - case in_array(strtolower($value), array('null', '~')): - return "'$value'"; - default: - return $value; - } - } - - /** - * Dumps a PHP array to a YAML string. - * - * @param array $value The PHP array to dump - * - * @return string The YAML string representing the PHP array - */ - static protected function dumpArray($value) - { - // array - $keys = array_keys($value); - if ( - (1 == count($keys) && '0' == $keys[0]) - || - (count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2)) - { - $output = array(); - foreach ($value as $val) - { - $output[] = self::dump($val); - } - - return sprintf('[%s]', implode(', ', $output)); - } - - // mapping - $output = array(); - foreach ($value as $key => $val) - { - $output[] = sprintf('%s: %s', self::dump($key), self::dump($val)); - } - - return sprintf('{ %s }', implode(', ', $output)); - } - - /** - * Parses a scalar to a YAML string. - * - * @param scalar $scalar - * @param string $delimiters - * @param array $stringDelimiter - * @param integer $i - * @param boolean $evaluate - * - * @return string A YAML string - */ - static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) - { - if (in_array($scalar[$i], $stringDelimiters)) - { - // quoted scalar - $output = self::parseQuotedScalar($scalar, $i); - } - else - { - // "normal" string - if (!$delimiters) - { - $output = substr($scalar, $i); - $i += strlen($output); - - // remove comments - if (false !== $strpos = strpos($output, ' #')) - { - $output = rtrim(substr($output, 0, $strpos)); - } - } - else if (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) - { - $output = $match[1]; - $i += strlen($output); - } - else - { - throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', $scalar)); - } - - $output = $evaluate ? self::evaluateScalar($output) : $output; - } - - return $output; - } - - /** - * Parses a quoted scalar to YAML. - * - * @param string $scalar - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseQuotedScalar($scalar, &$i) - { - if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) - { - throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i))); - } - - $output = substr($match[0], 1, strlen($match[0]) - 2); - - if ('"' == $scalar[$i]) - { - // evaluate the string - $output = str_replace(array('\\"', '\\n', '\\r'), array('"', "\n", "\r"), $output); - } - else - { - // unescape ' - $output = str_replace('\'\'', '\'', $output); - } - - $i += strlen($match[0]); - - return $output; - } - - /** - * Parses a sequence to a YAML string. - * - * @param string $sequence - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseSequence($sequence, &$i = 0) - { - $output = array(); - $len = strlen($sequence); - $i += 1; - - // [foo, bar, ...] - while ($i < $len) - { - switch ($sequence[$i]) - { - case '[': - // nested sequence - $output[] = self::parseSequence($sequence, $i); - break; - case '{': - // nested mapping - $output[] = self::parseMapping($sequence, $i); - break; - case ']': - return $output; - case ',': - case ' ': - break; - default: - $isQuoted = in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i); - - if (!$isQuoted && false !== strpos($value, ': ')) - { - // embedded mapping? - try - { - $value = self::parseMapping('{'.$value.'}'); - } - catch (InvalidArgumentException $e) - { - // no, it's not - } - } - - $output[] = $value; - - --$i; - } - - ++$i; - } - - throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $sequence)); - } - - /** - * Parses a mapping to a YAML string. - * - * @param string $mapping - * @param integer $i - * - * @return string A YAML string - */ - static protected function parseMapping($mapping, &$i = 0) - { - $output = array(); - $len = strlen($mapping); - $i += 1; - - // {foo: bar, bar:foo, ...} - while ($i < $len) - { - switch ($mapping[$i]) - { - case ' ': - case ',': - ++$i; - continue 2; - case '}': - return $output; - } - - // key - $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false); - - // value - $done = false; - while ($i < $len) - { - switch ($mapping[$i]) - { - case '[': - // nested sequence - $output[$key] = self::parseSequence($mapping, $i); - $done = true; - break; - case '{': - // nested mapping - $output[$key] = self::parseMapping($mapping, $i); - $done = true; - break; - case ':': - case ' ': - break; - default: - $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i); - $done = true; - --$i; - } - - ++$i; - - if ($done) - { - continue 2; - } - } - } - - throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $mapping)); - } - - /** - * Evaluates scalars and replaces magic values. - * - * @param string $scalar - * - * @return string A YAML string - */ - static protected function evaluateScalar($scalar) - { - $scalar = trim($scalar); - - if ('1.1' === sfYaml::getSpecVersion()) - { - $trueValues = array('true', 'on', '+', 'yes', 'y'); - $falseValues = array('false', 'off', '-', 'no', 'n'); - } - else - { - $trueValues = array('true'); - $falseValues = array('false'); - } - - switch (true) - { - case 'null' == strtolower($scalar): - case '' == $scalar: - case '~' == $scalar: - return null; - case 0 === strpos($scalar, '!str'): - return (string) substr($scalar, 5); - case 0 === strpos($scalar, '! '): - return intval(self::parseScalar(substr($scalar, 2))); - case 0 === strpos($scalar, '!!php/object:'): - return unserialize(substr($scalar, 13)); - case ctype_digit($scalar): - $raw = $scalar; - $cast = intval($scalar); - return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case in_array(strtolower($scalar), $trueValues): - return true; - case in_array(strtolower($scalar), $falseValues): - return false; - case is_numeric($scalar): - return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : floatval($scalar); - case 0 == strcasecmp($scalar, '.inf'): - case 0 == strcasecmp($scalar, '.NaN'): - return -log(0); - case 0 == strcasecmp($scalar, '-.inf'): - return log(0); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): - return floatval(str_replace(',', '', $scalar)); - case preg_match(self::getTimestampRegex(), $scalar): - return strtotime($scalar); - default: - return (string) $scalar; - } - } - - static protected function getTimestampRegex() - { - return <<<EOF - ~^ - (?P<year>[0-9][0-9][0-9][0-9]) - -(?P<month>[0-9][0-9]?) - -(?P<day>[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P<hour>[0-9][0-9]?) - :(?P<minute>[0-9][0-9]) - :(?P<second>[0-9][0-9]) - (?:\.(?P<fraction>[0-9]*))? - (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?) - (?::(?P<tz_minute>[0-9][0-9]))?))?)? - $~x -EOF; - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlParser.php b/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlParser.php deleted file mode 100644 index 91da2dcb19035089aed3fab434b44b6d384e0208..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/lib/sfYamlParser.php +++ /dev/null @@ -1,622 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <fabien.potencier@symfony-project.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once(dirname(__FILE__).'/sfYamlInline.php'); - -if (!defined('PREG_BAD_UTF8_OFFSET_ERROR')) -{ - define('PREG_BAD_UTF8_OFFSET_ERROR', 5); -} - -/** - * sfYamlParser parses YAML strings to convert them to PHP arrays. - * - * @package symfony - * @subpackage yaml - * @author Fabien Potencier <fabien.potencier@symfony-project.com> - * @version SVN: $Id: sfYamlParser.class.php 10832 2008-08-13 07:46:08Z fabien $ - */ -class sfYamlParser -{ - protected - $offset = 0, - $lines = array(), - $currentLineNb = -1, - $currentLine = '', - $refs = array(); - - /** - * Constructor - * - * @param integer $offset The offset of YAML document (used for line numbers in error messages) - */ - public function __construct($offset = 0) - { - $this->offset = $offset; - } - - /** - * Parses a YAML string to a PHP value. - * - * @param string $value A YAML string - * - * @return mixed A PHP value - * - * @throws InvalidArgumentException If the YAML is not valid - */ - public function parse($value) - { - $this->currentLineNb = -1; - $this->currentLine = ''; - $this->lines = explode("\n", $this->cleanup($value)); - - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) - { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - } - - $data = array(); - while ($this->moveToNextLine()) - { - if ($this->isCurrentLineEmpty()) - { - continue; - } - - // tab? - if (preg_match('#^\t+#', $this->currentLine)) - { - throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - - $isRef = $isInPlace = $isProcessed = false; - if (preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) - { - if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) - { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - // array - if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) - { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $data[] = $parser->parse($this->getNextEmbedBlock()); - } - else - { - if (isset($values['leadspaces']) - && ' ' == $values['leadspaces'] - && preg_match('#^(?P<key>'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $values['value'], $matches)) - { - // this is a compact notation element, add to next block and parse - $c = $this->getRealCurrentLineNb(); - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - - $block = $values['value']; - if (!$this->isNextLineIndented()) - { - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + 2); - } - - $data[] = $parser->parse($block); - } - else - { - $data[] = $this->parseValue($values['value']); - } - } - } - else if (preg_match('#^(?P<key>'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) - { - $key = sfYamlInline::parseScalar($values['key']); - - if ('<<' === $key) - { - if (isset($values['value']) && '*' === substr($values['value'], 0, 1)) - { - $isInPlace = substr($values['value'], 1); - if (!array_key_exists($isInPlace, $this->refs)) - { - throw new InvalidArgumentException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - else - { - if (isset($values['value']) && $values['value'] !== '') - { - $value = $values['value']; - } - else - { - $value = $this->getNextEmbedBlock(); - } - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $parsed = $parser->parse($value); - - $merged = array(); - if (!is_array($parsed)) - { - throw new InvalidArgumentException(sprintf("YAML merge keys used with a scalar value instead of an array at line %s (%s)", $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - else if (isset($parsed[0])) - { - // Numeric array, merge individual elements - foreach (array_reverse($parsed) as $parsedItem) - { - if (!is_array($parsedItem)) - { - throw new InvalidArgumentException(sprintf("Merge items must be arrays at line %s (%s).", $this->getRealCurrentLineNb() + 1, $parsedItem)); - } - $merged = array_merge($parsedItem, $merged); - } - } - else - { - // Associative array, merge - $merged = array_merge($merge, $parsed); - } - - $isProcessed = $merged; - } - } - else if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) - { - $isRef = $matches['ref']; - $values['value'] = $matches['value']; - } - - if ($isProcessed) - { - // Merge keys - $data = $isProcessed; - } - // hash - else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) - { - // if next line is less indented or equal, then it means that the current value is null - if ($this->isNextLineIndented()) - { - $data[$key] = null; - } - else - { - $c = $this->getRealCurrentLineNb() + 1; - $parser = new sfYamlParser($c); - $parser->refs =& $this->refs; - $data[$key] = $parser->parse($this->getNextEmbedBlock()); - } - } - else - { - if ($isInPlace) - { - $data = $this->refs[$isInPlace]; - } - else - { - $data[$key] = $this->parseValue($values['value']); - } - } - } - else - { - // 1-liner followed by newline - if (2 == count($this->lines) && empty($this->lines[1])) - { - $value = sfYamlInline::load($this->lines[0]); - if (is_array($value)) - { - $first = reset($value); - if ('*' === substr($first, 0, 1)) - { - $data = array(); - foreach ($value as $alias) - { - $data[] = $this->refs[substr($alias, 1)]; - } - $value = $data; - } - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return $value; - } - - switch (preg_last_error()) - { - case PREG_INTERNAL_ERROR: - $error = 'Internal PCRE error on line'; - break; - case PREG_BACKTRACK_LIMIT_ERROR: - $error = 'pcre.backtrack_limit reached on line'; - break; - case PREG_RECURSION_LIMIT_ERROR: - $error = 'pcre.recursion_limit reached on line'; - break; - case PREG_BAD_UTF8_ERROR: - $error = 'Malformed UTF-8 data on line'; - break; - case PREG_BAD_UTF8_OFFSET_ERROR: - $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point on line'; - break; - default: - $error = 'Unable to parse line'; - } - - throw new InvalidArgumentException(sprintf('%s %d (%s).', $error, $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - - if ($isRef) - { - $this->refs[$isRef] = end($data); - } - } - - if (isset($mbEncoding)) - { - mb_internal_encoding($mbEncoding); - } - - return empty($data) ? null : $data; - } - - /** - * Returns the current line number (takes the offset into account). - * - * @return integer The current line number - */ - protected function getRealCurrentLineNb() - { - return $this->currentLineNb + $this->offset; - } - - /** - * Returns the current line indentation. - * - * @return integer The current line indentation - */ - protected function getCurrentLineIndentation() - { - return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' ')); - } - - /** - * Returns the next embed block of YAML. - * - * @param integer $indentation The indent level at which the block is to be read, or null for default - * - * @return string A YAML string - */ - protected function getNextEmbedBlock($indentation = null) - { - $this->moveToNextLine(); - - if (null === $indentation) - { - $newIndent = $this->getCurrentLineIndentation(); - - if (!$this->isCurrentLineEmpty() && 0 == $newIndent) - { - throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - else - { - $newIndent = $indentation; - } - - $data = array(substr($this->currentLine, $newIndent)); - - while ($this->moveToNextLine()) - { - if ($this->isCurrentLineEmpty()) - { - if ($this->isCurrentLineBlank()) - { - $data[] = substr($this->currentLine, $newIndent); - } - - continue; - } - - $indent = $this->getCurrentLineIndentation(); - - if (preg_match('#^(?P<text> *)$#', $this->currentLine, $match)) - { - // empty line - $data[] = $match['text']; - } - else if ($indent >= $newIndent) - { - $data[] = substr($this->currentLine, $newIndent); - } - else if (0 == $indent) - { - $this->moveToPreviousLine(); - - break; - } - else - { - throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine)); - } - } - - return implode("\n", $data); - } - - /** - * Moves the parser to the next line. - */ - protected function moveToNextLine() - { - if ($this->currentLineNb >= count($this->lines) - 1) - { - return false; - } - - $this->currentLine = $this->lines[++$this->currentLineNb]; - - return true; - } - - /** - * Moves the parser to the previous line. - */ - protected function moveToPreviousLine() - { - $this->currentLine = $this->lines[--$this->currentLineNb]; - } - - /** - * Parses a YAML value. - * - * @param string $value A YAML value - * - * @return mixed A PHP value - */ - protected function parseValue($value) - { - if ('*' === substr($value, 0, 1)) - { - if (false !== $pos = strpos($value, '#')) - { - $value = substr($value, 1, $pos - 2); - } - else - { - $value = substr($value, 1); - } - - if (!array_key_exists($value, $this->refs)) - { - throw new InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine)); - } - return $this->refs[$value]; - } - - if (preg_match('/^(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?$/', $value, $matches)) - { - $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - - return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers))); - } - else - { - return sfYamlInline::load($value); - } - } - - /** - * Parses a folded scalar. - * - * @param string $separator The separator that was used to begin this folded scalar (| or >) - * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) - * @param integer $indentation The indentation that was used to begin this folded scalar - * - * @return string The text value - */ - protected function parseFoldedScalar($separator, $indicator = '', $indentation = 0) - { - $separator = '|' == $separator ? "\n" : ' '; - $text = ''; - - $notEOF = $this->moveToNextLine(); - - while ($notEOF && $this->isCurrentLineBlank()) - { - $text .= "\n"; - - $notEOF = $this->moveToNextLine(); - } - - if (!$notEOF) - { - return ''; - } - - if (!preg_match('#^(?P<indent>'.($indentation ? str_repeat(' ', $indentation) : ' +').')(?P<text>.*)$#u', $this->currentLine, $matches)) - { - $this->moveToPreviousLine(); - - return ''; - } - - $textIndent = $matches['indent']; - $previousIndent = 0; - - $text .= $matches['text'].$separator; - while ($this->currentLineNb + 1 < count($this->lines)) - { - $this->moveToNextLine(); - - if (preg_match('#^(?P<indent> {'.strlen($textIndent).',})(?P<text>.+)$#u', $this->currentLine, $matches)) - { - if (' ' == $separator && $previousIndent != $matches['indent']) - { - $text = substr($text, 0, -1)."\n"; - } - $previousIndent = $matches['indent']; - - $text .= str_repeat(' ', $diff = strlen($matches['indent']) - strlen($textIndent)).$matches['text'].($diff ? "\n" : $separator); - } - else if (preg_match('#^(?P<text> *)$#', $this->currentLine, $matches)) - { - $text .= preg_replace('#^ {1,'.strlen($textIndent).'}#', '', $matches['text'])."\n"; - } - else - { - $this->moveToPreviousLine(); - - break; - } - } - - if (' ' == $separator) - { - // replace last separator by a newline - $text = preg_replace('/ (\n*)$/', "\n$1", $text); - } - - switch ($indicator) - { - case '': - $text = preg_replace('#\n+$#s', "\n", $text); - break; - case '+': - break; - case '-': - $text = preg_replace('#\n+$#s', '', $text); - break; - } - - return $text; - } - - /** - * Returns true if the next line is indented. - * - * @return Boolean Returns true if the next line is indented, false otherwise - */ - protected function isNextLineIndented() - { - $currentIndentation = $this->getCurrentLineIndentation(); - $notEOF = $this->moveToNextLine(); - - while ($notEOF && $this->isCurrentLineEmpty()) - { - $notEOF = $this->moveToNextLine(); - } - - if (false === $notEOF) - { - return false; - } - - $ret = false; - if ($this->getCurrentLineIndentation() <= $currentIndentation) - { - $ret = true; - } - - $this->moveToPreviousLine(); - - return $ret; - } - - /** - * Returns true if the current line is blank or if it is a comment line. - * - * @return Boolean Returns true if the current line is empty or if it is a comment line, false otherwise - */ - protected function isCurrentLineEmpty() - { - return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); - } - - /** - * Returns true if the current line is blank. - * - * @return Boolean Returns true if the current line is blank, false otherwise - */ - protected function isCurrentLineBlank() - { - return '' == trim($this->currentLine, ' '); - } - - /** - * Returns true if the current line is a comment line. - * - * @return Boolean Returns true if the current line is a comment line, false otherwise - */ - protected function isCurrentLineComment() - { - //checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = ltrim($this->currentLine, ' '); - return $ltrimmedLine[0] === '#'; - } - - /** - * Cleanups a YAML string to be parsed. - * - * @param string $value The input YAML string - * - * @return string A cleaned up YAML string - */ - protected function cleanup($value) - { - $value = str_replace(array("\r\n", "\r"), "\n", $value); - - if (!preg_match("#\n$#", $value)) - { - $value .= "\n"; - } - - // strip YAML header - $count = 0; - $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#su', '', $value, -1, $count); - $this->offset += $count; - - // remove leading comments - $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); - if ($count == 1) - { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - } - - // remove start of the document marker (---) - $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); - if ($count == 1) - { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - - // remove end of the document marker (...) - $value = preg_replace('#\.\.\.\s*$#s', '', $value); - } - - return $value; - } -} diff --git a/vendor/flexi/vendor/mustache.php/test/lib/yaml/package.xml b/vendor/flexi/vendor/mustache.php/test/lib/yaml/package.xml deleted file mode 100644 index 1869ae9fc6b1844b0a9d85f04bd3566b4ff428ab..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/lib/yaml/package.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.4.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> - <name>YAML</name> - <channel>pear.symfony-project.com</channel> - <summary>The Symfony YAML Component.</summary> - <description>The Symfony YAML Component.</description> - <lead> - <name>Fabien Potencier</name> - <user>fabpot</user> - <email>fabien.potencier@symfony-project.org</email> - <active>yes</active> - </lead> - <date>2009-12-01</date> - <version> - <release>1.0.2</release> - <api>1.0.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.symfony-project.com/license">MIT license</license> - <notes>-</notes> - <contents> - <dir name="/"> - <file name="README.markdown" role="doc" /> - <file name="LICENSE" role="doc" /> - - <dir name="lib"> - <file install-as="SymfonyComponents/YAML/sfYaml.php" name="sfYaml.php" role="php" /> - <file install-as="SymfonyComponents/YAML/sfYamlDumper.php" name="sfYamlDumper.php" role="php" /> - <file install-as="SymfonyComponents/YAML/sfYamlInline.php" name="sfYamlInline.php" role="php" /> - <file install-as="SymfonyComponents/YAML/sfYamlParser.php" name="sfYamlParser.php" role="php" /> - </dir> - </dir> - </contents> - - <dependencies> - <required> - <php> - <min>5.2.4</min> - </php> - <pearinstaller> - <min>1.4.1</min> - </pearinstaller> - </required> - </dependencies> - - <phprelease> - </phprelease> - - <changelog> - <release> - <version> - <release>1.0.2</release> - <api>1.0.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.symfony-project.com/license">MIT license</license> - <date>2009-12-01</date> - <license>MIT</license> - <notes> - * fabien: fixed \ usage in quoted string - </notes> - </release> - <release> - <version> - <release>1.0.1</release> - <api>1.0.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.symfony-project.com/license">MIT license</license> - <date>2009-12-01</date> - <license>MIT</license> - <notes> - * fabien: fixed a possible loop in parsing a non-valid quoted string - </notes> - </release> - <release> - <version> - <release>1.0.0</release> - <api>1.0.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.symfony-project.com/license">MIT license</license> - <date>2009-11-30</date> - <license>MIT</license> - <notes> - * fabien: first stable release as a Symfony Component - </notes> - </release> - </changelog> -</package> diff --git a/vendor/flexi/vendor/mustache.php/test/phpunit.xml b/vendor/flexi/vendor/mustache.php/test/phpunit.xml deleted file mode 100644 index 891fa8e04d17a80e32ffe9504e3e2755a9a3f876..0000000000000000000000000000000000000000 --- a/vendor/flexi/vendor/mustache.php/test/phpunit.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit colors="true"> - <testsuite name="Mustache"> - <directory>./</directory> - </testsuite> - <blacklist> - <directory suffix=".php">../examples</directory> - <directory suffix=".php">./</directory> - </blacklist> -</phpunit> \ No newline at end of file diff --git a/vendor/trails/src/controller.php b/vendor/trails/src/controller.php index c8e7b8e5b1ba78b7a4ea698d1530c16807361590..6ab954238417c6b7cde75244b29f083b609d3b29 100644 --- a/vendor/trails/src/controller.php +++ b/vendor/trails/src/controller.php @@ -1,5 +1,4 @@ <?php - /** * A Trails_Controller is responsible for matching the unconsumed part of an URI * to an action using the left over words as arguments for that action. The @@ -286,13 +285,6 @@ class Trails_Controller { $factory = $this->get_template_factory(); $template = $factory->open($template_name); - # template requires setup ? - switch (get_class($template)) { - case 'Flexi_JsTemplate': - $this->set_content_type('text/javascript'); - break; - } - $template->set_attributes($this->get_assigned_variables()); if (isset($layout)) { @@ -306,10 +298,10 @@ class Trails_Controller { /** * Create and return a template factory for this controller. * - * @return a Flexi_TemplateFactory + * @return Flexi\Factory */ function get_template_factory() { - return new Flexi_TemplateFactory($this->dispatcher->trails_root . + return new Flexi\Factory($this->dispatcher->trails_root . '/views/'); } diff --git a/vendor/trails/trails-abridged.php b/vendor/trails/trails-abridged.php index 812c1f1ae7e6e6e550725397fd594211d200cb1a..07b337a0e8f4f4d58a466080b46b094d05fade85 100644 --- a/vendor/trails/trails-abridged.php +++ b/vendor/trails/trails-abridged.php @@ -1,2 +1,3 @@ <?php - define('TRAILS_VERSION','0.6.9');class Trails_Dispatcher{public$trails_root;public$trails_uri;public$default_controller;function __construct($trails_root,$trails_uri,$default_controller){$this->trails_root=$trails_root;$this->trails_uri=$trails_uri;$this->default_controller=$default_controller;}function dispatch($uri){$old_handler=set_error_handler(array($this,'error_handler'),5888);ob_start();$level=ob_get_level();$this->map_uri_to_response($this->clean_request_uri((string)$uri))->output();while(ob_get_level()>=$level){ob_end_flush();}if(isset($old_handler)){set_error_handler($old_handler);}}function map_uri_to_response($uri){try{list($controller_path,$unconsumed)=''===$uri?$this->default_route():$this->parse($uri);$controller=$this->load_controller($controller_path);$response=$controller->perform($unconsumed);}catch(Exception$e){$response=isset($controller)?$controller->rescue($e):$this->trails_error($e);}return$response;}function default_route(){if(!$this->file_exists($this->default_controller.'.php')){throw new Trails_MissingFile("Default controller '{$this->default_controller}' not found'");}return array($this->default_controller,'');}function trails_error($exception){ob_clean();$detailed=@$_SERVER['REMOTE_ADDR']==='127.0.0.1';$body=sprintf('<html><head><title>Trails Error</title></head>'.'<body><h1>%s</h1><pre>%s</pre></body></html>',htmlentities($exception->__toString()),$detailed?htmlentities($exception->getTraceAsString()):'');if($exception instanceof Trails_Exception){$response=new Trails_Response($body,$exception->headers,$exception->getCode(),$exception->getMessage());}else{$response=new Trails_Response($body,array(),500,$exception->getMessage());}return$response;}function clean_request_uri($uri){if(FALSE!==($pos=strpos($uri,'?'))){$uri=substr($uri,0,$pos);}return ltrim($uri,'/');}function parse($unconsumed,$controller=NULL){list($head,$tail)=$this->split_on_first_slash($unconsumed);if(!preg_match('/^\w+$/',$head)){throw new Trails_RoutingError("No route matches '$head'");}$controller=(isset($controller)?$controller.'/':'').$head;if($this->file_exists($controller.'.php')){return array($controller,$tail);}else if($this->file_exists($controller)){return$this->parse($tail,$controller);}throw new Trails_RoutingError("No route matches '$head'");}function split_on_first_slash($str){preg_match(":([^/]*)(/+)?(.*):",$str,$matches);return array($matches[1],$matches[3]);}function file_exists($path){return file_exists("{$this->trails_root}/controllers/$path");}function load_controller($controller){require_once"{$this->trails_root}/controllers/{$controller}.php";$class=Trails_Inflector::camelize($controller).'Controller';if(!class_exists($class)){throw new Trails_UnknownController("Controller missing: '$class'");}return new$class($this);}function error_handler($errno,$string,$file,$line,$context){if(!(5888&$errno))return false;throw new Trails_Exception(500,$string);}}class Trails_Response{public$body='',$status,$reason,$headers=array();function __construct($body='',$headers=array(),$status=NULL,$reason=NULL){$this->set_body($body);$this->headers=$headers;if(isset($status)){$this->set_status($status,$reason);}}function set_body($body){$this->body=$body;return$this;}function set_status($status,$reason=NULL){$this->status=$status;$this->reason=isset($reason)?$reason:$this->get_reason($status);return$this;}function get_reason($status){$reason=array(100=>'Continue','Switching Protocols',200=>'OK','Created','Accepted','Non-Authoritative Information','No Content','Reset Content','Partial Content',300=>'Multiple Choices','Moved Permanently','Found','See Other','Not Modified','Use Proxy','(Unused)','Temporary Redirect',400=>'Bad Request','Unauthorized','Payment Required','Forbidden','Not Found','Method Not Allowed','Not Acceptable','Proxy Authentication Required','Request Timeout','Conflict','Gone','Length Required','Precondition Failed','Request Entity Too Large','Request-URI Too Long','Unsupported Media Type','Requested Range Not Satisfiable','Expectation Failed',500=>'Internal Server Error','Not Implemented','Bad Gateway','Service Unavailable','Gateway Timeout','HTTP Version Not Supported');return isset($reason[$status])?$reason[$status]:'';}function add_header($key,$value){$this->headers[$key]=$value;return$this;}function output(){if(isset($this->status)){$this->send_header(sprintf('HTTP/1.1 %d %s',$this->status,$this->reason),TRUE,$this->status);}foreach($this->headers as$k=>$v){$this->send_header("$k: $v");}echo$this->body;}function send_header($header,$replace=FALSE,$status=NULL){if(isset($status)){header($header,$replace,$status);}else{header($header,$replace);}}}class Trails_Controller{protected$dispatcher,$response,$performed,$layout;function __construct($dispatcher){$this->dispatcher=$dispatcher;$this->erase_response();}function erase_response(){$this->performed=FALSE;$this->response=new Trails_Response();}function get_response(){return$this->response;}function perform($unconsumed){list($action,$args,$format)=$this->extract_action_and_args($unconsumed);$this->format=isset($format)?$format:'html';$before_filter_result=$this->before_filter($action,$args);if(!(FALSE===$before_filter_result||$this->performed)){$callable=$this->map_action($action);if(is_callable($callable)){call_user_func_array($callable,$args);}else{$this->does_not_understand($action,$args);}if(!$this->performed){$this->render_action($action);}$this->after_filter($action,$args);}return$this->response;}function extract_action_and_args($string){if(''===$string){return$this->default_action_and_args();}$format=NULL;if(preg_match('/^(.*[^\/.])\.(\w+)$/',$string,$matches)){list($_,$string,$format)=$matches;}$args=explode('/',$string);$action=array_shift($args);return array($action,$args,$format);}function default_action_and_args(){return array('index',array(),NULL);}function map_action($action){return array(&$this,$action.'_action');}function before_filter(&$action,&$args){}function after_filter($action,$args){}function does_not_understand($action,$args){throw new Trails_UnknownAction("No action responded to '$action'.");}function redirect($to){if($this->performed){throw new Trails_DoubleRenderError();}$this->performed=TRUE;$url=preg_match('#^(/|\w+://)#',$to)?$to:$this->url_for($to);$this->response->add_header('Location',$url)->set_status(302);}function render_text($text=' '){if($this->performed){throw new Trails_DoubleRenderError();}$this->performed=TRUE;$this->response->set_body($text);}function render_nothing(){$this->render_text('');}function render_action($action){$this->render_template($this->get_default_template($action),$this->layout);}function get_default_template($action){$class=get_class($this);$controller_name=Trails_Inflector::underscore(substr($class,0,-10));return$controller_name.'/'.$action;}function render_template($template_name,$layout=NULL){$factory=$this->get_template_factory();$template=$factory->open($template_name);switch(get_class($template)){case'Flexi_JsTemplate':$this->set_content_type('text/javascript');break;}$template->set_attributes($this->get_assigned_variables());if(isset($layout)){$template->set_layout($layout);}$this->render_text($template->render());}function get_template_factory(){return new Flexi_TemplateFactory($this->dispatcher->trails_root.'/views/');}function get_assigned_variables(){$assigns=array();$protected=get_class_vars(get_class($this));foreach(get_object_vars($this)as$var=>$value){if(!array_key_exists($var,$protected)){$assigns[$var]=&$this->$var;}}$assigns['controller']=$this;return$assigns;}function set_layout($layout){$this->layout=$layout;}function url_for($to){$args=func_get_args();$args=array_map('urlencode',$args);$args[0]=$to;return$this->dispatcher->trails_uri.'/'.join('/',$args);}function set_status($status,$reason_phrase=NULL){$this->response->set_status($status,$reason_phrase);}function set_content_type($type){$this->response->add_header('Content-Type',$type);}function rescue($exception){return$this->dispatcher->trails_error($exception);}function respond_to($ext){return$this->format===$ext;}}class Trails_Inflector{static function camelize($word){$parts=explode('/',$word);foreach($parts as$key=>$part){$parts[$key]=str_replace(' ','',ucwords(str_replace('_',' ',$part)));}return join('_',$parts);}static function underscore($word){$parts=explode('_',$word);foreach($parts as$key=>$part){$parts[$key]=preg_replace('/(?<=\w)([A-Z])/','_\\1',$part);}return strtolower(join('/',$parts));}}class Trails_Flash implements ArrayAccess{public$flash=array(),$used=array();static function instance(){if(!isset($_SESSION)){throw new Trails_SessionRequiredException();}if(!isset($_SESSION['trails_flash'])){$_SESSION['trails_flash']=new Trails_Flash();}return$_SESSION['trails_flash'];}function offsetExists($offset){return isset($this->flash[$offset]);}function offsetGet($offset){return$this->get($offset);}function offsetSet($offset,$value){$this->set($offset,$value);}function offsetUnset($offset){unset($this->flash[$offset],$this->used[$offset]);}function _use($k=NULL,$v=TRUE){if($k){$this->used[$k]=$v;}else{foreach($this->used as$k=>$value){$this->_use($k,$v);}}}function discard($k=NULL){$this->_use($k);}function&get($k){$return=NULL;if(isset($this->flash[$k])){$return=&$this->flash[$k];}return$return;}function keep($k=NULL){$this->_use($k,FALSE);}function set($k,$v){$this->keep($k);$this->flash[$k]=$v;}function set_ref($k,&$v){$this->keep($k);$this->flash[$k]=&$v;}function sweep(){foreach(array_keys($this->flash)as$k){if($this->used[$k]){unset($this->flash[$k],$this->used[$k]);}else{$this->_use($k);}}$fkeys=array_keys($this->flash);$ukeys=array_keys($this->used);foreach(array_diff($fkeys,$ukeys)as$k=>$v){unset($this->used[$k]);}}function __toString(){$values=array();foreach($this->flash as$k=>$v){$values[]=sprintf("'%s': [%s, '%s']",$k,var_export($v,TRUE),$this->used[$k]?"used":"unused");}return"{".join(", ",$values)."}\n";}function __sleep(){$this->sweep();return array('flash','used');}function __wakeUp(){$this->discard();}}class Trails_Exception extends Exception{public$headers;function __construct($status=500,$reason=NULL,$headers=array()){if($reason===NULL){$reason=Trails_Response::get_reason($status);}parent::__construct($reason,$status);$this->headers=$headers;}function __toString(){return"{$this->code} {$this->message}";}}class Trails_DoubleRenderError extends Trails_Exception{function __construct(){$message="Render and/or redirect were called multiple times in this action. "."Please note that you may only call render OR redirect, and at most "."once per action.";parent::__construct(500,$message);}}class Trails_MissingFile extends Trails_Exception{function __construct($message){parent::__construct(500,$message);}}class Trails_RoutingError extends Trails_Exception{function __construct($message){parent::__construct(400,$message);}}class Trails_UnknownAction extends Trails_Exception{function __construct($message){parent::__construct(404,$message);}}class Trails_UnknownController extends Trails_Exception{function __construct($message){parent::__construct(404,$message);}}class Trails_SessionRequiredException extends Trails_Exception{function __construct(){$message="Tried to access a non existing session.";parent::__construct(500,$message);}} + +define('TRAILS_VERSION','0.6.9');class Trails_Dispatcher{public$trails_root;public$trails_uri;public$default_controller;function __construct($trails_root, $trails_uri, $default_controller){$this->trails_root=$trails_root;$this->trails_uri=$trails_uri;$this->default_controller=$default_controller;}function dispatch($uri){$old_handler=set_error_handler(array($this, 'error_handler'),5888);ob_start();$level=ob_get_level();$this->map_uri_to_response($this->clean_request_uri((string)$uri))->output();while(ob_get_level()>=$level){ob_end_flush();}if(isset($old_handler)){set_error_handler($old_handler);}}function map_uri_to_response($uri){try{[$controller_path, $unconsumed]=''===$uri?$this->default_route():$this->parse($uri);$controller=$this->load_controller($controller_path);$response=$controller->perform($unconsumed);}catch(Exception$e){$response=isset($controller)?$controller->rescue($e):$this->trails_error($e);}return$response;}function default_route(){if(!$this->file_exists($this->default_controller.'.php')){throw new Trails_MissingFile("Default controller '{$this->default_controller}' not found'");}return array($this->default_controller, '');}function trails_error($exception){ob_clean();$detailed=@$_SERVER['REMOTE_ADDR']==='127.0.0.1';$body=sprintf('<html><head><title>Trails Error</title></head>'.'<body><h1>%s</h1><pre>%s</pre></body></html>',htmlentities($exception->__toString()),$detailed?htmlentities($exception->getTraceAsString()):'');if($exception instanceof Trails_Exception){$response=new Trails_Response($body,$exception->headers,$exception->getCode(),$exception->getMessage());}else{$response=new Trails_Response($body,array(),500,$exception->getMessage());}return$response;}function clean_request_uri($uri){if(FALSE!==($pos=strpos($uri,'?'))){$uri=substr($uri,0,$pos);}return ltrim($uri,'/');}function parse($unconsumed, $controller=NULL){[$head, $tail]=$this->split_on_first_slash($unconsumed);if(!preg_match('/^\w+$/',$head)){throw new Trails_RoutingError("No route matches '$head'");}$controller=(isset($controller)?$controller.'/':'').$head;if($this->file_exists($controller.'.php')){return array($controller, $tail);}else if($this->file_exists($controller)){return$this->parse($tail,$controller);}throw new Trails_RoutingError("No route matches '$head'");}function split_on_first_slash($str){preg_match(":([^/]*)(/+)?(.*):",$str,$matches);return array($matches[1], $matches[3]);}function file_exists($path){return file_exists("{$this->trails_root}/controllers/$path");}function load_controller($controller){require_once"{$this->trails_root}/controllers/{$controller}.php";$class=Trails_Inflector::camelize($controller).'Controller';if(!class_exists($class)){throw new Trails_UnknownController("Controller missing: '$class'");}return new$class($this);}function error_handler($errno, $string, $file, $line, $context){if(!(5888&$errno))return false;throw new Trails_Exception(500,$string);}}class Trails_Response{public$body='',$status,$reason,$headers=array();function __construct($body='', $headers=array(), $status=NULL, $reason=NULL){$this->set_body($body);$this->headers=$headers;if(isset($status)){$this->set_status($status,$reason);}}function set_body($body){$this->body=$body;return$this;}function set_status($status, $reason=NULL){$this->status=$status;$this->reason=isset($reason)?$reason:$this->get_reason($status);return$this;}function get_reason($status){$reason=array(100 =>'Continue', 'Switching Protocols', 200 =>'OK', 'Created', 'Accepted', 'Non-Authoritative Information', 'No Content', 'Reset Content', 'Partial Content', 300 =>'Multiple Choices', 'Moved Permanently', 'Found', 'See Other', 'Not Modified', 'Use Proxy', '(Unused)', 'Temporary Redirect', 400 =>'Bad Request', 'Unauthorized', 'Payment Required', 'Forbidden', 'Not Found', 'Method Not Allowed', 'Not Acceptable', 'Proxy Authentication Required', 'Request Timeout', 'Conflict', 'Gone', 'Length Required', 'Precondition Failed', 'Request Entity Too Large', 'Request-URI Too Long', 'Unsupported Media Type', 'Requested Range Not Satisfiable', 'Expectation Failed', 500 =>'Internal Server Error', 'Not Implemented', 'Bad Gateway', 'Service Unavailable', 'Gateway Timeout', 'HTTP Version Not Supported');return isset($reason[$status])? $reason[$status]:'';}function add_header($key, $value){$this->headers[$key]=$value;return$this;}function output(){if(isset($this->status)){$this->send_header(sprintf('HTTP/1.1 %d %s',$this->status,$this->reason),TRUE,$this->status);}foreach($this->headers as $k=> $v){$this->send_header("$k: $v");}echo$this->body;}function send_header($header, $replace=FALSE, $status=NULL){if(isset($status)){header($header,$replace,$status);}else{header($header,$replace);}}}class Trails_Controller{protected$dispatcher,$response,$performed,$layout;function __construct($dispatcher){$this->dispatcher=$dispatcher;$this->erase_response();}function erase_response(){$this->performed=FALSE;$this->response=new Trails_Response();}function get_response(){return$this->response;}function perform($unconsumed){[$action, $args, $format]=$this->extract_action_and_args($unconsumed);$this->format=isset($format)?$format:'html';$before_filter_result=$this->before_filter($action,$args);if(!(FALSE===$before_filter_result||$this->performed)){$callable=$this->map_action($action);if(is_callable($callable)){call_user_func_array($callable,$args);}else{$this->does_not_understand($action,$args);}if(!$this->performed){$this->render_action($action);}$this->after_filter($action,$args);}return$this->response;}function extract_action_and_args($string){if(''===$string){return$this->default_action_and_args();}$format=NULL;if(preg_match('/^(.*[^\/.])\.(\w+)$/',$string,$matches)){[$_, $string, $format]=$matches;}$args=explode('/',$string);$action=array_shift($args);return array($action, $args, $format);}function default_action_and_args(){return array('index', array(), NULL);}function map_action($action){return array(&$this, $action.'_action');}function before_filter(&$action, &$args){}function after_filter($action, $args){}function does_not_understand($action, $args){throw new Trails_UnknownAction("No action responded to '$action'.");}function redirect($to){if($this->performed){throw new Trails_DoubleRenderError();}$this->performed=TRUE;$url=preg_match('#^(/|\w+://)#',$to)?$to:$this->url_for($to);$this->response->add_header('Location',$url)->set_status(302);}function render_text($text=' '){if($this->performed){throw new Trails_DoubleRenderError();}$this->performed=TRUE;$this->response->set_body($text);}function render_nothing(){$this->render_text('');}function render_action($action){$this->render_template($this->get_default_template($action),$this->layout);}function get_default_template($action){$class=get_class($this);$controller_name=Trails_Inflector::underscore(substr($class,0,-10));return$controller_name.'/'.$action;}function render_template($template_name, $layout=NULL){$factory=$this->get_template_factory();$template=$factory->open($template_name);$template->set_attributes($this->get_assigned_variables());if(isset($layout)){$template->set_layout($layout);}$this->render_text($template->render());}function get_template_factory(){return new Flexi\Factory($this->dispatcher->trails_root.'/views/');}function get_assigned_variables(){$assigns=array();$protected=get_class_vars(get_class($this));foreach(get_object_vars($this) as $var=> $value){if(!array_key_exists($var,$protected)){$assigns[$var]=&$this->$var;}}$assigns['controller']=$this;return$assigns;}function set_layout($layout){$this->layout=$layout;}function url_for($to){$args=func_get_args();$args=array_map('urlencode',$args);$args[0]=$to;return$this->dispatcher->trails_uri.'/'.join('/',$args);}function set_status($status, $reason_phrase=NULL){$this->response->set_status($status,$reason_phrase);}function set_content_type($type){$this->response->add_header('Content-Type',$type);}function rescue($exception){return$this->dispatcher->trails_error($exception);}function respond_to($ext){return$this->format===$ext;}}class Trails_Inflector{static function camelize($word){$parts=explode('/',$word);foreach($parts as $key=> $part){$parts[$key]=str_replace(' ','',ucwords(str_replace('_',' ',$part)));}return join('_',$parts);}static function underscore($word){$parts=explode('_',$word);foreach($parts as $key=> $part){$parts[$key]=preg_replace('/(?<=\w)([A-Z])/','_\\1',$part);}return strtolower(join('/',$parts));}}class Trails_Flash implements ArrayAccess{public$flash=array(),$used=array();static function instance(){if(!isset($_SESSION)){throw new Trails_SessionRequiredException();}if(!isset($_SESSION['trails_flash'])){$_SESSION['trails_flash']=new Trails_Flash();}return $_SESSION['trails_flash'];}function offsetExists($offset){return isset($this->flash[$offset]);}function offsetGet($offset){return$this->get($offset);}function offsetSet($offset, $value){$this->set($offset,$value);}function offsetUnset($offset){unset($this->flash[$offset], $this->used[$offset]);}function _use($k=NULL, $v=TRUE){if($k){$this->used[$k]=$v;}else{foreach($this->used as $k=> $value){$this->_use($k,$v);}}}function discard($k=NULL){$this->_use($k);}function&get($k){$return=NULL;if(isset($this->flash[$k])){$return=& $this->flash[$k];}return$return;}function keep($k=NULL){$this->_use($k,FALSE);}function set($k, $v){$this->keep($k);$this->flash[$k]=$v;}function set_ref($k, &$v){$this->keep($k);$this->flash[$k]=&$v;}function sweep(){foreach(array_keys($this->flash) as $k){if($this->used[$k]){unset($this->flash[$k], $this->used[$k]);}else{$this->_use($k);}}$fkeys=array_keys($this->flash);$ukeys=array_keys($this->used);foreach(array_diff($fkeys,$ukeys) as $k=> $v){unset($this->used[$k]);}}function __toString(){$values=array();foreach($this->flash as $k=> $v){$values[]=sprintf("'%s': [%s, '%s']",$k,var_export($v,TRUE), $this->used[$k]?"used":"unused");}return"{".join(", ",$values)."}\n";}function __sleep(){$this->sweep();return array('flash', 'used');}function __wakeUp(){$this->discard();}}class Trails_Exception extends Exception{public$headers;function __construct($status=500, $reason=NULL, $headers=array()){if($reason===NULL){$reason=Trails_Response::get_reason($status);}parent::__construct($reason,$status);$this->headers=$headers;}function __toString(){return"{$this->code} {$this->message}";}}class Trails_DoubleRenderError extends Trails_Exception{function __construct(){$message="Render and/or redirect were called multiple times in this action. "."Please note that you may only call render OR redirect, and at most "."once per action.";parent::__construct(500,$message);}}class Trails_MissingFile extends Trails_Exception{function __construct($message){parent::__construct(500,$message);}}class Trails_RoutingError extends Trails_Exception{function __construct($message){parent::__construct(400,$message);}}class Trails_UnknownAction extends Trails_Exception{function __construct($message){parent::__construct(404,$message);}}class Trails_UnknownController extends Trails_Exception{function __construct($message){parent::__construct(404,$message);}}class Trails_SessionRequiredException extends Trails_Exception{function __construct(){$message="Tried to access a non existing session.";parent::__construct(500,$message);}} diff --git a/vendor/trails/trails.php b/vendor/trails/trails.php index 96b9562da078d4256e64af0ef3a28bb22baaaac7..911765555570ed3fe3e7b3463c4414928a126b25 100644 --- a/vendor/trails/trails.php +++ b/vendor/trails/trails.php @@ -24,6 +24,7 @@ /** * The version of the trails library. */ + define('TRAILS_VERSION', '0.6.9'); @@ -749,13 +750,6 @@ class Trails_Controller { $factory = $this->get_template_factory(); $template = $factory->open($template_name); - # template requires setup ? - switch (get_class($template)) { - case 'Flexi_JsTemplate': - $this->set_content_type('text/javascript'); - break; - } - $template->set_attributes($this->get_assigned_variables()); if (isset($layout)) { @@ -769,10 +763,10 @@ class Trails_Controller { /** * Create and return a template factory for this controller. * - * @return a Flexi_TemplateFactory + * @return Flexi\Factory */ function get_template_factory() { - return new Flexi_TemplateFactory($this->dispatcher->trails_root . + return new Flexi\Factory($this->dispatcher->trails_root . '/views/'); }