/** * Require login * @Developer brandon * @Date May 17, 2010 */ public function __construct() { parent::__construct(); user::require_login(); // Add the topics to the footer layout::add(View::factory('topics/index'), 'footer'); }
/** * Add media to layout */ public static function add() { layout::add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css', 10000); layout::add_js('//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js', 10000); layout::add_css('/numbers/media_submodules/numbers_frontend_html_bootstrap_media_css_base.css', 10001); layout::add_js('/numbers/media_submodules/numbers_frontend_html_bootstrap_media_js_base.js', 10001); }
public static function Ret() { $class = __CLASS__; if (!self::$SINGLETON) { self::$SINGLETON = new $class(); } return self::$SINGLETON; }
/** * see html::wysiwyg(); */ public static function wysiwyg($options = []) { // tinymce library library::add('tinymce'); $options['class'] = $options['class'] ?? ''; $options['class'] .= ' wysiwyg'; layout::onload("tinymce.init({selector: 'textarea.wysiwyg', height: 500, plugins: ['advlist autolink lists link image charmap print preview hr anchor pagebreak','searchreplace wordcount visualblocks visualchars code fullscreen','insertdatetime media nonbreaking save table contextmenu directionality','emoticons template paste textcolor colorpicker textpattern imagetools'],toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',toolbar2: 'print preview media | forecolor backcolor emoticons'});"); return html::textarea($options); }
/** * Show the login page * @Developer brandon * @Date May 19, 2010 */ public function new_one() { if (user::logged_in()) { url::redirect(''); } parent::new_one(); layout::add(View::factory('shared/mentions')->render(), 'pre_footer'); meta::set_title('Login'); }
public function Run() { if (layout::Ret()->Ready() and $this->output) { $this->output .= layout::Ret()->Display(); error::Ret()->Warn("Output found from action - " . stack::Ret()->GetAction() . " - and layout - " . layout::Ret()->GetTemplate()); } elseif (layout::Ret()->Ready()) { $this->output = layout::Ret()->Display(); } return $this->output; }
public function __construct() { parent::__construct(); ssl::force_ssl(); meta::set_keywords('Daily Journal, Free Journal, Private Diary, Private Journal, Free Online Journal, Online Journaling, Write Messages, My Diary, Secure Diary, Secure Journal, Journal, Diary'); meta::set_description('Keep a free online journal or diary to remember events in your life. Secure, simple and free. Access from anywhere.'); // Add Analytics to the page, except on journal pages if ($this->model_name != 'journal') { layout::add(View::factory('shared/analytics'), 'footer'); } }
/** * Clear the cache on an constructive/destructive action * Also, make sure only admins can get here * @Developer brandon * @Date May 27, 2010 */ public function __construct() { parent::__construct(); if (in_array(Router::$method, array('new_one', 'edit', 'create', 'update', 'delete'))) { if (!user::is_admin()) { url::redirect('blog'); } Cache::instance()->delete_all(); } layout::add(View::factory('shared/mentions')->render(), 'pre_footer'); }
/** * Renew session */ public function action_renew() { $input = request::input(null, true, true); $result = ['success' => false, 'error' => []]; if (!empty($input['token'])) { $crypt = new crypt(); $token_data = $crypt->token_validate($input['token'], ['skip_time_validation' => true]); if (!($token_data === false || $token_data['id'] !== 'general')) { $result['success'] = true; } } layout::render_as($result, 'application/json'); }
/** * see html::calendar() */ public static function calendar($options = []) { // include js & css files if (empty($options['readonly'])) { layout::add_js('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_js_base.js'); layout::add_css('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_css_base.css'); } // font awesome icons library::add('fontawesome'); // widget parameters $type = $options['calendar_type'] ?? $options['type'] ?? 'date'; $widget_options = ['id' => $options['id'], 'type' => $type, 'format' => $options['calendar_format'] ?? format::get_date_format($type), 'date_week_start_day' => $options['calendar_date_week_start_day'] ?? 1, 'date_disable_week_days' => $options['calendar_date_disable_week_days'] ?? null, 'master_id' => $options['calendar_master_id'] ?? null, 'slave_id' => $options['calendar_slave_id'] ?? null]; $options['type'] = 'text'; // determine input size $placeholder = format::get_date_placeholder($widget_options['format']); $options['size'] = strlen($placeholder); // set placeholder if (!empty($options['placeholder']) && $options['placeholder'] == 'format::get_date_placeholder') { $options['placeholder'] = $placeholder; $options['title'] = ($options['title'] ?? '') . ' (' . $placeholder . ')'; } if (isset($options['calendar_icon']) && ($options['calendar_icon'] == 'left' || $options['calendar_icon'] == 'right')) { $position = $options['calendar_icon']; if (i18n::rtl()) { if ($position == 'left') { $position = 'right'; } else { $position = 'left'; } } $icon_type = $type == 'time' ? 'clock-o' : 'calendar'; unset($options['calendar_icon']); if (empty($options['readonly'])) { $icon_onclick = 'numbers_calendar_var_' . $options['id'] . '.show();'; } else { $icon_onclick = null; } $icon_value = html::span(['onclick' => $icon_onclick, 'class' => 'numbers_calendar_icon numbers_prevent_selection', 'value' => html::icon(['type' => $icon_type])]); $result = html::input_group(['value' => html::input($options), $position => $icon_value, 'dir' => 'ltr']); $div_id = $options['id'] . '_div_holder'; $result .= html::div(['id' => $div_id, 'class' => 'numbers_calendar_div_holder']); $widget_options['holder_div_id'] = $div_id; } else { $result = html::input($options); } // we do not render a widget if readonly if (empty($options['readonly'])) { layout::onload('numbers_calendar(' . json_encode($widget_options) . ');'); } return $result; }
/** * This would process error message sent from frontend */ public function action_index() { $input = request::input(); if (!empty($input['token'])) { $crypt = new crypt(); $token_data = $crypt->token_validate($input['token'], ['skip_time_validation' => true]); if (!($token_data === false || $token_data['id'] !== 'general')) { $input['data'] = json_decode($input['data'], true); error_base::error_handler('javascript', $input['data']['message'], $input['data']['file'], $input['data']['line']); } } // rendering layout::render_as(file_get_contents(__DIR__ . '/error.png'), 'image/png'); }
public static function init() { static $run = null; if (!$run) { $template = layout::getTemplateName(); $css_override = "/templates/{$template}/assets/phphl.css"; if (file_exists(conf::pathHtdocs() . $css_override)) { template::setCss($css_override); } else { template::setCss('/css/assets/phphl.css'); } $run = 1; } }
public static function js() { $js = <<<TTT \t\t\t/* custom locale methods */ \t\t\tnumbers.format.__custom = { \t\t\t\tamount: function(amount, options) { \t\t\t\t\treturn amount.toString().replace(/[0123456789]/g, function(number) { return '٠١٢٣٤٥٦٧٨٩'[parseInt(number)]; }); \t\t\t\t}, \t\t\t\tread_floatval: function(amount, options) { \t\t\t\t\treturn amount.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function(char) { return char.charCodeAt(0) - 1632; }).replace(/[۰۱۲۳۴۵۶۷۸۹]/g, function(char) { return char.charCodeAt(0) - 1776; }); \t\t\t\t} \t\t\t}; TTT; layout::onload($js); }
/** * Initializing i18n * * @param array $options */ public static function init($options = []) { do { self::$language_code = $options['language_code']; $where = " AND lc_translation_language_code = '{$options['language_code']}'"; // retrive data from cache $cache_id_file = $cache_id = 'numbers_backend_i18n_basic_base_' . $options['language_code']; // if we are including js translations if (strpos($_SERVER['REQUEST_URI'] ?? '', $cache_id_file . '.js') !== false) { $where .= " AND lc_translation_javascript = 1"; $cache_id .= '_js'; } $cache = new cache(); $data = $cache->get($cache_id); if ($data !== false) { self::$data = !empty($data) ? $data : ['ids' => [], 'hashes' => []]; break; } // load data from database $sql = <<<TTT \t\t\t\tSELECT \t\t\t\t\tlc_translation_id id, \t\t\t\t\tlc_translation_text_sys sys, \t\t\t\t\tlc_translation_text_new new \t\t\t\tFROM lc_translations \t\t\t\tWHERE 1=1 \t\t\t\t\t{$where} TTT; $query_result = factory::model('numbers_backend_i18n_basic_model_translations')->db_object->query($sql); foreach ($query_result['rows'] as $k => $v) { if (strlen($v['sys']) > 40) { $v['sys'] = sha1($v['sys']); } self::$data['hashes'][$v['sys']] = $v['new']; self::$data['ids'][$v['id']] = $v['sys']; } // set the cache $cache->set($cache_id, self::$data, ['translations']); } while (0); // load js numbers_frontend_media_libraries_jssha_base::add(); layout::add_js('/numbers/media_submodules/numbers_backend_i18n_basic_media_js_i18n.js', 5001); layout::add_js('/numbers/backend/i18n/basic/controller/javascript/_js/' . $cache_id_file . '.js', 50000); // load data into cache return ['success' => 1, 'error' => []]; }
/** * see html::select(); */ public static function select($options = []) { // we do not process readonly selects if (empty($options['readonly'])) { // include js & css files layout::add_js('/numbers/media_submodules/numbers_frontend_components_select_numbers_media_js_base.js', 10000); layout::add_css('/numbers/media_submodules/numbers_frontend_components_select_numbers_media_css_base.css', 10000); // font awesome icons library::add('fontawesome'); // id with name if (empty($options['id']) && !empty($options['name'])) { $options['id'] = $options['name']; } layout::onload('numbers_select(' . json_encode(['id' => $options['id']]) . ');'); } // must gain proper class from previous submodule $options['flag_call_previous_parent'] = true; return html::select($options); }
function items_order($category) { global $website; global $DB; global $layout; $out = array(); $layout = new layout('free'); $naviforms = new naviforms(); // order blocks of the same type (for lists with priority ordering) $DB->query('SELECT i.id as id, d.text as title FROM nv_items i, nv_webdictionary d WHERE i.association = "category" AND i.category = "' . $category . '" AND d.node_type = "item" AND d.subtype = "title" AND d.lang = "' . $website->languages_list[0] . '" AND d.node_id = i.id AND i.website = ' . $website->id . ' AND d.website = ' . $website->id . ' ORDER BY i.position ASC'); $item_ids = $DB->result('id'); $items = $DB->result(); $out[] = $naviforms->hidden('items-order', implode('#', $item_ids)); $table = new naviorderedtable("items_order_table"); $table->setWidth("560px"); $table->setHiddenInput("items-order"); $table->addHeaderColumn('ID', 50); $table->addHeaderColumn(t(67, 'Title'), 450); foreach ($items as $row) { $table->addRow($row->id, array(array('content' => $row->id, 'align' => 'left'), array('content' => $row->title, 'align' => 'left'))); } $out[] = '<div class="subcomment" style=" margin-left: 0px; margin-bottom: 10px; "><img src="img/icons/silk/information.png" align="absmiddle" /> ' . t(72, 'Drag any row to assign priorities') . '</div>'; $out[] = '<div>' . $table->generate() . '</div>'; $out[] = '<div class="subcomment" style=" margin-left: 0px; margin-top: 10px; "><span class="ui-icon ui-icon-alert" style="float: left; margin-right: 4px; "></span> ' . t(408, 'Order is only used on lists ordered by priority') . '</div>'; $out[] = $layout->generate(); return implode("\n", $out); }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title><?php echo layout::getPage(); ?> - Rokket Webinterface</title> <link rel="shortcut icon" href="../layout/default/img/favicon.png" type="image/png" /> <link rel="icon" href="../layout/default/img/favicon.png" type="image/png" /> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,300, 700, 400italic"> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.min.css"> <link rel="stylesheet" href="../layout/default/css/bootstrap.css"> <link rel="stylesheet" href="../layout/default/css/modal.css"> <link rel="stylesheet" href="../layout/default/css/style.css"> <?php echo layout::getCSS(); ?> </head> <body>
/** * Add media to layout */ public static function add() { layout::add_js('https://code.jquery.com/jquery-2.2.0.min.js', -50000); }
/* * * @project 0xSentinel * @author KinG-InFeT * @licence GNU/GPL * * @file index.php * * @link http://0xproject.netsons.org#0xSentinel * */ session_start(); include "config.php"; include "lib/layout.class.php"; $layout = new layout(); $layout->header(); if (isset($_SESSION['0xSentinel']['admin'])) { $layout->admin_menu(); } else { $layout->menu(); } switch (@$_GET['act']) { case 'banner': print "\n<div align=\"center\">" . "\n<img src=\"/0xSentinel/banner.php\" />" . "\n<br /><br />" . "\n<p>Per aggiungere il banner dinamico al vostro portale, basta copiare ed incollare il seguente codice HTML:</p>" . "\n<br />" . "\n<textarea cols=\"50\" rows=\"6\">" . "\n<a href=\"/0xSentinel/about.php\" target=\"_blank\"><img border=\"0\" src=\"/0xSentinel/banner.php\" alt=\"0xSentinel Dinamic Banner\" title=\"0xSentinel Dinamic Banner\"></a>" . "\n</textarea>" . "\n</div>"; break; default: print "\n<br /><br />" . "\n0xSentinel nella sua release attuale è in grado di protegge una qualsiasi applicazione in PHP dai seguenti tipi di attacchi:<br />" . "\n<br />" . "<li>Scanning/crawling di software come Acunetix o simili</li>\n" . "<li>Blind SQL Injection</li>\n" . "<li>SQL Injection</li>\n" . "<li>RFI (Remote File Inclusion)</li>\n" . "<li>LFI (Local File Inclusion)</li>\n" . "<li>Log Poisoning</li>\n" . "<li>RCE (Remote Code Execution)</li>\n" . "<li>Directory Traversal</li>\n" . "<li>Full Path Disclosure</li>\n" . "<li>XSS (Cross Site Scripting)</li>\n" . "<li>CSRF (Cross Site Request Forgery)</li>\n" . "<li>Blocco Script in PERL (Exploit)</li>\n" . "<br /><br />\n"; if (file_exists('./install.php')) { print "<a href='install.php'><u><b><font color=\"red\">0xSentinel non è ancora installato, installalo ora!.</font></b></u></a>\n"; }
<?php layout::addJs('addons/mediamanager/layout/js/mediamanager.js'); userPerm::add('media[edit]', lang::get('media[edit]')); userPerm::add('media[delete]', lang::get('media[delete]')); userPerm::add('media[category][edit]', lang::get('media[category][edit]')); userPerm::add('media[category][delete]', lang::get('media[category][delete]')); if (dyn::get('user')->hasPerm('media[edit]') || dyn::get('user')->hasPerm('media[delete]') || dyn::get('user')->hasPerm('media[category][edit]') || dyn::get('user')->hasPerm('media[category][delete]')) { backend::addNavi(lang::get('media'), url::backend('media'), 'picture-o', 2, function () { return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'media.php'); }); } form::addClassMethod('addMediaField', function ($name, $value) { return $this->addField($name, $value, 'formMedia'); }); form::addClassMethod('addMediaListField', function ($name, $value) { return $this->addField($name, $value, 'formMediaList'); }); $page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); $action = type::super('action', 'string'); pageArea::addType('varsMedia'); pageArea::addType('varsMedialist'); if (addonConfig::isActive('metainfos')) { metainfosPage::addType('DYN_MEDIA'); metainfosPage::addType('DYN_MEDIA_LIST'); if ($page == 'meta') { backend::addSubNavi(lang::get('media'), url::backend('meta', ['subpage' => 'media']), 'circle', -1, function () { return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'meta.media.php'); }); }
function extensions_dialog($extension, $function, $params) { global $layout; $layout = null; $layout = new layout('navigate'); // load the extension source code, if not already done extension::include_php($extension->code); if (function_exists($function)) { call_user_func($function, $params); $out = $layout->generate(); } else { $out = 'ERROR: "' . $function . '" function does not exist!'; } return $out; }
if ($action == 'online' && dyn::get('user')->hasPerm('page[edit]')) { $sql = sql::factory(); $sql->query('SELECT online FROM ' . sql::table('structure') . ' WHERE id=' . $id)->result(); $online = $sql->get('online') ? 0 : 1; $sql->setTable('structure'); $sql->setWhere('id=' . $id); $sql->addPost('online', $online); $sql->update(); echo message::success(lang::get('save_status')); $action = ''; } if ($action == '') { if (ajax::is()) { echo pageMisc::getTreeStructurePage(); exit; } $button = []; if (dyn::get('user')->hasPerm('page[edit]')) { $button = ['<a class="btn btn-sm btn-default" href="' . url::backend('structure', ['subpage' => 'pages', 'action' => 'add']) . '">' . lang::get('add') . '</a>']; } ?> <div class="row" id="structure-body"><?php echo bootstrap::panel(lang::get('pages'), $button, pageMisc::getTreeStructurePage()); ?> </div> <?php if (dyn::get('user')->hasPerm('page[edit]')) { layout::addJs("layout/js/structureSort.js"); } } }
/** * This public function allows your users to go to * http://localhost/app/<controller>/<function>/ via the web browser. Use * protected functions to prevent users from accessing. * */ public function index() { layout::Ret()->SetTemplate('views/index/index.smarty'); layout::Ret()->Define('title', 'BreathePHP | Home'); }
<?php get_header(); ?> <div class="content"> <div class="container"> <div class="row"> <?php global $post; /* GET LAYOUT DETAILS */ $myThemes_layout = new layout('single', $post->ID); /* LEFT SIDEBAR */ $myThemes_layout->echoSidebar('left'); ?> <!-- CONTENT --> <section class="<?php echo $myThemes_layout->contentClass(); ?> "> <?php /* LEFT WRAPPER */ $myThemes_layout->contentWrapper('left'); if (have_posts()) { while (have_posts()) { the_post(); ?> <article <?php
addonConfig::includeAllLibs(); $page = type::super('page', 'string', 'dashboard'); $action = type::super('action', 'string'); $id = type::super('id', 'int'); $success = type::get('success', 'string'); $error = type::get('error', 'string'); if (!is_null($error)) { echo message::danger($error); } elseif (!is_null($success)) { echo message::success($success); } layout::addNav(lang::get('dashboard'), 'dashboard', 'home', ['refresh'], true); layout::addNav(lang::get('settings'), 'settings', 'settings', [], false); layout::addNav(lang::get('server'), 'server', 'list', ['add'], true); layout::addNav(lang::get('addons'), 'addons', 'alt', [], true); layout::addNav(lang::get('user'), 'user', 'users', ['add'], true); foreach (addonConfig::includeAllConfig() as $file) { include $file; } if (userLogin::isLogged()) { $path = 'pages/' . $page . '.php'; $path = extension::get('PAGE_PATH', $path); if (file_exists($path)) { include $path; } else { echo message::danger(lang::get('page_not_found'), false); } } $content = ob_get_contents(); ob_end_clean(); rp::add('content', $content);
<?php if (dyn::get('user')->hasPerm('media[edit]') || dyn::get('user')->hasPerm('media[delete]')) { backend::addSubnavi(lang::get('media_manage'), url::backend('media', ['subpage' => 'files'])); } if (dyn::get('user')->hasPerm('media[category][edit]') || dyn::get('user')->hasPerm('media[category][delete]')) { backend::addSubnavi(lang::get('media_manage_cat'), url::backend('media', ['subpage' => 'category'])); } $action = type::super('action', 'string', ''); $id = type::super('id', 'int', 0); $subpage = type::super('subpage', 'string'); layout::addCSS('addons/mediamanager/layout/css/mediamanager.css'); if ($subpage == 'popup') { backend::addSubnavi('Popup', url::backend('media', ['subpage' => 'popup'])); } include_once backend::getSubnaviInclude('mediamanager');
$page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); $action = type::super('action', 'string'); $structure_id = type::super('structure_id', 'int', 0); $id = type::super('id', 'int', 0); // Falls was an der Page geändert worden ist if ($page == 'structure' && $subpage == 'pages' && in_array($action, ['add', 'edit', 'seo']) && !$structure_id) { extension::add('FORM_AFTER_SAVE', function ($form) { seo_rewrite::generatePathlist(); return $form; }); } // Wenn SEO Button geklickt worden ist if ($page == 'structure' && $subpage == 'pages' && $action == 'seo') { seoPage::generateForm($id); layout::addJsCode("\n\t\tvar default_url = \$('#seo-costum-url').text();\n\t\t\n\t\t\$('#seo-costum-url-text').keyup(function() {\n\t\t\tvar val = \$(this).val();\n\t\t\t\n\t\t\tif(val == '')\n\t\t\t\tval = default_url;\n\t\t\t\t\t\t\t\n\t\t\t\$('#seo-costum-url').text(val);\n\t\t});\n\t\t\n\t\tvar default_title = \$('#seo-default-title').text();\n\t\t\$('#seo-title-text').keyup(function() {\n\t\t\tvar val = \$(this).val();\n\t\t\t\n\t\t\tif(val == '')\n\t\t\t\tval = default_title;\n\t\t\t\n\t\t\t\$('#seo-title').text(val);\n\t\t});\n\t\t"); } // Wenn Sortiert worden ist if ($page == 'structure' && $subpage == 'pages' && (ajax::is() || $action == 'delete' && !$structure_id)) { extension::add('BACKEND_OUTPUT', function ($output) { seo_rewrite::generatePathlist(); return $output; }); } // Inhaltsseite der page if ($page == 'structure' && $subpage == 'pages' && ($structure_id || $action == 'edit' && $id)) { $id = $structure_id ? $structure_id : $id; extension::add('BACKEND_OUTPUT', function ($output) use($id) { return seoPage::generateButton($output, $id); }); }
/** * Pre render processing */ public static function pre_render() { $crypt_class = new crypt(); $token = urldecode($crypt_class->token_create('general')); layout::js_data(['token' => $token, 'controller_full' => application::get(['mvc', 'full']), 'flag' => ['global' => ['format' => format::$options]], 'object_data_domains' => ['data' => object_data_domains::get_static()]]); }
</header> <section id="left"> <a id="logo" href="http://dynao.de" target="_blank"> <img src="../admin/layout/img/logo.svg" alt="dynao CMS Logo" /> <span>dynao CMS</span> </a> <h4><? echo lang::get('main_navi'); ?></h4> <ul> <?php foreach ($navi as $href => $options) { $class = $href == $page ? 'active ' : ''; echo '<li class="' . $class . '"><a><i class="fa fa-' . $options[1] . '"></i><span>' . $options[0] . '</span></a></li>'; } ?> </ul> </section> <section id="content"> <?php include 'pages/' . $page . '.php'; ?> </section> <?php echo layout::getJS(); ?> </body> </html>
/** * @see html::tabs(); */ public static function tabs($options = []) { $header = $options['header'] ?? []; $values = $options['options'] ?? []; $id = $options['id'] ?? 'tabs_default'; // determine active tab $active_id = $id . '_active_hidden'; $active_tab = $options['active_tab'] ?? request::input($active_id); if (empty($active_tab)) { $active_tab = key($header); } $result = ''; $result .= '<div id="' . $id . '" class="' . ($options['class'] ?? '') . '">'; $result .= html::hidden(['name' => $active_id, 'id' => $active_id, 'value' => $active_tab]); $tabs = []; $panels = []; $class = $li_class = $id . '_tab_li'; foreach ($header as $k => $v) { $li_id = $id . '_tab_li_' . $k; $content_id = $id . '_tab_content_' . $k; $class2 = $class; if ($k == $active_tab) { $class2 .= ' active'; } if (!empty($options['tab_options'][$k]['hidden'])) { $class2 .= ' hidden'; } $tabindex = ''; if (!empty($options['tab_options'][$k]['tabindex'])) { $tabindex = ' tabindex="' . $options['tab_options'][$k]['tabindex'] . '" '; } $tabs[$k] = '<li id="' . $li_id . '" class="' . $class2 . '"' . $tabindex . ' role="presentation"><a href="#' . $content_id . '" tab-data-id="' . $k . '" aria-controls="' . $content_id . '" role="tab" data-toggle="tab">' . $v . '</a></li>'; $panels[$k] = '<div role="tabpanel" class="tab-pane ' . ($k == $active_tab ? 'active' : '') . ' ' . $k . '" id="' . $content_id . '">' . $values[$k] . '</div>'; } $result .= '<ul class="nav nav-tabs" role="tablist" id="' . $id . '_links' . '">'; $result .= implode('', $tabs); $result .= '</ul>'; $result .= '<div class="tab-content">'; $result .= implode('', $panels); $result .= '</div>'; $result .= '</div>'; $js = <<<TTT \t\t\t\$('#{$id}_links a').click(function(e) { \t\t\t\te.preventDefault(); \t\t\t\t\$(this).tab('show'); \t\t\t\t\$('#{$active_id}').val(\$(this).attr('tab-data-id')); \t\t\t}); \t\t\t\$('.{$li_class}').mousedown(function(e) { \t\t\t\tvar that = \$(this); \t\t\t\tif (!that.is(':focus')) { \t\t\t\t\tthat.data('mousedown', true); \t\t\t\t} \t\t\t}); \t\t\t\$('.{$li_class}').focus(function(e) { \t\t\t\te.preventDefault(); \t\t\t\tvar mousedown = \$(this).data('mousedown'), tabindex = parseInt(\$(this).attr('tabindex')); \t\t\t\t\$(this).removeData('mousedown'); \t\t\t\t\$(this).find('a:first').click(); \t\t\t\tif (!mousedown && tabindex > 0) { \t\t\t\t\t\$("[tabindex='" + (tabindex + 1) + "']").focus(); \t\t\t\t} else if (mousedown) { \t\t\t\t\t\$(this).blur(); \t\t\t\t} \t\t\t\te.preventDefault(); \t\t\t}); TTT; layout::onload($js); return $result; }