public static function run($p = null, $root = null, $routes = true, $session = true, $whoops = true) { ob_start(); // self::$page = $p; self::$root = $root; // //session require __DIR__ . '/../core/Storage/Session.php'; if ($session) { Session::start(__DIR__ . '/../app/storage/session'); } // require __DIR__ . '/../core/Access/ErrorHandler.php'; // Config require __DIR__ . '/../core/Config/Config.php'; require __DIR__ . '/../core/Config/Exceptions/ConfigException.php'; //Maintenance require __DIR__ . '/../core/Maintenance/Maintenance.php'; //Objects require __DIR__ . '/../core/Objects/Vars.php'; require __DIR__ . '/../core/Objects/String/String.php'; require __DIR__ . '/../core/Objects/String/Exceptions/StringOutIndexException.php'; // Access require __DIR__ . '/../core/Access/Path.php'; // Set the error log ini_set("log_errors", 1); ini_set("error_log", __DIR__ . '/../app/storage/logs/fiesta.log'); // Set Whoops error handler if ($whoops) { ErrorHandler::ini(self::$root); } // //require __DIR__.'/../core/MVC/Templete.php'; require __DIR__ . '/../core/Objects/Exception.php'; require __DIR__ . '/../core/Faker.php'; require __DIR__ . '/../core/Storage/Cookie.php'; //routes // old //require __DIR__.'/../core/Access/Routes_2.php'; // new require __DIR__ . '/../core/Router/Routes.php'; require __DIR__ . '/../core/Router/Route.php'; require __DIR__ . '/../core/Router/Exceptions/RouteNotFoundException.php'; // Caches require __DIR__ . '/../core/Caches/Caches.php'; require __DIR__ . '/../core/Caches/Cache.php'; require __DIR__ . '/../core/Caches/FileCache.php'; require __DIR__ . '/../core/Caches/DatabaseCache.php'; require __DIR__ . '/../core/Caches/Exceptions/DriverNotFoundException.php'; require __DIR__ . '/../core/Storage/Storage.php'; require __DIR__ . '/../core/Security/Auth.php'; require __DIR__ . '/../core/Objects/Table.php'; // Database require __DIR__ . '/../core/Database/Schema.php'; require __DIR__ . '/../core/Database/Migration.php'; require __DIR__ . '/../core/Database/Seeder.php'; require __DIR__ . '/../core/Database/Database.php'; require __DIR__ . '/../core/Database/Drivers/MySql.php'; require __DIR__ . '/../core/Database/Exceptions/DatabaseArgumentsException.php'; require __DIR__ . '/../core/Database/Exceptions/DatabaseConnectionException.php'; require __DIR__ . '/../core/Access/Url.php'; require __DIR__ . '/../core/Hypertext/Pages.php'; require __DIR__ . '/../core/Objects/DateTime.php'; require __DIR__ . '/../core/Objects/Sys.php'; require __DIR__ . '/../core/Http/Links.php'; require __DIR__ . '/../core/Objects/Base.php'; require __DIR__ . '/../core/Libs.php'; require __DIR__ . '/../core/Hypertext/Res.php'; require __DIR__ . '/../core/Hypertext/Input.php'; require __DIR__ . '/../core/License.php'; require __DIR__ . '/../core/Hypertext/Cookie.php'; //Languages require __DIR__ . '/../core/Lang/Lang.php'; require __DIR__ . '/../core/Lang/Exceptions/LanguageKeyNotFoundException.php'; // MVC - model require __DIR__ . '/../core/MVC/Model/Model.php'; require __DIR__ . '/../core/MVC/Model/ModelArray.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ForeingKeyMethodException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ColumnNotEmptyException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/ManyPrimaryKeysException.php'; require __DIR__ . '/../core/MVC/Model/Exceptions/PrimaryKeyNotFoundException.php'; // MVC - View require __DIR__ . '/../core/MVC/View/View.php'; require __DIR__ . '/../core/MVC/View/Libs/Template.php'; require __DIR__ . '/../core/MVC/View/Libs/Views.php'; require __DIR__ . '/../core/MVC/View/Exceptions/ViewNotFoundException.php'; require __DIR__ . '/../core/Hypertext/HTML.php'; require __DIR__ . '/../core/Security/Encrypt.php'; require __DIR__ . '/../core/Security.php'; //require __DIR__.'/../core/MVC/Model.php'; // require __DIR__.'/../core/MVC/View.php'; require __DIR__ . '/../core/MVC/Controller.php'; require __DIR__ . '/../core/Http/Error.php'; require __DIR__ . '/../core/Hypertext/Script.php'; require __DIR__ . '/../core/Http/Root.php'; require __DIR__ . '/../core/Mail_2.php'; require __DIR__ . '/../core/Objects/DataCollection.php'; require __DIR__ . '/../core/Debug.php'; // Filesystem require __DIR__ . '/../core/Filesystem/Exceptions/FileNotFoundException.php'; require __DIR__ . '/../core/Filesystem/Exceptions/DirectoryNotFoundException.php'; require __DIR__ . '/../core/Filesystem/Filesystem.php'; // Database files require __DIR__ . '/../core/Database/DBTable.php'; Sys::ini(); Url::ini(); Path::ini(); Fiesta\MVC\View\Template::ini(self::$root); // Faker::ini(); Links::ini(); Errors::ini($root); License::ini(self::$page); Lang::ini(); Database::ini(); Auth::ini(); // if ($root != null) { // include models foreach (glob($root . "../app/models/*.php") as $file) { include_once $file; } //include the controllers files foreach (glob($root . "../app/controllers/*.php") as $file) { include_once $file; } //include the link files foreach (glob($root . "../app/paths/*.php") as $file) { include_once $file; } //include the seeders files foreach (glob($root . "../app/seeds/*.php") as $file) { include_once $file; } // //include filters include_once $root . "../app/http/Filters.php"; //include for routes if ($routes) { include_once $root . "../app/http/Routes.php"; Fiesta\Router\Routes::run(); } } else { // include models foreach (glob("../app/models/*.php") as $file) { include_once $file; } //include the controllers files foreach (glob("../app/controllers/*.php") as $file) { include_once $file; } //include the seeders files foreach (glob("../app/seeds/*.php") as $file) { include_once $file; } //include filters include_once "../app/http/Filters.php"; //include for routes if ($routes) { include_once "../app/http/Routes.php"; Fiesta\Router\Routes::run(); } } }
<?php namespace ScriptAcid; $startKernelIncludeTime = microtime(); require_once $_SERVER['DOCUMENT_ROOT'] . '/scriptacid/core/kernel.php'; //require_once $_SERVER['DOCUMENT_ROOT'].'/scriptacid/core/application.php'; $stopKernelIncludeTime = microtime(); $diffKernelIncludeTime = $stopKernelIncludeTime - $startKernelIncludeTime; ob_start(); App::setTitle('bench_kernel_include'); $startMakePage = microtime(); App::page(function () { echo '{__bench_placeholder}'; }); $stopMakePage = microtime(); $fullBufferContents = ob_get_clean(); $diffMakePage = $stopMakePage - $startMakePage; echo str_replace('{__bench_placeholder}', '' . 'kernel include time: ' . $diffKernelIncludeTime . endl . 'Application::makePage time: ' . $diffMakePage . endl, $fullBufferContents);
/** * App constructor. */ public static function init() { // we'll reset this after we read our config file date_default_timezone_set('UTC'); self::$config = array('system' => array()); self::$page = array(); self::$pager = array(); self::$query_string = ''; startup(); set_include_path('include' . PATH_SEPARATOR . 'library' . PATH_SEPARATOR . 'library/langdet' . PATH_SEPARATOR . '.'); self::$scheme = 'http'; if (x($_SERVER, 'HTTPS') && $_SERVER['HTTPS']) { self::$scheme = 'https'; } elseif (x($_SERVER, 'SERVER_PORT') && intval($_SERVER['SERVER_PORT']) == 443) { self::$scheme = 'https'; } if (x($_SERVER, 'SERVER_NAME')) { self::$hostname = $_SERVER['SERVER_NAME']; if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { self::$hostname .= ':' . $_SERVER['SERVER_PORT']; } /** * Figure out if we are running at the top of a domain * or in a sub-directory and adjust accordingly */ $path = trim(dirname($_SERVER['SCRIPT_NAME']), '/\\'); if (isset($path) && strlen($path) && $path != self::$path) { self::$path = $path; } } set_include_path("include/self::{$hostname}" . PATH_SEPARATOR . get_include_path()); if (x($_SERVER, 'QUERY_STRING') && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") { self::$query_string = substr($_SERVER['QUERY_STRING'], 2); // removing trailing / - maybe a nginx problem if (substr(self::$query_string, 0, 1) == "/") { self::$query_string = substr(self::$query_string, 1); } } if (x($_GET, 'q')) { self::$cmd = trim($_GET['q'], '/\\'); } // unix style "homedir" if (substr(self::$cmd, 0, 1) === '~') { self::$cmd = 'channel/' . substr(self::$cmd, 1); } /* * Break the URL path into C style argc/argv style arguments for our * modules. Given "http://example.com/module/arg1/arg2", self::$argc * will be 3 (integer) and self::$argv will contain: * [0] => 'module' * [1] => 'arg1' * [2] => 'arg2' * * There will always be one argument. If provided a naked domain * URL, self::$argv[0] is set to "home". */ self::$argv = explode('/', self::$cmd); self::$argc = count(self::$argv); if (array_key_exists('0', self::$argv) && strlen(self::$argv[0])) { self::$module = str_replace(".", "_", self::$argv[0]); self::$module = str_replace("-", "_", self::$module); if (strpos(self::$module, '_') === 0) { self::$module = substr(self::$module, 1); } } else { self::$argc = 1; self::$argv = array('home'); self::$module = 'home'; } /* * See if there is any page number information, and initialise * pagination */ self::$pager['page'] = x($_GET, 'page') && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1; self::$pager['itemspage'] = 60; self::$pager['start'] = self::$pager['page'] * self::$pager['itemspage'] - self::$pager['itemspage']; if (self::$pager['start'] < 0) { self::$pager['start'] = 0; } self::$pager['total'] = 0; /* * Detect mobile devices */ $mobile_detect = new Mobile_Detect(); self::$is_mobile = $mobile_detect->isMobile(); self::$is_tablet = $mobile_detect->isTablet(); self::head_set_icon('/images/hz-32.png'); /* * register template engines */ spl_autoload_register('ZotlabsAutoloader::loader'); self::$meta = new Zotlabs\Web\HttpMeta(); // create an instance of the smarty template engine so we can register it. $smarty = new Zotlabs\Render\SmartyTemplate(); $dc = get_declared_classes(); foreach ($dc as $k) { if (in_array('Zotlabs\\Render\\TemplateEngine', class_implements($k))) { self::register_template_engine($k); } } }
require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; App::page(function (&$arPageParams) { ?> <?php App::USER()->Authorize('1'); SetTitle('Проект "ScriptACID CMF"'); ?> <?php App::callComponent('system:catalog.section', '_default:default', array('TYPE' => 'orion_locations', 'CATALOG_ID' => '3', 'CACHE_TIME' => '3600', 'COMPONENT_AJAX_MODE' => 'OFF', 'LIST_URL' => '', 'ELEMENT_URL' => '', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); ?> <?php App::callComponent('system:catalog.element.add', '_default:default', array('TYPE' => 'orion_locations', 'FIELDS' => array('1' => 'ID', '2' => 'NAME', '3' => 'CATALOG_SECTION_ID', '4' => 'CODE', '5' => 'PREVIEW_PICTURE', '6' => 'PREVIEW_TEXT', '7' => 'PREVIEW_TEXT_TYPE', '8' => 'DETAIL_PICTURE', '9' => 'DETAIL_TEXT'), 'CATALOG_ID' => '3', 'ID' => '{%_GET[ID]}', 'ACTION_PARAMETER' => '{%_GET[ACTION]}', 'COMPONENT_AJAX_MODE' => 'OFF', 'CACHE_TIME' => '3600', 'LIST_URL' => '/test/test_edit_component_call.php', 'ELEMENT_URL' => '/test/test_edit_component_call.php?ID=#ID#', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); ?> <?php App::callComponent('test:empty', '_default:default', array('CACHE_TIME' => '36001', 'COMPONENT_AJAX_MODE' => 'OFF', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); App::callComponent('test:empty', '_default:default', array('CACHE_TIME' => '36002', 'COMPONENT_AJAX_MODE' => 'OFF', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); ?> <?php // d(ComponentTools::getComponentListInFile('public_page')) ?> <?php }); // end makePage
/** * http://demoshop.actionpay.ru/shop.yml * Генерация YML-каталога */ $app->page('/shop.yml', function () use($app) { $xml = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . '<!DOCTYPE yml_catalog SYSTEM "shops.dtd">' . PHP_EOL . '<yml_catalog date="' . date('Y-m-d H:i:s') . '">' . PHP_EOL . ' <shop>' . PHP_EOL . ' <name>Овощи&Фрукты</name>' . PHP_EOL . ' <company>ООО "Овощи&Фрукты"</company>' . PHP_EOL . ' <url>http://' . DEMOSHOP_DOMAIN . '</url>' . PHP_EOL . ' <agency>Actionpay</agency>' . PHP_EOL . ' <currencies>' . PHP_EOL . ' <currency id="RUR" rate="1" />' . PHP_EOL . ' </currencies>' . PHP_EOL . ' <categories>' . PHP_EOL; $categories = Category::getAll(); foreach ($categories as $category) { $xml .= ' <category id="' . $category->id . '"' . ($category->parent_id ? ' parentId="' . $category->parent_id . '"' : '') . '>' . $category->name . '</category>' . PHP_EOL; } $xml .= ' </categories>' . PHP_EOL; $xml .= ' <offers>' . PHP_EOL; $products = Product::getAll(); foreach ($products as $product) { $xml .= ' <offer id="' . $product->id . '" available="true">' . PHP_EOL; $xml .= ' <url>http://' . DEMOSHOP_DOMAIN . '/product?p=' . $product->id . '</url>' . PHP_EOL; $xml .= ' <price>' . $product->price . '</price>' . PHP_EOL; $xml .= ' <currencyId>RUR</currencyId>' . PHP_EOL; $xml .= ' <categoryId>' . $product->category_id . '</categoryId>' . PHP_EOL; $xml .= ' <picture>http://' . DEMOSHOP_DOMAIN . '/img/big/' . $product->image . '</picture>' . PHP_EOL; $xml .= ' <name>' . $product->name . '</name>' . PHP_EOL; $xml .= ' </offer>' . PHP_EOL; } $xml .= ' </offers>' . PHP_EOL . ' </shop>' . PHP_EOL . '</yml_catalog>' . PHP_EOL; header('Content-Type: text/xml'); return $xml; }); /** * http://demoshop.actionpay.ru/actionpay.xml * XML-отчет по заказам для Actionpay */
<?php namespace ScriptAcid; require_once $_SERVER['DOCUMENT_ROOT'] . '/scriptacid/core/application.php'; App::page(function () { // Не знаю в чем прикол, но надо обязательно вызвать первый раз, что бы тесты не искажались. startBench('_this_need_for_correct_bench_at_first_call'); stopBench('_this_need_for_correct_bench_at_first_call'); Bench::startTime('_this_need_for_correct_bench_at_first_call'); Bench::stopTime('_this_need_for_correct_bench_at_first_call'); define('IF_DEFINE', true); define('FORCE_DEFINE', true); Bench::startTime('IF_DEFINE'); if (!defined('IF_DEFINE')) { define('IF_DEFINE', true); } d(Bench::stopTime('IF_DEFINE')); Bench::startTime('FORCE_DEFINE'); @define('FORCE_DEFINE', true); d(Bench::stopTime('FORCE_DEFINE')); ?> <?php }); // end of makePage
require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; SetTitle('Проект "ScriptACID CMF"'); App::page(function (&$arPageParams) { ?> <?php App::USER()->Authorize('1'); ?> <?php Bench::startTime(":catalog.section"); App::callComponent(":catalog.section", "", array("TYPE" => "orion_locations", "CATALOG_ID" => "3", "CACHE_OFF" => "Y", "COMPONENT_AJAX_MODE" => "N")); ?> <p>Время: <?php echo Bench::stopTime(":catalog.section"); ?> </p> <?php Bench::startTime(":catalog.element.add@_default"); App::callComponent(":catalog.element.add", "_default", array("COMPONENT_AJAX_MODE" => "N", "FIELDS" => array("ID", "ACTIVE", "NAME", "CATALOG_SECTION_ID", "CATALOG_ID", "SORT", "CODE", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "TAGS"), "TYPE" => "orion_locations", "CATALOG_ID" => "3", "ID" => '{%_GET[ID]}', "ACTION" => '{%_GET[ACTION]}', "LIST_URL" => "/test/test_ajax_component_call.php", "ELEMENT_URL" => "/test/test_ajax_component_call.php?ID=#ID#")); ?> <p>Время: <?php echo Bench::stopTime(":catalog.element.add@_default"); ?> </p> <?php }); // end makePage
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; App::page(function (&$arPageParams) { ?> <b><?php echo App::get()->getTemplateName(); ?> </b><br /> <b><?php echo App::get()->getTemplateSkin(); ?> </b><br /> <?php }, false); // end of makePage App::setTitle("Тестируем работу шаблонов и скинов"); ?> <?php App::connectTemplate("_default:skin1"); // App::connectTemplate(":skin2"); // App::connectTemplate("app_template:skin1"); // App::get()->connectTemplate("../../../../../index.php\0"); // App::setTemplateName("_admin"); // Сначала задаем шаблон // App::setTemplateName(":skin1"); // Потом отдельно скин // App::setTemplateName("_admin:skin1"); // Или все сразу
App::page(function (&$arPageParams) { ?> <?php App::USER()->Authorize('1'); SetTitle('Проект "ScriptACID CMF"'); ?> <p class="some-class">TEST AJAX Component Call</p> <p><b>Тестирование редиректа в аджакс вызовах.</b></p> <?php App::callComponent('test:test.redirect_to', '', array('REDIRECT_TO' => '{%_GET[REDIRECT_TO]}', 'COMPONENT_AJAX_MODE' => 'N')); ?> <p><b>Тест передачи пост запроса к асинхронному запросу компонента</b></p> <span>Нажмите "отправить", что бы увидеть вывод в компоненте</span> <br /> <?php App::callComponent('test:test.print_post', '', array('COMPONENT_AJAX_MODE' => 'Y', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'Y')); ?> <form action="" method="post"> <input type="hidden" name="post_param1" value="value1" /> <input type="hidden" name="post_param2" value="value2" /> <input type="hidden" name="post_param3" value="value3" /> <input type="submit" name="post_send" value="Отправить" /> </form> <br /> <br /> <p><b>Тест работы аджакс двух компонентов.</b></p> <?php App::callComponent('system:catalog.section', '_default:default', array('TYPE' => 'orion_locations', 'CATALOG_ID' => '3', 'COMPONENT_AJAX_MODE' => 'AJAX', 'CACHE_TIME' => '3600', 'ELEMENT_URL' => '', 'LIST_URL' => '', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); App::callComponent('system:catalog.element.add', '_default:inherit', array('TYPE' => 'orion_locations', 'FIELDS' => array('1' => 'ID', '2' => 'ACTIVE', '3' => 'NAME', '4' => 'CATALOG_SECTION_ID', '5' => 'CATALOG_ID', '6' => 'SORT', '7' => 'CODE', '8' => 'PREVIEW_PICTURE', '9' => 'PREVIEW_TEXT', '10' => 'PREVIEW_TEXT_TYPE', '11' => 'DETAIL_PICTURE', '12' => 'DETAIL_TEXT', '13' => 'DETAIL_TEXT_TYPE', '14' => 'TAGS'), 'CATALOG_ID' => '3', 'ID' => '{%_REQUEST[ID]}', 'ACTION_PARAMETER' => '{%_GET[ACTION]}', 'COMPONENT_AJAX_MODE' => 'AJAX', 'CACHE_TIME' => '3600', 'LIST_URL' => '/test/test_ajax_component_call.php', 'ELEMENT_URL' => '/test/test_ajax_component_call.php?ID=#ID#', 'COMPONENT_AJAX_SEND_PAGE_POST' => 'N')); ?> <p> Так бдет делаться связывание компонентов<br /> $cckSystemCatalogSection_1 = App::callComponent(":catalog.section", ...);<br /> $cckSystemCatalogElementAdd_1 = App::callComponent(":catalog.element.add", ...);<br /> App::linkComponentKeys(array($cckSystemCatalogSection_1, $cckSystemCatalogElementAdd_1));<br /> </p> <b>Ссылки для того, что бы убедиться в том, что компоненты перегружаются только в случае изменения только тез #?-параметров от которых зависит компонент. см. параметры вызова.</b><br /> <a href="#!get_ID1=11&get_ID2=12&get_ID3=13&get_ID4=14">#?get_ID1=11&get_ID2=12&get_ID3=13&get_ID4=14</a>,<br /> <a href="#!get_ID1=21&get_ID2=22&get_ID3=23&get_ID4=24">#?get_ID1=21&get_ID2=22&get_ID3=23&get_ID4=24</a>,<br /> <a href="#!get_ID1=31&get_ID2=32&get_ID3=33&get_ID4=34">#?get_ID1=31&get_ID2=32&get_ID3=33&get_ID4=34</a>,<br /> <a href="#!get_ID1=41&get_ID2=42&get_ID3=43&get_ID4=44">#?get_ID1=41&get_ID2=42&get_ID3=43&get_ID4=44</a>,<br /> <?php });
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; App::page(function (&$arPageParams) { trigger_error("some app deprecated error. TRIGGER.", E_USER_DEPRECATED); trigger_error("some app warning error. TRIGGER.", E_USER_WARNING); trigger_error("some app notice error. TRIGGER.", E_USER_NOTICE); trigger_error("some app ERROR error. TRIGGER. It stops executing.", E_USER_ERROR); throwException(AppDeprecatedException, "some app deprecated error"); throwException(AppNoticeException, "some app notice error"); throwException(AppWarningException, "some app warning error"); throwException(AppErrorException, "some app ERROR error. It stops executing"); throw new AppWarningException("some app error", "1"); throw new AppErrorException("some app fatal error", "1"); }); //end of makePage
if (!$parentKey) { $parentKey = 0; } $arParents[$parentKey][$CHILDS_KEY][] = $key; $prevKey = $key; $arLastKeyInDepth[$item[$DEPTH_KEY]] = $prevKey; } //d($arParents, '$arParents'); //d($arChilds, '$arChilds'); $arRelations = array(); $arRelations[0] = $arParents[0]; foreach ($arChilds as $childKey => $arChild) { $arRelations[$childKey] = $arChild; $arRelations[$childKey][$CHILDS_KEY] = array(); $arRelations[$childKey][$CHILDS_KEY] = $arParents[$childKey][$CHILDS_KEY]; } //d($arRelations, '$arRelations'); return $arRelations; } App::page(function () { ?> <?php $array1 = array("KEY1" => array("NAME" => "EL1", "DEPTH_LEVEL" => "1"), "KEY2" => array("NAME" => "EL2", "DEPTH_LEVEL" => "1"), "KEY21" => array("NAME" => "EL21", "DEPTH_LEVEL" => "2"), "KEY22" => array("NAME" => "EL22", "DEPTH_LEVEL" => "2"), "KEY221" => array("NAME" => "EL221", "DEPTH_LEVEL" => "3"), "KEY222" => array("NAME" => "EL222", "DEPTH_LEVEL" => "3"), "KEY23" => array("NAME" => "EL23", "DEPTH_LEVEL" => "2"), "KEY24" => array("NAME" => "EL24", "DEPTH_LEVEL" => "2"), "KEY241" => array("NAME" => "EL241", "DEPTH_LEVEL" => "3"), "KEY2411" => array("NAME" => "EL2411", "DEPTH_LEVEL" => "4"), "KEY3" => array("NAME" => "EL3", "DEPTH_LEVEL" => "1")); $arResultTree = getRelationTableFromFlatTree($array1); d($arResultTree); ?> <?php }); // end of makePage
<?php namespace ScriptAcid; require_once $_SERVER['DOCUMENT_ROOT'] . '/scriptacid/core/application.php'; App::page(function () { ?> <?php ?> <?php }); // end of makePage
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/kernel.php"; class MyApplicationClass extends Application { public static function getInstance() { if (!self::$_instance || !self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; } public function myAppMethod() { echo __CLASS__ . "::myAppMethod()"; } } App::page(function () { ?> <pre><?php App::setApplicationClass("ScriptAcid\\MyApplicationClass"); App::myAppMethod(); echo App::Version(); ?> </pre> <?php }); //end makePage
<?php namespace ScriptAcid; require_once $_SERVER["DOCUMENT_ROOT"] . "/scriptacid/core/application.php"; SetTitle('Проект "ScriptACID CMF". Тест получения параметров компонента'); App::page(function (&$arPageParams) { ?> <?php echo "<b>:catalog.element.add@_default</b>" . endl; $arCatalogElementAddComponentSettings = ComponentTools::getSettingsByName(':catalog.element.add'); d($arCatalogElementAddComponentSettings, ':catalog.element.add'); $arTplList = ComponentTools::getTemplatesList(':catalog.element.add'); d($arTplList, ':catalog.element.add - templates list'); echo "<b>:menu@top</b>" . endl; $arMenuTopComponentSettings = ComponentTools::getSettingsByName(":menu", 'top'); d($arMenuTopComponentSettings, ':menu@top'); echo "<b>:menu@left</b>" . endl; $arMenuLeftComponentSettings = ComponentTools::getSettingsByName(':menu', 'left'); d($arMenuLeftComponentSettings, ':menu@left'); $arTplList = ComponentTools::getTemplatesList(':menu'); d($arTplList, ':menu - templates list'); ?> <?php }); // end of makePage