本文整理汇总了PHP中Theme::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::display方法的具体用法?PHP Theme::display怎么用?PHP Theme::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show(Request $request)
{
$stylesData = \Theme::GetCSS();
$styles = null;
if (file_exists($stylesData['path'])) {
$styles = $stylesData['path'];
}
$styles = explode('/', $styles);
$styles = array_pop($styles);
// now check for cookies
$cookie_list = $request->cookie('list_joined');
$showList = false;
$showThankyou = false;
// check if there is a default list
if (\Configuration::get('default_list')) {
$showList = true;
}
if (isset($cookie_list) && $cookie_list == \Configuration::get('default_list')) {
$showList = false;
if ($request->cookie('list_cid')) {
// check if the user is on the current list...
$member = ListMember::find($request->cookie('list_cid'));
if ($member->list_id == \Configuration::get('default_list')) {
$showThankyou = true;
}
}
}
return \Theme::display('home.front', ['user' => \Auth::user(), 'styles' => $styles, 'showList' => $showList, 'thankyou' => $showThankyou]);
}
示例2: getEdit
public function getEdit($id)
{
$content = Content::find($id);
if (isset($content)) {
// now get the editor scripts
$scripts = [url() . '/trumbowyg/trumbowyg.min.js', url() . '/trumbowyg/plugins/upload/trumbowyg.upload.js', url() . '/trumbowyg/plugins/colors/trumbowyg.colors.js'];
$styles = [url() . '/trumbowyg/ui/trumbowyg.min.css', url() . '/trumbowyg/plugins/colors/ui/trumbowyg.colors.css'];
return \Theme::display('content.admin-edit', ['content' => $content, 'scripts' => $scripts, 'styles' => $styles]);
}
}
示例3: action_admin_theme_post_options_edit
/**
* Admin control for edit post
*
* @param AdminHandler $handler
* @param Theme $theme
* @return void
*/
public function action_admin_theme_post_options_edit(AdminHandler $handler, Theme $theme)
{
// saving is handled by FormUI
$option = $this->get_option_from_name($handler->handler_vars['option_name']);
$theme->option = $option;
$theme->display('options_edit');
}
示例4: action_admin_theme_get_addons
/**
* Prepare and display admin page
*
**/
public function action_admin_theme_get_addons(AdminHandler $handler, Theme $theme)
{
$theme->page_content = "";
$theme->display('versions_admin');
}
示例5: action_admin_theme_get_menus
/**
* Prepare and display admin page
*
**/
public function action_admin_theme_get_menus(AdminHandler $handler, Theme $theme)
{
$theme->page_content = '';
$action = isset($_GET['action']) ? $_GET['action'] : 'create';
switch ($action) {
case 'edit':
$vocabulary = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
if ($vocabulary == false) {
$theme->page_content = _t('<h2>Invalid Menu.</h2>', 'termmenus');
// that's it, we're done. Maybe we show the list of menus instead?
break;
}
$form = new FormUI('edit_menu');
$form->append(new FormControlText('menuname', 'null:null', _t('Name', 'termmenus'), 'transparent_text'))->add_validator('validate_required', _t('You must supply a valid menu name', 'termmenus'))->add_validator(array($this, 'validate_newvocab'))->value = $vocabulary->name;
$form->append(new FormControlHidden('oldname', 'null:null'))->value = $vocabulary->name;
$form->append(new FormControlText('description', 'null:null', _t('Description', 'termmenus'), 'transparent_text'))->value = $vocabulary->description;
$edit_items_array = $this->get_menu_type_data();
$edit_items = '';
foreach ($edit_items_array as $action => $menu_type) {
$edit_items .= '<a class="modal_popup_form menu_button_dark" href="' . URL::get('admin', array('page' => 'menu_iframe', 'action' => $action, 'menu' => $vocabulary->id)) . "\">" . _t('Add %s', array($menu_type['label']), 'termmenus') . "</a>";
}
if (!$vocabulary->is_empty()) {
$form->append('tree', 'tree', $vocabulary->get_tree(), _t('Menu', 'termmenus'));
$form->tree->config = array('itemcallback' => array($this, 'tree_item_callback'));
// $form->tree->value = $vocabulary->get_root_terms();
// append other needed controls, if there are any.
$form->append('static', 'buttons', _t("<div id='menu_item_button_container'>{$edit_items}</div>", 'termmenus'));
$form->append('submit', 'save', _t('Apply Changes', 'termmenus'));
} else {
$form->append('static', 'buttons', _t("<div id='menu_item_button_container'>{$edit_items}</div>", 'termmenus'));
}
$delete_link = URL::get('admin', array('page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars['menu']));
$form->append('static', 'deletebutton', _t("<a class='a_button' href='{$delete_link}'>Delete Menu</a>", 'termmenus'));
$form->append(new FormControlHidden('menu', 'null:null'))->value = $handler->handler_vars['menu'];
$form->on_success(array($this, 'rename_menu_form_save'));
$form->properties['onsubmit'] = "return habari.menu_admin.submit_menu_update();";
$theme->page_content .= $form->get();
break;
case 'create':
$form = new FormUI('create_menu');
$form->append('text', 'menuname', 'null:null', _t('Menu Name', 'termmenus'), 'transparent_text')->add_validator('validate_required', _t('You must supply a valid menu name', 'termmenus'))->add_validator(array($this, 'validate_newvocab'));
$form->append('text', 'description', 'null:null', _t('Description', 'termmenus'), 'transparent_text');
$form->append('submit', 'submit', _t('Create Menu', 'termmenus'));
$form->on_success(array($this, 'add_menu_form_save'));
$theme->page_content = $form->get();
break;
case 'delete_menu':
$menu_vocab = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
$menu_vocab->delete();
// log that it has been deleted?
Session::notice(_t('Menu deleted.', 'termmenus'));
// redirect to a blank menu creation form
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'create')));
break;
case 'delete_term':
$term = Term::get(intval($handler->handler_vars['term']));
$menu_vocab = $term->vocabulary_id;
$term->delete();
// log that it has been deleted?
Session::notice(_t('Item deleted.', 'termmenus'));
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
break;
default:
Utils::debug($_GET, $action);
die;
}
$theme->display('menus_admin');
// End everything
exit;
}
示例6: action_admin_theme_get_menus
/**
* Prepare and display admin page
*
*/
public function action_admin_theme_get_menus(AdminHandler $handler, Theme $theme)
{
$theme->page_content = '';
$action = isset($_GET['action']) ? $_GET['action'] : 'create';
switch ($action) {
case 'edit':
$vocabulary = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
if ($vocabulary == false) {
$theme->page_content = '<h2>' . _t('Invalid Menu.');
// that's it, we're done. Maybe we show the list of menus instead?
break;
}
$form = new FormUI('edit_menu');
$form->append(new FormControlText('menuname', 'null:null', _t('Name'), 'transparent_text'))->add_validator('validate_required', _t('You must supply a valid menu name'))->add_validator(array($this, 'validate_newvocab'))->value = $vocabulary->name;
$form->append(new FormControlHidden('oldname', 'null:null'))->value = $vocabulary->name;
$form->append(new FormControlText('description', 'null:null', _t('Description'), 'transparent_text'))->value = $vocabulary->description;
$edit_items_array = $this->get_menu_type_data();
$edit_items = '';
foreach ($edit_items_array as $action => $menu_type) {
$edit_items .= '<a class="modal_popup_form menu_button_dark" href="' . URL::get('admin', array('page' => 'menu_iframe', 'action' => $action, 'menu' => $vocabulary->id)) . "\">" . _t('Add %s', array($menu_type['label'])) . "</a>";
}
if (!$vocabulary->is_empty()) {
$form->append('tree', 'tree', $vocabulary->get_tree(), _t('Menu'));
$form->tree->options = $vocabulary->get_tree();
$form->tree->config = array('itemcallback' => array($this, 'tree_item_callback'));
// $form->tree->value = $vocabulary->get_root_terms();
// append other needed controls, if there are any.
$form->append('static', 'buttons', '<div id="menu_item_button_container">' . $edit_items . '</div>');
$form->append('submit', 'save', _t('Apply Changes'));
} else {
$form->append('static', 'buttons', '<div id="menu_item_button_container">' . $edit_items . '</div>');
}
$delete_link = URL::get('admin', Utils::WSSE(array('page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars['menu'])));
//$delete_link = URL::get( 'admin', array( 'page' => 'menus', 'action' => 'delete_menu', 'menu' => $handler->handler_vars[ 'menu' ] ) );
$form->append('static', 'deletebutton', '<a class="a_button" href="' . $delete_link . '">' . _t('Delete Menu') . '</a>');
$form->append(new FormControlHidden('menu', 'null:null'))->value = $handler->handler_vars['menu'];
$form->on_success(array($this, 'rename_menu_form_save'));
$form->properties['onsubmit'] = "return habari.menu_admin.submit_menu_update();";
$theme->page_content .= $form->get();
break;
case 'create':
$form = new FormUI('create_menu');
$form->append('text', 'menuname', 'null:null', _t('Menu Name'), 'transparent_text')->add_validator('validate_required', _t('You must supply a valid menu name'))->add_validator(array($this, 'validate_newvocab'));
$form->append('text', 'description', 'null:null', _t('Description'), 'transparent_text');
$form->append('submit', 'submit', _t('Create Menu'));
$form->on_success(array($this, 'add_menu_form_save'));
$theme->page_content = $form->get();
break;
case 'delete_menu':
if (Utils::verify_wsse($_GET, true)) {
$menu_vocab = Vocabulary::get_by_id(intval($handler->handler_vars['menu']));
// Delete blocks using this menu
$at = Themes::get_active_data(true);
$t = Themes::create(Themes::get_active()['name']);
$i = 0;
foreach ($at['areas'] as $area) {
foreach ($t->get_blocks($area['name'], 0, $t) as $block) {
if ($block->type == 'menu' && $block->menu_taxonomy == $handler->handler_vars['menu']) {
$block->delete();
$i++;
}
}
}
Session::notice(sprintf(_n('%s block linking to this menu deleted.', '%s blocks linking to this menu deleted.', $i), $i));
$menu_vocab->delete();
// log that it has been deleted?
Session::notice(_t('Menu deleted.'));
// redirect to a blank menu creation form
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'create')));
} else {
Session::notice(_t('Menu deletion failed - please try again.'));
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $handler->handler_vars['menu'])));
}
break;
case 'delete_term':
$term = Term::get(intval($handler->handler_vars['term']));
$menu_vocab = $term->vocabulary_id;
if (Utils::verify_wsse($_GET, true)) {
$term->delete();
// log that it has been deleted?
Session::notice(_t('Item deleted.'));
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
} else {
Session::notice(_t('Item deletion failed - please try again.'));
Utils::redirect(URL::get('admin', array('page' => 'menus', 'action' => 'edit', 'menu' => $menu_vocab)));
}
break;
default:
Utils::debug($_GET, $action);
die;
}
$theme->display('menus_admin');
// End everything
exit;
}
示例7: unsubscribe
public function unsubscribe(Request $request)
{
$cookie_list = $request->cookie('list_joined');
$cid = $request->cookie('list_cid');
if ($cookie_list && $cid) {
// now we can unsubscribe the user
$member = ListMember::find($cid);
$member->subscribed = 0;
$member->save();
$list = MailList::find($cookie_list);
$c1 = \Cookie::forget('list_joined');
$c2 = \Cookie::forget('list_cid');
return \Theme::display('lists.list-remove', ['list' => $list], array($c1, $c2));
}
// look for get varibale
if ($request->has('e')) {
$member = ListMember::where('email', $request->e)->first();
$member->subscribed = 0;
$member->save();
$list = MailList::find($member->list_id);
// for good measure, unset cookie too.
$c1 = \Cookie::forget('list_joined');
$c2 = \Cookie::forget('list_cid');
return \Theme::display('lists.list-remove', ['list' => $list], array($c1, $c2));
}
// dfault page
// @todo set up a way of searching email addresses and unsubsribing them.
return \Theme::display('lists.list-subscriptions', []);
}
示例8: Exec
/**
*
*/
public static function Exec()
{
static::init();
Listing::parse();
Theme::display();
}
示例9: action_admin_theme_get_categories
/**
* Display the page
**/
public function action_admin_theme_get_categories(AdminHandler $handler, Theme $theme)
{
$category_term = false;
$parent_term = false;
$parent_term_display = _t('None', 'simplecategories');
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'delete':
$term = $_GET['category'];
$this->delete_category($term);
break;
case 'edit':
$term = $_GET['category'];
$category_term = $this->vocabulary->get_term((int) $term);
if ($category_term) {
$parent_term = $category_term->parent();
if ($parent_term) {
$parent_term_display = $parent_term->term_display;
}
}
break;
}
}
if (isset($GET['category'])) {
$term = $_GET['category'];
$category_term = $this->vocabulary->get_term((int) $term);
if ($category_term) {
$parent_term = $category_term->parent();
if ($parent_term) {
$parent_term_display = $parent_term->term_display;
}
}
}
$options = array(0 => _t('(none)', 'simplecategories')) + $this->vocabulary->get_options();
$form = new FormUI('simplecategories');
if ($category_term) {
$category_id = $form->append('hidden', 'category_id')->value = $category_term->id;
// send this id, for seeing what has changed
$fieldset = $form->append('fieldset', '', sprintf(_t('Edit Category: <b>%1$s</b>', 'simplecategories'), $category_term->term_display));
} else {
$fieldset = $form->append('fieldset', '', _t('Create a new Category', 'simplecategories'));
}
$category = $fieldset->append('text', 'category', 'null:null', _t('Category', 'simplecategories'), 'formcontrol_text');
$category->value = !$category_term ? '' : $category_term->term_display;
$category->add_validator('validate_required');
$category->class = 'pct30';
$parent = $fieldset->append('select', 'parent', 'null:null', _t('Parent: <b>%1$s</b> Change Parent to:', array($parent_term_display), 'simplecategories'), $options, 'optionscontrol_select');
$parent->value = !$parent_term ? '' : $parent_term->id;
// select the current parent
$parent->class = 'pct50';
$save_button = $fieldset->append('submit', 'save', _t('Save', 'simplecategories'));
$save_button->class = 'pct20 last';
// $cancelbtn = $form->append( 'button', 'btn', _t( 'Cancel', 'simplecategories' ) );
// $cancelbtn->id = 'btn';
// $cancelbtn->onclick = 'habari_ajax.get("' . URL::get( 'admin', 'page=categories' ) . '")' ;
$cancelbtn = $form->append('static', 'btn', '<p id="btn" ><a class="button dashboardinfo" href="' . URL::get('admin', 'page=categories') . '">' . _t('Cancel', 'simplecategories') . "</a></p>\n");
if ($category_term) {
//editing an existing category
$form->on_success(array($this, 'formui_edit_submit'));
} else {
//new category
$form->on_success(array($this, 'formui_create_submit'));
}
$theme->form = $form;
$theme->all_categories = $this->vocabulary->get_tree();
$theme->display('categories');
// End everything
exit;
}
示例10: getEdit
public function getEdit($id)
{
$user = User::find($id);
return \Theme::display('users.edit', array('user' => $user));
}
示例11: frontEndCSS
public function frontEndCSS()
{
// get the css
$fileData = \Theme::getCSS();
return \Theme::display('admin.css', ['file' => $fileData]);
}
示例12: getEdit
public function getEdit()
{
return \Theme::display('profile.edit', ['user' => \Auth::user()]);
}
示例13: action_admin_theme_post_cronjob
public function action_admin_theme_post_cronjob(AdminHandler $handler, Theme $theme)
{
// saving is handled by FormUI
$cron = CronTab::get_cronjob((int) $handler->handler_vars['cron_id']);
$theme->display('cronjob');
// this is stoopid, but exit so adminhandler doesn't complain
exit;
}
示例14: theme_route_display_tests
/**
* @todo Removing initial newline shouldn't be necessary, find out what's causing it
*/
public function theme_route_display_tests(Theme $theme)
{
$url = $this->get_url('/index.php?c=symbolic&o=1&d=1');
$loaded_tests = false;
try {
$raw_xml = file_get_contents($url);
$test_list = new \SimpleXMLElement(preg_replace("/^\n/", "", $raw_xml));
$loaded_tests = true;
} catch (\Exception $e) {
$output = $e->getMessage();
$output .= '<pre>' . Utils::htmlspecialchars($raw_xml) . '</pre>';
}
if ($loaded_tests) {
$output = '';
$unit_names = array();
foreach ($test_list->unit as $unit) {
$unit_names[] = (string) $unit->attributes()->name;
}
$theme->unit_names = $unit_names;
if (isset($_GET['run']) && isset($_GET['unit'])) {
$dryrun = false;
$unit = $_GET['unit'];
if ($unit != 'all') {
$url = '/index.php?c=symbolic&o=1&u=' . $unit;
if (isset($_GET['test'])) {
$test = $_GET['test'];
$url = $url . '&t=' . $test;
$theme->test = $test;
}
$url = $this->get_url($url);
} else {
$url = '/index.php?c=symbolic&o=1';
$url = $this->get_url($url);
}
if ($_GET['run'] == 'Dry Run') {
$url .= '&d=1';
$dryrun = true;
}
} else {
$dryrun = true;
$url = $this->get_url('/index.php?c=symbolic&o=1&d=1');
}
$results = preg_replace("/^\n/", "", file_get_contents($url));
$results_array = array();
$parsed_xml = true;
$theme->symbolic_url = $url;
$theme->direct_url = str_replace('c=symbolic', 'c=html', $url);
try {
$xmldata = file_get_contents($url);
$results = @new \SimpleXMLElement(preg_replace("/^\n/", "", $xmldata));
} catch (\Exception $e) {
if (strpos($xmldata, 'debugtoggle(') !== false) {
$theme->error = var_export($e->getMessage(), true) . $xmldata;
} else {
$theme->error = var_export($e->getMessage(), true) . '<textarea style="width:100%;height: 20em;">' . htmlentities($xmldata) . '</textarea>';
}
$parsed_xml = false;
$theme->unit = $unit;
}
$theme->xmldata = $xmldata;
if ($parsed_xml) {
$dom = dom_import_simplexml($results)->ownerDocument;
$dom->formatOutput = true;
$theme->xmldata = $dom->saveXML();
$theme->connection_string = $results['connection_string'];
foreach ($results->unit as $result) {
$result_array = (array) $result->attributes();
$result_array = array_shift($result_array);
$result_array['methods'] = array();
foreach ($result->method as $method) {
$method_array = (array) $method;
$output_array = array();
if (isset($method->output)) {
// output is on, and output can appear whether passing or failing.
foreach ($method->output as $outputz) {
$output_array[] = $outputz;
}
}
if (!isset($method->message)) {
// no <message> means the method passed
$method_result = 'Pass';
if ($dryrun) {
$method_result = 'Dry Run';
}
$result_array['methods'][] = array_merge(array_shift($method_array), array("result" => $method_result, "output" => implode(" ", $output_array)));
} else {
$message_array = array();
$result = (string) $method->message->attributes()->type;
foreach ($method->message as $message) {
$message_array[] = "{$message}" . ($result != "Fail" ? "" : "<br><em>" . basename($message->attributes()->file) . ":{$message->attributes()->line}</em>");
}
$result_array['methods'][] = array_merge(array_shift($method_array), array("result" => $result, "messages" => implode("<br>", $message_array), "output" => implode(" ", $output_array)));
}
}
$results_array[] = $result_array;
}
$theme->results = $results_array;
//.........这里部分代码省略.........
示例15:
/**
* Display a custom publish page for handled content types
*
* @param AdminHandler $handler The admin handler object
* @param Theme $theme The admin theme object
*/
function action_admin_theme_get_publish($handler, $theme)
{
$handled = Options::get('cctypes_types');
if (isset($handler->handler_vars['id'])) {
$post = Post::get(array('id' => $handler->handler_vars['id'], 'status' => Post::status('any')));
$ctype = Post::type_name($post->content_type);
} else {
if (isset($handler->handler_vars['content_type'])) {
$ctype = $handler->handler_vars['content_type'];
}
}
if (isset($ctype) && in_array($ctype, $handled)) {
$template_name = 'admin_publish_' . $ctype;
if ($theme->template_exists($template_name)) {
$theme->display($template_name);
exit;
}
}
}