/** * @return lmbSession */ protected function _getSession() { if (is_null($this->_session)) { $this->_session = lmbToolkit::instance()->getSession(); } return $this->_session; }
function setUp() { $this->connection = lmbToolkit::instance()->getDefaultDbConnection(); DriverMssqlSetup($this->connection->getConnectionId()); DriverMssqlExec($this->connection->getConnectionId(), "SET IDENTITY_INSERT founding_fathers OFF"); parent::setUp(); }
/** * @return lmbMPTree */ function getTree() { if (!$this->_tree) { $this->_tree = lmbToolkit::instance()->getCmsTree($this->getTableName(), $this->_db_conn); } return $this->_tree; }
function __construct($filter_name) { $this->filter_name = $filter_name; $this->toolkit = lmbToolkit::instance(); $this->request = $this->toolkit->getRequest(); $this->session = $this->toolkit->getSession(); }
function sendTo($recipients, $subject = null, $sender = null, $charset = 'utf-8') { $tools = lmbToolkit::instance(); $parts = self::_parseMailpartTags($this->_renderTemplate($tools)); if (!$sender) { if (isset($parts['sender'])) { $sender = $parts['sender']; } else { $sender = $this->getDefaultSender(); } } if (!$subject) { if (!isset($parts['subject'])) { throw new lmbException('Subject required for mail message'); } else { $subject = $parts['subject']; } } $html = isset($parts['html_body']) ? $parts['html_body'] : null; $text = isset($parts['txt_body']) ? $parts['txt_body'] : null; $mailer = $tools->getMailer(); if ($text and !$html) { $mailer->sendPlainMail($recipients, $sender, $subject, $text, $charset); } elseif ($html) { $mailer->sendHtmlMail($recipients, $sender, $subject, $html, $text, $charset); } else { throw new lmbException('Contents required for mail message'); } return $mailer; }
function getValue() { $value = $this->base->getValue(); $toolkit = lmbToolkit::instance(); if (isset($this->parameters[0]) && $this->parameters[0]->getValue()) { $locale = $toolkit->getLocaleObject($this->parameters[0]->getValue()); } else { $locale = $toolkit->getLocaleObject(); } if (isset($this->parameters[1]) && $this->parameters[1]->getValue()) { $fract_digits = $this->parameters[1]->getValue(); } else { $fract_digits = $locale->fract_digits; } if (isset($this->parameters[2]) && $this->parameters[2]->getValue()) { $decimal_symbol = $this->parameters[2]->getValue(); } else { $decimal_symbol = $locale->decimal_symbol; } if (isset($this->parameters[3]) && $this->parameters[3]->getValue()) { $thousand_separator = $this->parameters[3]->getValue(); } else { $thousand_separator = $locale->thousand_separator; } if ($this->isConstant()) { return number_format($value, $fract_digits, $decimal_symbol, $thousand_separator); } else { $this->raiseUnresolvedBindingError(); } }
function setUp() { $toolkit = lmbToolkit::instance(); $this->conn = $toolkit->getDefaultDbConnection(); $this->db = new lmbSimpleDb($this->conn); $this->_cleanUp(); }
function run($filter_chain) { $this->toolkit = lmbToolkit::instance(); lmbErrorGuard::registerFatalErrorHandler($this, 'handleFatalError'); lmbErrorGuard::registerExceptionHandler($this, 'handleException'); $filter_chain->next(); }
protected function _initRequestProperties($uri_string, $get, $post, $cookies, $files) { $this->__uri = !is_null($uri_string) ? new lmbUri($uri_string) : new lmbUri($this->getRawUriString()); $this->__get = !is_null($get) ? $get : $_GET; $items = $this->__uri->getQueryItems(); foreach ($items as $k => $v) { $this->__get[$k] = $v; } $this->__post = !is_null($post) ? $post : $_POST; $this->__cookies = !is_null($cookies) ? $cookies : $_COOKIE; $this->__files = !is_null($files) ? $this->_parseUploadedFiles($files) : $this->_parseUploadedFiles($_FILES); $this->_defineRequestMethod(); if ($this->getRequestMethod() == 'PUT') { $this->__put = lmbToolkit::instance()->getInputStreamParser()->parse(); } if (ini_get('magic_quotes_gpc')) { $this->__get = $this->_stripHttpSlashes($this->__get); $this->__post = $this->_stripHttpSlashes($this->__post); $this->__put = $this->_stripHttpSlashes($this->__put); $this->__cookies = $this->_stripHttpSlashes($this->__cookies); } $this->__request = lmbArrayHelper::arrayMerge($this->__get, $this->__post, $this->__put, $this->__files); foreach ($this->__request as $k => $v) { if (in_array($k, $this->__reserved_attrs)) { continue; } $this->set($k, $v); } }
static function locateTemplateByAlias($alias) { $locator = lmbToolkit::instance()->getWactLocator(); if ($template_path = $locator->locateSourceTemplate($alias)) { return $template_path; } }
function appendStatementTo(&$str, &$values = array(), $conn = null) { if (!is_object($conn)) { $conn = lmbToolkit::instance()->getDefaultDbConnection(); } if ($this->not_all) { $str .= 'NOT('; } if ($this->not) { $str .= 'NOT('; } $this->_appendExpressionToStatement($str, $values, $conn); if ($this->not) { $str .= ')'; } for ($i = 0; $i < count($this->criteria); $i++) { $criteria = $this->criteria[$i]; $str .= $this->conjunctions[$i]; if ($criteria->isComplex()) { $str .= '('; } $criteria->appendStatementTo($str, $values, $conn); if ($criteria->isComplex()) { $str .= ')'; } } if ($this->not_all) { $str .= ')'; } }
function setUp() { parent::setUp(); $config = new lmbSet(array('default_profile' => 'foo_profile', 'foo_profile' => array('type' => 'fckeditor', 'baz' => 42), 'bar_profile' => array('type' => 'tinymce', 'baz' => 111))); lmbToolkit::instance()->setConf('wysiwyg', $config); $this->_helper = new lmbWysiwygConfigurationHelper(); }
function createCacheConnectionByName($name) { $conf = $this->toolkit->getConf('cache'); if (!$conf->get('cache_enabled')) { return $this->createCacheFakeConnection(); } else { try { $dsn = lmbToolkit::instance()->getConf('cache')->get($name . '_cache_dsn'); if (!is_object($dsn)) { $dsn = new lmbUri($dsn); } if (!($wrapper = $dsn->getQueryItem('wrapper'))) { $wrapper = array(); } if ($conf->get('taggable_cache_enabled', false)) { $wrapper[] = 'taggable'; } if ($conf->get('mint_cache_enabled', false)) { $wrapper[] = 'mint'; } if ($conf->get('cache_log_enabled', false)) { $wrapper[] = 'logged'; } $dsn->addQueryItem('wrapper', $wrapper); return $this->createCacheConnectionByDSN($dsn); } catch (Exception $e) { return $this->createCacheFakeConnection(); } } }
function __construct($template_sql, $conn = null) { $this->_template_sql = $template_sql; if (!is_object($conn)) { $conn = lmbToolkit::instance()->getDefaultDbConnection(); } $this->_conn = $conn; }
protected function _getDsnForUser($user, $password) { $this->toolkit = lmbToolkit::instance(); $dsn_uri = clone $this->toolkit->getDefaultDbDSN()->_getUri(); $dsn_uri->setUser($user); $dsn_uri->setPassword($password); return new lmbDbDSN($dsn_uri->toString()); }
function lmb_tests_teardown_db() { $conn = lmbToolkit::instance()->getDefaultDbConnection(); lmb_require('limb/dbal/src/lmbSimpleDb.class.php'); $db = new lmbSimpleDb($conn); $db->truncateDb(); echo "INFO: Database was cleaned up\n"; }
function setUp() { $this->connection = lmbToolkit::instance()->getDefaultDbConnection(); DriverLinterSetup($this->connection->getConnectionId()); $sql = 'SELECT "id", "first" FROM founding_fathers ORDER BY "id"'; $this->stmt = $this->connection->newStatement($sql); $this->cursor = $this->stmt->getRecordSet(); }
function lmb_i18n($text, $arg1 = null, $arg2 = null) { static $toolkit; if (!$toolkit) { $toolkit = lmbToolkit::instance(); } return $toolkit->translate($text, $arg1, $arg2); }
function setUp() { parent::setUp(); $this->conn = lmbToolkit::instance()->getDefaultDbConnection(); $dir_for_tests = lmb_var_dir() . '/constructor/'; $this->dir_for_test_case = $dir_for_tests . '/' . get_class($this); lmbFs::mkdir($this->dir_for_test_case); }
function __construct($file = null, $connection = null) { $this->file = $file; if ($connection) { $this->connection = $connection; } else { $this->connection = lmbToolkit::instance()->getDefaultDbConnection(); } }
function run($filter_chain) { $dispatched = lmbToolkit::instance()->getDispatchedController(); if (!is_object($dispatched)) { throw new lmbException('Request is not dispatched yet! lmbDispatchedRequest not found in lmbToolkit!'); } $dispatched->performAction(); $filter_chain->next(); }
function imitate($request) { $toolkit = lmbToolkit::instance(); $toolkit->setRequest($request); $toolkit->setResponse(new lmbFakeHttpResponse()); $toolkit->setSession(new lmbFakeSession()); $this->app->process(); return $toolkit->getResponse(); }
function setUp() { parent::setUp(); $toolkit = lmbToolkit::instance(); $conn = $toolkit->getDefaultDbConnection(); $this->db = new lmbSimpleDb($conn); $this->db->insert('test_table', array('field1' => 1, 'field2' => 'wow'), null); $this->db->insert('test_table', array('field1' => 2, 'field2' => 'blah'), null); }
function _getExpectedAdminTemplateContent($vars, $template_name) { $view = lmbToolkit::instance()->createViewByTemplate($this->_admin_templates_path . 'admin_templates/' . $template_name . '.phtml'); $view->setVariables($vars); $content = $view->render(); $content = str_replace('[', '{', $content); $content = str_replace(']', '}', $content); return $content; }
function __construct($template_path, $cache_dir = '') { if (!$cache_dir && defined('LIMB_VAR_DIR')) { $cache_dir = LIMB_VAR_DIR . '/compiled/'; } $config = new lmbWactTemplateConfig($cache_dir); $locator = lmbToolkit::instance()->getWactLocator(); parent::__construct($template_path, $config, $locator); }
function _getExpectedConfigContent($vars, $template_name, $tags_needed = true) { $view = lmbToolkit::instance()->createViewByTemplate($this->_templates_path . 'settings/' . $template_name . '.phtml'); $view->setVariables($vars); $content = $view->render(); if ($tags_needed) { $content = '<?php' . PHP_EOL . $content; } return $content; }
protected function _applyDecorators($dataset) { $toolkit = lmbToolkit::instance(); foreach ($this->decorators as $decorator_data) { $class_path = new lmbClassPath($decorator_data[0]); $dataset = $class_path->createObject(array($dataset)); $this->_addParamsToDataset($dataset, $decorator_data[1]); } return $dataset; }
function sendPlainMail($recipients, $sender, $subject, $body, $charset = 'utf-8') { $content = ''; $content .= '<p>recipient: ' . $recipients . '</p>'; $content .= '<p>sender: ' . $sender . '</p>'; $content .= '<p>subject: ' . $subject . '</p>'; $content .= '<pre>text: ' . $body . '</pre>'; $content .= '<p>charset: ' . $charset . '</p>'; lmbToolkit::instance()->getResponse()->write($content); }
function setUp() { parent::setUp(); lmbFs::mkdir($this->tpl_dir . '/_mail'); $toolkit = lmbToolkit::instance(); $toolkit->setConf('macro', $this->_createMacroConfig()); $mail_config = $toolkit->getConf('mail'); $mail_config->set('mode', 'testing'); $toolkit->setConf('mail', $mail_config); }
function getValue() { $value = $this->base->getValue(); $toolkit = lmbToolkit::instance(); if ($this->isConstant()) { return lmb_ucfirst($value); } else { $this->raiseUnresolvedBindingError(); } }