function createRequest($req = 'socket') { $class = 'lmb' . ucfirst($req) . 'WebAgentRequest'; $class_path = dirname(__FILE__) . '/request/' . $class . '.class.php'; lmb_require($class_path); return new $class(); }
/** * @desc create admin controller and admin templates for entity specified by table name * @param table_name|all * @deps entity_parse_table_argument */ function task_entity_create_admin() { lmb_require('limb/constructor/src/lmbAdminControllerConstructor.class.php'); _createAndRunConstructor('lmbAdminControllerConstructor'); lmb_require('limb/constructor/src/lmbAdminTemplatesConstructor.class.php'); _createAndRunConstructor('lmbAdminTemplatesConstructor'); }
/** * @return lmbValidator */ protected function _createInsertValidator() { $validator = $this->_createValidator(); $validator->addRequiredRule('password', 'Поле "Пароль" обязательно для заполнения'); lmb_require('limb/validation/src/rule/lmbMatchRule.class.php'); $validator->addRule(new lmbMatchRule('password', 'repeat_password', 'Значения полей "Пароль" и "Подтверждение пароля" не совпадают')); return $validator; }
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 _getPalleteContainer() { $class_name = $this->_getClass('lmb%ImageContainer'); lmb_require('limb/imagekit/src/' . $this->driver . '/' . $class_name . '.class.php'); $cont = new $class_name(); $cont->load($this->_getInputPalleteImage()); return $cont; }
function _createModelAndIncludeThem($table_name, $object_name) { $table = $this->conn->getDatabaseInfo()->getTable($table_name); $model_constructor = new lmbModelConstructor(new lmbProjectConstructor($this->dir_for_test_case, new lmbCliOutput()), $this->conn->getDatabaseInfo(), $table, $object_name); $model_constructor->create(); foreach (lmb_glob($this->dir_for_test_case . '/src/model/*.class.php') as $file) { lmb_require($file); } }
protected function _createValidator() { lmb_require('limb/cms/src/validation/rule/lmbCmsUniqueFieldRule.class.php'); $validator = new lmbValidator(); $validator->addRequiredRule('title', '"Title" обязательное поле'); $validator->addRequiredRule('url', '"Url" обязательное поле'); $validator->addRule(new lmbCmsUniqueFieldRule('url', 'lmbCmsSeo', $this, '"Url" должен быть уникальным')); return $validator; }
function getValue() { lmb_require('limb/net/src/lmbIp.class.php'); if ($this->isConstant()) { return lmbIp::decode($this->base->getValue()); } else { $this->raiseUnresolvedBindingError(); } }
function getResponse() { if (is_object($this->response)) { return $this->response; } lmb_require('limb/net/src/lmbHttpResponse.class.php'); $this->response = new lmbHttpResponse(); return $this->response; }
/** * @return lmbValidator */ protected function _createValidator() { $validator = new lmbValidator(); $validator->addRequiredRule('identifier', 'Поле "Идентификатор" обязательно для заполнения'); $validator->addRequiredRule('content', 'Поле "Текст" обязательно для заполнения'); lmb_require('limb/cms/src/validation/rule/lmbCmsTextBlockUniqueFieldRule.class.php'); $validator->addRule(new lmbCmsTextBlockUniqueFieldRule('identifier', $this, 'Текстовый блок со значением поля "Идентификатор" уже существует')); return $validator; }
protected function _createCompiler() { lmb_require('limb/macro/src/compiler/*.interface.php'); lmb_require('limb/macro/src/compiler/*.class.php'); $tag_dictionary = lmbMacroTagDictionary::instance(); $filter_dictionary = lmbMacroFilterDictionary::instance(); $tag_dictionary->load($this->config); $filter_dictionary->load($this->config); return new lmbMacroCompiler($tag_dictionary, $this->locator, $filter_dictionary); }
function _createValidator() { $validator = new lmbValidator(); $validator->addRequiredRule('title', 'Поле "Заголовок" обязательно для заполнения'); $validator->addRequiredRule('content', 'Поле "Текст" обязательно для заполнения'); $validator->addRequiredRule('identifier', 'Поле "Идентификатор" обязательно для заполнения'); lmb_require('limb/cms/src/validation/rule/lmbTreeIdentifierRule.class.php'); $validator->addRule(new lmbTreeIdentifierRule('identifier')); return $validator; }
protected function _includeFiles() { if (function_exists('lmb_require')) { foreach ($this->class_paths as $path) { lmb_require($path); } } else { foreach ($this->class_paths as $path) { require_once $path; } } }
protected static function applyWrapper($connection, $wrapper_name) { $wrapper_class = 'lmb' . ucfirst($wrapper_name) . 'CacheWrapper'; if (!class_exists($wrapper_class)) { $file = DIRNAME(__FILE__) . '/wrappers/' . $wrapper_class . '.class.php'; if (!file_exists($file)) { throw new lmbException("Cache wripper '{$wrapper_class}' file not found", array('dsn' => $dsn, 'name' => $wrapper_name, 'class' => $wrapper_class, 'file' => $file)); } lmb_require($file); } return new $wrapper_class($connection); }
static function create($library = 'gd', $dir = '', $params = array()) { $image_class_name = 'lmb' . ucfirst($library) . 'ImageConverter'; $class_path = 'limb/imagekit/src/' . $library . '/' . $image_class_name . '.class.php'; lmb_require($class_path); try { $converter = new $image_class_name($params); } catch (lmbException $e) { throw new lmbFileNotFoundException($class_path, 'image library not found'); } return $converter; }
protected function _createLogWriter($dsn) { if (!is_object($dsn)) { $dsn = new lmbUri($dsn); } $writer_name = 'lmbLog' . ucfirst($dsn->getProtocol()) . 'Writer'; $writer_file = 'limb/log/src/' . $writer_name . '.class.php'; try { lmb_require($writer_file); $writer = new $writer_name($dsn); return $writer; } catch (lmbFileNotFoundException $e) { throw new lmbFileNotFoundException($writer_file, 'Log writer not found'); } }
function testSocketConnection() { lmb_require('core/src/lmbSys.class.php'); $this->skipIf(lmbSys::isWin32(), "Windows platform doesn't support sockets."); $config = $this->connection->getConfig()->export(); $config['socket'] = $this->getSocket(); $connection_class = get_class($this->connection); try { $connection = new $connection_class($config); $connection->connect(); } catch (Exception $e) { $this->fail("Connection through socket {$config['socket']} failed."); } if (isset($connection)) { $connection->disconnect(); unset($connection); } }
function lmb_cli_find_project_dir($current_dir) { if (file_exists($current_dir . '/setup.php')) { ob_start(); register_shutdown_function('lmb_cli_check_limb_instance'); lmb_require($current_dir . '/setup.php'); ob_end_clean(); lmb_cli_check_limb_instance($disable = true); return $current_dir; } else { $parent_dir = dirname($current_dir); if ($current_dir != $parent_dir) { return lmb_cli_find_project_dir($parent_dir); } else { return getcwd(); } } }
protected function _fillWactTemplate($template) { foreach ($this->getVariables() as $variable_name => $value) { $template->set($variable_name, $value); } foreach ($this->forms_datasources as $form_id => $datasource) { $form_component = $template->getChild($form_id); $form_component->registerDataSource($datasource); } foreach ($this->forms_errors as $form_id => $error_list) { $form_component = $template->getChild($form_id); if (!$error_list->isValid()) { lmb_require('limb/wact/src/components/form/error.inc.php'); $wact_error_list = new WactFormErrorList($error_list->getArray()); $wact_error_list->bindToForm($form_component); } } }
<?php lmb_require('limb/macro/src/compiler/lmbMacroTag.class.php'); lmb_require('limb/cms/src/model/lmbCmsTextBlock.class.php'); /** * class TextBlock. * @tag text_block * @req_attributes id * @restrict_self_nesting * @forbid_end_tag */ class TextBlockTag extends lmbMacroTag { protected function _generateContent($code) { $code->writeHTML(lmbCmsTextBlock::getRawContent($this->get('id'))); } }
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2010 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ /** * @package mail * @version $Id: common.inc.php 7486 2009-01-26 19:13:20Z pachanga $ */ require_once 'limb/core/common.inc.php'; lmb_require_optional('limb/view/common.inc.php'); lmb_require('limb/mail/toolkit.inc.php'); lmb_package_register('mail', dirname(__FILE__));
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/fs/src/exception/lmbFsException.class.php'); /** * class lmbFsRecursiveIterator. * * @package fs * @version $Id$ */ class lmbFsRecursiveIterator implements Iterator { protected $start_dir; protected $open_dirs = array(); protected $valid; protected $dir; protected $item; protected $counter = 0; function __construct($dir) { $this->start_dir = $dir; } function rewind() { $this->open_dirs = array();
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/dbal/src/lmbSimpleDb.class.php'); lmb_require('limb/dbal/src/query/lmbSelectQuery.class.php'); lmb_require('limb/dbal/src/query/lmbUpdateQuery.class.php'); lmb_require('limb/dbal/src/query/lmbDeleteQuery.class.php'); lmb_require('limb/dbal/src/query/lmbInsertQuery.class.php'); lmb_require('limb/dbal/src/query/lmbBulkInsertQuery.class.php'); /** * class lmbDBAL. * * @package dbal * @version $Id: lmbDBAL.class.php 8187 2010-04-28 17:48:33Z korchasa $ */ class lmbDBAL { /** * @param lmbDbDSN $dsn */ static function setDefaultDSN($dsn) { lmbToolkit::instance()->setDefaultDbDSN($dsn); } static function setEnvironment($env)
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/fs/src/lmbFileLocations.interface.php'); /** * class lmbFileLocationsList. * * @package fs * @version $Id$ */ class lmbFileLocationsList implements lmbFileLocations { protected $locations = array(); function __construct() { if (($args = func_get_args()) > 0) { $this->locations = $args; } } function getLocations($params = array()) { return $this->_collectLocations($this->locations, $params); } function _collectLocations($locations, $params) {
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/dbal/src/drivers/lmbDbBaseRecordSet.class.php'); lmb_require('limb/dbal/src/drivers/pgsql/lmbPgsqlRecord.class.php'); /** * class lmbPgsqlRecordSet. * * @package dbal * @version $Id: lmbPgsqlRecordSet.class.php 7486 2009-01-26 19:13:20Z pachanga $ */ class lmbPgsqlRecordSet extends lmbDbBaseRecordSet { protected $connection; protected $stmt; protected $current; protected $valid; protected $key; function __construct($connection, $statement) { $this->connection = $connection; $this->stmt = $statement; } function freeQuery() {
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/dbal/src/drivers/lmbDbStatement.interface.php'); /** * class lmbLinterStatement. * * @package dbal * @version $Id: $ */ class lmbLinterStatement implements lmbDbStatement { protected $sql; protected $original_sql; protected $prepared_sql; protected $statement; protected $connection; protected $parameters = array(); protected $queryId; protected $prepRequired = false; protected $prepParams = array(); function __construct($connection, $sql) { $this->sql = $sql; $this->original_sql = $sql;
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/macro/src/lmbMacroTemplate.class.php'); lmb_require('limb/macro/src/lmbMacroConfig.class.php'); class lmbBaseMacroTest extends UnitTestCase { public $base_dir; public $tpl_dir; public $cache_dir; public $tags_dir; public $filters_dir; function setUp() { $this->base_dir = lmb_var_dir() . '/tpl'; $this->tpl_dir = $this->base_dir; $this->cache_dir = $this->base_dir . '/compiled'; $this->tags_dir = dirname(__FILE__) . '/../../src/tags'; $this->filters_dir = dirname(__FILE__) . '/../../src/filters'; lmbFs::rm(lmb_var_dir()); lmbFs::mkdir(lmb_var_dir()); lmbFs::mkdir($this->base_dir); lmbFs::mkdir($this->tpl_dir); lmbFs::mkdir($this->cache_dir); }
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/dbal/src/drivers/lmbDbTypeInfo.class.php'); /** * class lmbMssqlTypeInfo. * * @package dbal * @version $Id: lmbMssqlTypeInfo.class.php,v 1.1.1.1 2009/06/08 11:57:21 mike Exp $ */ class lmbMssqlTypeInfo extends lmbDbTypeInfo { function getNativeToColumnTypeMapping() { return array('bit' => LIMB_DB_TYPE_BIT, 'tinyint' => LIMB_DB_TYPE_SMALLINT, 'smallint' => LIMB_DB_TYPE_SMALLINT, 'mediumint' => LIMB_DB_TYPE_INTEGER, 'int' => LIMB_DB_TYPE_INTEGER, 'integer' => LIMB_DB_TYPE_INTEGER, 'bigint' => LIMB_DB_TYPE_DECIMAL, 'int24' => LIMB_DB_TYPE_INTEGER, 'real' => LIMB_DB_TYPE_FLOAT, 'float' => LIMB_DB_TYPE_FLOAT, 'decimal' => LIMB_DB_TYPE_DECIMAL, 'numeric' => LIMB_DB_TYPE_DECIMAL, 'double' => LIMB_DB_TYPE_DOUBLE, 'char' => LIMB_DB_TYPE_CHAR, 'varchar' => LIMB_DB_TYPE_VARCHAR, 'nvarchar' => LIMB_DB_TYPE_VARCHAR, 'date' => LIMB_DB_TYPE_DATE, 'time' => LIMB_DB_TYPE_TIME, 'year' => LIMB_DB_TYPE_INTEGER, 'datetime' => LIMB_DB_TYPE_DATE, 'smalldatetime' => LIMB_DB_TYPE_DATE, 'timestamp' => LIMB_DB_TYPE_TIMESTAMP, 'tinyblob' => LIMB_DB_TYPE_BLOB, 'blob' => LIMB_DB_TYPE_BLOB, 'binary' => LIMB_DB_TYPE_BLOB, 'image' => LIMB_DB_TYPE_BLOB, 'mediumblob' => LIMB_DB_TYPE_BLOB, 'longblob' => LIMB_DB_TYPE_BLOB, 'tinytext' => LIMB_DB_TYPE_CLOB, 'mediumtext' => LIMB_DB_TYPE_CLOB, 'text' => LIMB_DB_TYPE_CLOB, 'longtext' => LIMB_DB_TYPE_CLOB, 'enum' => LIMB_DB_TYPE_CHAR, 'set' => LIMB_DB_TYPE_CHAR); } }
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2009 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/cli/src/lmbCliException.class.php'); /** * class lmbCliOption. * * @package cli * @version $Id: lmbCliOption.class.php 7686 2009-03-04 19:57:12Z korchasa $ */ class lmbCliOption { const VALUE_OPT = 0; const VALUE_REQ = 1; const VALUE_NO = 2; protected $short_name; protected $long_name; protected $value_mode; protected $value; function __construct($short_or_long_name, $long_name = null, $value_mode = self::VALUE_NO) { if (!is_string($long_name) && strlen($short_or_long_name) > 1) { $this->long_name = $short_or_long_name; $this->value_mode = !is_null($long_name) ? $long_name : self::VALUE_NO; } elseif (!is_string($long_name) && strlen($short_or_long_name) == 1) {
<?php /* * Limb PHP Framework * * @link http://limb-project.com * @copyright Copyright © 2004-2012 BIT(http://bit-creative.com) * @license LGPL http://www.gnu.org/copyleft/lesser.html */ lmb_require('limb/macro/src/tags/form/lmbMacroFormElementTag.class.php'); /** * Macro analog for html <input type="text"> tag * @tag form:text * @forbid_end_tag * @package macro */ class lmbMacroFormTextTag extends lmbMacroFormElementTag { protected $html_tag = 'input'; protected $widget_include_file = 'limb/macro/src/tags/form/lmbMacroInputWidget.class.php'; protected $widget_class_name = 'lmbMacroInputWidget'; function preParse($compiler) { parent::preParse($compiler); $this->set('type', 'text'); } }