Skip to content

Commit

Permalink
[WIP]RainTPL: upgrade to 3.1.0, install through Composer
Browse files Browse the repository at this point in the history
Relates to shaarli#613

Modifications:
- update `Rain\Tpl` initialization code:
  - autoload with Composer
  - update configuration
  - set 'auto_escape' to false
- [template] reference static resources relatively to the index page
- [template] linklist: move "link updated date" processing to PHP code

RainTPL 3.1 specificities:
- no complex variable processing in templates:
    - `{$var1=$var2}` works
    - `{$var1=$condition ? 'Value1' : 'Value2'}` does not
- static resources are now referenced relatively to the index page,
  not to the template file, e.g. '../inc/script.js' becomes 'inc/script.js'

WIP:
- check PHP compatibility
- check all pages work properly

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
  • Loading branch information
virtualtam committed Jan 7, 2017
1 parent 3ee5c69 commit 40e10ec
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 1,047 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- REST API: see [Shaarli API documentation](http://shaarli.github.io/api-documentation/)
- The theme can now be selected in the administration page.
- Upgrade [RainTPL](https://github.com/feulf/raintpl3) to 3.1, install via Composer
- Update HTML templates to work with RainTPL 3.1

### Removed
- Remove `inc/rain.tpl.class.php`

### Changed

Expand Down
4 changes: 3 additions & 1 deletion application/PageBuilder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
use Rain\Tpl;


/**
* This class is in charge of building the final page.
Expand Down Expand Up @@ -36,7 +38,7 @@ public function __construct(&$conf)
*/
private function initialize()
{
$this->tpl = new RainTPL();
$this->tpl = new Tpl();

try {
$version = ApplicationUtils::checkUpdate(
Expand Down
6 changes: 4 additions & 2 deletions application/Updater.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
use Rain\Tpl;


/**
* Class Updater.
Expand Down Expand Up @@ -303,8 +305,8 @@ public function updateMethodDefaultTheme()
$this->conf->set('resource.theme', trim(str_replace($parent, '', $tplDir), '/'));
$this->conf->write($this->isLoggedIn);

// Dependency injection gore
RainTPL::$tpl_dir = $tplDir;
// Live RainTPL configuration
Tpl::configure(array('tpl_dir' => $tplDir));

return true;
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"php": ">=5.5",
"shaarli/netscape-bookmark-parser": "1.*",
"erusev/parsedown": "1.6",
"rain/raintpl": "3.1.0",
"slim/slim": "^3.0",
"pubsubhubbub/publisher": "dev-master"
},
Expand Down
Loading

0 comments on commit 40e10ec

Please sign in to comment.