/** * Binds template files with a Smarty * * @author Rafal Wesolowski <*****@*****.**> * @param string $sFileName template filename * @return void */ public function render($sFileName) { $sTplPath = dirname(__DIR__) . '/views/page/'; $this->oSmarty->setTemplateDir($sTplPath); $this->oSmarty->assign($this->aData); $this->oSmarty->display($sTplPath . $sFileName . '.tpl'); }
/** * Step content */ public function content() { printf('<p class="lead-text align-center">%s</p>', __('Please tell us more about your website (all fields are required)', 'wp-easy-mode')); $this->fields->display(); /** * Fires after the Settings content */ do_action('wpem_step_settings_after_content'); }
/** * display() echo's the table right away, send the output to an object buffer and return the * contents for use in mustache * * @return string HTML form and table */ public function gallery_table() { ob_start(); echo '<form id="vimeography-gallery-list" method="get">'; echo '<input type="hidden" name="vimeography-action" value="bulk_process_galleries">'; echo '<input type="hidden" name="page" value="vimeography-edit-galleries" />'; $this->_table->search_box('search', 'search_id'); $this->_table->display(); echo '</form>'; $result = ob_get_contents(); ob_end_clean(); return $result; }
/** * display * * The Framework_Presenter_Module class only renders the module's template * file and not the page template that the Framework_Presenter_Smarty * presenter renders as well. * * @access public * @return void */ public function display() { $this->template->assign('modulePath', $path); $this->template->assign('site', Framework::$site); $this->template->assign('tplFile', $tplFile); $this->template->assign('user', $this->user); $this->template->assign('session', $this->session); foreach ($this->module->getData() as $var => $val) { if (!in_array($var, array('path', 'tplFile'))) { $this->template->assign($var, $val); } } $this->template->display($this->module->tplFile); }
/** * Create the HTML code for the module. * First the createHTMLLabels() will be called to add all labels to the template, * Then the tpl_id set in $this->getTemplateId() will be added to the main template automatically */ public function createHTML() { // add JS and CSS files $this->tpl->addJS('monitor.js'); $this->tpl->addCSS('monitor.css'); if (sm_get_conf('show_update')) { // user wants updates, lets see what we can do $this->createHTMLUpdateAvailable(); } $this->createHTMLLabels(); // add the module's custom template to the main template to get some content $this->tpl->addTemplatedata('main', array('content' => $this->tpl->getTemplate($this->getTemplateId()), 'message' => $this->message == '' ? ' ' : $this->message)); // display main template echo $this->tpl->display('main'); }
/** * Print the content of the "All Tables" text box * * @since 1.0.0 */ public function textbox_tables_list($data, $box) { if (!empty($_GET['s'])) { printf('<span class="subtitle">' . __('Search results for “%s”', 'tablepress') . '</span>', esc_html(stripslashes($_GET['s']))); } ?> <form method="get" action=""> <?php if (isset($_GET['page'])) { echo '<input type="hidden" name="page" value="' . esc_attr($_GET['page']) . '" />' . "\n"; } $this->wp_list_table->search_box(__('Search Tables', 'tablepress'), 'tables_search'); ?> </form> <form action="<?php echo admin_url('admin-post.php'); ?> " method="post"> <?php // this prints the nonce and action fields for this screen (done here instead of render(), due to moved <form>): $this->do_text_boxes('header'); $this->wp_list_table->display(); ?> </form> <?php }
/** * Gets http or ajax template according to request and assign variables. * * @return avoid */ public function get() { $this->setLinkVars(); $this->setLangVars(); if ($this->vars->get('ctr') && $this->vars->get('ctr') == 'ajaxCommander') { $template = $this->getAjaxTemplate(); if ($template['response'] == 'json') { print $template['data']; } else { $this->smarty->display($template['data']); } } else { $this->loadResources(); $this->smarty->display($this->getHttpTemplate()); } }
/** * 调用view的display接口 * 将$this->vars输出到模板 * * @stability: 4 * @param string $name * @return void */ protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { if ($this->vars) { $this->view->assign($this->vars); } $this->view->display($templateFile, $charset, $contentType, $content, $prefix); }
/** * Render specified template * * @param String $name - template name inside a subdirectory of "views" named after the controller * @return void */ function show($name) { // path to template $path = strtolower(preg_replace("/Controller/", "", $this->controller) . "/{$name}.tpl"); // check template file exists if (file_exists(APP_PATH . "/views/{$path}") == false) { throw new Exception("Template not found in {$path}"); return false; } // assign variables foreach ($this->vars as $key => $value) { $this->smarty->assign($key, $value); } // render template $this->smarty->display($path); }
/** * Listens all progress events from this monitor. * * @param mixed $event A hash describing the progress event. * * @return void * @since 1.0 * @access public * @throws HTML_PROGRESS_ERROR_INVALID_INPUT * @see callProgressHandler() */ function notify($event) { if (!is_array($event)) { return Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$event', 'was' => gettype($event), 'expected' => 'array', 'paramnum' => 1), PEAR_ERROR_TRIGGER); } $log = strtolower($event['log']); if ($log == 'incvalue') { if (!is_null($this->_callback)) { $this->callProgressHandler($event['value'], $this); } $this->_progress->display(); // sleep a bit ... for ($i = 0; $i < $this->_anim_speed * 1000; $i++) { } if ($this->_progress->getPercentComplete() == 1) { if ($this->_progress->isIndeterminate()) { $this->_progress->setValue(0); } else { // the progress bar has reached 100% $this->_progress->removeListener($this); } } else { $this->_progress->incValue(); } } }
/** * 解析视图文件 * * @param string $file */ public function renderFile($file) { // 开启smarty模版引擎后, 实例化smarty对象 switch (Imp::app()->instance('config')->get('template')) { case 'smarty': Loader::load('vendor/Imp/Core/Template'); $smartyObject = new Template(); $this->smarty = $smartyObject->smarty; $this->smarty->assign($this->tpl_var); $this->smarty->display($file); break; default: echo $this->readFileContent($file); break; } }
/** * Test the display() function * * @return void */ public function testDisplay() { // Setup $content = 'anything'; // Test display() with all null params $this->handler = new RDFa(); $this->assertEquals($this->handler->display(), ''); // Test if the params are reseted after the display() function $this->handler->setType('Article')->content($content)->property('name')->fallback('Thing', 'url')->display(); $this->assertNull($this->handler->getFallbackProperty()); $this->assertNull($this->handler->getFallbackType()); $this->assertNull($this->handler->getProperty()); $this->assertNull($this->handler->getContent()); // Test for a simple display $response = $this->handler->property('url')->display(); $this->assertEquals($response, "property='url'"); // Test for a simple display with $content $response = $this->handler->property('url')->content($content)->display(); $this->assertEquals($response, "<span property='url'>{$content}</span>"); // Test for a simple display if the $content is empty '' $response = $this->handler->enable(true)->content('')->property('name')->display(); $this->assertEquals($response, "<span property='name'></span>"); // Test for a simple 'nested' display $response = $this->handler->property('author')->display(); $this->assertEquals($response, "property='author' vocab='https://schema.org' typeof='Organization'"); // Test for a 'nested' display with $content $response = $this->handler->property('author')->content($content)->display(); $this->assertEquals($response, "<span property='author' vocab='https://schema.org' typeof='Organization'>{$content}</span>"); // Test for a 'nested' display with $content and $Fallback $response = $this->handler->fallback('Person', 'name')->property('author')->content($content)->display(); $this->assertEquals($response, "<span property='author' vocab='https://schema.org' typeof='Person'><span property='name'>{$content}</span></span>"); // Test for a 'nested' display with $Fallback and without $content $response = $this->handler->fallback('Person', 'name')->property('author')->display(); $this->assertEquals($response, "property='author' vocab='https://schema.org' typeof='Person' property='name'"); // Test for a 'meta' display without $content $response = $this->handler->property('datePublished')->display(); $this->assertEquals($response, "property='datePublished'"); // Test for a 'meta' display with $content $content = '01 January 2011'; $response = $this->handler->property('datePublished')->content($content)->display(); $this->assertEquals($response, "<meta property='datePublished' content='{$content}'/>{$content}"); // Test for a 'meta' display with human $content and $machineContent $machineContent = "2011-01-01T00:00:00+00:00"; $response = $this->handler->property('datePublished')->content($content, $machineContent)->display(); $this->assertEquals($response, "<meta property='datePublished' content='{$machineContent}'/>{$content}"); // Test when if fallbacks that the library returns an empty string as specified $response = $this->handler->content('en-GB')->property('doesNotExist')->display('meta', true); $this->assertEquals($response, ''); // Test if the library is disabled $response = $this->handler->enable(false)->content($content)->fallback('Article', 'about')->property('datePublished')->display(); $this->assertEquals($response, $content); // Test if the library is disabled and if it have a $content it must return an empty string $response = $this->handler->enable(false)->content('en-GB')->property('inLanguage')->fallback('Language', 'name')->display('meta', true); $this->assertEquals($response, ''); // Test if the params are reseted after display(), if the library is disabled $this->assertNull($this->handler->getFallbackProperty()); $this->assertNull($this->handler->getFallbackType()); $this->assertNull($this->handler->getProperty()); $this->assertNull($this->handler->getContent()); }
/** * testInject method * * @access public * @return void */ public function testInject() { $result = array(); for ($i = 1; $i <= 10; $i++) { $result[$i] = $this->Adsense->inject($i, $ads = array(3 => $this->Adsense->display('text', 'banner'), 6 => $this->Adsense->display('text', 'button'), 9 => $this->Adsense->display('image', 'banner')), array(), true); } $this->assertTrue(!empty($result[3])); $this->assertTrue(!empty($result[6])); $this->assertTrue(!empty($result[9])); }
/** * Loads the default or custom template (tpl) file and prints it out. * Enter the template file for appropriate script here. * * @param string The name of the template to be loaded * @param string If another plugin is to be used in the directory. */ public function show($load_view = false, $plugin = false) { // Get correct tpl file. $tpl_dir = $this->getTpl($load_view, $plugin); if (empty($tpl_dir)) { return false; } // Execute template else just skip it. $this->view->display($tpl_dir); }
/** * display * * @access public * @return void */ public function display() { $path = Framework_Template::getPath($this->module->tplFile, Framework::$request->module); $this->template->assign('modulePath', $path); $this->template->assign('site', Framework::$site); $this->template->assign('tplFile', $this->module->tplFile); $this->template->assign('user', $this->user); $this->template->assign('session', $this->session); foreach ($this->module->getData() as $var => $val) { if (!in_array($var, array('path', 'tplFile'))) { $this->template->assign($var, $val); } } if ($this->module->pageTemplateFile == null) { $pageTemplateFile = 'page.tpl'; } else { $pageTemplateFile = $this->module->pageTemplateFile; } $this->template->display($pageTemplateFile); }
/** * Show error listing table view. * * This method displays the listing table HTML to the page. * Regitsering action hook - "jj4t3_log_list_above_form". * Regitsering action hook - "jj4t3_log_list_below_form". * * @since 2.1.0 * @access public * * @return void */ public function error_list() { ?> <div class="wrap"> <h2><?php _e('404 Error Logs', JJ4T3_DOMAIN); ?> </h2> <div id="poststuff"> <div id="post-body" class="metabox-holder"> <div id="post-body-content"> <div class="meta-box-sortables ui-sortable"> <?php $this->list_table->prepare_items(); /** * Action hook to add something above listing page. * * Use this action hook to add custom filters and search * boxes to the listing table top section. * * @param object $this Listing page class object. * * @since 3.0.0 */ do_action('jj4t3_log_list_above_form', $this->list_table); ?> <form method="get"> <input type="hidden" name="page" value="jj4t3-logs"/> <?php $this->list_table->display(); ?> </form> <?php /** * Action hook to add something below the listing page. * * Use this action hook to add custom filters and search * boxes to the listing table bottom section. * * @param object $this Listing page class object. * * @since 3.0.0 */ do_action('jj4t3_log_list_below_form', $this->list_table); ?> </div> </div> </div> <br class="clear"> </div> </div> <?php }
/** * A renderer for the standard upload file form. * * @param object $course The course we are doing all of this action in. * @param object $mform The mform for uploading CSV files. * @return string html to be displayed. */ public function standard_upload_file_form($course, $mform) { $output = groups_print_course_menu($course, 'index.php?id=' . $course->id, true); $output .= html_writer::start_tag('div', array('class' => 'clearer')); $output .= html_writer::end_tag('div'); // Form. ob_start(); $mform->display(); $output .= ob_get_contents(); ob_end_clean(); return $output; }
/** * Test the display() function * * @return void * * @since 3.2 */ public function testDisplay() { // Setup $content = 'anything'; // Test display() with all null params $this->handler = new JMicrodata(); $this->assertEquals($this->handler->display(), ''); // Test if the params are reseted after display() $this->handler->setType('Article')->content($content)->property('name')->fallback('Thing', 'url')->display(); $this->assertNull($this->handler->getFallbackProperty()); $this->assertNull($this->handler->getFallbackType()); $this->assertNull($this->handler->getProperty()); $this->assertEmpty($this->handler->getContent()); // Test for a simple display $responce = $this->handler->property('url')->display(); $this->assertEquals($responce, "itemprop='url'"); // Test for a simple display with content $responce = $this->handler->property('url')->content($content)->display(); $this->assertEquals($responce, "<span itemprop='url'>{$content}</span>"); // Test for a simple display if the content is empty '' $responce = $this->handler->enable(true)->content('')->property('name')->display(); $this->assertEquals($responce, "<span itemprop='name'></span>"); // Test for a simple nested display $responce = $this->handler->property('author')->display(); $this->assertEquals($responce, "itemprop='author' itemscope itemtype='https://schema.org/Organization'"); // Test for a nested display with content $responce = $this->handler->property('author')->content($content)->display(); $this->assertEquals($responce, "<span itemprop='author' itemscope itemtype='https://schema.org/Organization'>{$content}</span>"); // Test for a nested display with content and Fallback $responce = $this->handler->fallback('Person', 'name')->property('author')->content($content)->display(); $this->assertEquals($responce, "<span itemprop='author' itemscope itemtype='https://schema.org/Person'><span itemprop='name'>{$content}</span></span>"); // Test for a nested display with Fallback and without content $responce = $this->handler->fallback('Person', 'name')->property('author')->display(); $this->assertEquals($responce, "itemprop='author' itemscope itemtype='https://schema.org/Person' itemprop='name'"); // Test for a meta display without content $responce = $this->handler->property('datePublished')->display(); $this->assertEquals($responce, "itemprop='datePublished'"); // Test for a meta display with content $content = '01 January 2011'; $responce = $this->handler->property('datePublished')->content($content)->display(); $this->assertEquals($responce, "<meta itemprop='datePublished' content='{$content}'/>{$content}"); // Test if the JMicrodata is disabled $responce = $this->handler->enable(false)->content($content)->fallback('Article', 'about')->property('datePublished')->display(); $this->assertEquals($responce, $content); // Test if JMicrodata is disabled and have a $content it must return an empty string $responce = $this->handler->enable(false)->content('en-GB')->property('inLanguage')->fallback('Language', 'name')->display('meta', true); $this->assertEquals($responce, ''); // Test if the params are reseted after display(), if the library is disabled $this->assertNull($this->handler->getFallbackProperty()); $this->assertNull($this->handler->getFallbackType()); $this->assertNull($this->handler->getProperty()); $this->assertNull($this->handler->getContent()); }
private function execute($controller, $action) { if (method_exists($controller, $action)) { call_user_func(array($controller, $action)); } else { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); if (file_exists(LAYOUT_ROOT . '404' . VIEWS_EXTENSION)) { $this->_view->display('404' . VIEWS_EXTENSION); } else { echo 'Not Found'; } $this->_notFound = true; } }
/** * Uploads the files asynchronously, so the class can perform other operations * while files are being uploaded, such : * display a progress bar in indeterminate mode. * * @param string $dest Changes from current to the specified directory. * @param boolean $overwrite (optional) overwrite existing files. * * @return mixed a null array if all files transfered * @since 1.1 * @access public * @see FTP_Upload::setFiles() */ function moveTo($dest, $overwrite = false) { if (!is_string($dest)) { Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$dest', 'was' => gettype($dest), 'expected' => 'string', 'paramnum' => 1), PEAR_ERROR_TRIGGER); } elseif (!is_bool($overwrite)) { Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$overwrite', 'was' => gettype($overwrite), 'expected' => 'boolean', 'paramnum' => 2), PEAR_ERROR_TRIGGER); } $dir = parent::_changeDir($dest); if (PEAR::isError($dir)) { return $dir; } $remoteFiles = ftp_nlist($this->_conn, '.'); if ($remoteFiles === false) { return PEAR::raiseError('Couldn\'t read directory ' . $dest); } $nomove = array(); // files not transfered on remote host foreach ($this->_files as $file) { if (!$overwrite && in_array(basename($file), $remoteFiles)) { // file already exists, skip to next one continue; } // writes file caption $status = ob_get_clean(); $status = '<script type="text/javascript">self.setStatus(\''; $status .= sprintf($this->captionMask, basename($file)); $status .= '\'); </script>'; echo $status; ob_start(); $ret = ftp_nb_put($this->_conn, basename($file), $file, FTP_BINARY); while ($ret == FTP_MOREDATA) { $this->_progress->display(); // sleep a bit ... for ($i = 0; $i < $this->_progress->_anim_speed * 1000; $i++) { } if ($this->_progress->getPercentComplete() == 1) { $this->_progress->setValue(0); } else { $this->_progress->incValue(); } // upload Continue ... $ret = ftp_nb_continue($this->_conn); } if ($ret != FTP_FINISHED) { $nomove[] = $file; } } return $nomove; }
function update(&$subject, $event, $data = null) { switch ($event) { case 'sentRequest': $this->_target = basename($subject->_url->path); break; case 'gotHeaders': if (isset($data['content-disposition']) && preg_match('/filename="([^"]+)"/', $data['content-disposition'], $matches)) { $this->setTarget(basename($matches[1])); } else { $this->setTarget($this->_target); } $this->_bar =& new HTML_Progress(); $this->_bar->setAnimSpeed(10); $inc = isset($data['content-length']) ? round($data['content-length'] / 100) : 1; $this->_bar->setIncrement(intval($inc)); echo '<style type="text/css">' . $this->_bar->getStyle() . '</style>'; echo '<script type="text/javascript">' . $this->_bar->getScript() . '</script>'; echo $this->_bar->toHtml(); $this->_size = 0; break; case 'tick': $this->_size += strlen($data); $this->_bar->display(); $val = round($this->_size / $this->_bar->getIncrement()); $this->_bar->setValue(intval($val)); fwrite($this->_fp, $data); break; case 'gotBody': fclose($this->_fp); break; default: PEAR::raiseError("Unhandled event '{$event}'"); } // switch }
/** * Render view * @return void */ public function View() { // If there is no view then use basic by default if (!$this->view) { $this->view = new View\Basic(); } // If there is no template then set default if (!$this->template) { $this->template = $this->view->defaultTemplate($this->module, $this->controller, $this->action); } // Assign controller reference $this->view->assign('controller', $this); // Display view $this->view->display($this->template); }
/** * Output the theme details box. * * @since 1.0.0 * @access public * @param object $post * @return void */ public function theme_details_box($post) { ?> <div id="thds-theme-tabs" class="postbox"> <h3><?php printf(esc_html__('Details: %s', 'members'), '<span class="thds-which-tab"></span>'); ?> </h3> <div class="inside"> <?php $this->manager->display($post->ID); ?> </div><!-- .inside --> </div><!-- .postbox --> <?php }
/** * Listens all progress events from this monitor. * * @param mixed $event A hash describing the progress event. * * @return void * @since 1.0 * @access public * @throws HTML_PROGRESS_ERROR_INVALID_INPUT * @see HTML_Progress::process() */ function notify($event) { if (!is_array($event)) { return $this->_progress->raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$event', 'was' => gettype($event), 'expected' => 'array', 'paramnum' => 1)); } $log = strtolower($event['log']); if ($log == 'incvalue') { $this->_progress->display(); $this->callProgressHandler($event['value']); if ($this->_progress->getPercentComplete() == 1) { if ($this->_progress->isIndeterminate()) { $this->_progress->setValue(0); } else { // the progress bar has reached 100% $this->_progress->removeListener($this); } } else { $this->_progress->incValue(); } } }
/** * Отобразить шаблон * Метод должен быть вызван один раз в конце работы метода контроллера * Имя шаблона присваивается переменной $body и шаблон подключается в index.tpl * * @param string $template Имя шаблона без расширения * @param string $id Идентификатор, который будет передан функции Smarty для управления кешированием * @param int $lifetime Время жизни кеша * @return void */ public function show($template, $id = NULL, $lifetime = NULL) { /** * Отправляем заголовки */ $this->sendHeaders(); /** * Имя отображаемого шаблона */ $this->smarty->assign('body', $template . TPLEXT); /** * Устанавливаем время жизни * По умолчанию 3600 секунд */ if (isset($lifetime)) { $this->smarty->cache_lifetime = $lifetime; } /** * Вызов отображения с идентификатором */ $this->smarty->display('index' . TPLEXT, $template . (isset($id) ? '|' . $id : '')); }
/** * Print custom column content for a specific bug. * @param object $p_column_object Column object * @param BugData $p_bug bug object * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php * @access public */ function print_column_plugin($p_column_object, $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE) { if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) { echo '<td class="column-plugin">'; $p_column_object->display($p_bug, $p_columns_target); echo '</td>'; } else { $p_column_object->display($p_bug, $p_columns_target); } }
/** * Render the specified page part * * @param string $zone */ function renderZone($zone) { global $xoops; $zones = array('canvas' => 0, 'page' => 1, 'content' => 2); if (isset($zones[$zone])) { $tpl = $zone . 'Template'; $tpl = $this->{$tpl}; if (!empty($tpl)) { if ($tpl[0] == '.') { $tpl = $xoops->path($this->resourcePath(substr($tpl, 1))); } $this->template->display($tpl); } elseif ($zone != 'content') { $this->renderZone($zones[$zone] + 1); } if (!empty($this->content) && $zone == 'content' && $this->themeAPI != '2.0') { echo $this->content; } } }
/** * Adds help tabs to the settings screen. * * @since 2.0.0 * @access public * @return void */ public function add_help_tabs() { get_current_screen()->add_help_tab(array('id' => 'default', 'title' => $this->theme->display('Name', false, true), 'content' => wpautop($this->theme->display('Description', true, true)))); }
/** * 显示当前页面的视图内容 * * 包括视图页面中所含有的挂件(widget), 视图布局结构(layout), 及render()所加载的视图片段等 * * @access public * * @param string $fileName 视图名称 * * @return string */ public function display($fileName = null) { return self::$_viewObject->display($fileName); }
/** * Display Page * * <code> * Pages::display($page); * </code> * * @access public * @param array $page Page array * @return string */ public static function display($page) { static::$current_template->display((!empty($page['template']) ? $page['template'] : 'index') . '.tpl', $page); }