From f4792ba1a7785220fef5adb1cb3e7ce8ac40152f Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Thu, 2 Aug 2012 10:13:55 +0000 Subject: Creation d'un projet cake (exemple Blog du book) pour développer le CakePHPWeaver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2012-php-weave/trunk@6 d972a294-176a-4cf9-8ea1-fcd5b0c30f5c --- .../src/workdir/in/app/webroot/.htaccess | 6 + .../src/workdir/in/app/webroot/css.php | 102 +++++++++ .../workdir/in/app/webroot/css/cake.generic.css | 250 +++++++++++++++++++++ .../src/workdir/in/app/webroot/favicon.ico | Bin 0 -> 4973 bytes .../src/workdir/in/app/webroot/img/cake.power.png | Bin 0 -> 3053 bytes .../src/workdir/in/app/webroot/img/w3c_css.png | Bin 0 -> 299 bytes .../src/workdir/in/app/webroot/img/w3c_xhtml10.png | Bin 0 -> 321 bytes .../src/workdir/in/app/webroot/index.php | 87 +++++++ .../src/workdir/in/app/webroot/js/vendors.php | 44 ++++ 9 files changed, 489 insertions(+) create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/.htaccess create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/css.php create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/css/cake.generic.css create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/favicon.ico create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/cake.power.png create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_css.png create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_xhtml10.png create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/index.php create mode 100644 poc/poc02-compiling-cake/src/workdir/in/app/webroot/js/vendors.php (limited to 'poc/poc02-compiling-cake/src/workdir/in/app/webroot') diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/.htaccess b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/.htaccess new file mode 100644 index 0000000..f9d8b93 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/.htaccess @@ -0,0 +1,6 @@ + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] + \ No newline at end of file diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css.php b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css.php new file mode 100644 index 0000000..dc87218 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css.php @@ -0,0 +1,102 @@ + + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 6305 $ + * @modifiedby $LastChangedBy: phpnut $ + * @lastmodified $Date: 2008-01-01 21:33:56 -0500 (Tue, 01 Jan 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +if (!defined('CAKE_CORE_INCLUDE_PATH')) { + header('HTTP/1.1 404 Not Found'); + exit('File Not Found'); +} +/** + * Enter description here... + */ + uses('file'); +/** + * Enter description here... + * + * @param unknown_type $path + * @param unknown_type $name + * @return unknown + */ + function make_clean_css($path, $name) { + require(VENDORS . 'csspp' . DS . 'csspp.php'); + $data = file_get_contents($path); + $csspp = new csspp(); + $output = $csspp->compress($data); + $ratio = 100 - (round(strlen($output) / strlen($data), 3) * 100); + $output = " /* file: $name, ratio: $ratio% */ " . $output; + return $output; + } +/** + * Enter description here... + * + * @param unknown_type $path + * @param unknown_type $content + * @return unknown + */ + function write_css_cache($path, $content) { + if (!is_dir(dirname($path))) { + mkdir(dirname($path)); + } + $cache = new File($path); + return $cache->write($content); + } + + if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) { + die('Wrong file name.'); + } + + $filename = 'css/' . $regs[1]; + $filepath = CSS . $regs[1]; + $cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]); + + if (!file_exists($filepath)) { + die('Wrong file name.'); + } + + if (file_exists($cachepath)) { + $templateModified = filemtime($filepath); + $cacheModified = filemtime($cachepath); + + if ($templateModified > $cacheModified) { + $output = make_clean_css($filepath, $filename); + write_css_cache($cachepath, $output); + } else { + $output = file_get_contents($cachepath); + } + } else { + $output = make_clean_css($filepath, $filename); + write_css_cache($cachepath, $output); + $templateModified = time(); + } + + header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT'); + header("Content-Type: text/css"); + header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT"); + header("Cache-Control: cache"); // HTTP/1.1 + header("Pragma: cache"); // HTTP/1.0 + print $output; +?> \ No newline at end of file diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css/cake.generic.css b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css/cake.generic.css new file mode 100644 index 0000000..bc27d22 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/css/cake.generic.css @@ -0,0 +1,250 @@ +*{ +margin:0; +padding:0; +} + +body{ +font-family:"frutiger linotype","lucida grande",helvetica,arial,sans-serif; +text-align:center; +color:#333; +font-size: 76%; +} + +/* General Style Info */ +a{ +color:#003d4c; +text-decoration:underline; +} +a:hover{ +color:#003d4c; +text-decoration:none; +} + +a img{ +border:none; +} + +h1, h2, h3, h4{ +font-weight:normal; +} + +h1{ +color: #003d4c; +margin:0.3em 0; +font-size: 180%; +} + +h2{ +color:#c6c65b; +padding-top: 1em; +margin:0.3em 0; +font-size: 180%; +} + +h3{ +color:#c6c65b; +padding-top:2em; +font-size: 140%; +} + +h4{ +color:#c6c65b; +padding-top:0.5em; +font-weight:normal; +} + +em { +font-size: 12px; +} + +ul, li { +margin: 0 12px; +} + +/* Layout */ + +#container{ +text-align:left; +} + +#header{ +margin-top: 1em; +padding: 4px 20px; +} + +#content{ +clear:both; +padding: 0px 40px 10px 40px; +background-color: #fff; +color: #333; +} +#footer{ +clear:both; +padding: 6px 10px; +text-align: right; +} + +/* tables */ + +table { +width: 100%; +border-top: 1px solid #ccc; +border-left: 1px solid #ccc; +border-bottom: 1px solid #ccc; +color:#333; +background-color: #fff; +clear:both; +padding: 0; +margin: 0 0 2em 0; +white-space: normal; +} +th { +background-color: #e2e2e2; +border-top: 1px solid #fff; +border-left: 1px solid #fff; +border-right: 1px solid #003d4c; +border-bottom: 1px solid #003d4c; +text-align: center; +padding:1px 4px; +} +table tr td { +border-right: 1px solid #ddd; +padding:4px 4px; +vertical-align:top; +text-align: center; +} +table tr.altRow td { +background: #f4f4f4; +} +table td.actions { + white-space: nowrap; +} +#cakeSqlLog td { +text-align: left; +padding: 4px 8px; +background: #fff; +border-bottom: 2px solid #ccc; +} + +/* scaffold show */ + +div.related { +clear:both; +display:block; +} +dl { +line-height:2em; +margin:0em 1em; +float:left; +width: 400px; +} +dt { +font-weight: bold; +vertical-align:top; +} +dd { +margin-left:10em; +margin-top:-2em; +vertical-align:top; +} + +/* notices and errors */ + +#flashMessage, .error, .error_message { +color:#900; +font-size: 16px; +background-color: #fff; +margin: 8px 0px; +font-weight: bold; +} +.error_message { +clear: both; +} +.error em { +font-size: 18px; +color: #003d4c; +} +.notice { +color: #656565; +font-size: 14px; +background-color: #f4f4f4; +padding: 0.5em; +margin: 1em 0; +display:block; +} +.tip { +color: #656565; +background-color: #ddd; +} + +/* forms */ + +form { +margin-top: 2em; +} +form div{ +vertical-align: text-top; +margin-left: 1em; +margin-bottom:2em; +} +form div.date{ +margin-left: 0em; +} +label { +display: block; +width: 140px; +font-size: 14px; +padding-right: 20px; +} +input[type=checkbox] { +float: left; +clear: left; +margin: 2px 6px 7px 2px; +} +input, textarea { +clear: both; +display:block; +font-size: 14px; +font-family: inherit; +} +select { +clear: both; +vertical-align: text-bottom; +font-size: 14px; +font-family: inherit; +} +option { +font-size: 14px; +font-family: inherit; +padding: 0 0.3em; +} +input[type=submit] { +display: inline; +vertical-align: bottom; +} +div.required { +clear: both; +color:#222; +font-weight:bold; +} +div.optional { +clear: both; +color:#555; +} +div.submit { +clear: both; +margin-top: 40px; +margin-left: 140px; +} +/* action links */ +ul.actions { +float: left; +margin-left:20px; +width: 200px; +} +ul.actions li { +margin-top: 4px; +} +pre { +padding: 1em; +} \ No newline at end of file diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/favicon.ico b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/favicon.ico new file mode 100644 index 0000000..1bc32bd Binary files /dev/null and b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/favicon.ico differ diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/cake.power.png b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/cake.power.png new file mode 100644 index 0000000..699ef80 Binary files /dev/null and b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/cake.power.png differ diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_css.png b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_css.png new file mode 100644 index 0000000..706325e Binary files /dev/null and b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_css.png differ diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_xhtml10.png b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_xhtml10.png new file mode 100644 index 0000000..ec68644 Binary files /dev/null and b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/img/w3c_xhtml10.png differ diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/index.php b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/index.php new file mode 100644 index 0000000..48771ff --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/index.php @@ -0,0 +1,87 @@ + + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 6305 $ + * @modifiedby $LastChangedBy: phpnut $ + * @lastmodified $Date: 2008-01-01 21:33:56 -0500 (Tue, 01 Jan 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/** + * Do not change + */ + if (!defined('DS')) { + define('DS', DIRECTORY_SEPARATOR); + } +/** + * These defines should only be edited if you have cake installed in + * a directory layout other than the way it is distributed. + * Each define has a commented line of code that explains what you would change. + * + */ + if (!defined('ROOT')) { + //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; + //You should also use the DS define to seperate your directories + define('ROOT', dirname(dirname(dirname(__FILE__)))); + } + if (!defined('APP_DIR')) { + //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION'; + define('APP_DIR', basename(dirname(dirname(__FILE__)))); + } +/** + * This only needs to be changed if the cake installed libs are located + * outside of the distributed directory structure. + */ + if (!defined('CAKE_CORE_INCLUDE_PATH')) { + //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; + //You should also use the DS define to seperate your directories + define('CAKE_CORE_INCLUDE_PATH', ROOT); + } +/////////////////////////////// +//DO NOT EDIT BELOW THIS LINE// +/////////////////////////////// + if (!defined('WEBROOT_DIR')) { + define('WEBROOT_DIR', basename(dirname(__FILE__))); + } + if (!defined('WWW_ROOT')) { + define('WWW_ROOT', dirname(__FILE__) . DS); + } + if (!defined('CORE_PATH')) { + if (function_exists('ini_set')) { + ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); + define('APP_PATH', null); + define('CORE_PATH', null); + } else { + define('APP_PATH', ROOT . DS . APP_DIR . DS); + define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); + } + } + require CORE_PATH . 'cake' . DS . 'bootstrap.php'; + if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { + } else { + $Dispatcher = new Dispatcher(); + $Dispatcher->dispatch($url); + } + if (Configure::read() > 0) { + echo ""; + } +?> \ No newline at end of file diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/webroot/js/vendors.php b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/js/vendors.php new file mode 100644 index 0000000..cee6b77 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/webroot/js/vendors.php @@ -0,0 +1,44 @@ + + * Copyright 2005-2008, Cake Software Foundation, Inc. + * 1785 E. Sahara Avenue, Suite 490-204 + * Las Vegas, Nevada 89104 + * + * Licensed under The MIT License + * Redistributions of files must retain the above copyright notice. + * + * @filesource + * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. + * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project + * @package cake + * @subpackage cake.app.webroot.js + * @since CakePHP(tm) v 0.2.9 + * @version $Revision: 7691 $ + * @modifiedby $LastChangedBy: nate $ + * @lastmodified $Date: 2008-10-02 00:59:12 -0400 (Thu, 02 Oct 2008) $ + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + */ +/** + * Enter description here... + */ +if (isset($_GET['file'])) { + $file = $_GET['file']; + $pos = strpos($file, '..'); + if ($pos === false) { + if (is_file('../../vendors/javascript/'.$file) && (preg_match('/(\/.+)\\.js/', $file))) { + readfile('../../vendors/javascript/'.$file); + return; + } + } +} +header('HTTP/1.1 404 Not Found'); +?> \ No newline at end of file -- cgit v1.2.3