/** * get the Themes config information * * @param object &$DBconn * @return array $arr_data * */ function getThemesByDB(&$DBconn) { $config = new Config(&$DBconn); $config->config_name = 'themes'; $themes_id = $config->getValuebyName(); $themes = new Themes(&$DBconn); $themes->id = $themes_id; $arr_data = $themes->selectThemes(); return $arr_data; }
/** * Establecer el tema visual a utilizar * * @param bool $force Forzar la detección del tema para los inicios de sesión */ public static function setTheme($force = false) { $theme = Session::getTheme(); if (empty($theme) || $force === true) { $Theme = new Themes(); $userTheme = $Theme->getUserTheme(); $globalTheme = $Theme->getGlobalTheme(); $theme = $userTheme ? $userTheme : $globalTheme; Session::setTheme($theme); } self::setThemePaths($theme); Session::setTheme($theme); }
/** * All handlers must implement act() to conform to handler API. * This is the default implementation of act(), which attempts * to call a class member method of $this->act_$action(). Any * subclass is welcome to override this default implementation. * * @param string $action the action that was in the URL rule */ public function act($action) { if (null === $this->handler_vars) { $this->handler_vars = new SuperGlobal(array()); } $this->action = $action; $this->theme->assign('matched_rule', URL::get_matched_rule()); $request = new StdClass(); foreach (URL::get_active_rules() as $rule) { $request->{$rule->name} = false; } $request->{$this->theme->matched_rule->name} = true; $this->theme->assign('request', $request); $action_hook = 'plugin_act_' . $action; $before_action_hook = 'before_' . $action_hook; $theme_hook = 'route_' . $action; $after_action_hook = 'after_' . $action_hook; Plugins::act($before_action_hook, $this); Plugins::act($action_hook, $this); if (Plugins::implemented($theme_hook, 'theme')) { $theme = Themes::create(); $rule = URL::get_matched_rule(); Plugins::theme($theme_hook, $theme, $rule->named_arg_values, $this); } Plugins::act($after_action_hook); }
/** * Trigger themes->requirements() at the last minute * * This is in case features are enabled/disabled */ public function _pre_render() { $this->themes->requirements(); $this->themes->plugin_requirements(); $this->template->header->header_block = $this->themes->header_block(); $this->template->footer->footer_block = $this->themes->footer_block(); }
/** * Respond to the URL that was created * Determine the post that was supposed to be displayed, and show it in raw * @params array $handlervars An array of values passed in from the URL requested */ function action_plugin_act_plaintext($handlervars) { $activetheme = Themes::create(); $user_filters = array('fetch_fn' => 'get_row', 'limit' => 1); $page_key = array_search('page', $activetheme->valid_filters); unset($activetheme->valid_filters[$page_key]); $user_filters = Plugins::filter('template_user_filters', $user_filters); $user_filters = array_intersect_key($user_filters, array_flip($activetheme->valid_filters)); $where_filters = Controller::get_handler()->handler_vars->filter_keys($activetheme->valid_filters); $where_filters = $where_filters->merge($user_filters); $where_filters = Plugins::filter('template_where_filters', $where_filters); $post = Posts::get($where_filters); $current_url = URL::get(); $created_at = $post->pubdate->get(); header('Content-type: text/plain; charset=utf-8'); echo <<<HERE # {$post->title} By {$post->author->displayname} <{$current_url}> {$created_at} \t {$post->content} HERE; exit; }
public function __construct() { parent::__construct(); $this->path = osc_themes_path(); if( Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '' ) { $this->setCurrentTheme( Params::getParam('theme') ); } else { $this->setCurrentTheme( osc_theme() ); } $functions_path = $this->getCurrentThemePath() . 'functions.php'; if( file_exists($functions_path) ) { require_once $functions_path; } $info = $this->loadThemeInfo($this->theme); if($info['template'] != '' ) { //$this->setCurrentTheme($info['template']); $parent_functions_path = osc_base_path() . 'oc-content/themes/' . $info['template'] . '/functions.php'; if( file_exists($parent_functions_path) ) { require_once $parent_functions_path; } } }
/** * Form Component */ public static function formComponent() { $_templates = Themes::getTemplates(); foreach ($_templates as $template) { $templates[basename($template, '.template.php')] = basename($template, '.template.php'); } echo '<div class="col-xs-3">' . Form::open() . Form::hidden('csrf', Security::token()) . Form::label('sandbox_form_template', __('Sandbox template', 'sandbox')) . Form::select('sandbox_form_template', $templates, Option::get('sandbox_template'), array('class' => 'form-control')) . Html::br() . Form::submit('sandbox_component_save', __('Save', 'sandbox'), array('class' => 'btn btn-default')) . Form::close() . '</div>'; }
public static function setCurrentTheme($x) { self::$set_theme = $x; $theme = new Theme(self::$set_theme); if ($theme->validate()) { self::$curr_theme = $theme; } }
public function action_init() { // gotta be an easier way of doing this $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', TRUE)); $theme = Themes::create('admin', 'RawPHPEngine', $theme_dir); if (!$theme->template_exists('admincontrol_select')) { $this->add_template('admincontrol_select', dirname(__FILE__) . '/admincontrol_select.php'); } }
public static function sysReady() { if (Themes::getCurrentTheme()->hasInterface()) { if (Themes::getCurrentTheme()->hasInterfaceName()) { $name = Themes::getCurrentTheme()->getInterfaceName(); } Admin::registerPage('theme-settings', $name ? $name : __('admin', 'theme-settings'), 'ThemeInterface::displayInterface', 2); } }
public function themes() { $available_themes = Themes::get_themes(); $active_theme = Setting::first()->theme; if (empty($active_theme)) { $active_theme = 'default'; } $data = array('themes' => $available_themes, 'active_theme' => $active_theme); return View::make('admin.sections.themes', $data); }
/** * Add the help to the publish form */ public function action_form_publish($form, $post) { $selector = $form->append('wrapper', 'help_container'); $selector->class = 'container'; $theme = Themes::create(); $theme->help = Options::get(strtolower(get_class($this)) . '__help'); $content = $theme->fetch('help'); $selector->append('static', 'help', $content); $form->move_after($selector, $form->silos); return $form; }
function filter_post_content_out($content, $post) { if ($post->info->phpexec == 'true') { $content = str_replace('<!--php', '<?php', $content); $content = str_replace('?-->', '?>', $content); ob_start(); $theme = Themes::create(); eval('?>' . $content . '<?php '); $content = ob_get_clean(); } return $content; }
public function actionSetDefault() { if (demo()) { throw new CException(tc('Sorry, this action is not allowed on the demo server.')); } $id = (int) Yii::app()->request->getPost('id'); $model = Themes::model()->findByPk($id); $model->setDefault(); // delete assets js cache ConfigurationModel::clearGenerateJSAssets(); Yii::app()->end(); }
/** * Handles AJAX from /admin/tags * Used to delete and rename tags */ public function ajax_tags($handler_vars) { Utils::check_request_method(array('POST')); $wsse = Utils::WSSE($handler_vars['nonce'], $handler_vars['timestamp']); if ($handler_vars['digest'] != $wsse['digest']) { Session::error(_t('WSSE authentication failed.')); echo Session::messages_get(true, array('Format', 'json_messages')); return; } $tag_names = array(); $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true)); $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir); $action = $this->handler_vars['action']; switch ($action) { case 'delete': foreach ($_POST as $id => $delete) { // skip POST elements which are not tag ids if (preg_match('/^tag_\\d+/', $id) && $delete) { $id = substr($id, 4); $tag = Tags::get_by_id($id); $tag_names[] = $tag->term_display; Tags::vocabulary()->delete_term($tag); } } $msg_status = _n(_t('Tag %s has been deleted.', array(implode('', $tag_names))), _t('%d tags have been deleted.', array(count($tag_names))), count($tag_names)); Session::notice($msg_status); break; case 'rename': if (!isset($this->handler_vars['master'])) { Session::error(_t('Error: New name not specified.')); echo Session::messages_get(true, array('Format', 'json_messages')); return; } $master = $this->handler_vars['master']; $tag_names = array(); foreach ($_POST as $id => $rename) { // skip POST elements which are not tag ids if (preg_match('/^tag_\\d+/', $id) && $rename) { $id = substr($id, 4); $tag = Tags::get_by_id($id); $tag_names[] = $tag->term_display; } } Tags::vocabulary()->merge($master, $tag_names); $msg_status = sprintf(_n('Tag %1$s has been renamed to %2$s.', 'Tags %1$s have been renamed to %2$s.', count($tag_names)), implode($tag_names, ', '), $master); Session::notice($msg_status); break; } $this->theme->tags = Tags::vocabulary()->get_tree(); $this->theme->max = Tags::vocabulary()->max_count(); echo json_encode(array('msg' => Session::messages_get(true, 'array'), 'tags' => $this->theme->fetch('tag_collection'))); }
public function index() { if (Input::method() == 'POST') { if (Metadata::update()) { return Response::redirect($this->admin_url . '/metadata'); } } // provide a list to set for our home page and posts page $pages = Pages::list_all(array('status' => 'published')); // list valid themes $themes = Themes::list_all(); Template::render('metadata/index', array('pages' => $pages, 'themes' => $themes, 'metadata' => (object) Config::get('metadata'))); }
public function __construct() { parent::__construct(); $this->path = osc_themes_path(); if (Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '') { $this->setCurrentTheme(Params::getParam('theme')); } else { $this->setCurrentTheme(osc_theme()); } $functions_path = $this->getCurrentThemePath() . 'functions.php'; if (file_exists($functions_path)) { require_once $functions_path; } }
public static function create($name, $initContents) { $p = self::$plugin; queue_css($p->pluginPublicDir() . 'elrte/css/smoothness/jquery-ui-1.8.13.custom.css'); queue_css($p->pluginPublicDir() . 'elrte/css/elrte.min.css'); queue_css($p->pluginPublicDir() . 'elfinder/css/elfinder.min.css'); queue_css($p->pluginPublicDir() . 'elfinder/css/theme.css'); queue_js($p->pluginPublicDir() . 'elrte/js/jquery-ui-1.8.13.custom.min.js'); queue_js($p->pluginPublicDir() . 'elrte/js/elrte.full.js'); queue_js($p->pluginPublicDir() . 'elfinder/js/elfinder.full.js'); queue_js($p->pluginPublicDir() . 'elrte/js/i18n/elrte.en.js'); return sprintf(<<<EOT <script type="text/javascript" charset="utf-8"> \t\$(function() { \t\tvar opts = { \t\t\tlang : 'en', // set your language \t\t\tstyleWithCSS : false, \t\t\theight : 400, \t\t\ttoolbar : 'maxi', \t\t\tcssfiles : ['%s'], \t\t\tfmOpen : function(callback) { \t\t\t\t\$('<div />').dialogelfinder({ \t\t\t\t\turl : '%selfinder/php/connector.php', \t\t\t\t\tlang : 'en', \t\t\t\t\tcommandsOptions : { \t\t\t\t\t\tgetfile : { \t\t\t\t\t\t\tonlyURL : true, // disable to return detail info \t\t\t\t\t\t\tmultiple : false, // disable to return multiple files info \t\t\t\t\t\t\tfolders : false, // disable to return folders info \t\t\t\t\t\t\toncomplete : 'destroy' // action after callback (""/"close"/"destroy") \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\tgetFileCallback : function (obj) { \t\t\t\t\t\tcallback(obj.baseUrl + obj.path.substr(obj.path.replace('\\\\', '/').indexOf('/')+1)); \t\t\t\t\t} \t\t\t\t}) \t\t\t} \t\t}; \t\t// create editor \t\t\$('#%s').elrte(opts); \t\t// or this way \t\t// var editor = new elRTE(document.getElementById('our-element'), opts); \t}); </script> <textarea id="%s">%s</textarea> EOT , Themes::getCurrentTheme()->getPublicPath() . "editor.css", $p->pluginPublicDir(), $name, $name, $initContents); }
public function indexAction() { // Get the user properties $values = $this->_properties->getProperties(array("title", "subtitle", "background_image", "header_image", "theme", "css_enabled", "css_content", "has_colors")); $colors = $this->_properties->getProperties(array("color_title", "color_subtitle", "color_sidebar_border", "color_background", "color_link", "color_sidebar_text", "color_sidebar_header")); // Get the form and assign the values $form = $this->getForm(); $form->populate($values); $this->view->form = $form; // Get the color form $form = $this->getFormColors(); $this->view->formtheme = $form; // Get the css form $form = $this->getFormCss(); $form->populate($values); $this->view->formcss = $form; // Do we have a background image ? if (isset($values['background_image'])) { $this->view->background_image = $values['background_image']; } // Do we have a header image ? if (isset($values['header_image'])) { $this->view->header_image = $values['header_image']; } // Get available themes $this->view->themes = Themes::getAvailableThemes(); $this->view->theme = $this->_properties->getProperty('theme'); // Custom css & colors $this->view->css_enabled = $values['css_enabled']; $this->view->css_content = $values['css_content']; $this->view->colors = $colors; $this->view->has_colors = $values['has_colors']; $this->view->onload = "onDesignLoad();"; // Get errror and status messages $this->view->status_messages = $this->getStatusMessages(); $this->view->error_messages = $this->getErrorMessages(); // Common view elements $this->common(); // Specific scripts $this->view->headScript()->appendFile('js/tab/tab.js'); $this->view->headScript()->appendFile('js/yahoo/yahoo.color.js'); $this->view->headScript()->appendFile('js/colorpicker/colorpicker.js'); $this->view->headScript()->appendFile('js/controllers/design.js'); // Specific CSS $this->view->headLink()->appendStylesheet('style/colorpicker.css'); }
/** * Constructor for theme * * If no parameter is supplied, then the constructor * Loads the active theme from the database. * * If no theme option is set, a fatal error is thrown * * @param name ( optional ) override the default theme lookup * @param template_engine ( optional ) specify a template engine * @param theme_dir ( optional ) specify a theme directory */ public function __construct( $themedata ) { $this->name = $themedata->name; $this->version = $themedata->version; $theme_dir = Utils::single_array($themedata->theme_dir); // Set up the corresponding engine to handle the templating $this->template_engine = new $themedata->template_engine(); if(isset($themedata->parent)) { $parent = Themes::create($themedata->parent); $parent_theme_dir = Utils::single_array($parent->theme_dir); $theme_dir = array_merge($theme_dir, $parent_theme_dir); } $this->theme_dir = $theme_dir; $this->template_engine->set_template_dir( $theme_dir ); $this->plugin_id = $this->plugin_id(); $this->load(); }
public static function registerMainAssets() { $cs = Yii::app()->clientScript; //$cs->coreScriptPosition = CClientScript::POS_BEGIN; $baseThemeUrl = Yii::app()->theme->baseUrl; $cs->registerCoreScript('jquery'); $cs->registerCoreScript('jquery.ui'); $cs->registerCoreScript('rating'); $cs->registerCssFile($baseThemeUrl . '/css/ui/jquery-ui.multiselect.css'); $cs->registerCssFile($baseThemeUrl . '/css/redmond/jquery-ui-1.7.1.custom.css'); $cs->registerCssFile($baseThemeUrl . '/css/ui.slider.extras.css'); $cs->registerScriptFile($baseThemeUrl . '/js/jquery.multiselect.min.js', CClientScript::POS_BEGIN); $cs->registerCssFile($baseThemeUrl . '/css/ui/jquery-ui.multiselect.css'); $cs->registerScriptFile($baseThemeUrl . '/js/jquery.dropdownPlain.js', CClientScript::POS_BEGIN); $cs->registerScriptFile($baseThemeUrl . '/js/common.js', CClientScript::POS_BEGIN); $cs->registerScriptFile($baseThemeUrl . '/js/habra_alert.js', CClientScript::POS_END); $cs->registerScriptFile($baseThemeUrl . '/js/jquery.cookie.js', CClientScript::POS_END); $cs->registerScriptFile($baseThemeUrl . '/js/scrollto.js', CClientScript::POS_END); $cs->registerCssFile($baseThemeUrl . '/css/form.css', 'screen, projection'); // superfish menu $cs->registerCssFile($baseThemeUrl . '/js/superfish/css/superfish.css', 'screen'); $cs->registerScriptFile($baseThemeUrl . '/js/superfish/js/superfish.js', CClientScript::POS_END); if (Yii::app()->theme->name == 'atlas') { $cs->registerCssFile($baseThemeUrl . '/css/rating/rating.css'); $colorTheme = Themes::getParam('color_theme'); if ($colorTheme) { $cs->registerCssFile($baseThemeUrl . '/css/colors/' . $colorTheme); } $cs->registerScriptFile($baseThemeUrl . '/js/jquery.easing.1.3.js', CClientScript::POS_BEGIN); $cs->registerScript('initizlize-superfish-menu', ' $("#sf-menu-id").superfish( {hoverClass: "sfHover", delay: 100, animationOut: {opacity:"hide"}, animation: {opacity:"show"}, cssArrows: false, dropShadows: false, speed: "fast", speedOut: 1 }); ', CClientScript::POS_READY); } //deb(Yii::app()->theme->name); exit; if (Yii::app()->theme->name == 'classic') { $cs->registerCssFile($cs->getCoreScriptUrl() . '/rating/jquery.rating.css'); $cs->registerCssFile($baseThemeUrl . '/js/superfish/css/superfish-vertical.css', 'screen'); $cs->registerScriptFile($baseThemeUrl . '/js/superfish/js/hoverIntent.js', CClientScript::POS_HEAD); $cs->registerScript('initizlize-superfish-menu', ' $("#sf-menu-id").superfish( {delay: 100, autoArrows: false, dropShadows: false, pathClass: "overideThisToUse", speed: "fast" }); ', CClientScript::POS_READY); } }
function activate($themeid) { $theme = Themes::find($themeid); if ($theme->active) { return Redirect::to('themes/manage')->withMessage($this->notifyView(Lang::get('messages.no_change'), 'warning')); } else { $themes = Themes::all(); foreach ($themes as $atheme) { if ($atheme->id != $theme->id) { $atheme->active = 0; $atheme->save(); } else { Event::fire('backend.themes.activate', array($atheme)); $atheme->active = 1; $atheme->save(); } } } return Redirect::to('themes/manage')->withMessage($this->notifyView(Lang::get('messages.theme_activated'))); }
function configure() { $ui = new FormUI('jsmincdn'); $scripts = $ui->append('checkboxes', 'scripts', 'jsmincdn__storage', 'Select the scripts that should be served as minimized.'); $theme = Themes::create(); Plugins::act('template_header', $theme); Plugins::act('template_footer', $theme); $options = Stack::get_named_stack('template_header_javascript'); $options = array_merge($options, Stack::get_named_stack('template_footer_javascript')); $options_out = array(); foreach ($options as $option => $value) { if (preg_match('#[a-f0-9]{32}#', $option)) { $value = htmlspecialchars(substr($value, 0, 80)); } else { $value = $option; } $options_out[$option] = $value; } $scripts->options = $options_out; $ui->append('submit', 'submit', 'Submit'); return $ui; }
/** * Handles AJAX requests from the dashboard */ public function ajax_dashboard($handler_vars) { Utils::check_request_method(array('POST')); $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true)); $this->theme = Themes::create('admin', 'RawPHPEngine', $theme_dir); switch ($handler_vars['action']) { case 'updateModules': $modules = array(); foreach ($_POST as $key => $module) { // skip POST elements which are not module names if (preg_match('/^module\\d+$/', $key)) { list($module_id, $module_name) = explode(':', $module, 2); // remove non-sortable modules from the list if ($module_id != 'nosort') { $modules[$module_id] = $module_name; } } } Modules::set_active($modules); $ar = new AjaxResponse(200, _t('Modules updated.')); break; case 'addModule': $id = Modules::add($handler_vars['module_name']); $this->fetch_dashboard_modules(); $ar = new AjaxResponse(200, _t('Added module %s.', array($handler_vars['module_name']))); $ar->html('modules', $this->theme->fetch('dashboard_modules')); break; case 'removeModule': Modules::remove($handler_vars['moduleid']); $this->fetch_dashboard_modules(); $ar = new AjaxResponse(200, _t('Removed module.')); $ar->html('modules', $this->theme->fetch('dashboard_modules')); break; } $ar->out(); }
/** * Load the active theme and create a new Theme instance. * Also, assign the request variables. */ public function setup_theme() { $this->theme = Themes::create(); $this->theme->assign('matched_rule', URL::get_matched_rule()); $request = new StdClass(); foreach (RewriteRules::get_active() as $rule) { $request->{$rule->name} = false; } $request->{$this->theme->matched_rule->name} = true; $this->theme->assign('request', $request); }
} Session::put('install.database', $database); return Response::redirect('metadata'); })); /* Metadata */ Route::get('metadata', array('before' => 'check', 'main' => function () { // check we have a database if (!Session::get('install.database')) { Notify::error('Please enter your database details'); return Response::redirect('database'); } // windows users may return a \ so we replace it with a / $vars['site_path'] = str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))); $vars['themes'] = Themes::all(); return Layout::create('metadata', $vars); })); Route::post('metadata', array('before' => 'check', 'main' => function () { $metadata = Input::get(array('site_name', 'site_description', 'site_path', 'theme', 'rewrite')); $validator = new Validator($metadata); $validator->check('site_name')->is_max(4, 'Please enter a site name'); $validator->check('site_description')->is_max(4, 'Please enter a site description'); $validator->check('site_path')->is_max(1, 'Please enter a site path'); $validator->check('theme')->is_max(1, 'Please select a site theme'); if ($errors = $validator->errors()) { Input::flash(); Notify::error($errors); return Response::redirect('metadata'); } Session::put('install.metadata', $metadata);
/** * Retreive the Theme used to display this form component and its descendants * * @return Theme The theme object to display the template for the control */ public function get_theme() { static $theme_obj = null; if (is_null($theme_obj)) { $theme_obj = Themes::create(); // Create the current theme instead of: 'admin', 'RawPHPEngine', $theme_dir } $this->prep_theme($theme_obj); return $theme_obj; }
/** * Display the login form * * @param string $name Pre-fill the name field with this name */ protected function login_form($name) { // Display the login form. $this->theme = Themes::create(); if (!$this->theme->template_exists('login')) { $this->theme = Themes::create('admin', 'RawPHPEngine', Site::get_dir('admin_theme', TRUE)); $this->theme->assign('admin_page', 'login'); } $request = new StdClass(); foreach (URL::get_active_rules() as $rule) { $request->{$rule->name} = $rule->name == URL::get_matched_rule()->name; } if (isset($this->handler_vars['error'])) { $this->theme->assign('error', Utils::htmlspecialchars($this->handler_vars['error'])); } $this->theme->assign('request', $request); $this->theme->assign('habari_username', htmlentities($name, ENT_QUOTES, 'UTF-8')); $this->display('login'); return TRUE; }
public function __construct() { $this->config = simplexml_load_file(dirname(__FILE__) . '/lifestream.config.xml'); $this->theme = Themes::create(); }
public function filter_post_content($content, Post $post) { if ($post->info->password) { // if user logged in, show post // make sure it's not just the anonymous user! $user = User::identify(); if ($user instanceof User && $user != User::anonymous()) { return $content; } $session = Session::get_set('post_passwords', false); $token = Utils::crypt('42' . $post->info->password . $post->id . Options::get('GUID')); // if password was submitted verify it if (Controller::get_var('post_password') && Controller::get_var('post_password_id') == $post->id) { $pass = InputFilter::filter(Controller::get_var('post_password')); if (Utils::crypt($pass, $post->info->password)) { Session::add_to_set('post_passwords', $token, $post->id); $session[$post->id] = $token; } else { Session::error(_t('That password was incorrect.', 'postpass')); } } // if password is stored in session verify it if (isset($session[$post->id]) && $session[$post->id] == $token) { return $content; } else { $theme = Themes::create(); $theme->post = $post; return $theme->fetch('post_password_form'); } } else { return $content; } }