├── .gitattributes ├── .gitignore ├── .htaccess ├── Gruntfile.coffee ├── README.md ├── app ├── cache │ └── .gitkeep ├── controllers │ ├── ControllerBase.php │ └── IndexController.php ├── models │ ├── Affiliates.php │ └── ModelBase.php ├── resources │ ├── config │ │ ├── config.php │ │ ├── loader.php │ │ └── services.php │ ├── library │ │ ├── Elements │ │ │ └── Internal.php │ │ └── Mail │ │ │ └── Mail.php │ └── plugins │ │ ├── MysqlExtended.php │ │ └── Security.php └── views │ ├── index.volt │ ├── index │ ├── index.volt │ └── test.volt │ └── layouts │ └── template.volt ├── bower.json ├── composer.json ├── composer.lock ├── composer_libraries ├── autoload.php ├── composer │ ├── ClassLoader.php │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ └── installed.json └── phpmailer │ └── phpmailer │ ├── .gitignore │ ├── .scrutinizer.yml │ ├── .travis.yml │ ├── LICENSE │ ├── PHPMailerAutoload.php │ ├── README.md │ ├── changelog.md │ ├── class.phpmailer.php │ ├── class.pop3.php │ ├── class.smtp.php │ ├── composer.json │ ├── docs │ ├── Callback_function_notes.txt │ ├── DomainKeys_notes.txt │ ├── Note_for_SMTP_debugging.txt │ ├── extending.html │ ├── faq.html │ ├── generatedocs.sh │ └── pop3_article.txt │ ├── examples │ ├── LGPLv3.txt │ ├── code_generator.phps │ ├── contents.html │ ├── exceptions.phps │ ├── gmail.phps │ ├── images │ │ ├── phpmailer.png │ │ └── phpmailer_mini.png │ ├── index.html │ ├── mail.phps │ ├── mailing_list.phps │ ├── pop_before_smtp.phps │ ├── scripts │ │ ├── XRegExp.js │ │ ├── shAutoloader.js │ │ ├── shBrushPhp.js │ │ ├── shCore.js │ │ └── shLegacy.js │ ├── sendmail.phps │ ├── smtp.phps │ ├── smtp_no_auth.phps │ └── styles │ │ ├── shCore.css │ │ ├── shCoreDefault.css │ │ ├── shCoreDjango.css │ │ ├── shCoreEclipse.css │ │ ├── shCoreEmacs.css │ │ ├── shCoreFadeToGrey.css │ │ ├── shCoreMDUltra.css │ │ ├── shCoreMidnight.css │ │ ├── shCoreRDark.css │ │ ├── shThemeAppleScript.css │ │ ├── shThemeDefault.css │ │ ├── shThemeDjango.css │ │ ├── shThemeEclipse.css │ │ ├── shThemeEmacs.css │ │ ├── shThemeFadeToGrey.css │ │ ├── shThemeMDUltra.css │ │ ├── shThemeMidnight.css │ │ ├── shThemeRDark.css │ │ ├── shThemeVisualStudio.css │ │ └── wrapping.png │ ├── extras │ ├── EasyPeasyICS.php │ ├── class.html2text.php │ ├── htmlfilter.php │ └── ntlm_sasl_client.php │ ├── language │ ├── phpmailer.lang-ar.php │ ├── phpmailer.lang-be.php │ ├── phpmailer.lang-br.php │ ├── phpmailer.lang-ca.php │ ├── phpmailer.lang-ch.php │ ├── phpmailer.lang-cz.php │ ├── phpmailer.lang-de.php │ ├── phpmailer.lang-dk.php │ ├── phpmailer.lang-el.php │ ├── phpmailer.lang-eo.php │ ├── phpmailer.lang-es.php │ ├── phpmailer.lang-et.php │ ├── phpmailer.lang-fa.php │ ├── phpmailer.lang-fi.php │ ├── phpmailer.lang-fo.php │ ├── phpmailer.lang-fr.php │ ├── phpmailer.lang-gl.php │ ├── phpmailer.lang-he.php │ ├── phpmailer.lang-hr.php │ ├── phpmailer.lang-hu.php │ ├── phpmailer.lang-it.php │ ├── phpmailer.lang-ja.php │ ├── phpmailer.lang-ka.php │ ├── phpmailer.lang-lt.php │ ├── phpmailer.lang-lv.php │ ├── phpmailer.lang-nl.php │ ├── phpmailer.lang-no.php │ ├── phpmailer.lang-pl.php │ ├── phpmailer.lang-pt.php │ ├── phpmailer.lang-ro.php │ ├── phpmailer.lang-ru.php │ ├── phpmailer.lang-se.php │ ├── phpmailer.lang-sk.php │ ├── phpmailer.lang-sr.php │ ├── phpmailer.lang-tr.php │ ├── phpmailer.lang-uk.php │ ├── phpmailer.lang-vi.php │ ├── phpmailer.lang-zh.php │ └── phpmailer.lang-zh_cn.php │ ├── test │ ├── bootstrap.php │ ├── fakepopserver.sh │ ├── fakesendmail.sh │ ├── phpmailerLangTest.php │ ├── phpmailerTest.php │ ├── runfakepopserver.sh │ ├── test_callback.php │ └── testbootstrap-dist.php │ └── travis.phpunit.xml.dist ├── package.json └── public ├── .htaccess ├── assets ├── css │ ├── app │ │ ├── sass │ │ │ ├── partials │ │ │ │ ├── _global-functions.sass │ │ │ │ ├── _global-variables.sass │ │ │ │ └── _internal-report.sass │ │ │ └── style.sass │ │ └── style.css │ └── vendor │ │ ├── bootstrap.css │ │ └── font-awesome.css ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── img │ ├── dist │ │ └── logo.png │ └── src │ │ └── logo.png └── js │ ├── app │ └── coffeescripts │ │ ├── name-space-example-original.js │ │ └── namespace-example.coffee │ └── vendor │ ├── bootstrap.min.js │ ├── jquery.min.js │ └── moment.min.js ├── favicon.ico └── index.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | *.cs text diff=csharp 5 | *.java text diff=java 6 | *.html text diff=html 7 | *.css text 8 | *.js text 9 | *.sql text 10 | 11 | *.csproj text merge=union 12 | *.sln text merge=union eol=crlf 13 | 14 | *.docx diff=astextplain 15 | *.DOCX diff=astextplain 16 | 17 | # absolute paths are ok, as are globs 18 | /**/postinst* text eol-lf 19 | 20 | # paths that don't start with / are treated relative to the .gitattributes folder 21 | relative/path/*.txt text eol-lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ######################## 2 | # node.js / npm 3 | ######################## 4 | lib-cov 5 | *.seed 6 | *.log 7 | *.csv 8 | *.dat 9 | *.out 10 | *.pid 11 | *.gz 12 | 13 | pids 14 | logs 15 | results 16 | 17 | node_modules 18 | bower_components 19 | 20 | app/cache/*.php 21 | public/assets/js/app/sourcemaps 22 | public/assets/css/app/sourcemaps 23 | 24 | npm-debug.log 25 | 26 | ########################### 27 | # misc 28 | ########################### 29 | .sass-cache 30 | public/assets/js/app/sourcemaps/* 31 | public/assets/js/app/*.js -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine on 3 | RewriteRule ^$ public/ [L] 4 | RewriteRule (.*) public/$1 [L] 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Phalcon PHP is a web framework delivered as a C extension providing high performance and lower resource consumption. 2 | 3 | PhalconPHP Sample Project Setup Example 4 | ======================================= 5 | 6 | PhalconPHP + Grunt + Composer + Bower + Git 7 | 8 | This is an example of how to combine the use of many popular automation tools with the Phalcon PHP Framework. This setup is intended for building web applications with scalability in mind. 9 | 10 | Phalcon PHP 11 | ----------- 12 | 13 | In this setup I'm using: 14 | 15 | - Volt templating engine 16 | - Universal Class Loader is registering the external classes via namespaces (maximizing speed) 17 | - Config files, libary and plugins are pooled into a resources folder for better organization 18 | - Under app/models, added a ModelBase.php which serves the same purpose as the ControllerBase.php but for common model functions 19 | - Extending the PHQL with MysqlExtended plugin so that useful mysql functionalities such as DATE_INTERVAL, FULLTEXT_MATCH can be supported 20 | 21 | Grunt 22 | ----- 23 | 24 | Grunt has become an essential tool for demanding projects. Look through the Gruntfile.coffee for ideas for your own project. 25 | 26 | Notable highlights: 27 | 28 | - Gruntfile written in coffeescript 29 | - Preprocessors such as coffeescript, sass /w compass, imagemin 30 | - Package.json separates out development and product dependencies 31 | 32 | Composer 33 | -------- 34 | 35 | Simplistic way to include third party php libraries for your projects with autoloading enabled. I've included PHPMailer in this repo as the example 36 | 37 | Bower 38 | ----- 39 | 40 | Bower has been something I've played around for a while. While its great at syncing down the latest resource packages such as bootstrap, fontawesome, it downloads the entire repository. One of the grunt automation I used often is Sails-Linker. It auto-inserts the css and script tags in the layout file. The bloated files bower downloads conflicts /w sails-linker. For those who prefers to manually update the css/js links, bower is still a very useful package manager for you. 41 | 42 | Git 43 | --- 44 | 45 | This is essential to any collaborative project for both version control and deployment. 46 | 47 | Notable highlights: 48 | - putting .gitkeep in any empty folders, otherwise git won't sync them. This is important for the cache folder that Volt requires 49 | - gitattributes Auto detect text files and perform LF normalization. This is important if you have both mac and window teammates working on the same project 50 | - do not sync sourcemap files 51 | -------------------------------------------------------------------------------- /app/cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewartx/PhalconPHP-Setup-Example/fd04ffbe287eab8cc2a2e697a29f682ae0c29441/app/cache/.gitkeep -------------------------------------------------------------------------------- /app/controllers/ControllerBase.php: -------------------------------------------------------------------------------- 1 | tag->prependTitle("Amplus | "); 12 | 13 | $this->config = $this->di->get('config'); 14 | $this->view->baseUrl = $this->config->application->baseUri; 15 | } 16 | 17 | protected function sendMailAction() { 18 | $email_fields = array( 19 | "subject" => "test", 20 | "toName" => "Amplus", 21 | "content" => "content" 22 | ); 23 | $this->di->get("mail")->send("info@amplusmarketing.com", $email_fields); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /app/controllers/IndexController.php: -------------------------------------------------------------------------------- 1 | tag->appendTitle("Dashboard"); 11 | } 12 | 13 | public function indexAction() { 14 | $this->view->hello = "hi"; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /app/models/Affiliates.php: -------------------------------------------------------------------------------- 1 | getDI()->getFlash(); 11 | 12 | //Show validation messages 13 | foreach ($this->getMessages() as $message) { 14 | $flash->error($message); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /app/resources/config/config.php: -------------------------------------------------------------------------------- 1 | 'Mysql', 10 | 'host' => '', 11 | 'username' => '', 12 | 'password' => '', 13 | 'name' => '' 14 | ); 15 | 16 | $localDB = array( 17 | 'adapter' => 'Mysql', 18 | 'host' => 'localhost', 19 | 'username' => 'root', 20 | 'password' => '', 21 | 'name' => '' 22 | ); 23 | 24 | // Paths 25 | $applicationPaths = array( 26 | 'controllersDir' => APP_DIR . '/controllers/', 27 | 'modelsDir' => APP_DIR . '/models/', 28 | 'viewsDir' => APP_DIR . '/views/', 29 | 'pluginsDir' => APP_DIR . '/resources/plugins/', 30 | 'libraryDir' => APP_DIR . '/resources/library/', 31 | 'cacheDir' => APP_DIR . '/cache/' 32 | ); 33 | 34 | $localPath = $applicationPaths; 35 | $localPath['baseUri'] = "/phalcon-example/"; 36 | 37 | $remotePath = $applicationPaths; 38 | $remotePath['baseUri'] = "/"; 39 | 40 | // mail 41 | $mail = array( 42 | "fromName" => "System Admin", 43 | "fromEmail" => "webmaster@amplusmarketing.com", 44 | "smtp" => array( 45 | 'server' => 'smtp.gmail.com', 46 | 'port' => 587, 47 | 'security' => 'tls', 48 | 'username' => '', 49 | 'password' => '', 50 | 'debug' => false 51 | ) 52 | ); 53 | 54 | /****** 3 Cases *******/ 55 | 56 | // Case 1: Working Locally 57 | if ($isLocal) { 58 | return new Config(array( 59 | 'database' => $localDB, 60 | 'application' => $localPath, 61 | 'mail' => $mail 62 | )); 63 | } 64 | 65 | // Case 3: Remote, Production Site 66 | if($isProduction) { 67 | return new Config(array( 68 | 'database' => $remoteDB, 69 | 'application' => $remotePath, 70 | 'mail' => $mail 71 | )); 72 | } -------------------------------------------------------------------------------- /app/resources/config/loader.php: -------------------------------------------------------------------------------- 1 | registerNamespaces(array( 10 | "Amplus\Controllers" => $config->application->controllersDir, 11 | "Amplus\Models" => $config->application->modelsDir, 12 | "Amplus\Plugins" => $config->application->pluginsDir, 13 | "Amplus" => $config->application->libraryDir 14 | )); 15 | 16 | $loader->register(); 17 | 18 | require_once __DIR__ . '/../../../composer_libraries/autoload.php'; -------------------------------------------------------------------------------- /app/resources/config/services.php: -------------------------------------------------------------------------------- 1 | set('url', function () use ($config) { 24 | $url = new UrlResolver(); 25 | $url->setBaseUri($config->application->baseUri); 26 | 27 | return $url; 28 | }, true); 29 | 30 | 31 | /** 32 | * Setting up the view component 33 | */ 34 | $di->set('view', function () use ($config) { 35 | 36 | $view = new View(); 37 | 38 | $view->setViewsDir($config->application->viewsDir); 39 | 40 | $view->registerEngines(array( 41 | '.volt' => function($view, $di) use ($config) { 42 | $volt = new VoltEngine($view, $di); 43 | $volt->setOptions(array( 44 | 'compiledPath' => $config->application->cacheDir, 45 | 'compiledSeparator' => '_', 46 | 'compileAlways' => true 47 | )); 48 | return $volt; 49 | }, 50 | '.phtml' => 'Phalcon\Mvc\View\Engine\Php' 51 | )); 52 | 53 | return $view; 54 | }, true); 55 | 56 | // Passing on the config to dipatcher so we can access this information later 57 | $di->set('config', $config); 58 | 59 | /** 60 | * Database connection is created based in the parameters defined in the configuration file 61 | */ 62 | $di->set('db', function () use ($config) { 63 | return new DbAdapter(array( 64 | 'host' => $config->database->host, 65 | 'username' => $config->database->username, 66 | 'password' => $config->database->password, 67 | 'dbname' => $config->database->name, 68 | "charset" => 'utf8', 69 | 'dialectClass' => '\Amplus\Plugins\MysqlExtended' 70 | )); 71 | }); 72 | 73 | /** 74 | * If the configuration specify the use of metadata adapter use it or use memory otherwise 75 | */ 76 | $di->set('modelsMetadata', function () { 77 | return new MetaDataAdapter(); 78 | }); 79 | 80 | 81 | /** 82 | * Start the session the first time some component request the session service 83 | */ 84 | $di->set('session', function () { 85 | $session = new SessionAdapter(array( 86 | "uniqueId" => "amplus" 87 | )); 88 | $session->start(); 89 | 90 | return $session; 91 | }); 92 | 93 | $di->set('router', function(){ 94 | $router = new \Phalcon\Mvc\Router(); 95 | 96 | $router 97 | ->add('/:controller/:action/:params', array( 98 | 'controller' => 1, 99 | 'action' => 2, 100 | 'params' => 3 101 | )) 102 | ->convert('action', function($action) { //The action name allows dashes 103 | $actionParts = explode("-", $action); $partName = ""; 104 | foreach($actionParts as $key => $part) { 105 | $partName .= ($key == 0) ? $part : ucfirst($part); 106 | } 107 | return $partName; 108 | }); 109 | 110 | //Remove trailing slashes automatically 111 | $router->removeExtraSlashes(true); 112 | 113 | return $router; 114 | }); 115 | 116 | //Register the flash service with custom CSS classes 117 | $di->set('flash', function(){ 118 | $flash = new \Phalcon\Flash\Direct(array( 119 | 'error' => 'alert alert-error', 120 | 'success' => 'alert alert-success', 121 | 'notice' => 'alert alert-info', 122 | )); 123 | return $flash; 124 | }); 125 | 126 | //Register an user component 127 | $di->set('internal', function(){ 128 | return new Elements\Internal(); 129 | }); 130 | 131 | /** 132 | * Mail service uses gmail 133 | */ 134 | $di->set('mail', function () { 135 | return new Mail(); 136 | }); 137 | 138 | /** 139 | * Dispatcher use a default namespace 140 | */ 141 | $di->set('dispatcher', function () { 142 | $dispatcher = new Dispatcher(); 143 | $dispatcher->setDefaultNamespace('Amplus\Controllers'); 144 | return $dispatcher; 145 | }); 146 | 147 | 148 | /** 149 | * Set the dispatcher to be available for use and enable Security plugin 150 | **/ 151 | // $di->set('dispatcher', function() use ($di) { 152 | // //Obtain the standard eventsManager from the DI 153 | // $eventsManager = $di->getShared('eventsManager'); 154 | 155 | // $eventsManager->attach("dispatch:beforeException", function($event, $dispatcher, $exception) { 156 | // switch ($exception->getCode()) { 157 | // case Dispatcher::EXCEPTION_HANDLER_NOT_FOUND: 158 | // case Dispatcher::EXCEPTION_ACTION_NOT_FOUND: 159 | // $dispatcher->forward( 160 | // array( 161 | // 'controller' => 'index', 162 | // 'action' => 'show404', 163 | // ) 164 | // ); 165 | // return false; 166 | // } 167 | // } 168 | // ); 169 | 170 | // // //Instantiate the Security plugin 171 | // $security = new \Amplus\Plugins\Security($di); 172 | 173 | // // //Listen for events produced in the dispatcher using the Security plugin 174 | // $eventsManager->attach('dispatch', $security); 175 | 176 | // $dispatcher = new Dispatcher(); 177 | 178 | // //Bind the EventsManager to the Dispatcher 179 | // $dispatcher->setEventsManager($eventsManager); 180 | 181 | // return $dispatcher; 182 | // }); -------------------------------------------------------------------------------- /app/resources/library/Elements/Internal.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | "; 15 | } 16 | } -------------------------------------------------------------------------------- /app/resources/library/Mail/Mail.php: -------------------------------------------------------------------------------- 1 | config->mail; 17 | $mail = new \PHPMailer; 18 | 19 | $mail->isSMTP(); // Set mailer to use SMTP 20 | $mail->Host = $mailSettings->smtp->server; // Specify main and backup SMTP servers 21 | $mail->SMTPAuth = true; // Enable SMTP authentication 22 | $mail->Username = $mailSettings->smtp->username; // SMTP username 23 | $mail->Password = $mailSettings->smtp->password; // SMTP password 24 | $mail->SMTPSecure = $mailSettings->smtp->security; // Enable encryption, 'ssl' also accepted 25 | 26 | $mail->From = $mailSettings->fromEmail; 27 | $mail->FromName = $mailSettings->fromName; 28 | $mail->addAddress($to, $email_fields['subject']); // Name is optional 29 | 30 | $mail->Subject = $subject; 31 | $mail->Body = $email_fields['content']; 32 | $mail->SMTPDebug = $mailSettings->smtp->debug; 33 | 34 | if(!$mail->send()) { 35 | $this->flash->notice('Message could not be sent.'); 36 | $this->flash->error('Mailer Error: ' . $mail->ErrorInfo); 37 | } else { 38 | $this->flash->success('Message has been sent'); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /app/resources/plugins/MysqlExtended.php: -------------------------------------------------------------------------------- 1 | | 17 | | Eduar Carvajal | 18 | +------------------------------------------------------------------------+ 19 | */ 20 | 21 | namespace Amplus\Plugins; 22 | 23 | /** 24 | * Phalcon\Db\Adapter\Dialect\MysqlExtended 25 | * 26 | * Every query executed via this adapter is automatically cached 27 | */ 28 | class MysqlExtended extends \Phalcon\Db\Dialect\Mysql 29 | { 30 | 31 | /** 32 | * Transforms an intermediate representation for a expression into a database system valid expression 33 | * 34 | * @param array expression 35 | * @param string escapeChar 36 | * @return string 37 | */ 38 | public function getSqlExpression($expression, $escapeChar = null) 39 | { 40 | 41 | if ($expression["type"] == 'functionCall') { 42 | 43 | switch ($expression["name"]) { 44 | 45 | case 'DATE_INTERVAL': 46 | 47 | if (count($expression["arguments"]) != 2) { 48 | throw new \Exception('DATE_INTERVAL requires 2 parameters'); 49 | } 50 | 51 | switch ($expression["arguments"][1]['value']) { 52 | 53 | case "'DAY'": 54 | return 'INTERVAL ' . $this->getSqlExpression($expression["arguments"][0]) . ' DAY'; 55 | 56 | case "'MONTH'": 57 | return 'INTERVAL ' . $this->getSqlExpression($expression["arguments"][0]) . ' MONTH'; 58 | 59 | case "'YEAR'": 60 | return 'INTERVAL ' . $this->getSqlExpression($expression["arguments"][0]) . ' YEAR'; 61 | } 62 | break; 63 | 64 | case 'FULLTEXT_MATCH': 65 | 66 | if (count($expression["arguments"]) < 2) { 67 | throw new \Exception('FULLTEXT_MATCH requires 2 parameters'); 68 | } 69 | 70 | $arguments = array(); 71 | $length = count($expression["arguments"]) - 1; 72 | for ($i = 0; $i < $length; $i++) { 73 | $arguments[] = $this->getSqlExpression($expression["arguments"][$i]); 74 | } 75 | 76 | return 'MATCH(' . join(', ', $arguments) . ') AGAINST (' . 77 | $this->getSqlExpression($expression["arguments"][$length]) . ')'; 78 | 79 | case 'FULLTEXT_MATCH_BMODE': 80 | 81 | if (count($expression["arguments"]) < 2) { 82 | throw new \Exception('FULLTEXT_MATCH requires 2 parameters'); 83 | } 84 | 85 | $arguments = array(); 86 | $length = count($expression["arguments"]) - 1; 87 | for ($i = 0; $i < $length; $i++) { 88 | $arguments[] = $this->getSqlExpression($expression["arguments"][$i]); 89 | } 90 | 91 | return 'MATCH(' . join(', ', $arguments) . ') AGAINST (' . 92 | $this->getSqlExpression($expression["arguments"][$length]) . ' IN BOOLEAN MODE)'; 93 | } 94 | } 95 | 96 | return parent::getSqlExpression($expression, $escapeChar); 97 | } 98 | } -------------------------------------------------------------------------------- /app/resources/plugins/Security.php: -------------------------------------------------------------------------------- 1 | _dependencyInjector = $dependencyInjector; 22 | } 23 | 24 | public function _getAcl() 25 | { 26 | if (!isset($this->persistent->acl)) { 27 | 28 | $acl = new Memory(); 29 | 30 | $acl->setDefaultAction(Acl::ALLOW); 31 | 32 | //Register roles 33 | $roles = array( 34 | 'admin' => new Acl\Role('Administrator'), 35 | 'manager' => new Acl\Role('Manager'), 36 | 'staff' => new Acl\Role('Staff') 37 | ); 38 | 39 | $acl->addRole($roles['staff']); 40 | $acl->addRole($roles['manager']); 41 | $acl->addRole($roles['admin']); // admin inherits staff 42 | 43 | 44 | // resources that sales are denied 45 | $staffResources = array( 46 | "reports" => array("index") 47 | ); 48 | 49 | // add resources for sales 50 | foreach($staffResources as $resource => $actions) { 51 | $acl->addResource(new Resource($resource), $actions); 52 | foreach($actions as $action) { 53 | $acl->deny($roles['staff']->getName(), $resource, $action); 54 | } 55 | // $acl->allow($roles['staff']->getName(), $resource, '*'); 56 | } 57 | 58 | //The acl is stored in session, APC would be useful here too 59 | $this->persistent->acl = $acl; 60 | } 61 | 62 | return $this->persistent->acl; 63 | } 64 | 65 | /** 66 | * This action is executed before execute any action in the application 67 | */ 68 | public function beforeDispatch(Event $event, Dispatcher $dispatcher) 69 | { 70 | 71 | $auth = $this->session->get('auth'); 72 | if (!$auth){ 73 | $role = 'Guest'; 74 | } else { 75 | $role = $auth['accountType']; 76 | } 77 | 78 | $controller = $dispatcher->getControllerName(); 79 | $action = $dispatcher->getActionName(); 80 | 81 | $acl = $this->_getAcl(); 82 | 83 | $allowed = $acl->isAllowed($role, $controller, $action); 84 | if ($allowed != Acl::ALLOW) { 85 | $this->flashSession->error("You don't have access to this module: $controller/$action"); 86 | // $this->flashSession->error("$role $controller $action"); 87 | $dispatcher->forward( 88 | array( 89 | 'controller' => 'dashboard', 90 | 'action' => 'index' 91 | ) 92 | ); 93 | 94 | return false; 95 | } 96 | return; 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /app/views/index.volt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{ get_title() }} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {{ content() }} 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/views/index/index.volt: -------------------------------------------------------------------------------- 1 | {{ internal.getMenu() }} 2 | 3 |

{{ hello }}, congratulations!

4 | 5 |

You're now flying with Phalcon. Great things are about to happen!

-------------------------------------------------------------------------------- /app/views/index/test.volt: -------------------------------------------------------------------------------- 1 | {% extends 'layouts/template.volt' %} 2 | 3 | {% block say_hello %} 4 | {{ hello }} 5 | {% endblock %} -------------------------------------------------------------------------------- /app/views/layouts/template.volt: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% block say_hello %}{% endblock %} 4 | 5 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Amplus", 3 | "version": "0.0.0", 4 | "authors": [ 5 | "Amplus Marketing " 6 | ], 7 | "description": "Amplus Marketing", 8 | "license": "MIT", 9 | "devDependencies": { 10 | "jquery": "~2.1.1", 11 | "bootstrap": "~3.2.0", 12 | "font-awesome": "~4.1.0", 13 | "moment": "~2.7.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Amplus/Amplus", 3 | "config": { 4 | "vendor-dir": "composer_libraries" 5 | }, 6 | "require": { 7 | "phpmailer/phpmailer": "5.2.*" 8 | } 9 | } -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "8c3acfd8eb8bde50dd63afac2c024719", 8 | "packages": [ 9 | { 10 | "name": "phpmailer/phpmailer", 11 | "version": "v5.2.8", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/PHPMailer/PHPMailer.git", 15 | "reference": "d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f", 20 | "reference": "d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.0.0" 25 | }, 26 | "require-dev": { 27 | "phpdocumentor/phpdocumentor": "*", 28 | "phpunit/phpunit": "4.0.*" 29 | }, 30 | "type": "library", 31 | "autoload": { 32 | "classmap": [ 33 | "class.phpmailer.php", 34 | "class.pop3.php", 35 | "class.smtp.php" 36 | ] 37 | }, 38 | "notification-url": "https://packagist.org/downloads/", 39 | "license": [ 40 | "LGPL-2.1" 41 | ], 42 | "authors": [ 43 | { 44 | "name": "Jim Jagielski", 45 | "email": "jimjag@gmail.com" 46 | }, 47 | { 48 | "name": "Marcus Bointon", 49 | "email": "phpmailer@synchromedia.co.uk" 50 | }, 51 | { 52 | "name": "Andy Prevost", 53 | "email": "codeworxtech@users.sourceforge.net" 54 | }, 55 | { 56 | "name": "Brent R. Matzelle" 57 | } 58 | ], 59 | "description": "PHPMailer is a full-featured email creation and transfer class for PHP", 60 | "time": "2014-05-14 07:04:18" 61 | } 62 | ], 63 | "packages-dev": [ 64 | 65 | ], 66 | "aliases": [ 67 | 68 | ], 69 | "minimum-stability": "stable", 70 | "stability-flags": [ 71 | 72 | ], 73 | "prefer-stable": false, 74 | "platform": [ 75 | 76 | ], 77 | "platform-dev": [ 78 | 79 | ] 80 | } 81 | -------------------------------------------------------------------------------- /composer_libraries/autoload.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php', 10 | 'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php', 11 | 'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php', 12 | 'phpmailerException' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php', 13 | ); 14 | -------------------------------------------------------------------------------- /composer_libraries/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | $path) { 28 | $loader->set($namespace, $path); 29 | } 30 | 31 | $map = require __DIR__ . '/autoload_psr4.php'; 32 | foreach ($map as $namespace => $path) { 33 | $loader->setPsr4($namespace, $path); 34 | } 35 | 36 | $classMap = require __DIR__ . '/autoload_classmap.php'; 37 | if ($classMap) { 38 | $loader->addClassMap($classMap); 39 | } 40 | 41 | $loader->register(true); 42 | 43 | return $loader; 44 | } 45 | } 46 | 47 | function composerRequire24ad2455476d30bcc4ed5114959d6247($file) 48 | { 49 | require $file; 50 | } 51 | -------------------------------------------------------------------------------- /composer_libraries/composer/installed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "phpmailer/phpmailer", 4 | "version": "v5.2.8", 5 | "version_normalized": "5.2.8.0", 6 | "source": { 7 | "type": "git", 8 | "url": "https://github.com/PHPMailer/PHPMailer.git", 9 | "reference": "d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f" 10 | }, 11 | "dist": { 12 | "type": "zip", 13 | "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f", 14 | "reference": "d3802c597bff8f6c2ccfa3eab2a511aa01b8d68f", 15 | "shasum": "" 16 | }, 17 | "require": { 18 | "php": ">=5.0.0" 19 | }, 20 | "require-dev": { 21 | "phpdocumentor/phpdocumentor": "*", 22 | "phpunit/phpunit": "4.0.*" 23 | }, 24 | "time": "2014-05-14 07:04:18", 25 | "type": "library", 26 | "installation-source": "dist", 27 | "autoload": { 28 | "classmap": [ 29 | "class.phpmailer.php", 30 | "class.pop3.php", 31 | "class.smtp.php" 32 | ] 33 | }, 34 | "notification-url": "https://packagist.org/downloads/", 35 | "license": [ 36 | "LGPL-2.1" 37 | ], 38 | "authors": [ 39 | { 40 | "name": "Jim Jagielski", 41 | "email": "jimjag@gmail.com" 42 | }, 43 | { 44 | "name": "Marcus Bointon", 45 | "email": "phpmailer@synchromedia.co.uk" 46 | }, 47 | { 48 | "name": "Andy Prevost", 49 | "email": "codeworxtech@users.sourceforge.net" 50 | }, 51 | { 52 | "name": "Brent R. Matzelle" 53 | } 54 | ], 55 | "description": "PHPMailer is a full-featured email creation and transfer class for PHP" 56 | } 57 | ] 58 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/.gitignore: -------------------------------------------------------------------------------- 1 | docs/phpdoc/ 2 | test/message.txt 3 | test/testbootstrap.php 4 | .idea 5 | build/ 6 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | before_commands: 2 | - "composer install --prefer-source" 3 | 4 | tools: 5 | # Code Coverage 6 | external_code_coverage: 7 | enabled: true 8 | timeout: 300 9 | filter: 10 | excluded_paths: 11 | - 'docs/*' 12 | - 'examples/*' 13 | - 'extras/*' 14 | - 'test/*' 15 | - 'vendor/*' 16 | 17 | 18 | php_code_coverage: 19 | enabled: false 20 | test_command: phpunit 21 | filter: 22 | excluded_paths: 23 | - 'docs/*' 24 | - 'examples/*' 25 | - 'extras/*' 26 | - 'test/*' 27 | - 'vendor/*' 28 | 29 | 30 | # Code Sniffer 31 | php_code_sniffer: 32 | enabled: true 33 | command: phpcs 34 | config: 35 | standard: PSR2 36 | filter: 37 | excluded_paths: 38 | - 'docs/*' 39 | - 'examples/*' 40 | - 'extras/*' 41 | - 'test/*' 42 | - 'vendor/*' 43 | 44 | 45 | # Copy/Paste Detector 46 | php_cpd: 47 | enabled: true 48 | command: phpcpd 49 | excluded_dirs: 50 | - docs 51 | - examples 52 | - extras 53 | - test 54 | - vendor 55 | 56 | 57 | # PHP CS Fixer (http://http://cs.sensiolabs.org/). 58 | php_cs_fixer: 59 | enabled: true 60 | command: php-cs-fixer 61 | config: 62 | level: psr2 63 | filter: 64 | excluded_paths: 65 | - 'docs/*' 66 | - 'examples/*' 67 | - 'extras/*' 68 | - 'test/*' 69 | - 'vendor/*' 70 | 71 | 72 | # Analyzes the size and structure of a PHP project. 73 | php_loc: 74 | enabled: true 75 | command: phploc 76 | excluded_dirs: 77 | - docs 78 | - examples 79 | - extras 80 | - test 81 | - vendor 82 | 83 | 84 | # PHP Mess Detector (http://phpmd.org). 85 | php_mess_detector: 86 | enabled: true 87 | command: phpmd 88 | config: 89 | rulesets: 90 | - codesize 91 | - unusedcode 92 | - naming 93 | - design 94 | filter: 95 | excluded_paths: 96 | - 'docs/*' 97 | - 'examples/*' 98 | - 'extras/*' 99 | - 'test/*' 100 | - 'vendor/*' 101 | 102 | 103 | # Analyzes the size and structure of a PHP project. 104 | php_pdepend: 105 | enabled: true 106 | command: pdepend 107 | excluded_dirs: 108 | - docs 109 | - examples 110 | - extras 111 | - test 112 | - vendor 113 | 114 | # Runs Scrutinizer's PHP Analyzer Tool 115 | php_analyzer: 116 | enabled: true 117 | filter: 118 | excluded_paths: 119 | - 'docs/*' 120 | - 'examples/*' 121 | - 'extras/*' 122 | - 'test/*' 123 | - 'vendor/*' 124 | 125 | # Security Advisory Checker 126 | sensiolabs_security_checker: true 127 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.5 4 | - 5.4 5 | - 5.3 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -y -qq postfix 9 | before_script: 10 | - sudo service postfix stop 11 | - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & 12 | - mkdir -p build/logs 13 | - cd test 14 | - cp testbootstrap-dist.php testbootstrap.php 15 | - chmod +x fakesendmail.sh 16 | - sudo mkdir -p /var/qmail/bin 17 | - sudo cp fakesendmail.sh /var/qmail/bin/sendmail 18 | - sudo cp fakesendmail.sh /usr/sbin/sendmail 19 | - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i|grep "PHP Version"|head -n 1|grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini" 20 | - pwd 21 | - ls -al 22 | script: 23 | - phpunit --configuration ../travis.phpunit.xml.dist 24 | after_script: 25 | - wget https://scrutinizer-ci.com/ocular.phar 26 | - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml 27 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/PHPMailerAutoload.php: -------------------------------------------------------------------------------- 1 | 8 | * @author Jim Jagielski (jimjag) 9 | * @author Andy Prevost (codeworxtech) 10 | * @author Brent R. Matzelle (original founder) 11 | * @copyright 2012 - 2014 Marcus Bointon 12 | * @copyright 2010 - 2012 Jim Jagielski 13 | * @copyright 2004 - 2009 Andy Prevost 14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License 15 | * @note This program is distributed in the hope that it will be useful - WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /** 21 | * PHPMailer SPL autoloader. 22 | * @param string $classname The name of the class to load 23 | */ 24 | function PHPMailerAutoload($classname) 25 | { 26 | //Can't use __DIR__ as it's only in PHP 5.3+ 27 | $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; 28 | if (is_readable($filename)) { 29 | require $filename; 30 | } 31 | } 32 | 33 | if (version_compare(PHP_VERSION, '5.1.2', '>=')) { 34 | //SPL autoloading was introduced in PHP 5.1.2 35 | if (version_compare(PHP_VERSION, '5.3.0', '>=')) { 36 | spl_autoload_register('PHPMailerAutoload', true, true); 37 | } else { 38 | spl_autoload_register('PHPMailerAutoload'); 39 | } 40 | } else { 41 | /** 42 | * Fall back to traditional autoload for old PHP versions 43 | * @param string $classname The name of the class to load 44 | */ 45 | function __autoload($classname) 46 | { 47 | PHPMailerAutoload($classname); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpmailer/phpmailer", 3 | "type": "library", 4 | "description": "PHPMailer is a full-featured email creation and transfer class for PHP", 5 | "authors": [ 6 | { 7 | "name": "Marcus Bointon", 8 | "email": "phpmailer@synchromedia.co.uk" 9 | }, 10 | { 11 | "name": "Jim Jagielski", 12 | "email": "jimjag@gmail.com" 13 | }, 14 | { 15 | "name": "Andy Prevost", 16 | "email": "codeworxtech@users.sourceforge.net" 17 | }, 18 | { 19 | "name": "Brent R. Matzelle" 20 | } 21 | ], 22 | "require": { 23 | "php": ">=5.0.0" 24 | }, 25 | "require-dev": { 26 | "phpdocumentor/phpdocumentor": "*", 27 | "phpunit/phpunit": "4.0.*" 28 | }, 29 | "autoload": { 30 | "classmap": ["class.phpmailer.php", "class.pop3.php", "class.smtp.php"] 31 | }, 32 | "license": "LGPL-2.1" 33 | } -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/Callback_function_notes.txt: -------------------------------------------------------------------------------- 1 | NEW CALLBACK FUNCTION: 2 | ====================== 3 | 4 | We have had requests for a method to process the results of sending emails 5 | through PHPMailer. In this new release, we have implemented a callback 6 | function that passes the results of each email sent (to, cc, and/or bcc). 7 | We have provided an example that echos the results back to the screen. The 8 | callback function can be used for any purpose. With minor modifications, the 9 | callback function can be used to create CSV logs, post results to databases, 10 | etc. 11 | 12 | Please review the test.php script for the example. 13 | 14 | It's pretty straight forward. 15 | 16 | Enjoy! 17 | Andy 18 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/DomainKeys_notes.txt: -------------------------------------------------------------------------------- 1 | CREATE DKIM KEYS and DNS Resource Record: 2 | ========================================= 3 | 4 | To create DomainKeys Identified Mail keys, visit: 5 | http://dkim.worxware.com/ 6 | ... read the information, fill in the form, and download the ZIP file 7 | containing the public key, private key, DNS Resource Record and instructions 8 | to add to your DNS Zone Record, and the PHPMailer code to enable DKIM 9 | digital signing. 10 | 11 | /*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/ 12 | 13 | You need to protect your DKIM private and public keys from being viewed or 14 | accessed. Add protection to your .htaccess file as in this example: 15 | 16 | # secure htkeyprivate file 17 | 18 | order allow,deny 19 | deny from all 20 | 21 | 22 | # secure htkeypublic file 23 | 24 | order allow,deny 25 | deny from all 26 | 27 | 28 | (the actual .htaccess additions are in the ZIP file sent back to you from 29 | http://dkim.worxware.com/ 30 | 31 | A few notes on using DomainKey Identified Mail (DKIM): 32 | 33 | You do not need to use PHPMailer to DKIM sign emails IF: 34 | - you enable DomainKey support and add the DNS resource record 35 | - you use your outbound mail server 36 | 37 | If you are a third-party emailer that works on behalf of domain owners to 38 | send their emails from your own server: 39 | - you absolutely have to DKIM sign outbound emails 40 | - the domain owner has to add the DNS resource record to match the 41 | private key, public key, selector, identity, and domain that you create 42 | - use caution with the "selector" ... at least one "selector" will already 43 | exist in the DNS Zone Record of the domain at the domain owner's server 44 | you need to ensure that the "selector" you use is unique 45 | Note: since the IP address will not match the domain owner's DNS Zone record 46 | you can be certain that email providers that validate based on DomainKey will 47 | check the domain owner's DNS Zone record for your DNS resource record. Before 48 | sending out emails on behalf of domain owners, ensure they have entered the 49 | DNS resource record you provided them. 50 | 51 | Enjoy! 52 | Andy 53 | 54 | PS. if you need additional information about DKIM, please see: 55 | http://www.dkim.org/info/dkim-faq.html 56 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/Note_for_SMTP_debugging.txt: -------------------------------------------------------------------------------- 1 | If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place. 2 | Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example: 3 | 4 | $mail->SMTPDebug = 1; 5 | $mail->isSMTP(); // telling the class to use SMTP 6 | $mail->SMTPAuth = true; // enable SMTP authentication 7 | $mail->Port = 26; // set the SMTP port 8 | $mail->Host = "mail.yourhost.com"; // SMTP server 9 | $mail->Username = "name@yourhost.com"; // SMTP account username 10 | $mail->Password = "your password"; // SMTP account password 11 | 12 | Notes on this: 13 | $mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default) 14 | $mail->SMTPDebug = 1; ... will echo errors and server responses 15 | $mail->SMTPDebug = 2; ... will echo errors, server responses and client messages 16 | 17 | And finally, don't forget to disable debugging before going into production. 18 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/extending.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Examples using phpmailer 4 | 5 | 6 | 7 | 8 |

Examples using PHPMailer

9 | 10 |

1. Advanced Example

11 |

12 | 13 | This demonstrates sending multiple email messages with binary attachments 14 | from a MySQL database using multipart/alternative messages.

15 | 16 |

 17 | require 'PHPMailerAutoload.php';
 18 | 
 19 | $mail = new PHPMailer();
 20 | 
 21 | $mail->From     = 'list@example.com';
 22 | $mail->FromName = 'List manager';
 23 | $mail->Host     = 'smtp1.example.com;smtp2.example.com';
 24 | $mail->Mailer   = 'smtp';
 25 | 
 26 | @mysqli_connect('localhost','root','password');
 27 | @mysqli_select_db("my_company");
 28 | $query = "SELECT full_name, email, photo FROM employee";
 29 | $result = @mysqli_query($query);
 30 | 
 31 | while ($row = mysqli_fetch_assoc($result))
 32 | {
 33 |     // HTML body
 34 |     $body  = "Hello <font size=\"4\">" . $row['full_name'] . "</font>, <p>";
 35 |     $body .= "<i>Your</i> personal photograph to this message.<p>";
 36 |     $body .= "Sincerely, <br>";
 37 |     $body .= "phpmailer List manager";
 38 | 
 39 |     // Plain text body (for mail clients that cannot read HTML)
 40 |     $text_body  = 'Hello ' . $row['full_name'] . ", \n\n";
 41 |     $text_body .= "Your personal photograph to this message.\n\n";
 42 |     $text_body .= "Sincerely, \n";
 43 |     $text_body .= 'phpmailer List manager';
 44 | 
 45 |     $mail->Body    = $body;
 46 |     $mail->AltBody = $text_body;
 47 |     $mail->addAddress($row['email'], $row['full_name']);
 48 |     $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
 49 | 
 50 |     if(!$mail->send())
 51 |         echo "There has been a mail error sending to " . $row['email'] . "<br>";
 52 | 
 53 |     // Clear all addresses and attachments for next loop
 54 |     $mail->clearAddresses();
 55 |     $mail->clearAttachments();
 56 | }
 57 | 
58 |

59 | 60 |

2. Extending PHPMailer

61 |

62 | 63 | Extending classes with inheritance is one of the most 64 | powerful features of object-oriented programming. It allows you to make changes to the 65 | original class for your own personal use without hacking the original 66 | classes, and it's very easy to do: 67 | 68 |

69 | Here's a class that extends the phpmailer class and sets the defaults 70 | for the particular site:
71 | PHP include file: my_phpmailer.php 72 |

73 | 74 |

 75 | require 'PHPMailerAutoload.php';
 76 | 
 77 | class my_phpmailer extends PHPMailer {
 78 |     // Set default variables for all new objects
 79 |     public $From     = 'from@example.com';
 80 |     public $FromName = 'Mailer';
 81 |     public $Host     = 'smtp1.example.com;smtp2.example.com';
 82 |     public $Mailer   = 'smtp';                         // Alternative to isSMTP()
 83 |     public $WordWrap = 75;
 84 | 
 85 |     // Replace the default debug output function
 86 |     protected function edebug($msg) {
 87 |         print('My Site Error');
 88 |         print('Description:');
 89 |         printf('%s', $msg);
 90 |         exit;
 91 |     }
 92 | 
 93 |     //Extend the send function
 94 |     public function send() {
 95 |         $this->Subject = '[Yay for me!] '.$this->Subject;
 96 |         return parent::send()
 97 |     }
 98 | 
 99 |     // Create an additional function
100 |     public function do_something($something) {
101 |         // Place your new code here
102 |     }
103 | }
104 | 
105 |
106 | Now here's a normal PHP page in the site, which will have all the defaults set above:
107 | 108 |
109 | require 'my_phpmailer.php';
110 | 
111 | // Instantiate your new class
112 | $mail = new my_phpmailer;
113 | 
114 | // Now you only need to add the necessary stuff
115 | $mail->addAddress('josh@example.com', 'Josh Adams');
116 | $mail->Subject = 'Here is the subject';
117 | $mail->Body    = 'This is the message body';
118 | $mail->addAttachment('c:/temp/11-10-00.zip', 'new_name.zip');  // optional name
119 | 
120 | if(!$mail->send())
121 | {
122 |    echo 'There was an error sending the message';
123 |    exit;
124 | }
125 | 
126 | echo 'Message was sent successfully';
127 | 
128 | 129 | 130 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/faq.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | PHPMailer FAQ 4 | 5 | 6 |

PHPMailer FAQ

7 |
    8 |
  • Q: I am concerned that using include files will take up too much 9 | processing time on my computer. How can I make it run faster?
    10 | A: PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable 11 | computer resources. You can bypass this by using an opcode cache which compiles 12 | PHP code and store it in memory to reduce overhead immensely. APC 13 | (Alternative PHP Cache) is a free opcode cache extension in the PECL library.
  • 14 |
  • Q: Which mailer gives me the best performance?
    15 | A: On a single machine the sendmail (or Qmail) is fastest overall. 16 | Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP. 17 | If you do not have a local mail server (as is typical on Windows), SMTP is your only option.
  • 18 |
  • Q: When I try to attach a file with on my server I get a 19 | "Could not find {file} on filesystem error". Why is this?
    20 | A: If you are using a Unix machine this is probably because the user 21 | running your web server does not have read access to the directory in question. If you are using Windows, 22 | then the problem is probably that you have used single backslashes to denote directories (\). 23 | A single backslash has a special meaning to PHP so these are not 24 | valid. Instead use double backslashes ("\\") or a single forward 25 | slash ("/").
  • 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/generatedocs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Regenerate PHPMailer documentation 3 | # Run from within the docs folder 4 | rm -rf phpdoc/* 5 | phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/ --sourcecode --force --title PHPMailer --template="clean" 6 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/docs/pop3_article.txt: -------------------------------------------------------------------------------- 1 | This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented. 2 | 3 | With that noted, here is how to implement it: 4 | 5 | I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory. 6 | 7 | When you need it, create your POP3 object 8 | 9 | Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer: 10 | 11 | authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); 13 | $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP(); 14 | $mail->isHTML(false); $mail->Host = 'relay.example.com'; 15 | $mail->From = 'mailer@example.com'; 16 | $mail->FromName = 'Example Mailer'; 17 | $mail->Subject = 'My subject'; 18 | $mail->Body = 'Hello world'; 19 | $mail->addAddress('rich@corephp.co.uk', 'Richard Davey'); 20 | if (!$mail->send()) { 21 | echo $mail->ErrorInfo; 22 | } 23 | ?> 24 | 25 | The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier. 26 | The Parameters 27 | 28 | The authorise parameters are as follows: 29 | 30 | $pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); 31 | 32 | 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address) 33 | 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host) 34 | 3. 30 - A connection time-out value (in seconds) 35 | 4. mailer - The POP3 Username required to logon 36 | 5. password - The POP3 Password required to logon 37 | 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser) 38 | 39 | Final Comments + the Download 40 | 41 | 1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me. 42 | 43 | 2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time. 44 | 45 | 3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead. 46 | 47 | 4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with. 48 | Download 49 | 50 | My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class) 51 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer Test 6 | 7 | 8 |
9 |

This is a test of PHPMailer.

10 |
11 | PHPMailer rocks 12 |
13 |

This example uses HTML.

14 |

The PHPMailer image at the top has been embedded automatically.

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/exceptions.phps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer - Exceptions test 6 | 7 | 8 | setFrom('from@example.com', 'First Last'); 17 | //Set an alternative reply-to address 18 | $mail->addReplyTo('replyto@example.com', 'First Last'); 19 | //Set who the message is to be sent to 20 | $mail->addAddress('whoto@example.com', 'John Doe'); 21 | //Set the subject line 22 | $mail->Subject = 'PHPMailer Exceptions test'; 23 | //Read an HTML message body from an external file, convert referenced images to embedded, 24 | //and convert the HTML into a basic plain-text alternative body 25 | $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); 26 | //Replace the plain text body with one created manually 27 | $mail->AltBody = 'This is a plain-text message body'; 28 | //Attach an image file 29 | $mail->addAttachment('images/phpmailer_mini.png'); 30 | //send the message 31 | //Note that we don't need check the response from this because it will throw an exception if it has trouble 32 | $mail->send(); 33 | echo "Message sent!"; 34 | } catch (phpmailerException $e) { 35 | echo $e->errorMessage(); //Pretty error messages from PHPMailer 36 | } catch (Exception $e) { 37 | echo $e->getMessage(); //Boring error messages from anything else! 38 | } 39 | ?> 40 | 41 | 42 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/gmail.phps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer - GMail SMTP test 6 | 7 | 8 | isSMTP(); 21 | 22 | //Enable SMTP debugging 23 | // 0 = off (for production use) 24 | // 1 = client messages 25 | // 2 = client and server messages 26 | $mail->SMTPDebug = 2; 27 | 28 | //Ask for HTML-friendly debug output 29 | $mail->Debugoutput = 'html'; 30 | 31 | //Set the hostname of the mail server 32 | $mail->Host = 'smtp.gmail.com'; 33 | 34 | //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission 35 | $mail->Port = 587; 36 | 37 | //Set the encryption system to use - ssl (deprecated) or tls 38 | $mail->SMTPSecure = 'tls'; 39 | 40 | //Whether to use SMTP authentication 41 | $mail->SMTPAuth = true; 42 | 43 | //Username to use for SMTP authentication - use full email address for gmail 44 | $mail->Username = "username@gmail.com"; 45 | 46 | //Password to use for SMTP authentication 47 | $mail->Password = "yourpassword"; 48 | 49 | //Set who the message is to be sent from 50 | $mail->setFrom('from@example.com', 'First Last'); 51 | 52 | //Set an alternative reply-to address 53 | $mail->addReplyTo('replyto@example.com', 'First Last'); 54 | 55 | //Set who the message is to be sent to 56 | $mail->addAddress('whoto@example.com', 'John Doe'); 57 | 58 | //Set the subject line 59 | $mail->Subject = 'PHPMailer GMail SMTP test'; 60 | 61 | //Read an HTML message body from an external file, convert referenced images to embedded, 62 | //convert HTML into a basic plain-text alternative body 63 | $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); 64 | 65 | //Replace the plain text body with one created manually 66 | $mail->AltBody = 'This is a plain-text message body'; 67 | 68 | //Attach an image file 69 | $mail->addAttachment('images/phpmailer_mini.png'); 70 | 71 | //send the message, check for errors 72 | if (!$mail->send()) { 73 | echo "Mailer Error: " . $mail->ErrorInfo; 74 | } else { 75 | echo "Message sent!"; 76 | } 77 | ?> 78 | 79 | 80 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/images/phpmailer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewartx/PhalconPHP-Setup-Example/fd04ffbe287eab8cc2a2e697a29f682ae0c29441/composer_libraries/phpmailer/phpmailer/examples/images/phpmailer.png -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/images/phpmailer_mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewartx/PhalconPHP-Setup-Example/fd04ffbe287eab8cc2a2e697a29f682ae0c29441/composer_libraries/phpmailer/phpmailer/examples/images/phpmailer_mini.png -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer Examples 6 | 7 | 8 |

PHPMailer code examplesPHPMailer logo

9 |

This folder contains a collection of examples of using PHPMailer.

10 |

About testing email sending

11 |

When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:

12 |
    13 |
  • FakeEmail, a Python-based fake mail server with a web interface.
  • 14 |
  • smtp-sink, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.
  • 15 |
  • FakeSMTP, a Java desktop app with the ability to show an SMTP log and save messages to a folder.
  • 16 |
  • smtp4dev, a dummy SMTP server for Windows.
  • 17 |
  • fakesendmail.sh, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.
  • 18 |
  • msglint, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.
  • 19 |
20 |
21 |

Security note

22 |

Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - please don't do that! Similarly, don't leave your passwords in these files as they will be visible to the world!

23 |
24 |

code_generator.phps

25 |

This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.

26 |

mail.phps

27 |

This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that sitution, either install a local mail server, or use a remote one and send using SMTP instead.

28 |

exceptions.phps

29 |

The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.

30 |

smtp.phps

31 |

A simple example sending using SMTP with authentication.

32 |

smtp_no_auth.phps

33 |

A simple example sending using SMTP without authentication.

34 |

sendmail.phps

35 |

A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.

36 |

gmail.phps

37 |

Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.

38 |

pop_before_smtp.phps

39 |

Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.

40 |

mailing_list.phps

41 |

This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.

42 |
43 |

Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in RFC 2606. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!

44 | 45 | 46 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/mail.phps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer - mail() test 6 | 7 | 8 | setFrom('from@example.com', 'First Last'); 15 | //Set an alternative reply-to address 16 | $mail->addReplyTo('replyto@example.com', 'First Last'); 17 | //Set who the message is to be sent to 18 | $mail->addAddress('whoto@example.com', 'John Doe'); 19 | //Set the subject line 20 | $mail->Subject = 'PHPMailer mail() test'; 21 | //Read an HTML message body from an external file, convert referenced images to embedded, 22 | //convert HTML into a basic plain-text alternative body 23 | $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); 24 | //Replace the plain text body with one created manually 25 | $mail->AltBody = 'This is a plain-text message body'; 26 | //Attach an image file 27 | $mail->addAttachment('images/phpmailer_mini.png'); 28 | 29 | //send the message, check for errors 30 | if (!$mail->send()) { 31 | echo "Mailer Error: " . $mail->ErrorInfo; 32 | } else { 33 | echo "Message sent!"; 34 | } 35 | ?> 36 | 37 | 38 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/mailing_list.phps: -------------------------------------------------------------------------------- 1 | isSMTP(); 14 | $mail->Host = 'smtp.example.com'; 15 | $mail->SMTPAuth = true; 16 | $mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead 17 | $mail->Port = 25; 18 | $mail->Username = 'yourname@example.com'; 19 | $mail->Password = 'yourpassword'; 20 | $mail->setFrom('list@example.com', 'List manager'); 21 | $mail->addReplyTo('list@example.com', 'List manager'); 22 | 23 | $mail->Subject = "PHPMailer Simple database mailing list test"; 24 | 25 | //Same body for all messages, so set this before the sending loop 26 | //If you generate a different body for each recipient (e.g. you're using a templating system), 27 | //set it inside the loop 28 | $mail->msgHTML($body); 29 | //msgHTML also sets AltBody, so if you want a custom one, set it afterwards 30 | $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; 31 | 32 | //Connect to the database and select the recipients from your mailing list that have not yet been sent to 33 | //You'll need to alter this to match your database 34 | $mysql = mysql_connect('localhost', 'username', 'password'); 35 | mysql_select_db('mydb', $mysql); 36 | $result = mysql_query("SELECT full_name, email, photo FROM mailinglist WHERE sent = false", $mysql); 37 | 38 | while ($row = mysql_fetch_array($result)) { 39 | $mail->addAddress($row['email'], $row['full_name']); 40 | $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB 41 | 42 | if (!$mail->send()) { 43 | echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '
'; 44 | break; //Abandon sending 45 | } else { 46 | echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')
'; 47 | //Mark it as sent in the DB 48 | mysql_query( 49 | "UPDATE mailinglist SET sent = true WHERE email = '" . mysql_real_escape_string($row['email'], $mysql) . "'" 50 | ); 51 | } 52 | // Clear all addresses and attachments for next loop 53 | $mail->clearAddresses(); 54 | $mail->clearAttachments(); 55 | } 56 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/pop_before_smtp.phps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PHPMailer - POP-before-SMTP test 6 | 7 | 8 | isSMTP(); 21 | //Enable SMTP debugging 22 | // 0 = off (for production use) 23 | // 1 = client messages 24 | // 2 = client and server messages 25 | $mail->SMTPDebug = 2; 26 | //Ask for HTML-friendly debug output 27 | $mail->Debugoutput = 'html'; 28 | //Set the hostname of the mail server 29 | $mail->Host = "mail.example.com"; 30 | //Set the SMTP port number - likely to be 25, 465 or 587 31 | $mail->Port = 25; 32 | //Whether to use SMTP authentication 33 | $mail->SMTPAuth = false; 34 | //Set who the message is to be sent from 35 | $mail->setFrom('from@example.com', 'First Last'); 36 | //Set an alternative reply-to address 37 | $mail->addReplyTo('replyto@example.com', 'First Last'); 38 | //Set who the message is to be sent to 39 | $mail->addAddress('whoto@example.com', 'John Doe'); 40 | //Set the subject line 41 | $mail->Subject = 'PHPMailer POP-before-SMTP test'; 42 | //Read an HTML message body from an external file, convert referenced images to embedded, 43 | //and convert the HTML into a basic plain-text alternative body 44 | $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); 45 | //Replace the plain text body with one created manually 46 | $mail->AltBody = 'This is a plain-text message body'; 47 | //Attach an image file 48 | $mail->addAttachment('images/phpmailer_mini.png'); 49 | //send the message 50 | //Note that we don't need check the response from this because it will throw an exception if it has trouble 51 | $mail->send(); 52 | echo "Message sent!"; 53 | } catch (phpmailerException $e) { 54 | echo $e->errorMessage(); //Pretty error messages from PHPMailer 55 | } catch (Exception $e) { 56 | echo $e->getMessage(); //Boring error messages from anything else! 57 | } 58 | ?> 59 | 60 | 61 | -------------------------------------------------------------------------------- /composer_libraries/phpmailer/phpmailer/examples/scripts/shAutoloader.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var sh = SyntaxHighlighter; 4 | 5 | /** 6 | * Provides functionality to dynamically load only the brushes that a needed to render the current page. 7 | * 8 | * There are two syntaxes that autoload understands. For example: 9 | * 10 | * SyntaxHighlighter.autoloader( 11 | * [ 'applescript', 'Scripts/shBrushAppleScript.js' ], 12 | * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ] 13 | * ); 14 | * 15 | * or a more easily comprehendable one: 16 | * 17 | * SyntaxHighlighter.autoloader( 18 | * 'applescript Scripts/shBrushAppleScript.js', 19 | * 'actionscript3 as3 Scripts/shBrushAS3.js' 20 | * ); 21 | */ 22 | sh.autoloader = function() 23 | { 24 | var list = arguments, 25 | elements = sh.findElements(), 26 | brushes = {}, 27 | scripts = {}, 28 | all = SyntaxHighlighter.all, 29 | allCalled = false, 30 | allParams = null, 31 | i 32 | ; 33 | 34 | SyntaxHighlighter.all = function(params) 35 | { 36 | allParams = params; 37 | allCalled = true; 38 | }; 39 | 40 | function addBrush(aliases, url) 41 | { 42 | for (var i = 0; i < aliases.length; i++) 43 | brushes[aliases[i]] = url; 44 | }; 45 | 46 | function getAliases(item) 47 | { 48 | return item.pop 49 | ? item 50 | : item.split(/\s+/) 51 | ; 52 | } 53 | 54 | // create table of aliases and script urls 55 | for (i = 0; i < list.length; i++) 56 | { 57 | var aliases = getAliases(list[i]), 58 | url = aliases.pop() 59 | ; 60 | 61 | addBrush(aliases, url); 62 | } 63 | 64 | // dynamically add