<?php require __DIR__ . '/../PreConfig.php'; function example() { $argument = ['credentials' => ['admin' => ['read' => true, 'write' => true], 'reader' => ['read' => true, 'write' => false]], 'users' => ['someImportantDude' => ['username' => 'him', 'password' => '...', 'credentials' => '{{ credentials.admin }}']]]; $configs = new \Namshi\PreConfig\PreConfig($argument); return $configs->get('users'); } print_r(example()); /* The Output: [ 'someImportantDude' => [ 'username' => 'him', 'password' => '...', 'credentials' => '{{ credentials.admin }}' ] ] */ function exampleMultiLevel() { $argument = ['credentials' => ['admin' => ['read' => true, 'write' => true], 'reader' => ['read' => true, 'write' => false]], 'users' => ['someImportantDude' => ['username' => 'him', 'password' => '...', 'credentials' => '{{ credentials.admin }}']]]; $configs = new \Namshi\PreConfig\PreConfig($argument); return $configs->get('users.someImportantDude'); } print_r(exampleMultiLevel()); /* The Output: [ 'username' => 'him', 'password' => '...', 'credentials' => '{{ credentials.admin }}'
function has_quirk($quirk) { global $client; example($quirk, $client->has_quirk($quirk)); }
<?php example('nc-table | advanced'); ?> <?php $table = $nc_core->ui->table()->bordered()->small(); $table->thead()->th('#')->text_right()->th('Name')->th('Email'); foreach ($data as $row) { $table->add_row()->modificator($row['status'] ? 'green' : 'red')->td($row['id'])->text_right()->td($row['name'])->href('#user-' . $row['id'])->td($row['email']); } echo $table; ?> <?php example('nc-table | advanced 2'); ?> <?php $table = $nc_core->ui->table()->bordered()->small()->wide(); $table->thead()->th('')->compact()->th('#')->text_center()->compact()->th('Name')->th('Email'); $t_row = $table->row(); $t_row->status = $t_row->td()->href('#')->icon('off'); $t_row->id = $t_row->td()->text_center(); $t_row->name = $t_row->td(); $t_row->email = $t_row->td(); foreach ($data as $row) { $t_row->status->icon($row['status'] ? 'on' : 'off'); $t_row->id->text($row['id']); $t_row->name->text($row['name']); $t_row->email->text($row['email']);
<br clear=all> <?php example("example27"); ?> <p>If you specify the optional <tt>$size</tt> parameter, the font will be scaled using that point size. The parameter has no effect for internal fonts. <p>Using Type1 or TTF fonts will make Chart a lot slower. Caching is an absolute must is you don't use the internal fonts. <br clear=all> <?php example("example22"); ?> <h4>add_legend</h4> <pre> add_legend ($string, $color) </pre> Add a legend to the chart. The following variables can be set to tune the legend: <p> <ul> <li><tt>$legend_background_color</tt>: The background color of the legend. If set to <tt>false</tt>, the background of the legend
$usermenu->add_btn('#user.add', 'Регистрация пользователя')->icon('user-add'); $usermenu->add_btn('#usergroup.list', 'Группы пользователей')->icon('user-add')->disabled(); $usermenu->add_text('Без иконки:'); $usermenu->add_btn('#', 'Без иконки 1')->icon(''); $usermenu->add_btn('#', 'Без иконки 2')->icon(''); $usermenu->add_divider(); $usermenu->add_btn('#', 'Рассылка по базе')->icon('mod-subscriber'); $menu->add_btn('#', 'без иконок')->submenu()->add_btn('#', 'Без иконки и отступа 1')->add_btn('#', 'Без иконки и отступа 2')->add_btn('#', 'Без иконки и отступа 3')->divider(); // Tray $tray = $navbar->tray(); $tray->add_btn('#')->icon_large('navbar-loader'); //->style('display:none'); $tray->add_btn('#')->icon_large('system-message')->disabled()->compact(); $tray->add_btn('#', 'custom')->dropdown()->div("Ваши права: <span class='nc-text-grey'>Директор</span><hr>" . $nc_core->ui->btn('#', 'Изменить пароль')->left() . $nc_core->ui->btn('#', 'Выход')->red()->right())->class_name('nc-padding-10'); ?> <?php echo $navbar; ?> <hr> <?php example('nc-navbar + quickmenu'); // Quickbar $navbar->quickmenu()->add_btn('#', 'просмотр')->add_btn('#', 'редактирование')->active(); $navbar->menu()->reset(); ?> <?php echo $navbar->bordered();
<?php if (!defined('NC')) { exit; } /*------------------------------------------------------------------------*/ ?> <?php example('Информационные блоки'); ?> <dl class="nc-info nc--mini"> <dt>55</dt> <dd>mini</dd> </dl> <dl class="nc-info nc--small"> <dt>55</dt> <dd>small<br>asdasd</dd> </dl> <dl class="nc-info nc--medium"> <dt>55</dt> <dd>default</dd> </dl> <dl class="nc-info nc--large"> <dt>55</dt> <dd>large</dd>
<?php echo $nc_core->ui->html('p')->text('Цветной текст (nc-text-grey)')->text_grey(); ?> <?php example('nc-box | Блоки'); ?> <div class="nc-box">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box</code></div> <div class="nc-box nc--light">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--light</code></div> <div class="nc-box nc--grey">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--grey</code></div> <div class="nc-box nc--dark nc-text-light">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--dark.nc-text-light</code></div> <div class="nc-box nc--darken nc-text-light">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--darken.nc-text-light</code></div> <div class="nc-box nc--black nc-text-light">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--black.nc-text-light</code></div> <div class="nc-box nc--red">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--red</code></div> <div class="nc-box nc--green">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--green</code></div> <div class="nc-box nc--blue">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--blue</code></div> <div class="nc-box nc--yellow">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code class="nc--right">.nc-box.nc--yellow</code></div> <?php example('Разное'); ?> <code class="nc-code">code.nc-code</code> <pre class="nc-code"># pre.nc-code user = dict(id=1, group_id=1, login='******') for k,v in user.list(): print k, ':', v </pre>
<?php echo $nc_core->ui->btn('#', 'Красная')->red()->small(); ?> <?php echo $nc_core->ui->btn('#', 'Зеленая')->green()->small(); ?> <?php echo $nc_core->ui->btn('#', 'Желтая')->yellow()->small(); ?> <?php example('nc-btn nc--bordered | с иконками'); ?> <?php echo $nc_core->ui->btn('#', 'Сайт')->bordered()->blue()->icon('site'); ?> <?php echo $nc_core->ui->btn('#', 'Сайт')->red(); ?> <?php echo $nc_core->ui->btn('#', 'Сообщение')->bordered()->green()->icon('user'); ?> <?php
heading('slug_name()'); desc('Converts a string into a "slug", suitable for file names, css class names, etc.'); $slug_tests = array('This/That', 'Adobe®', 'Kevlar™', 'Who Needs This?'); foreach ($slug_tests as $test) { example("echo slug_name('{$test}')"); } heading('place_image()'); example('echo place_image("alf.jpg")'); example('echo place_image("alf")', 'works without the file extension if there is a corresponding gif, jpg, or png'); example('echo place_image("test-png")'); example('echo place_image("test-gif")'); example('echo place_image("test-jpg")'); example('echo place_image("non-existing-file")', "doesn't output anything if it can't find the file"); heading('content_tag()'); desc('Wraps content in an html tag. Specify the attributes for the tag as an array in the third parameter.'); example("echo content_tag('h3', 'My Custom H3 Tag')"); example("echo content_tag('p', 'My Custom P Tag')"); example('echo content_tag(\'p\', \'My Custom P Tag with attributes\', $tag_attributes=array(\'id\' => \'custom_id\', \'class\' => \'custom_class\'))', 'add an array of attributes to the tag'); heading('title_tag()'); desc('Creates the <title> tag for the page based on the configuration and page values.'); heading('meta_tags()'); desc('Creates the meta keywords and meta description tags based on the configuration and page values.'); heading('ie6_alert()'); desc('Displays an html pop-up if browser is IE6.'); //example('echo ie6_alert()'); print_logr(); ?> </div> </body> </html>
<?php if (!defined('NC')) { exit; } /*------------------------------------------------------------------------*/ ?> <?php example('nc-tree'); ?> <div class="nc-tree"> <ul> <li> <a href="#"><i class="nc-icon nc--site"></i> Сайт 1</a> <ul> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 1</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 2</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 3</a></li> <li> <a href="#"><i class="nc-icon nc--folder"></i> Item 4</a> <ul> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 1</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 2</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 3</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 4</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 5</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 6</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 7</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 8</a></li> <li><a href="#"><i class="nc-icon nc--folder"></i> Item 9</a></li>
$identifier = "my_example_has_get_set"; if ($cache->has($identifier)) { var_dump($cache->get($identifier)); } else { var_dump($cache->set($identifier, "my value")); } $function = $cache->wrap(function ($x, $y) { return $x + $y; }); for ($i = 0; $i < 10000; ++$i) { var_dump($function(rand(0, 9), rand(0, 9))); } } $start = microtime(true); if (!file_exists('./cache/')) { mkdir('./cache/'); } $filecache = new FileCache('./cache/', 50); //$cache->clear(); example($filecache); echo 'time:' . (microtime(true) - $start); $start = microtime(true); if (!isset($_SESSION['cache'])) { $_SESSION['cache'] = []; } $sessioncache = new MemoryCache($_SESSION['cache']); //$cache->clear(); example($sessioncache); echo 'time:' . (microtime(true) - $start); $filecache->set('session', $_SESSION); var_dump($filecache->get('session'));
$elem->reset()->padding_10()->text('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); ?> <?php echo $elem->class_name('nc-shadow-small'); ?> <?php echo $elem->class_name('nc-shadow'); ?> <?php echo $elem->class_name('nc-shadow-large'); ?> <?php example('Разное | Смотрите вкладку "Source"'); ?> <?php echo $ui->helper->clearfix(); ?> <?php echo $elem->class_name('nc-shadow')->hide(); ?> <?php echo $elem->class_name('nc-shadow')->show();
<?php echo $nc_core->ui->label('red')->red()->rounded(); ?> <?php echo $nc_core->ui->label('green')->green()->rounded(); ?> <?php echo $nc_core->ui->label('yellow')->yellow()->rounded(); ?> <?php example('nc-label | дополнительно'); ?> <?php echo $nc_core->ui->label('link label')->blue()->href('#'); ?> <?php $label = $nc_core->ui->label->yellow()->href('#')->rounded(); ?> <?php echo $label->icon('edit'); ?>
<?php header('content-type:text/html;charset=utf-8'); function example($num) { return "{$num}*{$num}=" . $num * $num; } echo example(10); echo '<hr />'; /** * * @param unknown $price * @param string $tax */ function values($price, $tax = "") { $price = $price + $price * $tax; echo "价格:{$price}<br />"; } echo values(100, 0.25); echo values(100); echo '<hr />'; // 自定义函数名不能重复,也即是不能定义重名的函数,也不能和系统函数同名 function values1($price, $tax = 0.45) { $price = $price + $price * $tax; return $price; } echo values1(100); echo '<hr />'; function come()
/** * Fourth installation step. * * @return tempcode Progress report / UI */ function step_4() { global $LANG; if (count($_POST) == 0) { exit(do_lang('INST_POST_ERROR')); } require_code('database/' . post_param('db_type')); $GLOBALS['DB_STATIC_OBJECT'] = object_factory('Database_Static_' . post_param('db_type')); $domain = ocp_srv('HTTP_HOST'); if (substr($domain, 0, 4) == 'www.') { $domain = substr($domain, 4); } $colon_pos = strpos($domain, ':'); if ($colon_pos !== false) { $domain = substr($domain, 0, $colon_pos); } $pos = strpos(ocp_srv('PHP_SELF'), 'install.php'); if ($pos === false) { $pos = strlen(ocp_srv('PHP_SELF')); } else { $pos--; } $port = ocp_srv('SERVER_PORT'); if ($port == '' || $port == '80' || $port == '443') { $port = ''; } else { $port = ':' . $port; } $base_url = post_param('base_url', 'http://' . $domain . $port . substr(ocp_srv('PHP_SELF'), 0, $pos)); if (substr($base_url, -1) == '/') { $base_url = substr($base_url, 0, strlen($base_url) - 1); } // Our forum is $forum_type = post_param('forum_type'); require_code('forum/' . $forum_type); $GLOBALS['FORUM_DRIVER'] = object_factory('forum_driver_' . filter_naughty_harsh($forum_type)); $GLOBALS['FORUM_DRIVER']->MEMBER_ROWS_CACHED = array(); // Try and grab ourselves forum details global $INFO; $INFO['sql_database'] = ''; $INFO['sql_user'] = ''; $INFO['sql_pass'] = ''; $board_path = post_param('board_path'); find_forum_path($board_path); if (!array_key_exists('board_url', $INFO) || !(strlen($INFO['board_url']) > 0)) { $file_base = get_file_base(); for ($i = 0; $i < strlen($board_path); $i++) { if ($i >= strlen($file_base)) { break; } if ($board_path[$i] != $file_base[$i]) { break; } } $append = str_replace('\\', '/', substr($board_path, $i)); $INFO['board_url'] = strlen($append) < 15 ? substr($base_url, 0, strlen($base_url) - ($i - strlen($board_path))) . (strlen($append) > 0 && $append[0] == '/' ? '' : '/') . $append : $base_url . '/forums'; } if (!array_key_exists('cookie_member_id', $INFO)) { $INFO['cookie_member_id'] = 'ocp_member_id'; } if (!array_key_exists('cookie_member_hash', $INFO)) { $INFO['cookie_member_hash'] = 'ocp_member_hash'; } $cookie_domain = ''; //(($domain=='localhost') || (strpos($domain,'.')===false))?'':('.'.$domain); $cookie_path = '/'; $cookie_days = '120'; $use_persistent = false; require_code('version'); $table_prefix = $domain == 'test.ocportal.com' ? $forum_type . '_ocp_' : 'ocp_'; if (strpos(strtoupper(PHP_OS), 'WIN') !== false) { $db_site_host = '127.0.0.1'; } else { $db_site_host = 'localhost'; } $db_site_user = $INFO['sql_user']; $db_site_password = $INFO['sql_pass']; $db_site = $INFO['sql_database']; $db_forums_host = $db_site_host; $db_forums_user = $db_site_user; $db_forums_password = $db_site_password; $db_forums = $db_site; $board_prefix = $INFO['board_url']; $member_cookie = $INFO['cookie_member_id']; $pass_cookie = $INFO['cookie_member_hash']; if (function_exists('posix_getpwuid') && strpos(@ini_get('disable_functions'), 'posix_getpwuid') === false) { $u_info = posix_getpwuid(fileowner(get_file_base() . '/install.php')); if ($u_info !== false) { $ftp_username = $u_info['name']; } else { $ftp_username = ''; } } else { $ftp_username = ''; } if (is_null($ftp_username)) { $ftp_username = ''; } $dr = array_key_exists('DOCUMENT_ROOT', $_SERVER) ? $_SERVER['DOCUMENT_ROOT'] : (array_key_exists('DOCUMENT_ROOT', $_ENV) ? $_ENV['DOCUMENT_ROOT'] : ''); if (strpos($dr, '/') !== false) { $dr_parts = explode('/', $dr); } else { $dr_parts = explode('\\', $dr); } $webdir_stub = $dr_parts[count($dr_parts) - 1]; // If we have a host where the FTP is two+ levels down (often when we have one FTP covering multiple virtual hosts), then this "last component" rule would be insufficient; do a search through for critical strings to try and make a better guess $special_root_dirs = array('public_html', 'www', 'webroot', 'httpdocs', 'wwwroot'); $webdir_stub = $dr_parts[count($dr_parts) - 1]; foreach ($dr_parts as $i => $part) { if (in_array($part, $special_root_dirs)) { $webdir_stub = implode('/', array_slice($dr_parts, $i)); } } $ftp_folder = '/' . $webdir_stub . substr(ocp_srv('PHP_SELF'), 0, $pos); $ftp_domain = $domain; $specifics = $GLOBALS['FORUM_DRIVER']->install_specifics(); // Now we've gone through all the work of detecting it, lets grab from info.php to see what we had last time we installed global $SITE_INFO; if (file_exists(get_file_base() . '/info.php') && filesize(get_file_base() . '/info.php') != 0) { require_once get_file_base() . '/info.php'; if ($INFO['sql_database'] != '') { if (!array_key_exists('forum_type', $SITE_INFO) || $SITE_INFO['forum_type'] != $forum_type) { unset($SITE_INFO['user_cookie']); unset($SITE_INFO['pass_cookie']); } foreach ($specifics as $specific) { if (array_key_exists($specific['name'], $SITE_INFO)) { unset($SITE_INFO[$specific['name']]); } } unset($SITE_INFO['db_forums_host']); unset($SITE_INFO['db_forums_user']); unset($SITE_INFO['db_forums_password']); unset($SITE_INFO['db_forums']); unset($SITE_INFO['db_site_host']); unset($SITE_INFO['db_site_user']); unset($SITE_INFO['db_site_password']); unset($SITE_INFO['db_site']); } unset($SITE_INFO['base_url']); } $sections = new ocp_tempcode(); // Is this autoinstaller? global $FILE_ARRAY; if (@is_array($FILE_ARRAY) && !is_suexec_like()) { $title = protect_from_escaping(escape_html('FTP')); $text = do_lang_tempcode('AUTO_INSTALL'); $hidden = new ocp_tempcode(); $options = new ocp_tempcode(); $options->attach(make_option(do_lang_tempcode('FTP_DOMAIN'), new ocp_tempcode(), 'ftp_domain', post_param('ftp_domain', $ftp_domain), false, true)); $options->attach(make_option(do_lang_tempcode('FTP_USERNAME'), new ocp_tempcode(), 'ftp_username', post_param('ftp_username', $ftp_username), false, true)); $options->attach(make_option(do_lang_tempcode('FTP_PASSWORD'), new ocp_tempcode(), 'ftp_password', post_param('ftp_password', ''), true)); $options->attach(make_option(do_lang_tempcode('FTP_DIRECTORY'), do_lang_tempcode('FTP_FOLDER'), 'ftp_folder', post_param('ftp_folder', $ftp_folder))); $options->attach(make_option(do_lang_tempcode('FTP_FILES_PER_GO'), do_lang_tempcode('DESCRIPTION_FTP_FILES_PER_GO'), 'max', post_param('max', '1000'))); $sections->attach(do_template('INSTALLER_STEP_4_SECTION', array('_GUID' => '50fcb00f4d1da1813e94d86529ea0862', 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'OPTIONS' => $options))); } $title = do_lang_tempcode('GENERAL_SETTINGS'); $text = new ocp_tempcode(); $options = new ocp_tempcode(); $hidden = new ocp_tempcode(); $options->attach(make_option(do_lang_tempcode('DOMAIN'), example('DOMAIN_EXAMPLE', 'DOMAIN_TEXT'), 'domain', $domain, false, true)); $options->attach(make_option(do_lang_tempcode('BASE_URL'), example('BASE_URL_EXAMPLE', 'BASE_URL_TEXT'), 'base_url', $base_url, false, true)); if (post_param('db_type') != 'xml') { $options->attach(make_option(do_lang_tempcode('TABLE_PREFIX'), example('TABLE_PREFIX_EXAMPLE', 'TABLE_PREFIX_TEXT'), 'table_prefix', $table_prefix)); } else { $hidden->attach(form_input_hidden('table_prefix', $table_prefix)); } $admin_password = ''; $options->attach(make_option(do_lang_tempcode('MASTER_PASSWORD'), example('', 'CHOOSE_ADMIN_PASSWORD'), 'admin_password', $admin_password, true)); $options->attach(make_tick(do_lang_tempcode('USE_PERSISTENT'), example('', 'USE_PERSISTENT_TEXT'), 'use_persistent', $use_persistent ? 1 : 0)); // $options->attach(make_tick(do_lang_tempcode('MULTI_LANG'),example('','MULTI_LANG_TEXT'),'multi_lang',true)); require_lang('config'); $options->attach(make_tick(do_lang_tempcode('SEND_ERROR_EMAILS_OCPRODUCTS'), example('', 'CONFIG_OPTION_send_error_emails_ocproducts'), 'allow_reports_default', 1)); $sections->attach(do_template('INSTALLER_STEP_4_SECTION', array('_GUID' => 'f051465e86a7a53ec078e0d9de773993', 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'OPTIONS' => $options))); $hidden = new ocp_tempcode(); $forum_text = new ocp_tempcode(); if ($forum_type == 'ocf' || $forum_type == 'none') { $forum_title = do_lang_tempcode('FORUM_SETTINGS'); } else { $_forum_type = do_lang('FORUM_CLASS_' . preg_replace('#\\d+$#', '', $forum_type), NULL, NULL, NULL, NULL, false); if (is_null($_forum_type)) { $_forum_type = ucwords($forum_type); } $forum_title = do_lang_tempcode('_FORUM_SETTINGS', escape_html($_forum_type)); } $forum_options = new ocp_tempcode(); $use_msn = post_param_integer('use_msn', 0); if ($use_msn == 0) { $use_msn = post_param_integer('use_multi_db', 0); } $forum_type = post_param('forum_type'); if ($forum_type != 'none') { if ($use_msn == 1) { if ($forum_type != 'ocf') { $forum_text = do_lang_tempcode('AUTODETECT'); } $forum_options->attach(make_option(do_lang_tempcode('DATABASE_NAME'), new ocp_tempcode(), 'db_forums', $db_forums, false, true)); if (!$GLOBALS['DB_STATIC_OBJECT']->db_is_flat_file_simple()) { $forum_options->attach(make_option(do_lang_tempcode('DATABASE_HOST'), example('', 'DATABASE_HOST_TEXT'), 'db_forums_host', $db_forums_host, false, true)); $forum_options->attach(make_option(do_lang_tempcode('DATABASE_USERNAME'), new ocp_tempcode(), 'db_forums_user', $db_forums_user, false, true)); $forum_options->attach(make_option(do_lang_tempcode('DATABASE_PASSWORD'), new ocp_tempcode(), 'db_forums_password', $db_forums_password, true)); } else { $hidden->attach(form_input_hidden('db_forums_host', 'localhost')); $hidden->attach(form_input_hidden('db_forums_user', '')); $hidden->attach(form_input_hidden('db_forums_password', '')); } $hidden->attach(form_input_hidden('use_msn', strval($use_msn))); } if ($forum_type != 'ocf' || $use_msn == 1) { $forum_options->attach(make_option(do_lang_tempcode('BASE_URL'), example('FORUM_BASE_URL_EXAMPLE', 'BASE_URL_TEXT_FORUM'), 'board_prefix', $board_prefix, false, true)); } } foreach ($specifics as $specific) { if ($specific['name'] == 'clear_existing_forums_on_install') { $hidden->attach(form_input_hidden('clear_existing_forums_on_install', 'yes')); } elseif ($specific['name'] == 'ocf_table_prefix' && $use_msn == 0) { // Nothing } else { $forum_options->attach(make_option(is_object($specific['title']) ? $specific['title'] : make_string_tempcode($specific['title']), is_object($specific['description']) ? $specific['description'] : make_string_tempcode($specific['description']), $specific['name'], array_key_exists($specific['name'], $SITE_INFO) ? $SITE_INFO[$specific['name']] : $specific['default'], strpos($specific['name'], 'password') !== false)); } } $text = $use_msn == 1 ? do_lang_tempcode($forum_type == 'ocf' ? 'DUPLICATE_OCF' : 'DUPLICATE') : new ocp_tempcode(); $options = make_option(do_lang_tempcode('DATABASE_NAME'), new ocp_tempcode(), 'db_site', $db_site, false, true); if (!$GLOBALS['DB_STATIC_OBJECT']->db_is_flat_file_simple()) { $options->attach(make_option(do_lang_tempcode('DATABASE_HOST'), example('', 'DATABASE_HOST_TEXT'), 'db_site_host', $db_site_host, false, true)); $options->attach(make_option(do_lang_tempcode('DATABASE_USERNAME'), new ocp_tempcode(), 'db_site_user', $db_site_user, false, true)); $options->attach(make_option(do_lang_tempcode('DATABASE_PASSWORD'), new ocp_tempcode(), 'db_site_password', $db_site_password, true)); } else { $hidden->attach(form_input_hidden('db_site_host', 'localhost')); $hidden->attach(form_input_hidden('db_site_user', '')); $hidden->attach(form_input_hidden('db_site_password', '')); } if ($use_msn == 0 && $forum_type != 'ocf') { $forum_options->attach($options); $sections->attach(do_template('INSTALLER_STEP_4_SECTION', array('HIDDEN' => $hidden, 'TITLE' => $forum_title, 'TEXT' => $forum_text, 'OPTIONS' => $forum_options))); } else { $title = do_lang_tempcode('OCPORTAL_SETTINGS'); if (!$forum_options->is_empty()) { $sections->attach(do_template('INSTALLER_STEP_4_SECTION', array('_GUID' => '232b69a995f384275c1cd9269a42c3b8', 'HIDDEN' => '', 'TITLE' => $forum_title, 'TEXT' => $forum_text, 'OPTIONS' => $forum_options))); } $sections->attach(do_template('INSTALLER_STEP_4_SECTION', array('_GUID' => '15e0f275f78414b6c4fe7775a1cacb23', 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'OPTIONS' => $options))); } $title = do_lang_tempcode('COOKIE_SETTINGS'); $text = new ocp_tempcode(); $options = new ocp_tempcode(); $hidden = new ocp_tempcode(); $options->attach(make_option(do_lang_tempcode('COOKIE'), example('COOKIE_EXAMPLE', 'COOKIE_TEXT'), 'user_cookie', $member_cookie, false, true)); $options->attach(make_option(do_lang_tempcode('COOKIE_PASSWORD'), example('COOKIE_PASSWORD_EXAMPLE', 'COOKIE_PASSWORD_TEXT'), 'pass_cookie', $pass_cookie, false, true)); $options->attach(make_option(do_lang_tempcode('COOKIE_DOMAIN'), example('COOKIE_DOMAIN_EXAMPLE', 'COOKIE_DOMAIN_TEXT'), 'cookie_domain', $cookie_domain)); $options->attach(make_option(do_lang_tempcode('COOKIE_PATH'), example('COOKIE_PATH_EXAMPLE', 'COOKIE_PATH_TEXT'), 'cookie_path', $cookie_path)); $options->attach(make_option(do_lang_tempcode('COOKIE_DAYS'), example('COOKIE_DAYS_EXAMPLE', 'COOKIE_DAYS_TEXT'), 'cookie_days', $cookie_days, false, true)); $temp = do_template('INSTALLER_STEP_4_SECTION', array('_GUID' => '3b9ea022164801f4b60780a4a966006f', 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'OPTIONS' => $options)); $sections->attach(do_template('INSTALLER_STEP_4_SECTION_HIDE', array('_GUID' => '42eb3d44bcf8ef99987b6daa9e6530aa', 'TITLE' => $title, 'CONTENT' => $temp))); $js = do_template('JAVASCRIPT'); $js->attach(chr(10)); $js->attach(do_template('JAVASCRIPT_AJAX')); $message = paragraph(do_lang_tempcode('BASIC_CONFIG')); if ($forum_type != 'none' && $forum_type != 'ocf') { $message->attach(paragraph(do_lang_tempcode('FORUM_DRIVER_NATIVE_LOGIN'))); } return do_template('INSTALLER_STEP_4', array('_GUID' => '73c3ac0a7108709b74b2e89cae30be12', 'JS' => $js, 'MESSAGE' => $message, 'LANG' => $LANG, 'DB_TYPE' => post_param('db_type'), 'FORUM_TYPE' => $forum_type, 'BOARD_PATH' => $board_path, 'SECTIONS' => $sections, 'MAX' => strval(post_param_integer('max', 1000)))); }
<?php if (!defined('NC')) { exit; } /*------------------------------------------------------------------------*/ ?> <?php example('nc-alert'); ?> <?php echo $nc_core->ui->alert('Серенькое предупреждение'); ?> <?php echo $nc_core->ui->alert->error('Предупреждение об ошибке'); ?> <?php echo $nc_core->ui->alert->info('Информационное сообщение'); ?> <?php echo $nc_core->ui->alert->success('Сообщение об успешном выполнении операции'); ?> <?php echo $nc_core->ui->alert('Просто предупреждение')->yellow();
?> <?php example('nc-form nc--horizontal'); $form = $nc_core->ui->form('#submit')->multipart()->horizontal(); $form->add_row('Название поля 1')->string('field1')->large(); $form->add_row('Название поля 2')->textarea('field2')->rows(3)->large(); $form->add_row('Название поля 3')->select('field3', $select_options, 3)->large(); $form->add_row('Название поля 4')->multiple('field4', $select_options, array(1, 3))->large(); $form->add_row('Название поля 5')->vertical()->checkbox('field5', true, 'Label'); $form->add_row('Название поля 6')->vertical()->radiogroup('field6', array('Нет', 'Да', 'Не задано'), 2); $form->actions()->button('button', 'Отменить')->red()->click('alert(1)')->button('submit', 'Отправить')->blue()->right()->button('button', 'Просмотр')->right(); echo $form; ?> <?php example('nc-form'); $form = $nc_core->ui->form('#submit', 'get'); $form->add()->label('Название поля'); $form->add()->string('search')->placeholder('Поиск...')->large(); $form->add()->button('submit', 'Найти')->red(); ?> <?php echo $form;
<?php if (!defined('NC')) { exit; } /*------------------------------------------------------------------------*/ ?> <?php example('nc-toolbar'); ?> <?php $toolbar = $nc_core->ui->toolbar(); $toolbar->add_text('Toolbar'); $toolbar->add_btn('#', 'Action'); $toolbar->add_divider(); $toolbar->add_btn('#', 'Edit')->icon('edit'); $toolbar->add_btn('#', 'Copy')->icon('copy'); $toolbar->add_btn('#', 'Remove')->icon('remove'); $toolbar->add_divider(); $toolbar[] = $nc_core->ui->html('li')->div()->code('CUSTOM ITEM'); echo $toolbar; ?> <br> <div class="nc-admin-mode-content-box"> <?php $toolbar = $nc_core->ui->toolbar()->right();
array_pop($dogs); var_dump($dogs); array_reverse($dogs); var_dump($dogs); $Actor = array('Jack' => 'Nicholson'); array_flip($Actor); var_dump($Actor); $Cats = array(0, 1, 2, 3, 4, 5); var_dump($Cats); // index, #element to be removed array_splice($Cats, 2, 0, array("A")); var_dump($Cats); /* Lesson 11*/ $MyVar = 1; echo "outside: {$MyVar} "; example(); function example() { global $MyVar; echo "inside: {$MyVar} "; } var_dump($GLOBALS); /* Lesson 14*/ class UserClass { public $firstname; function __construct($firstname) { $this->firstname = $firstname; } function GetName()
<td class="nc-bg-dark"> <big>директор</big> </td> </tr> <tr> <td style="height:1%"> <a href="#" class="nc-btn nc--blocked">сменить пароль</a> </td> </tr> </table> </div> </div> <div class="nc--clearfix"></div> <?php example('Типография виджетов 2'); ?> <div style="width:150px; height:150px; float:left; margin:10px"> <div class="nc-widget nc--light"> <div> <a class="nc-position-tl nc-bg-light" href="#"><i class="nc-icon nc--info nc--dark"></i></a> <a class="nc-position-tr nc-bg-light" href="#"><i class="nc-icon nc--close nc--dark"></i></a> <a class="nc-position-bl nc-bg-dark" href="#"><i class="nc-icon nc--download nc--dark"></i></a> <a class="nc-position-br nc-bg-dark" href="#"><i class="nc-icon nc--edit nc--dark"></i></a> </div> </div> </div>
<?php $foo = array('one' => 'two', 'three' => 'four'); $foo = [1, 2, 3]; if ($foo) { $a = 'bar'; } ?> <div> <?php echo "OK"; ?> <?php example(); echo example(); ?> </div>
<?php if (!defined('NC')) { exit; } /*------------------------------------------------------------------------*/ ?> <?php example('nc-tabs'); $tabs = $nc_core->ui->tabs(); $tabs->add_btn('#', 'Настройки'); $tabs->add_btn('#', 'Инфоблоки'); $tabs->add_btn('#', 'Редактирование')->active(); $tabs->add_btn('#', 'Просмотр')->disabled(); echo $tabs; ?> <?php example('nc-tabs nc--small'); $tabs = $nc_core->ui->tabs()->small(); $tabs->add_btn('#', 'Настройки')->active(false); $tabs->add_btn('#', 'Инфоблоки')->active(false); $tabs->add_btn('#', 'Редактирование')->active(true); $tabs->add_btn('#', 'Просмотр')->active(false); echo $tabs;