/** * {@inheritdoc} * * @SuppressWarnings(PHPMD.NPathComplexity) */ public function create($themeName, array $themeDefinition) { $theme = new Theme($themeName, isset($themeDefinition['parent']) ? $themeDefinition['parent'] : null); if (isset($themeDefinition['label'])) { $theme->setLabel($themeDefinition['label']); } if (isset($themeDefinition['screenshot'])) { $theme->setScreenshot($themeDefinition['screenshot']); } if (isset($themeDefinition['icon'])) { $theme->setIcon($themeDefinition['icon']); } if (isset($themeDefinition['logo'])) { $theme->setLogo($themeDefinition['logo']); } if (isset($themeDefinition['directory'])) { $theme->setDirectory($themeDefinition['directory']); } if (isset($themeDefinition['groups'])) { $theme->setGroups((array) $themeDefinition['groups']); } if (isset($themeDefinition['description'])) { $theme->setDescription($themeDefinition['description']); } if (isset($themeDefinition['data'])) { $theme->setData($themeDefinition['data']); } return $theme; }
function send_form_test() { $theme = new Theme(); $response = $theme->form_test(); echo json_encode($response); exit; }
public function form() { $text = new FormElement("textarea", "q_post"); $t = new Theme(); $text->addClasses("actualite_area_text"); return $t->process_form_elements($text); }
public static function price($euro) { $theme = new Theme(); $theme->set_title("Convertion euro > franc"); $theme->add_to_body($euro * 6.55957); $theme->process_theme(Theme::STRUCT_DEFAULT); }
function _load_themes() { $this->themes = []; $themes = glob("{$this->theme_dir}*.{{$this->theme_ext}}", GLOB_BRACE); $p_exts = $this->theme_ext; $p_exts = preg_split('/,/i', $p_exts); foreach ($p_exts as &$ext) { $ext = preg_quote('.' . trim($ext)); } $p_exts = join('|', $p_exts); foreach ($themes as $theme_dir) { $theme = new Theme($theme_dir, $this->theme_file, ['class' => preg_replace('/([^\\/]+\\/(?=[^$])|(' . $p_exts . ')|\\/\\s?$)/i', '', $theme_dir) . "\\" . $this->theme_class]); $this->themes[] = $theme; } foreach ($this->themes as $index => $theme) { $result = $theme->init(); if (!$result) { $this->themes[$index] = false; } } $loaded = $this->themes; $this->themes = []; foreach ($loaded as $theme) { if ($theme) { $this->themes[] = $theme; } } }
/** * @param string $theme * @param array $vars */ public static function _($theme, $vars = array()) { $instance = new Theme(); foreach ($vars as $key => $value) { $instance->set($key, $value); } $instance->dispatch($theme); }
public function widget_menu_system() { $theme = new Theme(); $list = array(); $list[] = Theme::linking(Page::url("/admin/modules/"), t("<i class=\"fa fa-puzzle-piece fa-fw\"></i> Modules")); $list[] = Theme::linking(Page::url("/admin/database/"), t("<i class=\"fa fa-database fa-fw\"></i> Base de données")); return t("<div class=\"widget_titre\"><i class=\"fa fa-wrench fa-fw\"></i> Système</div>") . $theme->listing($list); }
function index() { list($params, $id) = $this->parse_params(func_get_args()); $t = new Theme(); $final = $t->read(); $final = Shutter::filter('api.themes', array($final)); $this->set_response_data($final); }
public static function setCurrentTheme($x) { self::$set_theme = $x; $theme = new Theme(self::$set_theme); if ($theme->validate()) { self::$curr_theme = $theme; } }
/** * Respond to call to $theme->linkoid() in template * * @param string $return The return value to the template function (passed through other potential plugin calls) * @param Theme $theme The theme object * @param string $tag An optional tag to use instead of the one defined in the plugin options. * @return string The return value to the template function */ public function theme_linkoid($theme, $tag = null) { if (!isset($tag)) { $tag = Options::get('linkoid__show'); } $linkoids = Posts::get(array('tag_slug' => $tag, 'limit' => Options::get('linkoid__count'))); $theme->linkoids = $linkoids; return $theme->fetch('linkoid'); }
public function exampleImageUrls() { $layout = new ThemeLayout(1); $template = new ThemeTemplate(1); $theme = new Theme(1); print_d($layout->getThemeConfig()); var_dump($theme->getPath()); var_dump($template->getImageUrl()); echo '<br>'; var_dump($layout->getImageUrl()); echo '<br>'; var_dump($theme->getImageUrl()); }
public function page_permissions() { if (isset($_POST['save-permissions'])) { PermissionObject::removeAllPermissions(); if (isset($_POST['permission'])) { foreach ($_POST['permission'] as $perm => $groups) { foreach ($groups as $grp => $d) { PermissionObject::addPermission($grp, $perm); } } } Notification::statusNotify(t("configuration enregistrée"), Notification::STATUS_SUCCESS); } $defined_permissions = PermissionObject::loadAllPermissions(); $df = array(); foreach ($defined_permissions as $p) { if (!isset($df[$p->pid])) { $df[$p->pid] = array(); } $df[$p->pid][$p->gid] = 1; } $p = new PermissionsManager(); $permissions = $p->scanForPermission(); $groups = GroupObject::loadAll(); $table = array(); $hcol = array(""); $hrow = array(); foreach ($permissions as $u => $t) { $hrow[] = $t; $row = array(); foreach ($groups as $gd => $g) { if ($u == 0) { $hcol[] = $g->label; } $pm = new PermissionObject(); $pm->loadByName($t); $tlabel = "permission[" . $g->gid . "][" . $pm->pid . "]"; if (isset($df[$pm->pid][$g->gid])) { $row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' checked='checked'/>"; } else { $row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' />"; } } $table[] = $row; } $theme = new Theme(); $theme->set_title(t("Permissions déclarées")); $table = Themed::tabling($table, $hcol, $hrow); $theme->add_to_body("<form method='POST' action=''>{$table} <input type='submit' name='save-permissions' value='" . t("Enregistrer") . "'/></form>"); $theme->process_theme(Theme::STRUCT_ADMIN); }
function test_db_methods() { $theme = new Theme("Master", "And Servant"); $sp1 = new BackgroundColorSP("#FFFCF0"); $id1 = $theme->registerSP($sp1); $sp2 = new ColorSP("#2E2B33"); $id2 = $theme->registerSP($sp2); $sp3 = new FontSP("Verdana", "10pt"); $id3 = $theme->registerSP($sp3); $this->manager->setTheme($theme); $this->manager->saveTheme(); $id = $theme->getId(); $this->assertIsA($id, "HarmoniId"); $theme1 = new Theme("Master", "And Servant"); $sp1 = new BackgroundColorSP("#241"); $id1 = $theme1->registerSP($sp1); $sp2 = new ColorSP("#325"); $id2 = $theme1->registerSP($sp2); $sp3 = new FontSP("Arial", "9pt"); $id3 = $theme1->registerSP($sp3); $this->manager->loadTheme($id); $themea = $this->manager->getTheme(); $this->assertIdentical($theme, $themea); /*** testing method replaceThemeState ***/ $theme2 = new Theme("Master", "And Servant"); $sp1 = new BackgroundColorSP("#241"); $id1 = $theme2->registerSP($sp1); $sp2 = new ColorSP("#325"); $id2 = $theme2->registerSP($sp2); $sp3 = new FontSP("Arial", "9pt"); $id3 = $theme2->registerSP($sp3); $this->manager->saveTheme($id, $theme2); $this->manager->loadTheme($id, $theme1); $this->assertIdentical($theme2, $theme1); /*** testing method deleteThemeState ***/ $dbHandler =& Services::getService("DatabaseManager"); $dbIndex = $dbHandler->addDatabase(new MySQLDatabase("devo", "doboHarmoniTest", "test", "test")); $dbHandler->connect($dbIndex); $this->manager->deleteTheme($id); $idValue = $id->getIdString(); $query = new SelectQuery(); $query->addColumn("gui_theme"); $query->addColumn("gui_state"); $query->addTable("gui"); $query->addWhere("gui_id = " . $idValue); $queryResult = $dbHandler->query($query, $dbIndex); $affectedRows = $queryResult->getNumberOfRows(); $this->assertIdentical($affectedRows, 0); $queryResult->free(); }
public function getStyleConfig() { $conf = array(); foreach ($this->getAllParentThemes() as $theme) { $inst = new Theme($theme, $this->application); $conf = $this->array_merge_recursive_distinct($conf, $inst->getStyleConfig()); } $path = $this->application->getRenderer()->getTemplatePath('theme/' . $this->name . '/.theme/style.ini'); if ($path) { //$conf = $this->array_merge_recursive_distinct($conf, parse_ini_file($path, true)); $conf = parse_ini_file($path, true); } return $conf; }
public function testGetPatternDirs() { $parentTheme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $parentTheme->expects($this->any())->method('getThemePath')->will($this->returnValue('package/parent_theme')); $theme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface'); $theme->expects($this->any())->method('getThemePath')->will($this->returnValue('package/current_theme')); $theme->expects($this->any())->method('getParentTheme')->will($this->returnValue($parentTheme)); $ruleDirsMap = array(array(array('theme_path' => 'package/current_theme'), array('package/current_theme/path/one', 'package/current_theme/path/two')), array(array('theme_path' => 'package/parent_theme'), array('package/parent_theme/path/one', 'package/parent_theme/path/two'))); $rule = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\Fallback\\Rule\\RuleInterface'); $rule->expects($this->any())->method('getPatternDirs')->will($this->returnValueMap($ruleDirsMap)); /** @var $rule RuleInterface */ $object = new Theme($rule); $expectedResult = array('package/current_theme/path/one', 'package/current_theme/path/two', 'package/parent_theme/path/one', 'package/parent_theme/path/two'); $this->assertEquals($expectedResult, $object->getPatternDirs(array('theme' => $theme))); }
private function on_get() { $response = []; foreach (['langs', 'options', 'types'] as $name) { if ($this->request->query_boolean($name, false)) { $methodname = 'get_' . $name; $response[$name] = $this->context->{$methodname}(); } } if ($this->request->query_boolean('setup', false)) { $response['setup'] = $this->setup->to_jsono($this->context->is_admin()); } if ($this->request->query_boolean('theme', false)) { $theme = new Theme($this->context); $response['theme'] = $theme->get_icons(); } if ($this->request->query('items', false)) { $href = $this->request->query('items.href'); $what = $this->request->query_numeric('items.what'); $response['items'] = $this->context->get_items($href, $what); } if ($this->request->query('custom', false)) { Util::json_fail(Util::ERR_DISABLED, 'custom disabled', !$this->context->query_option('custom.enabled', false)); $href = $this->request->query('custom'); $custom = new Custom($this->context); $response['custom'] = $custom->get_customizations($href); } if ($this->request->query('l10n', false)) { Util::json_fail(Util::ERR_DISABLED, 'l10n disabled', !$this->context->query_option('l10n.enabled', false)); $iso_codes = $this->request->query_array('l10n'); $iso_codes = array_filter($iso_codes); $response['l10n'] = $this->context->get_l10n($iso_codes); } if ($this->request->query('search', false)) { Util::json_fail(Util::ERR_DISABLED, 'search disabled', !$this->context->query_option('search.enabled', false)); $href = $this->request->query('search.href'); $pattern = $this->request->query('search.pattern'); $search = new Search($this->context); $response['search'] = $search->get_items($href, $pattern); } if ($this->request->query('thumbs', false)) { Util::json_fail(Util::ERR_DISABLED, 'thumbnails disabled', !$this->context->query_option('thumbnails.enabled', false)); Util::json_fail(Util::ERR_UNSUPPORTED, 'thumbnails not supported', !$this->setup->get('HAS_PHP_JPEG')); $thumbs = $this->request->query_array('thumbs'); $response['thumbs'] = $this->context->get_thumbs($thumbs); } Util::json_exit($response); }
/** * Displays all controllers from the layout map, categories * by which sector they are in. * * @param string $name * @param array $args * @return mixed */ public function __call($name, $args) { $this->setOutputType(self::_OT_CONFIG); if (!$this->_acl->check('content_layout_config_module')) { throw new Module_NoPermission(); } $layoutName = substr($name, 0, -7); $siteType = substr($layoutName, 0, strpos($layoutName, '-')); if (empty($layoutName) || !$this->_router->siteTypeExists($siteType)) { $this->_event->error(t('Unable to manage content layout, invalid name given')); return zula_redirect($this->_router->makeUrl('content_layout')); } $this->setTitle(sprintf(t('"%s" content layout'), $layoutName)); $this->setOutputType(self::_OT_CONFIG); // Create the new content layout object $layout = new Layout($layoutName); if (!$layout->exists()) { $this->_event->error(t('Provided layout does not exist')); return zula_redirect($this->_router->makeUrl('content_layout')); } // Build view form with validation for the regex (for layout) $form = new View_form('manage/main.html', 'content_layout'); $form->caseSensitive(); $form->action($this->_router->makeUrl('content_layout', 'manage', $layoutName)); $form->addElement('content_layout/regex', $layout->getRegex(), t('URL/Regex'), new Validator_Length(2, 255)); if ($form->hasInput() && $form->isValid()) { $layout->setRegex($form->getValues('content_layout/regex')); if ($layout->save()) { $this->_event->success(t('Updated content layout')); return zula_redirect($this->_router->makeUrl('content_layout', 'manage', $layoutName)); } $this->_event->error(t('Unable to save content layout')); } /** * Gather all controllers in the layout for the theme of the site type * this layout is for. */ $theme = new Theme($this->_config->get('theme/' . $siteType . '_default')); $themeSectors = array(); foreach ($theme->getSectors() as $sector) { $themeSectors[$sector['id']] = array('sector' => $sector, 'cntrlrs' => $layout->getControllers($sector['id'])); } // Assign additional data $form->assign(array('layoutName' => $layout->getName(), 'themeSectors' => $themeSectors)); $this->_theme->addJsFile('jQuery/plugins/dnd.js'); $this->addAsset('js/dnd_order.js'); return $form->getOutput(); }
/** * Display the tab * * @param array $data The data to inject in the view * * @return string The generated HTML */ public static function make($data) { if (is_array($data['page']) && isset($data['page']['content'])) { $data['page'] = $data['page']['content']; } return parent::make(Theme::getSelected()->getView('tabs-layout/tabs-no-sidebar.tpl'), $data); }
public function getIndex() { $theme = Theme::uses('notebook')->layout('blue'); $theme->setMenu('reference.index'); $params = array(); return $theme->scope('reference.index', $params)->render(); }
function displayPage() { Theme::Set('version', VERSION); Theme::Set('text', Theme::RenderReturn('about_text')); // Render the Theme and output Theme::Render('about_page'); }
/** * Shiv IE, add the stylesheet * @param Theme $theme */ function action_template_header($theme) { // Add the HTML5 shiv for IE < 9 Stack::add('template_header_javascript', array('http://cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.js', null, '<!--[if lt IE 9]>%s<![endif]-->'), 'html5_shiv'); // Add this line to your config.php to show an error and a notice, and // to process the raw LESS code via javascript instead of the rendered CSS: define('DEBUG_THEME', 1); if (defined('DEBUG_THEME')) { // Session::error('This is a <b>sample error</b>'); // Session::notice('This is a <b>sample notice</b> for ' . $_SERVER['REQUEST_URI']); Stack::add('template_header_javascript', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', 'jquery'); Stack::add('template_header_javascript', $theme->get_url('/less/less-1.3.0.min.js'), 'less'); Stack::add('template_stylesheet', array($theme->get_url('/less/style.less'), null, array('type' => null, 'rel' => 'stylesheet/less')), 'style'); } else { Stack::add('template_stylesheet', $theme->get_url('/css/style.css'), 'style'); } }
function upgrade_module_1_3_2_11($object) { $themes = Theme::getThemes(); $theme_meta_value = array(); foreach ($object->controllers as $controller) { $page = 'module-' . $object->name . '-' . $controller; $result = Db::getInstance()->getValue('SELECT * FROM ' . _DB_PREFIX_ . 'meta WHERE page="' . pSQL($page) . '"'); if ((int) $result > 0) { continue; } $meta = new Meta(); $meta->page = $page; $meta->configurable = 0; $meta->save(); if ((int) $meta->id > 0) { foreach ($themes as $theme) { $theme_meta_value[] = array('id_theme' => $theme->id, 'id_meta' => $meta->id, 'left_column' => (int) $theme->default_left_column, 'right_column' => (int) $theme->default_right_column); } } else { $object->_errors[] = sprintf(Tools::displayError('Unable to install controller: %s'), $controller); } } if (count($theme_meta_value) > 0) { return Db::getInstance()->insert('theme_meta', $theme_meta_value); } return true; }
function add_mainMenu() { $div = html_div(''); $div->add(html_br()); $table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 0, 0); $row = html_tr(); $blank = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 10, 10)); //$blank->set_tag_attribute('colspan','4'); $image = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 20, 14)); $image->set_tag_attribute('align', 'right'); $image->set_tag_attribute('width', '40%'); $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=new'), agt('Registrar entidad'), null, "_top"); $link->set_tag_attribute('class', ''); $item1 = html_td('', '', $link); $item1->set_tag_attribute('width', '20%'); $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=ficha entidad'), agt('Ficha entidad'), null, "_top"); $link->set_tag_attribute('class', ''); $item2 = html_td('', '', $link); $item2->set_tag_attribute('width', '20%'); $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=del&entity=' . $this->getViewVariable('id')), agt('Baja entidad'), null, "_top"); $link->set_tag_attribute('class', ''); $item3 = html_td('', '', $link); $item3->set_tag_attribute('width', '20%'); $row->add($blank); $row->add($image); $row->add($item1); $row->add($item2); $row->add($item3); $table->add_row($row); $div->add($table); return $div; }
public function action_index() { //template header $this->template->title = ''; // $this->template->meta_keywords = 'keywords'; $this->template->meta_description = Core::config('general.site_description'); //setting main view/template and render pages // swith to decide on ads_in_home $ads = new Model_Ad(); $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED); switch (core::config('advertisement.ads_in_home')) { case 2: $id_ads = array_keys(Model_Visit::popular_ads()); if (count($id_ads) > 0) { $ads->where('id_ad', 'IN', $id_ads); } break; case 1: $ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc'); break; case 0: default: $ads->order_by('published', 'desc'); break; } //if ad have passed expiration time dont show if (core::config('advertisement.expire_date') > 0) { $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', DB::expr('NOW()')); } $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all(); $this->ads = $ads; $categs = Model_Category::get_category_count(); $this->template->bind('content', $content); $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs)); }
public function setUserEntityTheme($file, $dataarr) { $getpersonalcount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Personal')->where('bankaccount_createdby', Auth::user()->id)->count(); $getbusinesscount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Business')->where('bankaccount_createdby', Auth::user()->id)->count(); $resultbViewAcctype = DB::table('tbl_bankaccounttypes')->get(); $resultbViewAcctypearr = array(); foreach ($resultbViewAcctype as $data) { $resultbViewAcctypearr[$data->accounttype_id] = $data->accounttype_name; } $resultbViewBanks = DB::table('tbl_banks')->where('bank_isproduct', 0)->where('bank_status', '1')->orderBy('bank_name', 'ASC')->get(); $resultbViewBanksarr = array(); foreach ($resultbViewBanks as $data) { $resultbViewBanksarr[$data->bank_id] = $data->bank_name; } $resultbViewBankbranchs = DB::table('tbl_bankbranches')->where("branch_bankid", key($resultbViewBanksarr))->where("branch_status", "1")->get(); $resultbViewBankBrancharr = array(); foreach ($resultbViewBankbranchs as $data) { $resultbViewBankBrancharr[$data->branch_id] = $data->branch_name; } if ($getpersonalcount <= 0 and $getbusinesscount <= 0) { $data = array('bankaccttype' => $resultbViewAcctypearr, 'bankname' => $resultbViewBanksarr, 'bankbranch' => $resultbViewBankBrancharr); $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0'); return $MyTheme->of('registration.firstloginaddbankacct', $data)->render(); } else { // $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0'); $MyTheme = Theme::uses('fonebayad')->layout('newDefault_myBills'); return $MyTheme->of($file, $dataarr)->render(); } }
/** * return an array of all available theme (installed or not) * * @param boolean $installed_only * @return array string (directory) */ public static function getAvailable($installed_only = true) { static $dirlist = array(); $available_theme = array(); if (empty($dirlist)) { $themes = scandir(_PS_ALL_THEMES_DIR_); foreach ($themes as $theme) { if (is_dir(_PS_ALL_THEMES_DIR_ . DIRECTORY_SEPARATOR . $theme) && $theme[0] != '.') { $dirlist[] = $theme; } } } if ($installed_only) { $themes = Theme::getThemes(); foreach ($themes as $theme_obj) { $themes_dir[] = $theme_obj->directory; } foreach ($dirlist as $theme) { if (false !== array_search($theme, $themes_dir)) { $available_theme[] = $theme; } } } else { $available_theme = $dirlist; } return $available_theme; }
/** * generates HTML for apy buton * @param Model_Order $order * @return string */ public static function button(Model_Order $order) { if (Core::config('payment.paymill_private') != '' and Core::config('payment.paymill_public') != '' and Theme::get('premium') == 1 and $order->loaded()) { return View::factory('pages/paymill/button', array('order' => $order)); } return ''; }
/** * generates HTML form * @param Model_Product $order * @return string */ public static function form(Model_Order $order) { if (Core::config('payment.authorize_login') != '' and Core::config('payment.authorize_key') != '' and Auth::instance()->logged_in() and $order->loaded() and Theme::get('premium') == 1) { return View::factory('pages/authorize/form', array('order' => $order)); } return ''; }
public function __construct() { parent::__construct(); $this->forgetBeforeFilter('maintenance'); $this->theme = \Theme::type('admincp')->current(\ThemeManager::getActive('admincp'))->reBoot()->layout('layouts.default'); $this->activePage('dashboard'); }
public function testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile() { $themeName = self::THEME; $this->assertEquals('', (string) get_theme_option('logo', $themeName)); // specify the files array for the post $_FILES = array('logo' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), 'header_background' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0)); // specify the theme options for the post $themeOptions = array('display_featured_item' => '1', 'display_featured_collection' => '1', 'display_featured_exhibit' => '1', 'homepage_recent_items' => '', 'homepage_text' => '', 'footer_text' => '', 'display_footer_copyright' => '0'); $csrf = new Zend_Form_Element_Hash('theme_config_csrf'); $csrf->initCsrfToken(); // specify other post data $otherPostData = array('hidden_file_logo' => '', 'hidden_file_header_background' => '', 'MAX_FILE_SIZE' => '33554432', 'submit' => 'Save Changes', 'theme_config_csrf' => $csrf->getHash()); // set the the post data $post = array_merge($themeOptions, $otherPostData); $this->getRequest()->setParam('name', $themeName); $this->getRequest()->setPost($post); $this->getRequest()->setMethod('POST'); // dispatch the controller action $this->dispatch('themes/config'); $actualOptions = Theme::getOptions(self::THEME); $this->assertArrayNotHasKey('theme_config_csrf', $actualOptions); foreach ($themeOptions as $name => $value) { $this->assertArrayHasKey($name, $actualOptions); $this->assertEquals($actualOptions[$name], $value, "Option '{$name}' was not correctly set."); } // verify that logo is empty $this->assertEmpty(get_theme_option('logo', $themeName)); }