private function _renderTemplatesForm(&$form, $themeDir, $themeName, $index = 0) { $sourceTemplates = getTemplates(); $path = $themeDir . '/templates/templates.php'; if (file_exists($path)) { require_once $path; $input = array(); foreach ($sourceTemplates as $type => $caption) { $options = array(); if (isset($templates[$type])) { $min = 0; $minIndex = 0; $i = 0; $template = $templates[$type]; $name = getTemplateName($themeName, $type); foreach ($template as $t) { if (isset($t['name']) && $t['name'] == $type) { $minIndex = $i; } $options[] = array('id_option' => $type . '_' . $t['id'], 'name' => $t['caption']); $i++; } if (isset($options) && sizeof($options)) { $input[] = array('type' => 'select', 'label' => $caption, 'name' => $name, 'options' => array('query' => $options, 'id' => 'id_option', 'name' => 'name')); $value = Configuration::get($name); $hasEmptyRecord = is_null($value); // has database record with null value $form['fields_value'][$name] = $hasEmptyRecord || !$value ? $options[$minIndex]['id_option'] : $value; } } } $form['fields_form'][$index]['form'] = array('legend' => array('title' => 'Template settings', 'icon' => 'icon-edit'), 'input' => $input); } }
public function postProcess() { if (Tools::isSubmit('submitAddconfiguration')) { $themeName = $this->_getThemeName(); $modes = getSliderModes(); $sliders = getSliders(); foreach ($sliders as $sliderName => $sliderCaption) { foreach ($modes as $modeName => $modeCaption) { $name = getSliderSettingsName($themeName, $sliderName, $modeName); $value = Tools::getValue($name, ''); if (Validate::isInt($value) || empty($value)) { $value = empty($value) ? '' : $value; Configuration::updateValue($name, $value); } else { $this->errors[] = $this->l('Invalid value for slider "' . $sliderCaption . '" in "' . $modeCaption . '" mode'); } } } $sourceTemplates = getTemplates(); foreach ($sourceTemplates as $type => $caption) { $name = getTemplateName($themeName, $type); $value = Tools::getValue($name, ''); Configuration::updateValue($name, $value); } if (!count($this->errors)) { $this->confirmations[] = $this->l('The settings have been updated.'); } } return parent::postProcess(); }
/** * */ public function __construct() { $this->Register = Register::getInstance(); $this->setPhpSettings(); $this->touchStartTime(); $this->Register['Cache'] = new Cache(); $viewerLoader = new Fps_Viewer_Loader(array('template_root' => ROOT . '/template/' . getTemplateName() . '/html/')); $this->Register['Viewer'] = new Fps_Viewer_Manager($viewerLoader); if (isInstall()) { $this->registerCustomTemplateFunctions(); $this->Register['DB'] = class_exists('PDO') && Config::read('use_pdo') ? FpsPDO::get() : FpsDataBase::get(); $this->Register['UserAuth'] = new UserAuth(); $this->Register['Log'] = new Logination(); } $this->Register['DocParser'] = new Document_Parser(); $this->Register['ACL'] = new ACL(ROOT . '/sys/settings/'); $this->Register['PrintText'] = new PrintText(); $this->Register['Validate'] = new Validate(function ($errors) { $Register = Register::getInstance(); return $Register['DocParser']->wrapErrors($errors); }); $this->Register['ModManager'] = new ModulesManager(ROOT . '/sys/settings/modules_access.php'); $this->Register['PluginController'] = new Plugins(); $this->Register['URL'] = new AtmUrl(); $this->Register['Protector'] = new Protect(); if (isInstall()) { $this->inputCheck(); $this->initProtect(); $this->initUser(); $this->loadLanguages(); } }
function showInfoMessage($message, $queryString = null) { $Register = Register::getInstance(); header('Refresh: ' . $Register['Config']->read('redirect_delay') . '; url=http://' . $_SERVER['SERVER_NAME'] . get_url($queryString)); $html = file_get_contents(ROOT . '/template/' . getTemplateName() . '/html/default/infomessagegrand.html'); $html = str_replace('{INFO_MESSAGE}', $message, $html); echo $html; die; }
public function getAvatar() { $template = getTemplateName(); if (file_exists(ROOT . '/sys/avatars/' . $this->getId() . '.jpg')) { $avatar = get_url('/sys/avatars/' . $this->getId() . '.jpg'); } else { $avatar = get_url('/template/' . $template . '/img/noavatar.png'); } return $avatar; }
public function getCaptcha($key = null) { $key = !empty($key) ? trim($key) : 'captcha_keystring'; $Register = Register::getInstance(); $permitted_types = array('question', 'question-image', 'image'); $permitted_types = $Register['PluginController']->intercept('get_captcha_types', $permitted_types); $captcha_type = Config::read('secure.captcha_type'); if (empty($captcha_type) || !in_array($captcha_type, $permitted_types)) { $captcha_type = 'question-image'; } $output = ''; $help_text = ''; switch ($captcha_type) { case 'question-image': $output = '<img src="' . WWW_ROOT . '/sys/inc/kcaptcha/textCaptcha/kc.php?' . rand(rand(0, 1000), 999999) . '&name=' . $key . '" onClick="this.src=\'' . WWW_ROOT . '/sys/inc/kcaptcha/textCaptcha/kc.php?name=' . $key . '&' . rand(rand(0, 1000), 999999) . '\'+Math.round(Math.random(0)*1000)" id="fps_captcha" />'; $help_text = __('Give the right ansver'); break; case 'question': include_once ROOT . '/sys/inc/kcaptcha/textCaptcha/AtmCaptcha.class.php'; $obj = new AtmCaptcha(); $output = $obj->getTextContent($key); $help_text = __('Give the right ansver'); break; case 'image': $output = '<img src="' . WWW_ROOT . '/sys/inc/kcaptcha/kc.php?' . rand(rand(0, 1000), 999999) . '&name=' . $key . '" onclick="this.src=\'' . WWW_ROOT . '/sys/inc/kcaptcha/kc.php?name=' . $key . '&' . rand(rand(0, 1000), 999999) . '\'+Math.round(Math.random(0)*1000)" id="fps_captcha" />'; $help_text = __('Enter the characters from the image'); break; default: list($output, $help_text) = $Register['PluginController']->intercept('get_captcha', $key); break; } //return array($output, $help_text); $tpl = file_get_contents(ROOT . '/template/' . getTemplateName() . '/html/default/captcha.html'); $captcha = str_replace(array('{{ captcha }}', '{{ captcha_text }}'), array($output, $help_text), $tpl); return array($captcha, $help_text); }
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $this->curItem = $item; $submenuOutput = ''; $atts = array(); $atts['title'] = !empty($item->attr_title) ? $item->attr_title : ''; $atts['target'] = !empty($item->target) ? $item->target : ''; $atts['rel'] = !empty($item->xfn) ? $item->xfn : ''; $atts['href'] = !empty($item->url) ? $item->url : ''; $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); if (isset($item->submenu_category) && $item->submenu_category == 1) { $post = get_post($item->object_id); $template = get_metadata('post', $item->object_id, '_wp_page_template', true); if ($template == 'menu.php' || $template == 'menu2.php' || $template == 'menu3.php') { $categories = get_metadata('post', $item->object_id, 'menu_categories', true); if (!empty($categories)) { $terms = get_terms('berg_menu_categories', array('include' => $categories, 'hide_empty' => false)); $termsArray = array(); foreach ($terms as $term) { $termsArray[$term->term_id] = array('id' => $term->term_id, 'name' => $term->name, 'slug' => $term->slug); } $submenuOutput = "<div class=\"subnav image-subnav\"><ul class=\"subnav-wrapper\">\n"; foreach ($categories as $cat) { $t_id = $termsArray[$cat]['id']; $imgUrl = get_option("taxonomy_{$t_id}"); if (isset($imgUrl['menu_category_icon_image']) && getTemplateName() == 'homepage.php') { $imgUrl = get_attachment_id_from_url($imgUrl['menu_category_icon_image']); $imgUrl = wp_get_attachment_image_src($imgUrl, 'menu_thumb'); $imgUrl = 'background-image: url(' . $imgUrl[0] . ')'; } else { $imgUrl = ''; } $submenuOutput .= '<li><a href="' . esc_url($atts['href']) . '#category-' . $termsArray[$cat]['slug'] . '">' . $termsArray[$cat]['name'] . '</a><div><a href="' . esc_url($atts['href']) . '#category-' . $termsArray[$cat]['slug'] . '" class="menu-img" style="' . $imgUrl . '"></a></div></li>'; } $submenuOutput .= "</ul></div>\n"; $this->excluded[] = $item->ID; } } } $indent = $depth ? str_repeat("\t", $depth) : ''; $class_names = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr($id) . '"' : ''; $output .= $indent . '<li' . $id . $class_names . '>'; $attributes = ''; foreach ($atts as $attr => $value) { if (!empty($value)) { $value = 'href' === $attr ? esc_url($value) : esc_attr($value); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; /** This filter is documented in wp-includes/post-template.php */ $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; $item_output .= '</a>'; $item_output .= $submenuOutput; $item_output .= $args->after; // $output .= $submenuOutput; if (!in_array($item->menu_item_parent, $this->excluded)) { $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } }
$config[$newkey] = $sublangval[1]; } } } } # End Parse Multilang Text return $config; } if (file_exists($dir . '/templateDetails.xml')) { $template_xml = simplexml_load_file($dir . '/templateDetails.xml', 'SimpleXMLElement', LIBXML_NOCDATA); $template_name = $template_xml->name; $template_date = $template_xml->creationDate; } else { $template_name = 'blank'; } $style_name = getTemplateName($template_name); $file = 'vertex.json'; $params = handleJSONFile($file, $style_name, $dir); foreach ($params as $k => $v) { ${$k} = $v; } $s5_lr_tab1_text = str_replace(" ", " ", $s5_lr_tab1_text); $s5_lr_tab2_text = str_replace(" ", " ", $s5_lr_tab2_text); $s5_urlforSEO = $s5_seourl; if ($s5_fstyle != "") { $s5_fstyle = ":" . $s5_fstyle; } if ($s5_fstyle_responsive_mobile_bar != "") { $s5_fstyle_responsive_mobile_bar = ":" . $s5_fstyle_responsive_mobile_bar; } $s5_fonts_with_style = $s5_fonts . $s5_fstyle;
/** * Work for language pack. * Open language file and return needed * string. * * @param string $key * @param string $context * @return string */ function __($key, $context = false) { $Register = Register::getInstance(); $language = getLang(); if (empty($language) || !is_string($language)) { $language = 'rus'; } if (!empty($Register['translation_cache'])) { $lang = $Register['translation_cache']; } else { $lang_file = ROOT . '/sys/settings/languages/' . $language . '.php'; $tpl_lang_file = ROOT . '/template/' . getTemplateName() . '/languages/' . $language . '.php'; if (!file_exists($lang_file)) { throw new Exception('Main language file not found'); } $lang = (include $lang_file); if (file_exists($tpl_lang_file)) { $tpl_lang = (include $tpl_lang_file); $lang = array_merge($lang, $tpl_lang); } $mod_langs = array_search_recursive($language, $Register['modules_translations']); if ($mod_langs) { foreach ($mod_langs as $path) { $mod_lang = (include $path); $lang = array_merge($lang, $mod_lang); } } $Register['translation_cache'] = $lang; } if ($context && is_string($context) && is_array($lang[$context])) { if (array_key_exists($context, $lang) && array_key_exists($key, $lang[$context])) { return $lang[$context][$key]; } } if (array_key_exists($key, $lang)) { return $lang[$key]; } return $key; }
public static function loadCustomTemplateFunctions() { $path = ROOT . '/template/' . getTemplateName() . '/customize/AtmCustomTemplateFunctions.class.php'; if (file_exists($path) && is_readable($path)) { include_once $path; if (class_exists('AtmCustomTemplateFunctions')) { return AtmCustomTemplateFunctions::get(); } } return array(); }
public function pm() { if (!isset($_SESSION['user'])) { redirect('/'); } // Navigation Panel $nav = array(); $nav['navigation'] = get_link(__('Home'), '/') . __('Separator') . get_link(h($this->module_title), '/users/') . __('Separator') . __('PM nav'); $this->_globalize($nav); $markers = array('error' => ''); $messages = $this->Model->getUserDialogs($_SESSION['user']['id']); if (!is_array($messages) || !count($messages)) { $markers['messages'] = array(); $markers['errors'] = __('This dir is empty'); $source = $this->render('pm.html', array('context' => $markers)); return $this->_view($source); } foreach ($messages as $message) { // Если сообщение еще не прочитано $icon = $message->getViewed() == 0 ? 'folder_new' : 'folder'; $message->setIcon(get_img('/template/' . getTemplateName() . '/img/' . $icon . '.gif')); $message->setEntryLink(get_link(h($message->getSubject()), '/users/pm_view/' . $message->getId())); $message->setEntryUrl(get_url('/users/pm_view/' . $message->getId())); $message->setDeleteLink(get_link(__('Delete'), '/users/pm_delete/' . $message->getId(), array('onClick' => "return confirm('" . __('Are you sure') . "');"))); $message->setMessage(h($message->getMessage())); } //pr($messages[0]->getTouser()->getAvatar()); die(); $source = $this->render('pm.html', array('messages' => $messages, 'context' => $markers)); return $this->_view($source); }
?> " /> <?php wp_head(); ?> </head> <body <?php body_class(); ?> > <?php if (current_user_can('manage_options')) { ?> <div id="devHelper"> Template Loaded: <?php echo getTemplateName(); ?> </div> <?php } ?> <div id="siteWrapper"> <header> <div id="header" class="container"> <hgroup> <h1> <span> <a href="<?php echo esc_url(home_url('/')); ?> " title="<?php
function getTemplateVars() { $vars = array(); $controllers = getTemplateControllers(); foreach (Theme::getAvailable(false) as $themeName) { $themeDir = getThemeDir($themeName); $path = $themeDir . '/templates/templates.php'; if (file_exists($path)) { require_once $path; } foreach ($controllers as $type => $controller) { $name = getTemplateName($themeName, $type); $value = Configuration::get($name, false); if (!$value && isset($templates)) { // template settings has not been saved to database yet or it's preview theme foreach ($templates[$type] as $t) { if (isset($t['name']) && $t['name'] == $type) { $value = $type . '_' . $t['id']; } } } if ($value) { $c = strtolower($controller); $vars[$themeName][$c] = $value; } } } return $vars; }
/** * @param string $page * @return data with parsed global tags */ public function getGlobalMarkers($page = '') { $Register = Register::getInstance(); $markers = array(); $markers['fps_wday'] = date("D"); $markers['fps_date'] = date("d-m-Y"); $markers['fps_time'] = date("H:i"); $markers['fps_year'] = date("Y"); $markers['version'] = FPS_VERSION; $path = $Register['Config']->read('smiles_set'); $path = !empty($path) ? $path : 'fapos'; $markers['smiles_set'] = $path; $path = ROOT . '/sys/img/smiles/' . $path . '/info.php'; include $path; if (isset($smilesList) && is_array($smilesList)) { $markers['smiles_list'] = isset($smilesInfo) && isset($smilesInfo['show_count']) ? array_slice($smilesList, 0, $smilesInfo['show_count']) : $smilesList; } else { $markers['smiles_list'] = array(); } $markers['powered_by'] = '©AtomX CMS'; $markers['site_title'] = Config::read('site_title'); if (isset($_SESSION['user']) && isset($_SESSION['user']['name'])) { $markers['fps_user'] = $_SESSION['user']; $markers['personal_page_link'] = get_url(getProfileUrl($_SESSION['user']['id'])); $markers['fps_user_name'] = $_SESSION['user']['name']; $userGroup = $Register['ACL']->get_user_group($_SESSION['user']['status']); $markers['fps_user_group'] = $userGroup['title']; } else { $userGroup = $Register['ACL']->get_user_group(0); $markers['personal_page_link'] = get_url('/users/add_form/'); $markers['fps_user_name'] = __('Гость'); //TODO $markers['fps_user_group'] = $userGroup['title']; $markers['fps_user'] = array('id' => 0, 'name' => $markers['fps_user_name'], 'group' => $markers['fps_user_group'], 'avatar' => get_url('/template/' . getTemplateName() . '/img/noavatar.png', false, false)); } $markers['atm_users_groups'] = $Register['ACL']->getGroups(); $markers['fps_admin_access'] = $Register['ACL']->turn(array('panel', 'entry'), false) ? '1' : '0'; $markers['fps_user_id'] = !empty($_SESSION['user']['id']) ? $_SESSION['user']['id'] : 0; $online = getWhoOnline(); $markers['all_online'] = $online['users'] + $online['guests']; $markers['users_online'] = $online['users']; $markers['guests_online'] = $online['guests']; $markers['online_users_list'] = !empty($_SESSION['online_users_list']) ? $_SESSION['online_users_list'] : ''; $markers['count_users'] = getAllUsersCount(); $overal_stats = getOveralStat(); $markers['max_online_all_time'] = !empty($overal_stats['max_users_online']) ? intval($overal_stats['max_users_online']) : 0; $markers['max_online_all_time_date'] = !empty($overal_stats['max_users_online_date']) ? h($overal_stats['max_users_online_date']) : 'Uncnown'; if (strstr($page, '{{ fps_chat }}')) { include_once ROOT . '/modules/chat/index.php'; $markers['fps_chat'] = '<div id="fpsChat" ' . ' style="width:100%; height:400px; overflow:auto; margin:0px; padding:0px; border:none;"></div>'; $markers['fps_chat'] .= ChatModule::add_form(); } $markers['counter'] = get_url('/sys/img/counter.png?rand=' . rand(0, 999999), false, false); $markers['template_path'] = get_url('/template/' . getTemplateName(), false, false); $markers['www_root'] = WWW_ROOT; $markers['lang'] = getLang(); $markers['fps_rss'] = $this->getRss(); if (false !== strpos($page, '{{ mainmenu }}')) { $markers['mainmenu'] = $this->builMainMenu(); } // today borned users $today_born = getBornTodayUsers(); $tbout = ''; if (count($today_born) > 0) { $names = array(); foreach ($today_born as $user) { $names[] = get_link($user['name'], getProfileUrl($user['id'])); } $tbout = implode(', ', $names); } $markers['today_born_users'] = !empty($tbout) ? $tbout : __('No birthdays today'); return $markers; }
public function importTemplateFiles($pathToTemplateFiles, $module) { if (file_exists($pathToTemplateFiles) && is_dir($pathToTemplateFiles)) { $templatePath = ROOT . '/template/' . getTemplateName(); $dirs = glob($pathToTemplateFiles . '/*', GLOB_ONLYDIR); foreach ($dirs as $dir) { $dirName = basename($dir); // Copying HTML templates to the special module directory if ($dirName === 'html') { touchDir($templatePath . '/html/' . $module, 0777); copyr($dir, $templatePath . '/html/' . $module, 0777); continue; } touchDir($templatePath . '/' . $dirName, 0777); copyr($dir, $templatePath . '/' . $dirName, 0777); } } }
function getTemplateVars() { $vars = array(); $templates = getTemplateControllers(); foreach (Theme::getAvailable(false) as $themeName) { foreach ($templates as $type => $controller) { $name = getTemplateName($themeName, $type); $value = Configuration::get($name); if ($value) { $c = strtolower($controller); $vars[$themeName][$c] = $value; } } } return $vars; }