├── CHANGELOG.txt ├── INSTALL.txt ├── LICENSE.txt ├── README.md ├── app ├── .htaccess.example ├── global │ └── css │ │ └── demo.css ├── index.php ├── protected │ ├── config │ │ ├── common.conf.php │ │ ├── db.conf.php │ │ ├── forms │ │ │ └── register_example_rule.php │ │ └── routes.conf.php │ ├── controller │ │ ├── ErrorController.php │ │ └── MainController.php │ ├── module │ │ └── example │ │ │ └── plugin │ │ │ └── TemplateTag.php │ └── plugin │ │ └── TemplateTag.php └── tools │ ├── AC_OETags.js │ ├── DooDebugger.swf │ ├── DooSitemap.swf │ ├── logviewer.html │ ├── playerProductInstall.swf │ └── sitemap.html ├── demos ├── acl │ ├── .htaccess.example │ ├── global │ │ └── css │ │ │ └── screen.css │ ├── index.php │ ├── protected │ │ ├── config │ │ │ ├── acl.conf.php │ │ │ ├── common.conf.php │ │ │ ├── db.conf.php │ │ │ └── routes.conf.php │ │ ├── controller │ │ │ ├── BlogController.php │ │ │ ├── ErrorController.php │ │ │ ├── MainController.php │ │ │ ├── PageController.php │ │ │ └── SnsController.php │ │ ├── model │ │ │ └── User.php │ │ ├── plugin │ │ │ └── TemplateTag.php │ │ ├── view │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── links.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ └── viewc │ │ │ ├── about.php │ │ │ ├── example.php │ │ │ ├── header.php │ │ │ ├── nav.php │ │ │ └── template.php │ └── user.sql ├── blog │ ├── .htaccess │ ├── blog.mwb │ ├── blog.sql │ ├── global │ │ ├── css │ │ │ ├── demo.css │ │ │ └── style.css │ │ └── img │ │ │ ├── bottom.jpg │ │ │ ├── content.jpg │ │ │ ├── menu.jpg │ │ │ ├── pic.jpg │ │ │ └── top.jpg │ ├── index.php │ └── protected │ │ ├── config │ │ ├── common.conf.php │ │ ├── db.conf.php │ │ ├── forms │ │ │ ├── post_create.rules.php │ │ │ └── post_edit.rules.php │ │ └── routes.conf.php │ │ ├── controller │ │ ├── AdminController.php │ │ ├── BlogController.php │ │ ├── ErrorController.php │ │ └── MainController.php │ │ ├── model │ │ ├── Comment.php │ │ ├── Post.php │ │ ├── PostTag.php │ │ └── Tag.php │ │ ├── plugin │ │ └── TemplateTag.php │ │ ├── view │ │ ├── admin.html │ │ ├── admin_comments.html │ │ ├── admin_edit_post.html │ │ ├── admin_msg.html │ │ ├── admin_new_post.html │ │ ├── admin_sidebar.html │ │ ├── blog_sidebar.html │ │ ├── blog_single.html │ │ ├── comment.html │ │ ├── error.html │ │ ├── index.html │ │ └── top.html │ │ └── viewc │ │ ├── admin.php │ │ ├── admin_comments.php │ │ ├── admin_edit_post.php │ │ ├── admin_msg.php │ │ ├── admin_new_post.php │ │ ├── admin_sidebar.php │ │ ├── blog_sidebar.php │ │ ├── blog_single.php │ │ ├── comment.php │ │ ├── error.php │ │ ├── index.php │ │ ├── status.php │ │ └── top.php ├── database │ ├── .htaccess.example │ ├── food.mwb │ ├── foodexample.sql │ ├── global │ │ ├── css │ │ │ └── screen.css │ │ ├── img │ │ │ └── food.png │ │ └── js │ │ │ ├── common.js │ │ │ └── jquery.1.3.2.js │ ├── index.php │ └── protected │ │ ├── config │ │ ├── common.conf.php │ │ ├── db.conf.php │ │ └── routes.conf.php │ │ ├── controller │ │ ├── DbController.php │ │ ├── ErrorController.php │ │ └── MainController.php │ │ ├── model │ │ ├── Article.php │ │ ├── Food.php │ │ ├── FoodType.php │ │ ├── Ingredient.php │ │ └── Recipe.php │ │ ├── plugin │ │ └── TemplateTag.php │ │ ├── view │ │ ├── about.html │ │ ├── example.html │ │ ├── header.html │ │ ├── links.html │ │ ├── nav.html │ │ └── template.html │ │ └── viewc │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php ├── i18n │ ├── .htaccess.example │ ├── global │ │ ├── css │ │ │ └── screen.css │ │ └── js │ │ │ ├── common.js │ │ │ └── jquery.1.3.2.js │ ├── index.php │ └── protected │ │ ├── config │ │ ├── common.conf.php │ │ ├── db.conf.php │ │ └── routes.conf.php │ │ ├── controller │ │ ├── ErrorController.php │ │ ├── I18nController.php │ │ └── MainController.php │ │ ├── plugin │ │ ├── TemplateTag.php │ │ └── lang │ │ │ ├── de.lang.php │ │ │ ├── de.lang2.php │ │ │ ├── pt.lang.php │ │ │ ├── pt.lang2.php │ │ │ ├── zh.lang.php │ │ │ └── zh.lang2.php │ │ ├── view │ │ ├── de │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ ├── en │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ ├── pt │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ └── zh │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ └── viewc │ │ ├── de │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php │ │ ├── en │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php │ │ ├── pt │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php │ │ └── zh │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php ├── rest_client_server │ ├── .htaccess.example │ ├── global │ │ ├── css │ │ │ └── screen.css │ │ └── js │ │ │ ├── common.js │ │ │ └── jquery.1.3.2.js │ ├── index.php │ ├── protected │ │ ├── config │ │ │ ├── common.conf.php │ │ │ └── routes.conf.php │ │ ├── controller │ │ │ ├── ErrorController.php │ │ │ ├── MainController.php │ │ │ ├── RestClientController.php │ │ │ └── RestServerController.php │ │ ├── plugin │ │ │ └── TemplateTag.php │ │ ├── view │ │ │ ├── about.html │ │ │ ├── example.html │ │ │ ├── header.html │ │ │ ├── links.html │ │ │ ├── nav.html │ │ │ └── template.html │ │ └── viewc │ │ │ ├── about.php │ │ │ ├── example.php │ │ │ ├── header.php │ │ │ ├── nav.php │ │ │ └── template.php │ └── template.html ├── template_engine │ ├── .htaccess.example │ ├── global │ │ ├── css │ │ │ └── screen.css │ │ └── js │ │ │ ├── common.js │ │ │ └── jquery.1.3.2.js │ ├── index.php │ └── protected │ │ ├── cache │ │ └── frontend │ │ │ └── parts │ │ │ └── messages.html │ │ ├── config │ │ ├── common.conf.php │ │ └── routes.conf.php │ │ ├── controller │ │ ├── ErrorController.php │ │ └── MainController.php │ │ ├── model │ │ ├── Blog.php │ │ ├── Physical.php │ │ ├── Tag.php │ │ └── Winner.php │ │ ├── plugin │ │ └── TemplateTag.php │ │ ├── view │ │ ├── about.html │ │ ├── example.html │ │ ├── header.html │ │ ├── links.html │ │ ├── nav.html │ │ ├── nested │ │ │ └── hi.html │ │ ├── template.html │ │ └── variable_include.html │ │ └── viewc │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ ├── nested │ │ └── hi.php │ │ ├── template.php │ │ └── variable_include.php └── uri_routing │ ├── .htaccess.example │ ├── global │ ├── css │ │ └── screen.css │ └── js │ │ ├── common.js │ │ └── jquery.1.3.2.js │ ├── index.php │ ├── protected │ ├── config │ │ ├── common.conf.php │ │ └── routes.conf.php │ ├── controller │ │ ├── CamelCaseController.php │ │ ├── ErrorController.php │ │ ├── HelloController.php │ │ ├── MainController.php │ │ ├── NewsController.php │ │ ├── RestController.php │ │ ├── SimpleController.php │ │ └── admin │ │ │ └── AdminController.php │ ├── plugin │ │ └── TemplateTag.php │ ├── view │ │ ├── about.html │ │ ├── example.html │ │ ├── header.html │ │ ├── links.html │ │ ├── nav.html │ │ └── template.html │ └── viewc │ │ ├── about.php │ │ ├── example.php │ │ ├── header.php │ │ ├── nav.php │ │ └── template.php │ └── template.html └── dooframework ├── Doo.php ├── app ├── DooCliApp.php ├── DooConfig.php ├── DooSiteMagic.php └── DooWebApp.php ├── auth ├── DooAcl.php ├── DooAuth.php ├── DooDigestAuth.php └── DooRbAcl.php ├── cache ├── DooApcCache.php ├── DooEAcceleratorCache.php ├── DooFileCache.php ├── DooFrontCache.php ├── DooMemCache.php ├── DooPhpCache.php └── DooXCache.php ├── controller ├── DooCliController.php └── DooController.php ├── db ├── DooDbExpression.php ├── DooMasterSlave.php ├── DooModel.php ├── DooModelGen.php ├── DooSmartModel.php ├── DooSqlMagic.php └── manage │ ├── DooDbUpdater.php │ ├── DooManageDb.php │ └── adapters │ ├── DooManageMySqlDb.php │ ├── DooManagePgSqlDb.php │ └── DooManageSqliteDb.php ├── deployment └── deploy.php ├── diagnostic ├── assets │ ├── bg-down.png │ ├── bg-footer.gif │ ├── bgcode.png │ └── logo-b2.png └── debug.php ├── helper ├── DooBenchmark.php ├── DooFile.php ├── DooFlashMessenger.php ├── DooForm.php ├── DooGdImage.php ├── DooMailer.php ├── DooPager.php ├── DooRestClient.php ├── DooTextHelper.php ├── DooTimezone.php ├── DooUrlBuilder.php └── DooValidator.php ├── logging └── DooLog.php ├── session ├── DooCacheSession.php └── DooSession.php ├── translate └── DooTranslator.php ├── uri ├── DooLoader.php └── DooUriRouter.php └── view ├── DooView.php └── DooViewBasic.php /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | DooPHP Framework Change Log 2 | =========================== 3 | 4 | Version 1.4.1 February 22, 2011 5 | --------------------------- 6 | - Chg: Improved DooMailer to support alternative content types ie. Plain Text + HTML in the same Email support for file attachments along with your emails content http://code.google.com/p/doophp/source/detail?r=606 7 | - New: Added option for routes: autoroute_force_dash http://code.google.com/p/doophp/source/detail?r=605 8 | - Bug: fixed loading wrong file when using internal reroute: return 404 or return array('/xxx', 'internal') in a module http://code.google.com/p/doophp/source/detail?r=603 9 | -------------------------------------------------------------------------------- /INSTALL.txt: -------------------------------------------------------------------------------- 1 | DOOPHP Web Framework 2 | ============================= 3 | 4 | Thank you for using DooPHP - a high performance MVC based PHP framework. 5 | 6 | 7 | INSTALLATION 8 | ------------ 9 | 10 | Please make sure the release file is unpacked under a Web-accessible 11 | directory. You have to put it under the root directory for the app & demos to work. 12 | 13 | You shall see the following files and directories: 14 | 15 | demos/ demos 16 | dooframework/ framework source files 17 | app/ base of a project 18 | LICENSE.txt license of DooPHP 19 | README.txt this file 20 | CHANGELOG.txt changes made in this version 21 | 22 | 23 | If you placed it elsewhere, please change the app or demos configurations in protected/config/common.conf.php 24 | 25 | $config['SITE_PATH'] = 'C:/wamp/www/myfolderapp/'; 26 | $config['BASE_PATH'] = 'C:/wamp/www/dooframework/'; 27 | 28 | 29 | If your app is in a sub directory, please change the following setting: 30 | 31 | $config['SUBFOLDER'] = '/myfolderapp/'; 32 | 33 | *This example can be accessed at http://localhost/myfolderapp/ 34 | 35 | More details on installation can be found at http://www.doophp.com/doc/guide/start/install 36 | 37 | REQUIREMENTS 38 | ------------ 39 | 40 | The minimum requirement by DooPHP is that your Web server supports 41 | PHP 5.1.x or above. DooPHP has been tested with Apache 2 and Cherokee Web Server 42 | on Windows and Linux operating systems. 43 | 44 | To use the database ORM you have to enable PDO extension. 45 | 46 | 47 | QUICK START 48 | ----------- 49 | 50 | DooPHP comes with a directory call 'app'. It is the basic of a DooPHP application. 51 | Change the Site path and project path configurations in /protected/config/common.conf.php 52 | 53 | The default configuration is for development purpose. 54 | 55 | 56 | WHAT's NEXT 57 | ----------- 58 | 59 | Please visit the project website for tutorials, class reference 60 | and join discussions with other DooPHP users. 61 | 62 | 63 | 64 | DooPHP 65 | http://www.doophp.com 66 | http://www.doophp.com/blog 67 | http://www.doophp.com/forum 68 | http://www.twitter.com/doophp 69 | 70 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Leng Sheng Hong (leng@doophp.com) 2 | All rights reserved. 3 | 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | 18 | * Neither the name of Leng Sheng Hong. nor the names of its 19 | contributors may be used to endorse or promote products derived from this 20 | software without specific prior written permission. 21 | 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 27 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 30 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #DooPHP 2 | 3 | ##Introduction 4 | * [Website](http://doophp.com/) 5 | * [Documentation](http://doophp.com/doc) 6 | * [Benchmark](http://doophp.com/benchmark) 7 | * [Google Code](http://code.google.com/p/doophp/) 8 | * [Twitter](http://twitter.com/doophp) 9 | * Version: 1.4.1 10 | 11 | DooPHP framework is one of the fastest, if not the fastest PHP framework available. It enables developers at all levels to rapidly develop robust web 2.0 applications. 12 | 13 | The framework is around 3-12 times faster than other frameworks, DooPHP is higly capable of delivering incomparably fast page loads. Besides being fast, Doophp is also quite feature rich. DooPHP supports some common stuffs found in a web framework, such as MVC structured, RESTful API, REST client, URI routing, database ORM tools, model generator, HTTP Digest Authentication, a flexible template engine, logging & profiling tools, etc. 14 | 15 | 16 | ##DooPHP's belief 17 | 18 | DooPHP believes in doing things as simple as possible. It is a framework for KISS lovers. 19 | 20 | Confucius(孔子) once said, 21 | "Life is really simple, but we insist on making it complicated." 22 | 23 | Leonardo da Vinci once said, 24 | "Simplicity is the ultimate sophistication." 25 | 26 | Albert Einstein once said, 27 | "Everything should be made as simple as possible, but not simpler." 28 | 29 | 30 | So why do things the hard way? 31 | 32 | Read more at [http://www.doophp.com](http://www.doophp.com) -------------------------------------------------------------------------------- /app/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /app/global/css/demo.css: -------------------------------------------------------------------------------- 1 | .paginate, .current, .inactivePrev, .inactiveNext, .prev, .next { 2 | font-family: Verdana,Helvetica,Arial,sans-serif; 3 | font-size:12px; 4 | border:1px solid #D8D8D8; 5 | float:left; 6 | height:20px; 7 | line-height:20px; 8 | margin-right:2px; 9 | overflow:hidden; 10 | padding:0 6px; 11 | text-decoration:none; 12 | } 13 | a:hover .paginate{ 14 | border-color:#006699; 15 | } 16 | 17 | .current { 18 | border-color:#006699; 19 | background-color:#006699; 20 | color:#fff; 21 | font-weight:bold; 22 | } 23 | .inactivePrev, .inactiveNext{ 24 | color:#999; 25 | } -------------------------------------------------------------------------------- /app/index.php: -------------------------------------------------------------------------------- 1 | set($config); 15 | 16 | # remove this if you wish to see the normal PHP error view. 17 | include $config['BASE_PATH'].'diagnostic/debug.php'; 18 | 19 | # database usage 20 | //Doo::useDbReplicate(); #for db replication master-slave usage 21 | //Doo::db()->setMap($dbmap); 22 | //Doo::db()->setDb($dbconfig, $config['APP_MODE']); 23 | //Doo::db()->sql_tracking = true; #for debugging/profiling purpose 24 | 25 | Doo::app()->route = $route; 26 | 27 | # Uncomment for DB profiling 28 | //Doo::logger()->beginDbProfile('doowebsite'); 29 | Doo::app()->run(); 30 | //Doo::logger()->endDbProfile('doowebsite'); 31 | //Doo::logger()->rotateFile(20); 32 | //Doo::logger()->writeDbProfiles(); 33 | ?> -------------------------------------------------------------------------------- /app/protected/config/db.conf.php: -------------------------------------------------------------------------------- 1 | Table B's column that links to Table A ); 5 | * $dbmap[Table B]['belongs_to'][Table A] = array('foreign_key'=> Table A's column where Table B links to ); 6 | 7 | 8 | //Food relationship 9 | $dbmap['Food']['belongs_to']['FoodType'] = array('foreign_key'=>'id'); 10 | $dbmap['Food']['has_many']['Article'] = array('foreign_key'=>'food_id'); 11 | $dbmap['Food']['has_one']['Recipe'] = array('foreign_key'=>'food_id'); 12 | $dbmap['Food']['has_many']['Ingredient'] = array('foreign_key'=>'food_id', 'through'=>'food_has_ingredient'); 13 | 14 | //Food Type 15 | $dbmap['FoodType']['has_many']['Food'] = array('foreign_key'=>'food_type_id'); 16 | 17 | //Article 18 | $dbmap['Article']['belongs_to']['Food'] = array('foreign_key'=>'id'); 19 | 20 | //Recipe 21 | $dbmap['Recipe']['belongs_to']['Food'] = array('foreign_key'=>'id'); 22 | 23 | //Ingredient 24 | $dbmap['Ingredient']['has_many']['Food'] = array('foreign_key'=>'ingredient_id', 'through'=>'food_has_ingredient'); 25 | 26 | */ 27 | 28 | //$dbconfig[ Environment or connection name] = array(Host, Database, User, Password, DB Driver, Make Persistent Connection?); 29 | /** 30 | * Database settings are case sensitive. 31 | * To set collation and charset of the db connection, use the key 'collate' and 'charset' 32 | * array('localhost', 'database', 'root', '1234', 'mysql', true, 'collate'=>'utf8_unicode_ci', 'charset'=>'utf8'); 33 | */ 34 | 35 | /* $dbconfig['dev'] = array('localhost', 'database', 'root', '1234', 'mysql', true); 36 | * $dbconfig['prod'] = array('localhost', 'database', 'root', '1234', 'mysql', true); 37 | */ 38 | ?> -------------------------------------------------------------------------------- /app/protected/config/forms/register_example_rule.php: -------------------------------------------------------------------------------- 1 | array( 5 | array('username',4,5,'username invalid'), 6 | array('maxlength',6,'This is too long'), 7 | array('minlength',6) 8 | ), 9 | 'pwd'=>array('password',3,5), 10 | 'email'=>array('email') 11 | ); 12 | 13 | ?> -------------------------------------------------------------------------------- /app/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | ERROR 404 not found'; 12 | echo '

This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']

13 | 14 |

Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.

15 | 16 |

Give some helpful comments other than 404 :( 17 | Also check out the links page for a list of URLs available in this demo.

'; 18 | } 19 | 20 | 21 | } 22 | ?> -------------------------------------------------------------------------------- /app/protected/controller/MainController.php: -------------------------------------------------------------------------------- 1 | params['filename']); 24 | } 25 | 26 | public function gen_sitemap_controller(){ 27 | //This will replace the routes.conf.php file 28 | Doo::loadCore('app/DooSiteMagic'); 29 | DooSiteMagic::buildSitemap(true); 30 | DooSiteMagic::buildSite(); 31 | } 32 | 33 | public function gen_sitemap(){ 34 | //This will write a new file, routes2.conf.php file 35 | Doo::loadCore('app/DooSiteMagic'); 36 | DooSiteMagic::buildSitemap(); 37 | } 38 | 39 | public function gen_site(){ 40 | Doo::loadCore('app/DooSiteMagic'); 41 | DooSiteMagic::buildSite(); 42 | } 43 | 44 | public function gen_model(){ 45 | Doo::loadCore('db/DooModelGen'); 46 | DooModelGen::genMySQL(); 47 | } 48 | 49 | } 50 | ?> -------------------------------------------------------------------------------- /app/protected/module/example/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | Tag 6 | * Every public static method in this class can be used in the templates 7 | */ 8 | class ExampleTag { 9 | public static function test(){ 10 | return 'Module tag class'; 11 | } 12 | } 13 | 14 | ?> -------------------------------------------------------------------------------- /app/tools/DooDebugger.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/app/tools/DooDebugger.swf -------------------------------------------------------------------------------- /app/tools/DooSitemap.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/app/tools/DooSitemap.swf -------------------------------------------------------------------------------- /app/tools/playerProductInstall.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/app/tools/playerProductInstall.swf -------------------------------------------------------------------------------- /demos/acl/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/acl/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/acl/index.php: -------------------------------------------------------------------------------- 1 | set($config); 13 | include $config['BASE_PATH'].'diagnostic/debug.php'; 14 | 15 | Doo::acl()->rules = $acl; 16 | Doo::acl()->defaultFailedRoute = '/error'; 17 | 18 | Doo::db()->setDb($dbconfig, $config['APP_MODE']); 19 | //Doo::db()->sql_tracking = true; 20 | 21 | Doo::app()->route = $route; 22 | 23 | Doo::app()->run(); 24 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/config/acl.conf.php: -------------------------------------------------------------------------------- 1 | array('index') 6 | ); 7 | 8 | $acl['vip']['allow'] = 9 | $acl['member']['allow'] = array( 10 | 'SnsController'=>'*', 11 | 'BlogController'=>'*', 12 | ); 13 | 14 | $acl['member']['deny'] = array( 15 | 'SnsController'=>array('banUser', 'showVipHome'), 16 | 'BlogController' =>array('deleteComment', 'writePost') 17 | ); 18 | 19 | $acl['vip']['deny'] = array( 20 | 'SnsController'=>array('banUser'), 21 | 'BlogController' =>array('deleteComment', 'writePost') 22 | ); 23 | 24 | $acl['admin']['allow'] = '*'; 25 | $acl['admin']['deny'] = array( 26 | 'SnsController'=>array('showVipHome') 27 | ); 28 | 29 | 30 | $acl['member']['failRoute'] = array( 31 | '_default'=>'/error/member', //if not found this will be used 32 | 'SnsController/banUser'=>'/error/member/sns/notAdmin', 33 | 'SnsController/showVipHome'=>'/error/member/sns/notVip', 34 | 'BlogController'=>'/error/member/blog/notAdmin' 35 | ); 36 | 37 | $acl['vip']['failRoute'] = array( 38 | '_default'=>'/error/vip', //if not found this will be used 39 | 'SnsController/banUser'=>'/error/member/sns/notAdmin', 40 | 'BlogController'=>'/error/member/blog/notAdmin' 41 | ); 42 | 43 | $acl['admin']['failRoute'] = array( 44 | 'SnsController/showVipHome'=>'/error/admin/sns/vipOnly' 45 | ); 46 | 47 | $acl['anonymous']['failRoute'] = array( 48 | '_default'=>'/error/loginfirst', 49 | ); 50 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/config/db.conf.php: -------------------------------------------------------------------------------- 1 | Table B's column that links to Table A ); 5 | * $dbmap[Table B]['belongs_to'][Table A] = array('foreign_key'=> Table A's column where Table B links to ); 6 | 7 | 8 | //Food relationship 9 | $dbmap['Food']['belongs_to']['FoodType'] = array('foreign_key'=>'id'); 10 | $dbmap['Food']['has_many']['Article'] = array('foreign_key'=>'food_id'); 11 | $dbmap['Food']['has_one']['Recipe'] = array('foreign_key'=>'food_id'); 12 | $dbmap['Food']['has_many']['Ingredient'] = array('foreign_key'=>'food_id', 'through'=>'food_has_ingredient'); 13 | 14 | //Food Type 15 | $dbmap['FoodType']['has_many']['Food'] = array('foreign_key'=>'food_type_id'); 16 | 17 | //Article 18 | $dbmap['Article']['belongs_to']['Food'] = array('foreign_key'=>'id'); 19 | 20 | //Recipe 21 | $dbmap['Recipe']['belongs_to']['Food'] = array('foreign_key'=>'id'); 22 | 23 | //Ingredient 24 | $dbmap['Ingredient']['has_many']['Food'] = array('foreign_key'=>'ingredient_id', 'through'=>'food_has_ingredient'); 25 | 26 | */ 27 | 28 | //$dbconfig[ Environment or connection name] = array(Host, Database, User, Password, DB Driver, Make Persistent Connection?); 29 | /* $dbconfig['dev'] = array('localhost', 'database', 'root', '1234', 'mysql',true); 30 | * $dbconfig['prod'] = array('localhost', 'database', 'root', '1234', 'mysql',true); 31 | */ 32 | $dbconfig['dev'] = array('localhost', 'acldemo', 'root', '1234', 'mysql',true); 33 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/config/routes.conf.php: -------------------------------------------------------------------------------- 1 | 'HomeController'); 17 | */ 18 | 19 | $route['*']['/'] = $route['*']['/about'] = array('MainController', 'index'); 20 | $route['*']['/url'] = array('MainController', 'url'); 21 | $route['*']['/example'] = array('MainController', 'example'); 22 | 23 | $route['post']['/login'] = array('MainController', 'login'); 24 | $route['*']['/logout'] = array('MainController', 'logout'); 25 | 26 | //Common pages 27 | $route['*']['/sns'] = array('PageController', 'home'); 28 | $route['*']['/sns/about'] = array('PageController', 'about'); 29 | $route['*']['/sns/contact'] = array('PageController', 'contact'); 30 | 31 | //Blog 32 | $route['*']['/sns/blog'] = array('BlogController', 'index'); 33 | $route['*']['/sns/blog/comments'] = array('BlogController', 'comments'); 34 | $route['*']['/sns/blog/comments/delete'] = array('BlogController', 'deleteComment'); 35 | $route['*']['/sns/blog/write'] = array('BlogController', 'writePost'); 36 | 37 | //Sns 38 | $route['*']['/sns/games'] = array('SnsController', 'game'); 39 | $route['*']['/sns/people/:uname'] = array('SnsController', 'viewProfile'); 40 | $route['*']['/sns/ban'] = array('SnsController', 'banUser'); 41 | 42 | //Vip 43 | $route['*']['/sns/vip/lounge'] = array('SnsController', 'showVipHome'); 44 | 45 | //Error 46 | $route['*']['/error/member'] = array('ErrorController', 'memberDefaultError'); 47 | $route['*']['/error/member/sns/:error'] = array('ErrorController', 'memberSnsDeny'); 48 | $route['*']['/error/member/blog/:error'] = array('ErrorController', 'memberBlogDeny'); 49 | 50 | $route['*']['/error/vip'] = array('ErrorController', 'vipDefaultError'); 51 | $route['*']['/error/admin/sns/:error'] = array('ErrorController', 'adminSnsDeny'); 52 | 53 | 54 | $route['*']['/error/loginfirst'] = array('ErrorController', 'loginRequire'); 55 | $route['*']['/error'] = array('ErrorController', 'error404'); 56 | 57 | 58 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/controller/BlogController.php: -------------------------------------------------------------------------------- 1 | acl()->process($role, $resource, $action )){ 13 | //echo $role .' is not allowed for '. $resource . ' '. $action; 14 | return $rs; 15 | } 16 | } 17 | 18 | function index() { 19 | $data['baseurl'] = Doo::conf()->APP_URL; 20 | $data['title'] = 'Welcome to Blog home'; 21 | $data['content'] = 'You can access this~'; 22 | $data['printr'] = 'This is some blog content.
This is some blog content.
This is some blog content.
This is some blog content.
This is some blog content. '; 23 | $this->render('template', $data); 24 | } 25 | 26 | function comments() { 27 | $data['baseurl'] = Doo::conf()->APP_URL; 28 | $data['title'] = 'Blog - posting comments'; 29 | $data['content'] = (isset($_SESSION['user']))?'You can access this~' : 'Have to login to post'; 30 | $data['printr'] = (isset($_SESSION['user']))?'You can post blog comment here' : 'Need to login to post comments!'; 31 | $this->render('template', $data); 32 | } 33 | 34 | function deleteComment() { 35 | $data['baseurl'] = Doo::conf()->APP_URL; 36 | $data['title'] = 'Blog - delete comment'; 37 | $data['content'] = 'You can access this~'; 38 | $data['printr'] = 'You are the admin '; 39 | $this->render('template', $data); 40 | } 41 | 42 | function writePost() { 43 | echo 'You are visiting '.$_SERVER['REQUEST_URI']; 44 | } 45 | 46 | } 47 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | APP_URL; 7 | $data['title'] = 'Member is not allowed!'; 8 | $data['content'] = 'Not allowed'; 9 | $data['printr'] = 'Access denied!'; 10 | $this->render('template', $data); 11 | } 12 | 13 | function memberSnsDeny() { 14 | switch($this->params['error']){ 15 | case 'notAdmin': 16 | $error = 'You are not the SNS admin!'; 17 | break; 18 | case 'notVip': 19 | $error = 'Sorry, this is for VIP only.'; 20 | break; 21 | default: 22 | $error = 'Not allowed'; 23 | break; 24 | } 25 | 26 | $data['baseurl'] = Doo::conf()->APP_URL; 27 | $data['title'] = 'Member is not allowed!'; 28 | $data['content'] = $error; 29 | $data['printr'] = 'Access denied!'; 30 | $this->render('template', $data); 31 | } 32 | 33 | function memberBlogDeny() { 34 | switch($this->params['error']){ 35 | case 'notAdmin': 36 | $error = 'You are not the Blog admin!'; 37 | break; 38 | default: 39 | $error = 'Not allowed'; 40 | break; 41 | } 42 | 43 | $data['baseurl'] = Doo::conf()->APP_URL; 44 | $data['title'] = 'Member is not allowed!'; 45 | $data['content'] = $error; 46 | $data['printr'] = 'Access denied!'; 47 | $this->render('template', $data); 48 | } 49 | 50 | function vipDefaultError() { 51 | echo 'You are visiting '.$_SERVER['REQUEST_URI']; 52 | } 53 | 54 | function adminSnsDeny() { 55 | $data['baseurl'] = Doo::conf()->APP_URL; 56 | $data['title'] = 'Admin is not allowed!'; 57 | $data['content'] = ($this->params['error']=='vipOnly') ? 'This is VIP only!' : 'Not allowed'; 58 | $data['printr'] = 'Access denied!'; 59 | $this->render('template', $data); 60 | } 61 | 62 | function error404() { 63 | $data['baseurl'] = Doo::conf()->APP_URL; 64 | $data['title'] = 'Page not found!'; 65 | $data['content'] = 'default 404 error'; 66 | $data['printr'] = 'Nothing is found...'; 67 | $this->render('template', $data); 68 | } 69 | 70 | function loginRequire() { 71 | $data['baseurl'] = Doo::conf()->APP_URL; 72 | $data['title'] = 'Login Required!'; 73 | $data['content'] = 'You cannot access this!'; 74 | $data['printr'] = 'You have to be logined to access this section.'; 75 | $this->render('template', $data); 76 | } 77 | 78 | } 79 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/controller/PageController.php: -------------------------------------------------------------------------------- 1 | APP_URL; 7 | $data['title'] = 'Welcome to SNS home'; 8 | $data['content'] = 'You can access this~'; 9 | $data['printr'] = 'Some latest photo, feeds, news, highlights to be displayed. '; 10 | $this->render('template', $data); 11 | } 12 | 13 | function about() { 14 | $data['baseurl'] = Doo::conf()->APP_URL; 15 | $data['title'] = 'About Us'; 16 | $data['content'] = 'You can access this~'; 17 | $data['printr'] = 'Something about us. Very cool!'; 18 | $this->render('template', $data); 19 | } 20 | 21 | function contact() { 22 | $data['baseurl'] = Doo::conf()->APP_URL; 23 | $data['title'] = 'Contact Us'; 24 | $data['content'] = 'You can access this~'; 25 | $data['printr'] = 'Contact Us form.'; 26 | $this->render('template', $data); 27 | } 28 | 29 | } 30 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/controller/SnsController.php: -------------------------------------------------------------------------------- 1 | acl()->process($role, $resource, $action )){ 18 | //echo $role .' is not allowed for '. $resource . ' '. $action; 19 | return $rs; 20 | } 21 | } 22 | 23 | function game() { 24 | $data['baseurl'] = Doo::conf()->APP_URL; 25 | $data['title'] = 'Welcome to SNS Games'; 26 | $data['content'] = 'You can access this~'; 27 | $data['printr'] = 'Very cool 3D Flash games here.'; 28 | $this->render('template', $data); 29 | } 30 | 31 | function viewProfile() { 32 | $data['baseurl'] = Doo::conf()->APP_URL; 33 | $data['title'] = 'Profile of ' . $this->params['uname']; 34 | $data['content'] = 'You can access this~'; 35 | $data['printr'] = 'Hi I am '. $this->params['uname'] . ' and I am a cool guy.'; 36 | $this->render('template', $data); 37 | } 38 | 39 | function banUser() { 40 | $data['baseurl'] = Doo::conf()->APP_URL; 41 | $data['title'] = 'Banning User'; 42 | $data['content'] = 'You can access this~'; 43 | $data['printr'] = ''; 44 | $this->render('template', $data); 45 | } 46 | 47 | function showVipHome() { 48 | $data['baseurl'] = Doo::conf()->APP_URL; 49 | $data['title'] = 'VIP Lounge'; 50 | $data['content'] = 'You can access this~'; 51 | $data['printr'] = 'SuperDuber contents! Thanks for being a paid member :)'; 52 | $this->render('template', $data); 53 | } 54 | 55 | } 56 | ?> -------------------------------------------------------------------------------- /demos/acl/protected/model/User.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/acl/protected/view/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - Access Control List demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/acl/protected/view/links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO TOP 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /demos/acl/protected/view/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp ACL demo. Class used - DooAcl
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/acl/protected/view/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/acl/protected/viewc/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - Access Control List demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/acl/protected/viewc/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp ACL demo. Class used - DooAcl
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/acl/protected/viewc/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 |

13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/acl/user.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 3.2.0.1 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Aug 23, 2009 at 06:41 PM 7 | -- Server version: 5.1.36 8 | -- PHP Version: 5.3.0 9 | 10 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; 11 | 12 | 13 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 14 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 15 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 16 | /*!40101 SET NAMES utf8 */; 17 | 18 | -- 19 | -- Database: `acldemo` 20 | -- 21 | 22 | -- -------------------------------------------------------- 23 | 24 | -- 25 | -- Table structure for table `user` 26 | -- 27 | 28 | CREATE TABLE IF NOT EXISTS `user` ( 29 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, 30 | `username` varchar(64) COLLATE utf8_unicode_ci NOT NULL, 31 | `pwd` varchar(64) COLLATE utf8_unicode_ci NOT NULL, 32 | `group` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'member', 33 | `vip` tinyint(4) NOT NULL DEFAULT '0', 34 | PRIMARY KEY (`id`), 35 | UNIQUE KEY `username` (`username`) 36 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; 37 | 38 | -- 39 | -- Dumping data for table `user` 40 | -- 41 | 42 | INSERT INTO `user` (`id`, `username`, `pwd`, `group`, `vip`) VALUES 43 | (1, 'demo', '1234', 'member', 0), 44 | (2, 'admin', '1234', 'admin', 0), 45 | (3, 'david', '1234', 'member', 0), 46 | (4, 'doophp', '1234', 'member', 1); 47 | -------------------------------------------------------------------------------- /demos/blog/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/blog/blog.mwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/blog.mwb -------------------------------------------------------------------------------- /demos/blog/global/css/demo.css: -------------------------------------------------------------------------------- 1 | .paginate, .current, .inactivePrev, .inactiveNext, .prev, .next { 2 | font-family: Verdana,Helvetica,Arial,sans-serif; 3 | font-size:12px; 4 | border:1px solid #D8D8D8; 5 | float:left; 6 | height:20px; 7 | line-height:20px; 8 | margin-right:2px; 9 | overflow:hidden; 10 | padding:0 6px; 11 | text-decoration:none; 12 | } 13 | a:hover .paginate{ 14 | border-color:#006699; 15 | } 16 | 17 | .current { 18 | border-color:#006699; 19 | background-color:#006699; 20 | color:#fff; 21 | font-weight:bold; 22 | } 23 | .inactivePrev, .inactiveNext{ 24 | color:#999; 25 | } -------------------------------------------------------------------------------- /demos/blog/global/img/bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/global/img/bottom.jpg -------------------------------------------------------------------------------- /demos/blog/global/img/content.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/global/img/content.jpg -------------------------------------------------------------------------------- /demos/blog/global/img/menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/global/img/menu.jpg -------------------------------------------------------------------------------- /demos/blog/global/img/pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/global/img/pic.jpg -------------------------------------------------------------------------------- /demos/blog/global/img/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/blog/global/img/top.jpg -------------------------------------------------------------------------------- /demos/blog/index.php: -------------------------------------------------------------------------------- 1 | set($config); 16 | include $config['BASE_PATH'].'diagnostic/debug.php'; 17 | 18 | # database usage 19 | //Doo::useDbReplicate(); #for db replication master-slave usage 20 | Doo::db()->setMap($dbmap); 21 | Doo::db()->setDb($dbconfig, $config['APP_MODE']); 22 | Doo::db()->sql_tracking = true; #for debugging/profiling purpose 23 | 24 | Doo::app()->route = $route; 25 | 26 | # Uncomment for DB profiling 27 | //Doo::logger()->beginDbProfile('doowebsite'); 28 | Doo::app()->run(); 29 | //Doo::logger()->endDbProfile('doowebsite'); 30 | //Doo::logger()->rotateFile(20); 31 | //Doo::logger()->writeDbProfiles(); 32 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/config/db.conf.php: -------------------------------------------------------------------------------- 1 | Table B's column that links to Table A ); 5 | * $dbmap[Table B]['belongs_to'][Table A] = array('foreign_key'=> Table A's column where Table B links to ); 6 | */ 7 | 8 | $dbmap['Post']['has_many']['Tag'] = array('foreign_key'=>'post_id', 'through'=>'post_tag'); 9 | $dbmap['Tag']['has_many']['Post'] = array('foreign_key'=>'tag_id', 'through'=>'post_tag'); 10 | 11 | $dbmap['Post']['has_many']['Comment'] = array('foreign_key'=>'post_id'); 12 | $dbmap['Comment']['belongs_to']['Post'] = array('foreign_key'=>'id'); 13 | 14 | 15 | $dbconfig['dev'] = array('localhost', 'blog', 'root', '1234', 'mysql', true, 'collate'=>'utf8_unicode_ci', 'charset'=>'utf8'); 16 | $dbconfig['prod'] = array('localhost', 'blog', 'root', '1234', 'mysql', true, 'collate'=>'utf8_unicode_ci', 'charset'=>'utf8'); 17 | 18 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/config/forms/post_create.rules.php: -------------------------------------------------------------------------------- 1 | array( 6 | array( 'maxlength', 145, 'Title cannot be longer than the 145 characters.' ), 7 | array( 'notnull' ), 8 | array( 'notEmpty', 'Title cannot be empty.' ), 9 | ), 10 | 11 | 'content' => array( 12 | array( 'notnull' ), 13 | array( 'notEmpty', 'Post content cannot be empty!' ), 14 | ), 15 | 16 | 'status' => array( 17 | array( 'integer', 'Invalid status for blog post' ), 18 | array( 'max', 1, 'Invalid status for blog post' ), 19 | array( 'min', 0, 'Invalid status for blog post' ), 20 | ), 21 | 'tags'=>array( 22 | array('custom', 'AdminController::checkTags'), 23 | array('optional') 24 | ) 25 | ); 26 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/config/forms/post_edit.rules.php: -------------------------------------------------------------------------------- 1 | array( 6 | array('integer', 'Invalid Post ID'), 7 | array('custom', 'AdminController::checkPostExist'), 8 | ), 9 | 10 | 'title' => array( 11 | array( 'maxlength', 145, 'Title cannot be longer than the 145 characters.' ), 12 | array( 'notnull' ), 13 | array( 'notEmpty', 'Title cannot be empty.' ), 14 | ), 15 | 16 | 'content' => array( 17 | array( 'notnull' ), 18 | array( 'notEmpty', 'Post content cannot be empty!' ), 19 | ), 20 | 21 | 'status' => array( 22 | array( 'integer', 'Invalid status for blog post' ), 23 | array( 'max', 1, 'Invalid status for blog post' ), 24 | array( 'min', 0, 'Invalid status for blog post' ), 25 | ), 26 | 'tags'=>array( 27 | array('custom', 'AdminController::checkTags'), 28 | array('optional') 29 | ) 30 | ); 31 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/controller/MainController.php: -------------------------------------------------------------------------------- 1 | params['filename']); 24 | } 25 | 26 | public function gen_sitemap_controller(){ 27 | //This will replace the routes.conf.php file 28 | Doo::loadCore('app/DooSiteMagic'); 29 | DooSiteMagic::buildSitemap(true); 30 | DooSiteMagic::buildSite(); 31 | } 32 | 33 | public function gen_sitemap(){ 34 | //This will write a new file, routes2.conf.php file 35 | Doo::loadCore('app/DooSiteMagic'); 36 | DooSiteMagic::buildSitemap(); 37 | } 38 | 39 | public function gen_site(){ 40 | Doo::loadCore('app/DooSiteMagic'); 41 | DooSiteMagic::buildSite(); 42 | } 43 | 44 | public function gen_model(){ 45 | Doo::loadCore('db/DooModelGen'); 46 | DooModelGen::genMySQL(); 47 | } 48 | 49 | } 50 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/model/Comment.php: -------------------------------------------------------------------------------- 1 | array( 55 | array( 'integer', 'Post ID needed to be an integer' ), 56 | array( 'custom', 'BlogController::checkPostExist' ), 57 | ), 58 | 59 | 'author' => array( 60 | array( 'maxlength', 64, 'Author name cannot be longer than 64 characters!' ), 61 | array( 'notempty', 'Author field cannot be empty' ), 62 | array( 'notnull' ), 63 | ), 64 | 65 | 'email' => array( 66 | array( 'email' ), 67 | ), 68 | 69 | 'content' => array( 70 | array( 'maxlength', 145, 'Comment cannot be longer than 145 characters!' ), 71 | array( 'notempty', 'Comment cannot be empty!' ), 72 | array( 'notnull' ), 73 | ), 74 | 75 | 'url' => array( 76 | array( 'url'), 77 | array( 'maxlength', 145, 'URL cannot be longer than 145 characters!' ), 78 | array( 'optional' ), 79 | ), 80 | ); 81 | } 82 | } 83 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/model/PostTag.php: -------------------------------------------------------------------------------- 1 | array( 23 | array( 'integer' ), 24 | array( 'min', 0 ), 25 | array( 'maxlength', 11 ), 26 | array( 'notnull' ), 27 | ), 28 | 29 | 'post_id' => array( 30 | array( 'integer' ), 31 | array( 'min', 0 ), 32 | array( 'maxlength', 11 ), 33 | array( 'notnull' ), 34 | ) 35 | ); 36 | } 37 | 38 | public function validate($checkMode='all', $requireMode='null'){ 39 | //You do not need this if you extend DooModel or DooSmartModel 40 | //MODE: all, all_one, skip 41 | Doo::loadHelper('DooValidator'); 42 | $v = new DooValidator; 43 | $v->checkMode = $checkMode; 44 | $v->requiredMode = $requireMode; 45 | return $v->validate(get_object_vars($this), $this->getVRules()); 46 | } 47 | 48 | } 49 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/model/Tag.php: -------------------------------------------------------------------------------- 1 | array( 28 | array( 'integer' ), 29 | array( 'min', 0 ), 30 | array( 'maxlength', 11 ), 31 | array( 'notnull' ), 32 | ), 33 | 34 | 'name' => array( 35 | array( 'maxlength', 145 ), 36 | array( 'notnull' ), 37 | ) 38 | ); 39 | } 40 | 41 | public function validate($checkMode='all', $requireMode='null'){ 42 | //You do not need this if you extend DooModel or DooSmartModel 43 | //MODE: all, all_one, skip 44 | Doo::loadHelper('DooValidator'); 45 | $v = new DooValidator; 46 | $v->checkMode = $checkMode; 47 | $v->requiredMode = $requireMode; 48 | return $v->validate(get_object_vars($this), $this->getVRules()); 49 | } 50 | 51 | } 52 | ?> -------------------------------------------------------------------------------- /demos/blog/protected/view/admin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Admin 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |

Manage Blog Posts


22 |

You can sort by the fields' value. Click the title to edit.


23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
StatusTitleCreate Time
PublishedDraft{{posts' value.@title}}{{formatDate(posts' value.@createtime)}}
38 |
39 | 40 |
41 | {{pager}} 42 |
43 | 44 |
45 | 46 |
47 | 48 |
49 |
50 | 51 |
52 | 53 | 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /demos/blog/protected/view/admin_comments.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Admin - Approve Comments 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |

Approve Comments


22 |

Approve/reject the comments:


23 |
24 | 25 | 26 | Author: {{comments' value.@author}}
27 | Email: {{links(comments' value.@email)}}
28 | Website: {{LINKS(comments' value.@url)}}
29 | Comment: {{comments' value.@content}}
30 | [Approve] | [Reject] 31 |
32 | 33 | 34 | 35 |

No comments to approve or reject.

36 | 37 |
38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 |
46 | 47 |
48 | 49 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /demos/blog/protected/view/admin_msg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - {{title}} 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

{{title}}

22 | {{content}} 23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/view/admin_sidebar.html: -------------------------------------------------------------------------------- 1 |

Admin

2 | 9 | 10 |
11 | 18 | -------------------------------------------------------------------------------- /demos/blog/protected/view/blog_sidebar.html: -------------------------------------------------------------------------------- 1 |

Tags :

2 | 3 | 4 | {{randomTags' value.@name}} 5 | 6 | 7 | 8 |

Archives

9 | 24 | 25 |
26 | advertisement -------------------------------------------------------------------------------- /demos/blog/protected/view/comment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - Comment Submitted 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

Comment Saved!

22 |

Your comment is submitted and awaiting for approval before it is listed in the blog page.

23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/view/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - {{title}} 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

{{title}}

22 | {{content}} 23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/view/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 |

{{posts' value.@title}}

23 |
24 | {{shorten(posts' value.@content)}} 25 |
26 | Tags: 27 | 28 | {{posts' v' v.@name}} 29 | 30 |
31 |  Comments ({{posts' value.@totalcomment}}) | Posted on {{formatDate(posts' value.@createtime)}} 32 |
33 |
34 | 35 |
{{pager}}
36 | 37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 |
45 | 46 |
47 | 48 | 51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /demos/blog/protected/view/top.html: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | 8 | 15 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/admin.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Admin 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |

Manage Blog Posts


22 |

You can sort by the fields' value. Click the title to edit.


23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | $v1): ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 |
StatusTitleCreate Time
status==1 ): ?>PublishedDrafttitle; ?>createtime); ?>
38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 | 48 |
49 |
50 | 51 |
52 | 53 | 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/admin_comments.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Admin - Approve Comments 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 |

Approve Comments


22 |

Approve/reject the comments:


23 |
24 | 25 | $v1): ?> 26 | Author: author; ?>
27 | Email: email); ?>
28 | Website: url); ?>
29 | Comment: content; ?>
30 | [Approve] | [Reject] 31 |
32 | 33 | 34 | 35 |

No comments to approve or reject.

36 | 37 |
38 |
39 | 40 |
41 | 42 |
43 | 44 |
45 |
46 | 47 |
48 | 49 | 52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/admin_msg.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - <?php echo $data['title']; ?> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

22 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/admin_sidebar.php: -------------------------------------------------------------------------------- 1 |

Admin

2 | 9 | 10 |
11 | 18 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/blog_sidebar.php: -------------------------------------------------------------------------------- 1 |

Tags :

2 | getPart('sidebarTag', 300)): ?> 3 | start('sidebarTag'); ?> 4 | $v1): ?> 5 | name; ?> 6 | 7 | 8 | end(); ?> 9 | 10 | 11 |

Archives

12 | 30 | 31 |
32 | advertisement -------------------------------------------------------------------------------- /demos/blog/protected/viewc/comment.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - Comment Submitted 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

Comment Saved!

22 |

Your comment is submitted and awaiting for approval before it is listed in the blog page.

23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/error.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - <?php echo $data['title']; ?> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

22 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | $v1): ?> 22 |

title; ?>

23 |
24 | content); ?> 25 |
26 | Tags: 27 | Tag as $k2=>$v2): ?> 28 | name; ?> 29 | 30 |
31 |  Comments (totalcomment; ?>) | Posted on createtime); ?> 32 |
33 |
34 | 35 |
36 | 37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 |
45 | 46 |
47 | 48 | 51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/status.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DooPHP Blog Demo - <?php echo $data['title']; ?> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 |

22 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 |
34 | 35 | 38 |
39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/blog/protected/viewc/top.php: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | 8 | 15 | -------------------------------------------------------------------------------- /demos/database/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/database/food.mwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/database/food.mwb -------------------------------------------------------------------------------- /demos/database/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/database/global/img/food.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/demos/database/global/img/food.png -------------------------------------------------------------------------------- /demos/database/global/js/common.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DooPHP demos 3 | */ 4 | var fontsize = 190; 5 | function smaller(){ 6 | fontsize *=0.9 7 | $("body").css("font-size", fontsize+'%'); 8 | } 9 | function larger(){ 10 | fontsize *=1.1 11 | $("body").css("font-size", fontsize+'%'); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/database/index.php: -------------------------------------------------------------------------------- 1 | set($config); 10 | include $config['BASE_PATH'].'diagnostic/debug.php'; 11 | 12 | //database usage 13 | Doo::db()->setMap($dbmap); 14 | Doo::db()->setDb($dbconfig, $config['APP_MODE']); 15 | Doo::db()->sql_tracking = true; 16 | 17 | Doo::app()->route = $route; 18 | Doo::app()->run(); 19 | ?> 20 | -------------------------------------------------------------------------------- /demos/database/protected/config/common.conf.php: -------------------------------------------------------------------------------- 1 | BASE_PATH; 5 | */ 6 | error_reporting(E_ALL | E_STRICT); 7 | date_default_timezone_set('Asia/Kuala_Lumpur'); 8 | /** 9 | * for benchmark purpose, call Doo::benchmark() for time used. 10 | */ 11 | //$config['START_TIME'] = microtime(true); 12 | 13 | 14 | //framework use, must defined, user full absolute path and end with / eg. /var/www/project/ 15 | $config['SITE_PATH'] = realpath('..').'/database/'; 16 | //$config['PROTECTED_FOLDER'] = 'protected/'; 17 | $config['BASE_PATH'] = realpath('../..').'/dooframework/'; 18 | 19 | //for production mode use 'prod' 20 | $config['APP_MODE'] = 'dev'; 21 | 22 | //----------------- optional, if not defined, default settings are optimized for production mode ---------------- 23 | $config['SUBFOLDER'] = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\','/',$config['SITE_PATH'])); 24 | if(strpos($config['SUBFOLDER'], '/')!==0){ 25 | $config['SUBFOLDER'] = '/'.$config['SUBFOLDER']; 26 | } 27 | 28 | $config['APP_URL'] = 'http://'.$_SERVER['HTTP_HOST'].$config['SUBFOLDER']; 29 | $config['AUTOROUTE'] = TRUE; 30 | $config['DEBUG_ENABLED'] = TRUE; 31 | 32 | //$config['TEMPLATE_COMPILE_ALWAYS'] = TRUE; 33 | 34 | //register functions to be used with your template files 35 | //$config['TEMPLATE_GLOBAL_TAGS'] = array('url', 'url2', 'time', 'isset', 'empty'); 36 | 37 | /** 38 | * defined either Document or Route to be loaded/executed when requested page is not found 39 | * A 404 route must be one of the routes defined in routes.conf.php (if autoroute on, make sure the controller and method exist) 40 | * Error document must be more than 512 bytes as IE sees it as a normal 404 sent if < 512b 41 | */ 42 | //$config['ERROR_404_DOCUMENT'] = 'error.php'; 43 | $config['ERROR_404_ROUTE'] = '/error'; 44 | 45 | /** 46 | * you can include self defined config, retrieved via Doo::conf()->variable 47 | * Use lower case for you own settings for future Compability with DooPHP 48 | */ 49 | //$config['pagesize'] = 10; 50 | 51 | ?> 52 | -------------------------------------------------------------------------------- /demos/database/protected/config/db.conf.php: -------------------------------------------------------------------------------- 1 | Table B's column that links to Table A ); 5 | * $dbmap[Table B]['belongs_to'][Table A] = array('foreign_key'=> Table A's column where Table B links to ); 6 | */ 7 | 8 | //Food relationship 9 | $dbmap['Food']['belongs_to']['FoodType'] = array('foreign_key'=>'id'); 10 | $dbmap['Food']['has_many']['Article'] = array('foreign_key'=>'food_id'); 11 | $dbmap['Food']['has_one']['Recipe'] = array('foreign_key'=>'food_id'); 12 | $dbmap['Food']['has_many']['Ingredient'] = array('foreign_key'=>'food_id', 'through'=>'food_has_ingredient'); 13 | 14 | //Food Type 15 | $dbmap['FoodType']['has_many']['Food'] = array('foreign_key'=>'food_type_id'); 16 | 17 | //Article 18 | $dbmap['Article']['belongs_to']['Food'] = array('foreign_key'=>'id'); 19 | 20 | //Recipe 21 | $dbmap['Recipe']['belongs_to']['Food'] = array('foreign_key'=>'id'); 22 | 23 | //Ingredient 24 | $dbmap['Ingredient']['has_many']['Food'] = array('foreign_key'=>'ingredient_id', 'through'=>'food_has_ingredient'); 25 | 26 | 27 | 28 | //$dbconfig[ Environment or connection name] = array(Host, Database, User, Password, DB Driver, Make Persistent Connection?); 29 | //for setting collation and charset 'collate'=>'utf8_unicode_ci', 'charset'=>'utf8' 30 | //$dbconfig['dev'] = array('localhost', 'mydb', 'root', '1234', 'mysql', true, 'collate'=>'utf8_unicode_ci', 'charset'=>'utf8'); 31 | $dbconfig['dev'] = array('localhost', 'foodexample', 'root', '1234', 'mysql',true); 32 | $dbconfig['prod'] = array('localhost', 'foodexample', 'root', '1234', 'mysql',true); 33 | 34 | ?> 35 | -------------------------------------------------------------------------------- /demos/database/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | means page not found!'; 12 | $data['content'] = 'This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']'; 13 | $data['content'] .= '

Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.

Give some helpful comments other than 404 :(
Also check out the links page for a list of URLs available in this demo.

'; 14 | $data['baseurl'] = Doo::conf()->APP_URL; 15 | $data['printr'] = null; 16 | $this->view()->render('template', $data); 17 | } 18 | } 19 | ?> -------------------------------------------------------------------------------- /demos/database/protected/model/Article.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/database/protected/model/Food.php: -------------------------------------------------------------------------------- 1 | 1, 'name'=>'Ban Mian', 'location'=>'Malaysia') ); //This is for you to set the properties with constructor 17 | //parent::$caseSensitive = true; 18 | parent::$className = __CLASS__; //a must if you are using static querying methods Food::_count(), Food::getById() 19 | //parent::setupModel(__CLASS__); 20 | //parent::setupModel(__CLASS__, true); 21 | } 22 | 23 | public function get_recipe(){ 24 | return Doo::db()->relate('Recipe', __CLASS__, array('limit'=>'first')); 25 | } 26 | 27 | public function get_by_id(){ 28 | if(intval($this->id)<=0) 29 | return null; 30 | return Doo::db()->find($this, array('limit'=>1)); 31 | } 32 | 33 | } 34 | ?> -------------------------------------------------------------------------------- /demos/database/protected/model/FoodType.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/database/protected/model/Ingredient.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/database/protected/model/Recipe.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/database/protected/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | TEMPLATE_GLOBAL_TAGS = array('upper', 'tofloat', 'sample_with_args', 'debug', 'triple'); 7 | 8 | /** 9 | Define as class (optional) 10 | 11 | class TemplateTag { 12 | public static test(){} 13 | public static test2(){} 14 | } 15 | **/ 16 | 17 | // the 1st argument must be the variable passed in from template, the other args should NOT be variables 18 | function upper($str){ 19 | return strtoupper($str); 20 | } 21 | 22 | function tofloat($str){ 23 | return sprintf("%.2f", $str); 24 | } 25 | 26 | function sample_with_args($str, $prefix){ 27 | return $str .' with args: '. $prefix; 28 | } 29 | 30 | function triple($str, $prefix='', $addup=0){ 31 | return ($str*3+$addup) .' ( '. $str. $prefix . $addup . ' )'; 32 | } 33 | 34 | function debug($var){ 35 | if(!empty($var)){ 36 | echo '
';
37 |         print_r($var);
38 |         echo '
'; 39 | } 40 | } 41 | 42 | ?> -------------------------------------------------------------------------------- /demos/database/protected/view/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - Database ORM demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/database/protected/view/links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO TOP 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /demos/database/protected/view/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp Database ORM demo. Class used - DooSqlMagic
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/database/protected/view/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/database/protected/viewc/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - Database ORM demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/database/protected/viewc/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp Database ORM demo. Class used - DooSqlMagic
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/database/protected/viewc/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 |

13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/i18n/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/i18n/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/i18n/global/js/common.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DooPHP demos 3 | */ 4 | var fontsize = 190; 5 | function smaller(){ 6 | fontsize *=0.9 7 | $("body").css("font-size", fontsize+'%'); 8 | } 9 | function larger(){ 10 | fontsize *=1.1 11 | $("body").css("font-size", fontsize+'%'); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/index.php: -------------------------------------------------------------------------------- 1 | set($config); 10 | include $config['BASE_PATH'].'diagnostic/debug.php'; 11 | 12 | Doo::app()->route = $route; 13 | Doo::app()->run(); 14 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/config/common.conf.php: -------------------------------------------------------------------------------- 1 | BASE_PATH; 5 | */ 6 | error_reporting(E_ALL | E_STRICT); 7 | date_default_timezone_set('Asia/Kuala_Lumpur'); 8 | /** 9 | * for benchmark purpose, call Doo::benchmark() for time used. 10 | */ 11 | //$config['START_TIME'] = microtime(true); 12 | 13 | 14 | //framework use, must defined 15 | $config['SITE_PATH'] = realpath('..').'/i18n/'; 16 | //$config['PROTECTED_FOLDER'] = 'protected/'; 17 | $config['BASE_PATH'] = realpath('../..').'/dooframework/'; 18 | 19 | //for production mode use 'prod' 20 | $config['APP_MODE'] = 'dev'; 21 | 22 | //----------------- optional, if not defined, default settings are optimized for production mode ---------------- 23 | $config['SUBFOLDER'] = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\','/',$config['SITE_PATH'])); 24 | if(strpos($config['SUBFOLDER'], '/')!==0){ 25 | $config['SUBFOLDER'] = '/'.$config['SUBFOLDER']; 26 | } 27 | 28 | $config['APP_URL'] = 'http://'.$_SERVER['HTTP_HOST'].$config['SUBFOLDER']; 29 | //$config['AUTOROUTE'] = TRUE; 30 | $config['DEBUG_ENABLED'] = TRUE; 31 | 32 | //$config['TEMPLATE_COMPILE_ALWAYS'] = TRUE; 33 | 34 | //register functions to be used with your template files 35 | //$config['TEMPLATE_GLOBAL_TAGS'] = array('url', 'url2', 'time', 'isset', 'empty'); 36 | 37 | /** 38 | * defined either Document or Route to be loaded/executed when requested page is not found 39 | * A 404 route must be one of the routes defined in routes.conf.php (if autoroute on, make sure the controller and method exist) 40 | * Error document must be more than 512 bytes as IE sees it as a normal 404 sent if < 512b 41 | */ 42 | //$config['ERROR_404_DOCUMENT'] = 'error.php'; 43 | $config['ERROR_404_ROUTE'] = '/error'; 44 | 45 | /** 46 | * you can include self defined config, retrieved via Doo::conf()->variable 47 | * Use lower case for you own settings for future Compability with DooPHP 48 | */ 49 | $config['default_lang'] = 'en'; 50 | $config['lang'] = 'en'; 51 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/config/db.conf.php: -------------------------------------------------------------------------------- 1 | Table B's column that links to Table A ); 5 | * $dbmap[Table B]['belongs_to'][Table A] = array('foreign_key'=> Table A's column where Table B links to ); 6 | 7 | 8 | //Food relationship 9 | $dbmap['Food']['belongs_to']['FoodType'] = array('foreign_key'=>'id'); 10 | $dbmap['Food']['has_many']['Article'] = array('foreign_key'=>'food_id'); 11 | $dbmap['Food']['has_one']['Recipe'] = array('foreign_key'=>'food_id'); 12 | $dbmap['Food']['has_many']['Ingredient'] = array('foreign_key'=>'food_id', 'through'=>'food_has_ingredient'); 13 | 14 | //Food Type 15 | $dbmap['FoodType']['has_many']['Food'] = array('foreign_key'=>'food_type_id'); 16 | 17 | //Article 18 | $dbmap['Article']['belongs_to']['Food'] = array('foreign_key'=>'id'); 19 | 20 | //Recipe 21 | $dbmap['Recipe']['belongs_to']['Food'] = array('foreign_key'=>'id'); 22 | 23 | //Ingredient 24 | $dbmap['Ingredient']['has_many']['Food'] = array('foreign_key'=>'ingredient_id', 'through'=>'food_has_ingredient'); 25 | 26 | */ 27 | 28 | //$dbconfig[ Environment or connection name] = array(Host, Database, User, Password, DB Driver, Make Persistent Connection?); 29 | /* $dbconfig['dev'] = array('localhost', 'database', 'root', '1234', 'mysql',true); 30 | * $dbconfig['prod'] = array('localhost', 'database', 'root', '1234', 'mysql',true); 31 | */ 32 | ?> 33 | -------------------------------------------------------------------------------- /demos/i18n/protected/config/routes.conf.php: -------------------------------------------------------------------------------- 1 | 'Model Generator', 'auth'=>array('admin'=>'1234'), 'authFail'=>'Unauthorized!'); 20 | 21 | 22 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | APP_URL; 17 | $this->view()->render($_COOKIE['lang'] .'/template', $data); 18 | } 19 | } 20 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/controller/I18nController.php: -------------------------------------------------------------------------------- 1 | langs)){ 13 | setcookie('lang', $_GET['lang'], time()+3600*240, '/'); 14 | Doo::conf()->lang = $_GET['lang']; 15 | }else{ 16 | setcookie('lang', 'en'); 17 | Doo::conf()->lang = 'en'; 18 | } 19 | } 20 | else if(!isset($_COOKIE['lang'])){ 21 | // if user doesn't specify any language, check his/her browser language 22 | // check if the visitor language is supported 23 | // $this->language(true) to return the country code such as en-US zh-CN zh-TW 24 | if(in_array($this->language(), $this->langs)){ 25 | setcookie('lang', $this->language(), time()+3600*240, '/'); 26 | Doo::conf()->lang = $this->language(); 27 | }else{ 28 | setcookie('lang', 'en', time()+3600*240, '/'); 29 | Doo::conf()->lang = 'en'; 30 | } 31 | } 32 | else{ 33 | Doo::conf()->lang = $_COOKIE['lang']; 34 | } 35 | } 36 | 37 | } 38 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/controller/MainController.php: -------------------------------------------------------------------------------- 1 | APP_URL; 19 | $data['printr'] = null; 20 | $this->view()->render(Doo::conf()->lang .'/about', $data); 21 | } 22 | 23 | public function example(){ 24 | $data['header'] ='header'; 25 | $data['nav'] = 'nav'; 26 | $data['baseurl'] = Doo::conf()->APP_URL; 27 | $this->view()->render(Doo::conf()->lang .'/example', $data); 28 | } 29 | 30 | } 31 | ?> -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | TEMPLATE_GLOBAL_TAGS = array('upper', 'tofloat', 'sample_with_args', 'debug', 't', 't2'); 7 | 8 | /** 9 | Define as class (optional) 10 | 11 | class TemplateTag { 12 | public static test(){} 13 | public static test2(){} 14 | } 15 | **/ 16 | 17 | // the 1st argument must be the variable passed in from template, the other args should NOT be variables 18 | 19 | // And of course you can change it to load ini/xml files for translation 20 | function t($str){ 21 | if(Doo::conf()->lang==Doo::conf()->default_lang) 22 | return $str; 23 | 24 | include 'lang/' . Doo::conf()->lang .'.lang.php'; 25 | 26 | if(isset($lang[$str])) 27 | return $lang[$str]; 28 | } 29 | 30 | // And of course you can change it to load ini/xml files for translation 31 | function t2($arr){ 32 | if(Doo::conf()->lang==Doo::conf()->default_lang) 33 | return $arr[1]; 34 | 35 | include 'lang/' . Doo::conf()->lang .'.lang2.php'; 36 | 37 | if(isset($lang[$arr[0]])) 38 | return $lang[$arr[0]]; 39 | } 40 | 41 | ?> 42 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/de.lang.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/de.lang2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/pt.lang.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/pt.lang2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/zh.lang.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/plugin/lang/zh.lang2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/de/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Dies ist ein Demo-i18n

11 |

Dies ist Deutsch.

12 | 13 |

Dies ist eine Variable

14 |
    15 |
  1. {{t(dynamic_msg)}}
  2. 16 |
  3. {{t2(dynamic_key_msg)}}
  4. 17 |
  5. {{t2(dynamic_key_msg2)}}
  6. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/de/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Beispiel für die Übersetzung

11 |

Übersetzung von Formulierungen lassen sich einfach durch Hinzufügen von Funktionen, Template-Tags.

12 |

Folgende Beispiel zeigt Ihnen 2 Geschmacksrichtungen in der Übersetzung Nachrichten in verschiedenen Sprachen.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | Zurück zum Anfang 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/de/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internationalisierung Demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/de/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. Klasse verwendet - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/de/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{t(title)}}

11 |

Ergebnis: {{t(content)}}

12 | Zurück zur vorherigen Seite 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/en/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

This is a i18n demo

11 |

This is English.

12 | 13 |

This is a variable

14 | 15 |
    16 |
  1. {{t(dynamic_msg)}}
  2. 17 |
  3. {{t2(dynamic_key_msg)}}
  4. 18 |
  5. {{t2(dynamic_key_msg2)}}
  6. 19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/en/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Example of Translation

11 |

Translation of wordings can be easily done by adding functions to template tags.

12 |

Example below shows you 2 flavours in translating messages into different languages.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | BACK TO TOP 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/en/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internationalization demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/en/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. Class used - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/en/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{t(title)}}

11 |

Result: {{t(content)}}

12 | BACK TO LAST PAGE 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/pt/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Esta é uma demonstração i18n

11 |

Este é o Português.

12 | 13 |

Esta é uma variável

14 |
    15 |
  1. {{t(dynamic_msg)}}
  2. 16 |
  3. {{t2(dynamic_key_msg)}}
  4. 17 |
  5. {{t2(dynamic_key_msg2)}}
  6. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/pt/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Exemplo de tradução

11 |

Tradução do texto pode ser feito facilmente adicionando funções para modelo tags.

12 |

Exemplo abaixo mostra-lhe 2 sabores em traduzir as mensagens em diferentes línguas.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | Voltar ao topo 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/pt/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internacionalização demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/pt/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. 4 | Classe utilizados - DooController
5 |
6 | 7 |
8 | en 9 | 10 | cn 11 | 12 | pt 13 | 14 | de 15 |
16 | ...
17 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/pt/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{t(title)}}

11 |

Resultado: {{t(content)}}

12 | Voltar à página anterior 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/zh/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

这是i18n演示

11 |

这是中文

12 | 13 |

这是一个变数

14 |
    15 |
  1. {{t(dynamic_msg)}}
  2. 16 |
  3. {{t2(dynamic_key_msg)}}
  4. 17 |
  5. {{t2(dynamic_key_msg2)}}
  6. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/zh/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

翻译示例

11 |

文字翻译可以很容易地被实现,只需增加模板标签/函数即可.

12 |

以下是两种不同形式的翻译方式.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | 最 顶 端 25 |
26 | 27 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/zh/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - i18n 国际化演示 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/zh/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n 演示. 运用了 - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/view/zh/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{t(title)}}

11 |

结果: {{t(content)}}

12 | 返回上一页 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/de/about.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Dies ist ein Demo-i18n

11 |

Dies ist Deutsch.

12 | 13 |

Dies ist eine Variable

14 |
    15 |
  1. 16 |
  2. 17 |
  3. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/de/example.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Beispiel für die Übersetzung

11 |

Übersetzung von Formulierungen lassen sich einfach durch Hinzufügen von Funktionen, Template-Tags.

12 |

Folgende Beispiel zeigt Ihnen 2 Geschmacksrichtungen in der Übersetzung Nachrichten in verschiedenen Sprachen.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | Zurück zum Anfang 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/de/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internationalisierung Demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/de/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. Klasse verwendet - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/de/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Ergebnis:

12 | Zurück zur vorherigen Seite 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/en/about.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

This is a i18n demo

11 |

This is English.

12 | 13 |

This is a variable

14 | 15 |
    16 |
  1. 17 |
  2. 18 |
  3. 19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/en/example.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Example of Translation

11 |

Translation of wordings can be easily done by adding functions to template tags.

12 |

Example below shows you 2 flavours in translating messages into different languages.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | BACK TO TOP 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/en/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internationalization demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/en/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. Class used - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/en/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 | BACK TO LAST PAGE 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/pt/about.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Esta é uma demonstração i18n

11 |

Este é o Português.

12 | 13 |

Esta é uma variável

14 |
    15 |
  1. 16 |
  2. 17 |
  3. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/pt/example.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

Exemplo de tradução

11 |

Tradução do texto pode ser feito facilmente adicionando funções para modelo tags.

12 |

Exemplo abaixo mostra-lhe 2 sabores em traduzir as mensagens em diferentes línguas.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | Voltar ao topo 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/pt/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - i18n Internacionalização demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/pt/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n demo. 4 | Classe utilizados - DooController
5 |
6 | 7 |
8 | en 9 | 10 | cn 11 | 12 | pt 13 | 14 | de 15 |
16 | ...
17 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/pt/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Resultado:

12 | Voltar à página anterior 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/zh/about.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

这是i18n演示

11 |

这是中文

12 | 13 |

这是一个变数

14 |
    15 |
  1. 16 |
  2. 17 |
  3. 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/zh/example.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

翻译示例

11 |

文字翻译可以很容易地被实现,只需增加模板标签/函数即可.

12 |

以下是两种不同形式的翻译方式.

13 |
14 | # in controller
15 | $data['dynamic_msg'] = 'This can be translated';
16 | $data['dynamic_key_msg'] = array('welcome_user', 'Welcome to my site, Mr. User!');
17 | $data['dynamic_key_msg2'] = array('input_invalid', 'Invalid input for email address.');
18 | 
19 | # in view
20 | {{t(dynamic_msg)}}
21 | {{t2(dynamic_key_msg)}}
22 | {{t2(dynamic_key_msg2)}}
23 |         
24 | 最 顶 端 25 |
26 | 27 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/zh/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - i18n 国际化演示 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/zh/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp i18n 演示. 运用了 - DooController
4 |
5 | 6 |
7 | en 8 | 9 | cn 10 | 11 | pt 12 | 13 | de 14 |
15 | ...
16 | -------------------------------------------------------------------------------- /demos/i18n/protected/viewc/zh/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

结果:

12 | 返回上一页 13 |
14 | 15 | -------------------------------------------------------------------------------- /demos/rest_client_server/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/rest_client_server/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/rest_client_server/global/js/common.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DooPHP demos 3 | */ 4 | var fontsize = 190; 5 | function smaller(){ 6 | fontsize *=0.9 7 | $("body").css("font-size", fontsize+'%'); 8 | } 9 | function larger(){ 10 | fontsize *=1.1 11 | $("body").css("font-size", fontsize+'%'); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/rest_client_server/index.php: -------------------------------------------------------------------------------- 1 | set($config); 10 | include $config['BASE_PATH'].'diagnostic/debug.php'; 11 | 12 | Doo::app()->route = $route; 13 | Doo::app()->run(); 14 | ?> 15 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/config/common.conf.php: -------------------------------------------------------------------------------- 1 | BASE_PATH; 5 | */ 6 | error_reporting(E_ALL | E_STRICT); 7 | date_default_timezone_set('Asia/Kuala_Lumpur'); 8 | /** 9 | * for benchmark purpose, call Doo::benchmark() for time used. 10 | */ 11 | //$config['START_TIME'] = microtime(true); 12 | 13 | 14 | //framework use, must defined, user full absolute path and end with / eg. /var/www/project/ 15 | $config['SITE_PATH'] = realpath('..').'/rest_client_server/'; 16 | //$config['PROTECTED_FOLDER'] = 'protected/'; 17 | $config['BASE_PATH'] = realpath('../..').'/dooframework/'; 18 | 19 | //for production mode use 'prod' 20 | $config['APP_MODE'] = 'dev'; 21 | 22 | //----------------- optional, if not defined, default settings are optimized for production mode ---------------- 23 | $config['SUBFOLDER'] = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\','/',$config['SITE_PATH'])); 24 | if(strpos($config['SUBFOLDER'], '/')!==0){ 25 | $config['SUBFOLDER'] = '/'.$config['SUBFOLDER']; 26 | } 27 | 28 | $config['APP_URL'] = 'http://'.$_SERVER['HTTP_HOST'].$config['SUBFOLDER']; 29 | //$config['AUTOROUTE'] = TRUE; 30 | $config['DEBUG_ENABLED'] = TRUE; 31 | 32 | 33 | /** 34 | * defined either Document or Route to be loaded/executed when requested page is not found 35 | * A 404 route must be one of the routes defined in routes.conf.php (if autoroute on, make sure the controller and method exist) 36 | * Error document must be more than 512 bytes as IE sees it as a normal 404 sent if < 512b 37 | */ 38 | //$config['ERROR_404_DOCUMENT'] = 'error.php'; 39 | $config['ERROR_404_ROUTE'] = '/error'; 40 | 41 | /** 42 | * you can include self defined config, retrieved via Doo::conf()->variable 43 | * Use lower case for you own settings for future Compability with DooPHP 44 | */ 45 | //$config['pagesize'] = 10; 46 | 47 | ?> 48 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | means page not found!'; 12 | $data['content'] = 'This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']'; 13 | $data['content'] .= '

Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.

Give some helpful comments other than 404 :(
Also check out the links page for a list of URLs available in this demo.

'; 14 | $data['baseurl'] = Doo::conf()->APP_URL; 15 | $data['printr'] = null; 16 | $this->view()->render('template', $data); 17 | } 18 | } 19 | ?> -------------------------------------------------------------------------------- /demos/rest_client_server/protected/controller/MainController.php: -------------------------------------------------------------------------------- 1 | APP_URL; 11 | $this->view()->render('about', $data); 12 | } 13 | 14 | public function url(){ 15 | $data['title'] = 'URL used in this demo'; 16 | $data['content'] = 'Replace :var with your values.
Request type */GET = You can test and visit these links.'; 17 | $data['baseurl'] = Doo::conf()->APP_URL; 18 | 19 | include Doo::conf()->SITE_PATH .'protected/config/routes.conf.php'; 20 | $data['printr'] = array(); 21 | $n = 1; 22 | foreach($route as $req=>$r){ 23 | foreach($r as $rname=>$value){ 24 | //$rname_strip = (strpos($rname, '/')===0)? substr($rname, 1, strlen($rname)) : $rname; 25 | $rname_strip = 'index.php'.$rname; 26 | $data['printr'][$n++ .strtoupper(" $req")] = ''.$rname.''; 27 | } 28 | } 29 | $this->view()->render('template', $data); 30 | } 31 | 32 | public function example(){ 33 | $data['baseurl'] = Doo::conf()->APP_URL; 34 | $data['printr'] = file_get_contents(Doo::conf()->SITE_PATH .'protected/config/routes.conf.php'); 35 | $this->view()->render('example', $data); 36 | } 37 | 38 | 39 | } 40 | ?> -------------------------------------------------------------------------------- /demos/rest_client_server/protected/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | TEMPLATE_GLOBAL_TAGS = array('upper', 'tofloat', 'sample_with_args', 'debug'); 7 | 8 | /** 9 | Define as class (optional) 10 | 11 | class TemplateTag { 12 | public static test(){} 13 | public static test2(){} 14 | } 15 | **/ 16 | 17 | function upper($str){ 18 | return strtoupper($str); 19 | } 20 | 21 | function tofloat($str){ 22 | return sprintf("%.2f", $str); 23 | } 24 | 25 | function sample_with_args($str, $prefix){ 26 | return $str .' with args '. $prefix; 27 | } 28 | 29 | function debug($var){ 30 | if(!empty($var)){ 31 | echo '
';
32 |         print_r($var);
33 |         echo '
'; 34 | } 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /demos/rest_client_server/protected/view/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - RESTful API demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/view/links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO TOP 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/view/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp RESTful API demo. Class used - DooRestClient
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/view/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/viewc/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - RESTful API demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/viewc/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp RESTful API demo. Class used - DooRestClient
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/rest_client_server/protected/viewc/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 |

13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/template_engine/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/template_engine/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/template_engine/global/js/common.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DooPHP demos 3 | */ 4 | var fontsize = 190; 5 | function smaller(){ 6 | fontsize *=0.9 7 | $("body").css("font-size", fontsize+'%'); 8 | } 9 | function larger(){ 10 | fontsize *=1.1 11 | $("body").css("font-size", fontsize+'%'); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/template_engine/index.php: -------------------------------------------------------------------------------- 1 | set($config); 10 | include $config['BASE_PATH'].'diagnostic/debug.php'; 11 | 12 | Doo::app()->route = $route; 13 | Doo::app()->run(); 14 | ?> 15 | -------------------------------------------------------------------------------- /demos/template_engine/protected/config/common.conf.php: -------------------------------------------------------------------------------- 1 | BASE_PATH; 5 | */ 6 | error_reporting(E_ALL | E_STRICT); 7 | date_default_timezone_set('Asia/Kuala_Lumpur'); 8 | /** 9 | * for benchmark purpose, call Doo::benchmark() for time used. 10 | */ 11 | //$config['START_TIME'] = microtime(true); 12 | 13 | 14 | //framework use, must defined, user full absolute path and end with / eg. /var/www/project/ 15 | $config['SITE_PATH'] = realpath('..').'/template_engine/'; 16 | //$config['PROTECTED_FOLDER'] = 'protected/'; 17 | $config['BASE_PATH'] = realpath('../..').'/dooframework/'; 18 | 19 | //for production mode use 'prod' 20 | $config['APP_MODE'] = 'dev'; 21 | 22 | //----------------- optional, if not defined, default settings are optimized for production mode ---------------- 23 | $config['SUBFOLDER'] = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\','/',$config['SITE_PATH'])); 24 | if(strpos($config['SUBFOLDER'], '/')!==0){ 25 | $config['SUBFOLDER'] = '/'.$config['SUBFOLDER']; 26 | } 27 | 28 | $config['APP_URL'] = 'http://'.$_SERVER['HTTP_HOST'].$config['SUBFOLDER']; 29 | //$config['AUTOROUTE'] = TRUE; 30 | $config['DEBUG_ENABLED'] = TRUE; 31 | 32 | $config['TEMPLATE_COMPILE_ALWAYS'] = TRUE; 33 | 34 | //register functions to be used with your template files 35 | //$config['TEMPLATE_GLOBAL_TAGS'] = array('url', 'url2', 'time', 'isset', 'empty'); 36 | 37 | /** 38 | * defined either Document or Route to be loaded/executed when requested page is not found 39 | * A 404 route must be one of the routes defined in routes.conf.php (if autoroute on, make sure the controller and method exist) 40 | * Error document must be more than 512 bytes as IE sees it as a normal 404 sent if < 512b 41 | */ 42 | //$config['ERROR_404_DOCUMENT'] = 'error.php'; 43 | $config['ERROR_404_ROUTE'] = '/error'; 44 | 45 | /** 46 | * you can include self defined config, retrieved via Doo::conf()->variable 47 | * Use lower case for you own settings for future Compability with DooPHP 48 | */ 49 | //$config['pagesize'] = 10; 50 | 51 | ?> 52 | -------------------------------------------------------------------------------- /demos/template_engine/protected/config/routes.conf.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/template_engine/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | means page not found!'; 12 | $data['content'] = 'This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']'; 13 | $data['content'] .= '

Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.

Give some helpful comments other than 404 :(
Also check out the links page for a list of URLs available in this demo.

'; 14 | $data['baseurl'] = Doo::conf()->APP_URL; 15 | $data['printr'] = null; 16 | $this->view()->render('template', $data); 17 | } 18 | } 19 | ?> -------------------------------------------------------------------------------- /demos/template_engine/protected/model/Blog.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/template_engine/protected/model/Physical.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/template_engine/protected/model/Tag.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demos/template_engine/protected/model/Winner.php: -------------------------------------------------------------------------------- 1 | Physical = new Physical; 20 | } 21 | } 22 | ?> -------------------------------------------------------------------------------- /demos/template_engine/protected/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | TEMPLATE_GLOBAL_TAGS = array('upper', 'tofloat', 'sample_with_args', 'debug', 'triple'); 7 | 8 | 9 | /** 10 | Define as class (optional) 11 | 12 | class TemplateTag { 13 | public static test(){} 14 | public static test2(){} 15 | } 16 | **/ 17 | 18 | function upper($str){ 19 | return strtoupper($str); 20 | } 21 | 22 | function tofloat($str){ 23 | return sprintf("%.2f", $str); 24 | } 25 | 26 | function sample_with_args($str, $prefix){ 27 | return $str .' with args: '. $prefix; 28 | } 29 | 30 | function triple($str, $prefix='', $addup=0){ 31 | return ($str*3+$addup) .' ( '. $str. $prefix . $addup . ' )'; 32 | } 33 | 34 | function debug($var){ 35 | if(!empty($var)){ 36 | echo '
';
37 |         print_r($var);
38 |         echo '
'; 39 | } 40 | } 41 | 42 | ?> -------------------------------------------------------------------------------- /demos/template_engine/protected/view/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - Template Engine demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/template_engine/protected/view/links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO TOP 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /demos/template_engine/protected/view/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp Templating demo. Class used - DooView
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/template_engine/protected/view/nested/hi.html: -------------------------------------------------------------------------------- 1 |

This is include file nested in sub folder.

2 |
This is from a included template in a sub folder. view/nested/hi.html
3 | Variable value: {{nested}} 
-------------------------------------------------------------------------------- /demos/template_engine/protected/view/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/template_engine/protected/view/variable_include.html: -------------------------------------------------------------------------------- 1 |

This is include file using a variable as file name.

-------------------------------------------------------------------------------- /demos/template_engine/protected/viewc/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - Template Engine demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/template_engine/protected/viewc/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp Templating demo. Class used - DooView
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/template_engine/protected/viewc/nested/hi.php: -------------------------------------------------------------------------------- 1 |

This is include file nested in sub folder.

2 |
This is from a included template in a sub folder. view/nested/hi.html
3 | Variable value:  
-------------------------------------------------------------------------------- /demos/template_engine/protected/viewc/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 |

13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/template_engine/protected/viewc/variable_include.php: -------------------------------------------------------------------------------- 1 |

This is include with a variable.

-------------------------------------------------------------------------------- /demos/uri_routing/.htaccess.example: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | # if a directory or a file exists, use it directly 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | # otherwise forward it to index.php 8 | RewriteRule .* index.php 9 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 10 | 11 | -------------------------------------------------------------------------------- /demos/uri_routing/global/css/screen.css: -------------------------------------------------------------------------------- 1 | .boldy { 2 | color: #e7c118; 3 | font-weight: bold; 4 | } 5 | .file, .file a{ 6 | color:#729fbe; 7 | text-decoration:none; 8 | } 9 | .file a:hover{ 10 | text-decoration:underline; 11 | } 12 | body{ 13 | margin:0px 0px 0px; 14 | color:#fff; 15 | background-color:#2e3436; 16 | font-size:190%; 17 | font-family: 'Courier New', Courier, monospace; 18 | } 19 | 20 | .totop a{ 21 | font-size:60%; 22 | display:block; 23 | color: #fff; 24 | height:30px; 25 | line-height:30px; 26 | text-align:center; 27 | margin-right:60px; 28 | margin-bottom:60px; 29 | } 30 | .totop a:hover{ 31 | color:#e7c118; 32 | text-decoration:none; 33 | background-color:#242424; 34 | } 35 | 36 | .normal{ 37 | font-size:75%; 38 | margin-right:50px; 39 | } 40 | 41 | .nav{ 42 | float:left;clear:right;width:230px;display:block; 43 | } 44 | .nav li{ 45 | list-style-type:none; 46 | text-align:right; 47 | font-size:60%; 48 | display:block; 49 | height:30px; 50 | line-height:30px; 51 | } 52 | 53 | .nav li a{ 54 | display:block; 55 | padding-right:10px; 56 | color:#FFFFFF; 57 | text-decoration:none; 58 | background-color:#333333; 59 | } 60 | .nav li a:hover{ 61 | color:#e7c118; 62 | text-decoration:none; 63 | background-color:#242424; 64 | } 65 | 66 | .header{ 67 | background-color:#222222;height:60px;line-height:60px;padding-left:10px; 68 | } 69 | 70 | .top, .top a{ 71 | background-color:#151515;height:20px;padding-left:10px;text-align:right;color:#00FF99;font-size:12px;text-decoration:none;padding-right:5px; 72 | } 73 | .top a:hover{ 74 | color: yellow; 75 | } 76 | 77 | .content{ 78 | float:right;text-align:left;width:75%;display:block; 79 | } 80 | 81 | .content em{ 82 | font-size:60%; 83 | } 84 | 85 | h1{ 86 | font-size:120%; 87 | } 88 | p{ 89 | padding-top:10px; 90 | } 91 | pre{ 92 | font-size:50%; 93 | width:auto; 94 | margin-right:60px; 95 | background-color:#121212; 96 | padding:10px 15px 10px; 97 | border:1px solid #555; 98 | } 99 | 100 | pre a{ 101 | color:yellow; 102 | font-weight:bold; 103 | text-decoration:none; 104 | } 105 | pre a:hover{ 106 | color:#729fbe; 107 | font-weight:bold; 108 | text-decoration:none; 109 | } 110 | -------------------------------------------------------------------------------- /demos/uri_routing/global/js/common.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DooPHP demos 3 | */ 4 | var fontsize = 190; 5 | function smaller(){ 6 | fontsize *=0.9 7 | $("body").css("font-size", fontsize+'%'); 8 | } 9 | function larger(){ 10 | fontsize *=1.1 11 | $("body").css("font-size", fontsize+'%'); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/uri_routing/index.php: -------------------------------------------------------------------------------- 1 | set($config); 10 | include $config['BASE_PATH'].'diagnostic/debug.php'; 11 | 12 | Doo::app()->route = $route; 13 | Doo::app()->run(); 14 | ?> 15 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/config/common.conf.php: -------------------------------------------------------------------------------- 1 | BASE_PATH; 5 | */ 6 | error_reporting(E_ALL | E_STRICT); 7 | date_default_timezone_set('Asia/Kuala_Lumpur'); 8 | /** 9 | * for benchmark purpose, call Doo::benchmark() for time used. 10 | */ 11 | //$config['START_TIME'] = microtime(true); 12 | 13 | 14 | //framework use, must defined 15 | $config['SITE_PATH'] = realpath('..').'/uri_routing/'; 16 | //$config['PROTECTED_FOLDER'] = 'protected/'; 17 | $config['BASE_PATH'] = realpath('../..').'/dooframework/'; 18 | 19 | //for production mode use 'prod' 20 | $config['APP_MODE'] = 'dev'; 21 | 22 | //----------------- optional, if not defined, default settings are optimized for production mode ---------------- 23 | $config['SUBFOLDER'] = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\','/',$config['SITE_PATH'])); 24 | if(strpos($config['SUBFOLDER'], '/')!==0){ 25 | $config['SUBFOLDER'] = '/'.$config['SUBFOLDER']; 26 | } 27 | 28 | $config['APP_URL'] = 'http://'.$_SERVER['HTTP_HOST'].$config['SUBFOLDER']; 29 | $config['AUTOROUTE'] = TRUE; 30 | $config['DEBUG_ENABLED'] = TRUE; 31 | 32 | //$config['TEMPLATE_COMPILE_ALWAYS'] = TRUE; 33 | 34 | //register functions to be used with your template files 35 | //$config['TEMPLATE_GLOBAL_TAGS'] = array('url', 'url2', 'time', 'isset', 'empty'); 36 | 37 | /** 38 | * defined either Document or Route to be loaded/executed when requested page is not found 39 | * A 404 route must be one of the routes defined in routes.conf.php (if autoroute on, make sure the controller and method exist) 40 | * Error document must be more than 512 bytes as IE sees it as a normal 404 sent if < 512b 41 | */ 42 | //$config['ERROR_404_DOCUMENT'] = 'error.php'; 43 | $config['ERROR_404_ROUTE'] = '/error'; 44 | 45 | /** 46 | * you can include self defined config, retrieved via Doo::conf()->variable 47 | * Use lower case for you own settings for future Compability with DooPHP 48 | */ 49 | //$config['pagesize'] = 10; 50 | 51 | ?> 52 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/CamelCaseController.php: -------------------------------------------------------------------------------- 1 | index'; 18 | $data['content'] = 'camel case auto routing'; 19 | $data['baseurl'] = Doo::conf()->APP_URL; 20 | $data['printr'] = $this->params; 21 | $this->view()->render('template', $data); 22 | } 23 | 24 | public function moo(){ 25 | $data['title'] = 'CamelCaseController->moo'; 26 | $data['content'] = 'camel mooing??? Hell no!'; 27 | $data['baseurl'] = Doo::conf()->APP_URL; 28 | $data['printr'] = $this->params; 29 | $this->view()->render('template', $data); 30 | } 31 | } 32 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/ErrorController.php: -------------------------------------------------------------------------------- 1 | means page not found!'; 12 | $data['content'] = 'This is handler by an internal Route as defined in common.conf.php $config[\'ERROR_404_ROUTE\']'; 13 | $data['content'] .= '

Your error document needs to be more than 512 bytes in length. If not IE will display its default error page.

Give some helpful comments other than 404 :(
Also check out the links page for a list of URLs available in this demo.

'; 14 | $data['baseurl'] = Doo::conf()->APP_URL; 15 | $data['printr'] = null; 16 | $this->view()->render('template', $data); 17 | } 18 | } 19 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/HelloController.php: -------------------------------------------------------------------------------- 1 | index'; 7 | $data['content'] = 'Hello index'; 8 | $data['baseurl'] = Doo::conf()->APP_URL; 9 | $data['printr'] = $this->params; 10 | $this->view()->render('template', $data); 11 | } 12 | 13 | public function walao(){ 14 | $data['title'] = 'HelloController->walao'; 15 | $data['content'] ='Walao is a common expression by a Malaysian' ; 16 | $data['baseurl'] = Doo::conf()->APP_URL; 17 | $data['printr'] = $this->params; 18 | $this->view()->render('template', $data); 19 | } 20 | 21 | public function sayhi(){ 22 | if(isset($this->params[0])) 23 | if(isset($_GET['title'])) 24 | $data['content'] = 'Hi, ' . $_GET['title']. ' ' . $this->params[0]; 25 | else 26 | $data['content'] = 'Hi, ' . $this->params[0]; 27 | else 28 | $data['content'] = 'Please tell me your name!'; 29 | 30 | $data['title'] = 'HelloController->sayhi'; 31 | $data['baseurl'] = Doo::conf()->APP_URL; 32 | $data['printr'] = $this->params; 33 | $this->view()->render('template', $data); 34 | } 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/MainController.php: -------------------------------------------------------------------------------- 1 | Check out the links page for a list of URLs available in this demo.

'; 13 | $data['baseurl'] = Doo::conf()->APP_URL; 14 | $data['printr'] = null; 15 | $this->view()->render('about', $data); 16 | } 17 | 18 | public function url(){ 19 | $data['title'] = 'URL used in this demo'; 20 | $data['content'] = 'Replace :var with your values.
Request type */GET = You can test and visit these links.'; 21 | $data['baseurl'] = Doo::conf()->APP_URL; 22 | 23 | include Doo::conf()->SITE_PATH .'protected/config/routes.conf.php'; 24 | $data['printr'] = array(); 25 | $n = 1; 26 | foreach($route as $req=>$r){ 27 | foreach($r as $rname=>$value){ 28 | //$rname_strip = (strpos($rname, '/')===0)? substr($rname, 1, strlen($rname)) : $rname; 29 | $rname_strip = 'index.php'.$rname; 30 | $data['printr'][$n++ .strtoupper(" $req")] = ''.$rname.''; 31 | } 32 | } 33 | $this->view()->render('template', $data); 34 | } 35 | 36 | public function example(){ 37 | $data['baseurl'] = Doo::conf()->APP_URL; 38 | $data['printr'] = file_get_contents(Doo::conf()->SITE_PATH .'protected/config/routes.conf.php'); 39 | $this->view()->render('example', $data); 40 | } 41 | 42 | 43 | } 44 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/NewsController.php: -------------------------------------------------------------------------------- 1 | show_news_by_id'; 7 | $data['content'] ='News id is '.$this->params['id']; 8 | $data['baseurl'] = Doo::conf()->APP_URL; 9 | $data['printr'] = $this->params; 10 | $this->view()->render('template', $data); 11 | } 12 | 13 | public function show_news_by_year_month(){ 14 | $data['title'] = 'NewsController->show_news_by_year_month'; 15 | $data['content'] ='News in month '.$this->params['month'] .', year '.$this->params['year'] ; 16 | $data['baseurl'] = Doo::conf()->APP_URL; 17 | $data['printr'] = $this->params; 18 | $this->view()->render('template', $data); 19 | } 20 | 21 | public function show_news_by_title(){ 22 | $data['title'] = 'NewsController->show_news_by_title'; 23 | $data['content'] ='News title is '. str_replace('%20', ' ', $this->params['title']); 24 | $data['baseurl'] = Doo::conf()->APP_URL; 25 | $data['printr'] = $this->params; 26 | $this->view()->render('template', $data); 27 | } 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/RestController.php: -------------------------------------------------------------------------------- 1 | extension){ 11 | case '.json': 12 | $result = json_encode($data); 13 | $format = 'JSON format'; 14 | break; 15 | case '.xml': 16 | $result = htmlentities("{$data['food']}{$data['type']}{$data['rating']}"); 17 | $format = 'XML format'; 18 | break; 19 | } 20 | $data['title'] = 'RestController->listFood'; 21 | $data['content'] = 'Food result in '.$format; 22 | $data['baseurl'] = Doo::conf()->APP_URL; 23 | $data['printr'] = $result; 24 | $this->view()->render('template', $data); 25 | } 26 | 27 | public function createFood(){ 28 | echo "RestController->createFood\n\n"; 29 | echo "Food created with data:\n"; 30 | print_r($_POST); 31 | } 32 | 33 | public function updateFood(){ 34 | echo "RestController->updateFood\n\n"; 35 | echo "Food updated with data:\n"; 36 | print_r($this->puts); 37 | } 38 | 39 | public function deleteFood(){ 40 | echo "RestController->deleteFood\n\n"; 41 | echo "Food deleted with id:\n"; 42 | print_r($this->params['id']); 43 | } 44 | 45 | } 46 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/SimpleController.php: -------------------------------------------------------------------------------- 1 | simple'; 17 | 18 | if(!empty($this->extension)) 19 | $data['content'] = 'Simple test, extension: ' . $this->extension; 20 | else 21 | $data['content'] = 'Simple extension test'; 22 | $data['baseurl'] = Doo::conf()->APP_URL; 23 | $data['printr'] = $this->params; 24 | $this->view()->render('template', $data); 25 | } 26 | 27 | } 28 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/controller/admin/AdminController.php: -------------------------------------------------------------------------------- 1 | index'; 16 | $data['content'] = 'Thanks for logging in to admin!'; 17 | $data['baseurl'] = Doo::conf()->APP_URL; 18 | $data['printr'] = $this->params; 19 | $this->view()->render('template', $data); 20 | } 21 | 22 | } 23 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/plugin/TemplateTag.php: -------------------------------------------------------------------------------- 1 | TEMPLATE_GLOBAL_TAGS = array('upper', 'tofloat', 'sample_with_args', 'debug'); 7 | 8 | /** 9 | Define as class (optional) 10 | 11 | class TemplateTag { 12 | public static test(){} 13 | public static test2(){} 14 | } 15 | **/ 16 | 17 | function upper($str){ 18 | return strtoupper($str); 19 | } 20 | 21 | function tofloat($str){ 22 | return sprintf("%.2f", $str); 23 | } 24 | 25 | function sample_with_args($str, $prefix){ 26 | return $str .' with args '. $prefix; 27 | } 28 | 29 | function debug($var){ 30 | if(!empty($var)){ 31 | echo '
';
32 |         print_r($var);
33 |         echo '
'; 34 | } 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /demos/uri_routing/protected/view/header.html: -------------------------------------------------------------------------------- 1 | DooPHP - URI Routing demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/view/links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO TOP 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/view/nav.html: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp URI routing demo. Class used - DooURIRouter
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/view/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

{{title}}

11 |

Result: {{content}}

12 |

{{debug(printr)}} 13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/viewc/header.php: -------------------------------------------------------------------------------- 1 | DooPHP - URI Routing demo 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/viewc/nav.php: -------------------------------------------------------------------------------- 1 | 2 |
[-][+] demo@doophp
3 |
Doophp URI routing demo. Class used - DooURIRouter
4 |
5 | ...
6 | -------------------------------------------------------------------------------- /demos/uri_routing/protected/viewc/template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 |

Result:

12 |

13 |

14 | BACK TO LAST PAGE 15 |
16 | 17 | -------------------------------------------------------------------------------- /dooframework/cache/DooApcCache.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doophp.com/ 7 | * @copyright Copyright © 2009 Leng Sheng Hong 8 | * @license http://www.doophp.com/license 9 | */ 10 | 11 | 12 | /** 13 | * DooApcCache provides caching methods utilizing the APC extension. 14 | * 15 | * @author Leng Sheng Hong 16 | * @version $Id: DooFrontCache.php 1000 2009-08-22 19:36:10 17 | * @package doo.cache 18 | * @since 1.1 19 | */ 20 | 21 | class DooApcCache{ 22 | 23 | /** 24 | * Adds a cache with an unique Id. 25 | * 26 | * @param string $id Cache Id 27 | * @param mixed $data Data to be stored 28 | * @param int $expire Seconds to expired 29 | * @return bool True if success 30 | */ 31 | public function set($id, $data, $expire=0){ 32 | return apc_store($id, $data, $expire); 33 | } 34 | 35 | /** 36 | * Retrieves a value from cache with an Id. 37 | * 38 | * @param string|array $id A unique key identifying the cache or a list of keys. 39 | * @return mixed The value stored in cache. Return false if no cache found or already expired. 40 | */ 41 | public function get($id){ 42 | return apc_fetch($id); 43 | } 44 | 45 | /** 46 | * Deletes an APC data cache with an identifying Id 47 | * 48 | * @param string $id Id of the cache 49 | * @return bool True if success 50 | */ 51 | public function flush($id){ 52 | return apc_delete($id); 53 | } 54 | 55 | /** 56 | * Deletes all APC data cache 57 | * @return bool True if success 58 | */ 59 | public function flushAll(){ 60 | return apc_clear_cache('user'); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /dooframework/cache/DooEAcceleratorCache.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doophp.com/ 7 | * @copyright Copyright © 2009 Leng Sheng Hong 8 | * @license http://www.doophp.com/license 9 | */ 10 | 11 | 12 | /** 13 | * DooEAcceleratorCache provides caching methods utilizing the EAccelerator extension. 14 | * 15 | * @author Leng Sheng Hong 16 | * @version $Id: DooEAcceleratorCache.php 1000 2009-08-22 19:36:10 17 | * @package doo.cache 18 | * @since 1.1 19 | */ 20 | 21 | class DooEAcceleratorCache{ 22 | 23 | /** 24 | * Adds a cache with an unique Id. 25 | * 26 | * @param string $id Cache Id 27 | * @param mixed $data Data to be stored 28 | * @param int $expire Seconds to expired 29 | * @return bool True if success 30 | */ 31 | public function set($id, $data, $expire=0){ 32 | return eaccelerator_put($id, $data, $expire); 33 | } 34 | 35 | /** 36 | * Retrieves a value from cache with an Id. 37 | * 38 | * @param string $id A unique key identifying the cache 39 | * @return mixed The value stored in cache. Return false if no cache found or already expired. 40 | */ 41 | public function get($id){ 42 | return eaccelerator_get($id); 43 | } 44 | 45 | /** 46 | * Deletes an EAccelerator data cache with an identifying Id 47 | * 48 | * @param string $id Id of the cache 49 | * @return bool True if success 50 | */ 51 | public function flush($id){ 52 | return eaccelerator_rm($id); 53 | } 54 | 55 | /** 56 | * Deletes all EAccelerator data cache 57 | */ 58 | public function flushAll(){ 59 | //delete expired content then delete all 60 | eaccelerator_gc(); 61 | 62 | $idkeys = eaccelerator_list_keys(); 63 | 64 | foreach($idkeys as $k) 65 | $this->flush(substr($k['name'], 1)); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /dooframework/cache/DooXCache.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doophp.com/ 7 | * @copyright Copyright © 2009 Leng Sheng Hong 8 | * @license http://www.doophp.com/license 9 | */ 10 | 11 | 12 | /** 13 | * DooXCache provides caching methods utilizing XCache. 14 | * 15 | * @author Leng Sheng Hong 16 | * @version $Id: DooXCache.php 1000 2009-08-22 19:36:10 17 | * @package doo.cache 18 | * @since 1.1 19 | */ 20 | 21 | class DooXCache{ 22 | 23 | /** 24 | * Adds a cache with an unique Id. 25 | * 26 | * @param string $id Cache Id 27 | * @param mixed $data Data to be stored 28 | * @param int $expire Seconds to expired 29 | * @return bool True if success 30 | */ 31 | public function set($id, $data, $expire=0){ 32 | return xcache_set($id, $data, $expire); 33 | } 34 | 35 | /** 36 | * Retrieves a value from cache with an Id. 37 | * 38 | * @param string $id A unique key identifying the cache 39 | * @return mixed The value stored in cache. Return false if no cache found or already expired. 40 | */ 41 | public function get($id){ 42 | return xcache_get($id); 43 | } 44 | 45 | /** 46 | * Deletes an data cache with an identifying Id 47 | * 48 | * @param string $id Id of the cache 49 | * @return bool True if success 50 | */ 51 | public function flush($id){ 52 | return xcache_unset($id); 53 | } 54 | 55 | /** 56 | * Deletes all data cache 57 | * @return bool True if success 58 | */ 59 | public function flushAll(){ 60 | return xcache_clear_cache(); 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /dooframework/db/DooDbExpression.php: -------------------------------------------------------------------------------- 1 | 6 | * @link http://www.doophp.com/ 7 | * @copyright Copyright © 2009 Leng Sheng Hong 8 | * @license http://www.doophp.com/license 9 | */ 10 | 11 | 12 | /** 13 | * DooDbExpression represents a DB expression that does not need escaping. 14 | * DooDbExpression is mainly used with DooSqlMagic as attribute values. When inserting or updating a database record, 15 | * attribute values of type DooDbExpression will be directly put into the corresponding SQL statement without escaping. 16 | * A typical usage is that an attribute is set with 'NOW()' expression so that saving the record would fill the corresponding column with the current DB server timestamp. 17 | * 18 | * Doo::loadCore('db/DooDbExpression'); 19 | * $usr = new User; 20 | * $usr->create_date = new DooDbExpression('NOW()'); 21 | * //$usr->create_date = 'NOW()'; will insert the date as a string 'NOW()' as it is escaped. 22 | * Doo::db()->insert($usr); 23 | * 24 | * 25 | * @author Leng Sheng Hong 26 | * @version $Id: DooDbExpression.php 1000 2009-07-7 18:27:22 27 | * @package doo.db 28 | * @since 1.0 29 | */ 30 | class DooDbExpression { 31 | 32 | private $expression; 33 | 34 | /** 35 | * Skip parameter binding on values. 36 | * @var bool 37 | */ 38 | public $skipBinding; 39 | 40 | /** 41 | * Use OR statement instead of AND 42 | * @var bool 43 | */ 44 | public $useOrStatement; 45 | 46 | function __construct($expression, $useOrStatement=FALSE, $skipBinding=FALSE) { 47 | $this->expression = $expression; 48 | $this->useOrStatement = $useOrStatement; 49 | $this->skipBinding = $skipBinding; 50 | } 51 | 52 | function __toString() { 53 | return $this->expression; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /dooframework/diagnostic/assets/bg-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/dooframework/diagnostic/assets/bg-down.png -------------------------------------------------------------------------------- /dooframework/diagnostic/assets/bg-footer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/dooframework/diagnostic/assets/bg-footer.gif -------------------------------------------------------------------------------- /dooframework/diagnostic/assets/bgcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/dooframework/diagnostic/assets/bgcode.png -------------------------------------------------------------------------------- /dooframework/diagnostic/assets/logo-b2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkredz/DooPHP/b5f89db87ea41a7f14a54c7d974fdf098f290a12/dooframework/diagnostic/assets/logo-b2.png --------------------------------------------------------------------------------