Testing smarty parser

This commit is contained in:
franck
2013-06-18 15:31:32 +02:00
parent 8daea97d3f
commit 797f0e2e38
41 changed files with 7 additions and 9922 deletions

View File

@@ -34,14 +34,14 @@ class Template extends Smarty
{ {
parent::__construct(); parent::__construct();
$compile_dir = THELIA_LOCAL_DIR . 'cache/smarty/compile'; $compile_dir = THELIA_ROOT . 'cache/smarty/compile';
if (! is_dir($compile_dir)) @mkdir($compile_dir, 0777, true); if (! is_dir($compile_dir)) @mkdir($compile_dir, 0777, true);
$cache_dir = THELIA_LOCAL_DIR . 'cache/smarty/cache'; $cache_dir = THELIA_ROOT . 'cache/smarty/cache';
if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true); if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true);
$web_root = THELIA_WEB_DIR; $web_root = THELIA_WEB_DIR;
$asset_dir_from_web_root = 'assets/admin/default'; $asset_dir_from_web_root = 'assets/admin/default'; // FIXME
$this->asset_manager = new AssetsManager($web_root, $asset_dir_from_web_root); $this->asset_manager = new AssetsManager($web_root, $asset_dir_from_web_root);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,135 +0,0 @@
// -- Tools --------------------------------------------------------------------
.border-radius(@radius: 5px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
.box-shadow(@shadow: 0 1px 2px rgba(0,0,0,.05)) {
-webkit-box-shadow: @shadow;
-moz-box-shadow: @shadow;
box-shadow: @shadow;
}
// -- Base styling ------------------------------------------------------------
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
background: url("img/bg.jpg") repeat;
font-size: 13px;
}
h3, h4 {
color: #5a6876;
background: -webkit-gradient(linear, left top, left bottom, from(#42505d), to(#72808e));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
h3 {
padding: 0px;
margin: 0px 0px 20px 0px;
text-align: left;
font-size : 18px;
}
h4 {
padding: 0px 0px 20px 0px;
margin: 0px;
text-align: left;
}
#wrapper {
padding-top: 20px;
}
a {
color: #e9720f;
font-weight: bold;
}
// -- Brandbar ----------------------------------------------------------------
/* --- BRAND BAR ---*/
.brandbar {
background: url("images/header.jpg") repeat-x;
height: 90px;
a.brand {
text-indent: -133337px;
display: block;
float: left;
margin-right: 20px;
background: url("images/logo.png") 0px 12px no-repeat;
width: 124px;
height: 63px;
}
.breadcrumb {
border-radius: 0px;
padding: 25px 0px 25px 30px;
background: url("images/logo-light.png") left center no-repeat;
float: left;
margin: 12px 0px 0px 0px;
a {
color: #949aa1;
text-shadow: 0px 1px 0px rgba(0,0,0,0.8);
}
.active {
color: #FFF;
text-shadow: 0px 1px 0px rgba(0,0,0,0.8);
border-bottom: 1px dotted white;
}
}
.Blocmoncompte {
float: right;
margin: 0px;
padding: 0px;
margin-top: 35px;
color: white;
font-size: 13px;
text-shadow: 0px 1px 0px rgba(0,0,0,0.8);
}
dt {
float: left;
margin-right: 15px;
}
.deconnexion {
float: right;
margin: 0px;
a {
text-indent: -13337px;
display: block;
background: url("images/deconnexion.png") no-repeat;
width: 23px;
height: 24px;
}
}
}
// -- Login form --------------------------------------------------------------
.form-signin {
max-width: 400px;
padding: 19px 29px 29px;
margin: 0 auto 20px;
background-color: #fff;
border: 1px solid #e5e5e5;
.border-radius;
.box-shadow;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,13 +0,0 @@
{* Include required JS files *}
{javascripts file='../assets/js/jquery.min.js'}
<link rel="stylesheet" href="{$asset_url}" target="screen">
{/javascripts}
{javascripts file='../assets/bootstrap/js/bootstrap.min.js'}
<link rel="stylesheet" href="{$asset_url}" target="screen">
{/javascripts}
{* TODO allow modules to include JS here *}
</body>
</html>

View File

@@ -1,24 +0,0 @@
<!DOCTYPE html>
<html lang="{$lang}">
<head>
<title>{intl l='Thelia Back Office'}{if ! empty($page_title)} - {$page_title}{/if}</title>
{images file='../assets/img/favicon.ico'}<link rel="shortcut icon" href="{$asset_url}" />{/images}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{stylesheets file='../assets/css/*' filters='less,cssrewrite'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
{stylesheets file='../assets/bootstrap/css/bootstrap.min.css' filters='cssrewrite'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
{stylesheets file='../assets/bootstrap/css/bootstrap-responsive.min.css' filters='cssrewrite'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
{* TODO allow modules to include CSS here *}
</head>
<body>

View File

@@ -1,35 +0,0 @@
{$page_title={intl l='Thelia'}}
{include file='includes/header.inc.tpl'}
<div class="loginpage">
<div class="brandbar container">
<a class="brand" href="index.php">{images file='assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}</a>
</div>
<div id="wrapper" class="container">
{thelia_module action='index_top'}
<div class="hero-unit">
<h1>{intl l='Thelia Back Office'}</h1>
<form action="/admin/login" method="post" class="well form-inline">
<input type="text" class="input" placeholder="{intl l='E-mail address'}" name="username" />
<input type="password" class="input" placeholder="{intl l='Password'}" name="password" />
<label class="checkbox"> <input type="checkbox" name="remember" value="yes"> {intl l='Remember me'}</label>
<button type="submit" class="btn btn-primary">{intl l='Login'} <i class="icon-play"></i></button>
</form>
</div>
<div class="row-fluid">
</div>
</div>
{thelia_module action='index_bottom'}
</div>
{include file='includes/footer.inc.tpl'}

View File

@@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -28,8 +28,11 @@
<service id="controller_resolver" class="Symfony\Component\HttpKernel\Controller\ControllerResolver"/> <service id="controller_resolver" class="Symfony\Component\HttpKernel\Controller\ControllerResolver"/>
<service id="parser" class="Thelia\Core\Template\Parser"> <service id="parser" class="Thelia\Core\Template\SmartyParser">
<argument type="service" id="service_container"/> <argument type="service" id="service_container"/>
<call method="setLoopList">
<argument>%tpex.loop%</argument>
</call>
</service> </service>
<service id="http_kernel" class="Thelia\Core\TheliaHttpKernel"> <service id="http_kernel" class="Thelia\Core\TheliaHttpKernel">

View File

@@ -1,124 +0,0 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Template\Assets;
use Assetic\AssetManager;
use Assetic\FilterManager;
use Assetic\Filter;
use Assetic\Factory\AssetFactory;
use Assetic\Factory\Worker\CacheBustingWorker;
use Assetic\AssetWriter;
use Assetic\Asset\AssetCache;
use Assetic\Cache\FilesystemCache;
class AsseticManager {
protected $options;
public function __construct($_options = array()) {
$this->options = $_options;
}
/**
* Generates assets from $asset_path in $output_path, using $filters.
*
* @param string $asset_path the full path to the asset file (or file collection)
* @param unknown $output_path the full disk path to the output directory (shoud be visible to web server)
* @param unknown $output_url the URL to the generated asset directory
* @param unknown $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
* @param unknown $filters a list of filters, as defined below (see switch($filter_name) ...)
* @param unknown $debug true / false
* @throws \Exception
* @return string The URL to the generated asset file.
*/
public function asseticize($asset_path, $output_path, $output_url, $asset_type, $filters, $debug) {
$asset_name = basename($asset_path);
$asset_dir = dirname($asset_path);
$am = new AssetManager();
$fm = new FilterManager();
if (! empty($filters)) {
$filter_list = explode(',', $filters);
foreach($filter_list as $filter_name) {
$filter_name = trim($filter_name);
switch($filter_name) {
case 'less' :
$fm->set('less', new Filter\LessphpFilter());
break;
case 'sass' :
$fm->set('less', new Filter\Sass\SassFilter());
break;
case 'cssembed' :
$fm->set('cssembed', new Filter\PhpCssEmbedFilter());
break;
case 'cssrewrite':
$fm->set('cssrewrite', new Filter\CssRewriteFilter());
break;
case 'cssimport':
$fm->set('cssimport', new Filter\CssImportFilter());
break;
default :
throw new \Exception("Unsupported Assetic filter: '$filter_name'");
break;
}
}
}
else {
$filter_list = array();
}
// Factory setup
$factory = new AssetFactory($asset_dir);
$factory->setAssetManager($am);
$factory->setFilterManager($fm);
$factory->setDefaultOutput('*'.(! empty($asset_type) ? '.' : '').$asset_type);
$factory->setDebug($debug);
$factory->addWorker(new CacheBustingWorker());
// Prepare the assets writer
$writer = new AssetWriter($output_path);
$asset = $factory->createAsset($asset_name, $filter_list);
$cache = new AssetCache($asset, new FilesystemCache($output_path));
$writer->writeAsset($cache);
return rtrim($output_url, '/').'/'.$asset->getTargetPath();
}
}