/** * @covers phpDocumentor\Partials\Partial::getName * @covers phpDocumentor\Partials\Partial::setName */ public function testGetName() { $this->assertSame(null, $this->fixture->getName()); $this->fixture->setName('My name'); $result = $this->fixture->getName(); $this->assertSame('My name', $result); }
/** * Renders a template fragment within a variable scope distinct from the * calling View object. * * If no arguments are provided, returns object instance. * * @param string $name Name of view script * @param string|array $module If $model is empty, and $module is an array, * these are the variables to populate in the * view. Otherwise, the module in which the * partial resides * @param array $model Variables to populate in the view * @return string */ public function direct($name = null, $module = null, $model = null) { if (0 == func_num_args()) { return $this; } if (null === $model && null !== $module) { $model = $module; $module = null; } if (!is_array($model) && !$model instanceof \Traversable && (is_object($model) && !method_exists($model, 'toArray'))) { $e = new Partial\Exception('PartialLoop helper requires iterable data'); $e->setView($this->view); throw $e; } if (is_object($model) && !$model instanceof \Traversable && method_exists($model, 'toArray')) { $model = $model->toArray(); } $content = ''; // reset the counter if it's call again $this->partialCounter = 0; foreach ($model as $item) { // increment the counter variable $this->partialCounter++; $content .= parent::direct($name, $module, $item); } return $content; }
protected function playerPartialExists($name) { if (array_key_exists($name, $this->playerPartialFlags)) { return $this->playerPartialFlags[$name]; } $controller = Controller::getController(); if (!$controller) { throw new Phpr_ApplicationException('Media tags can only be processed for front-end requests.'); } $partial = Partial::loadCached($controller->getTheme(), $name); return $this->playerPartialFlags[$name] = !!$partial; }
/** * Autorender partials in view * * @param string $view View to render if Route is current * @param string OR NULL $route * @return string Rendered view if exists */ public static function factory($view, $route = NULL) { $route = $route !== NULL ? $route : $view; if (Partial::is($route)) { $vars = View::factory('template/index'); if (Kohana::find_file('views/' . $vars->controller, $view)) { return View::factory($vars->controller . '/' . $view)->render(); } else { if (Kohana::find_file('views/' . $view, 'index')) { return View::factory($view . '/index')->render(); } } return View::factory($view)->render(); } return ''; }
function query_loop($arg = array(), $loop_template, $cache = true, $group = 'looping') { $data = false; if (empty($loop_template) || !is_string($loop_template)) { return new WP_Error('Missing arguments', __("query_loop missing template", TRANSLATE_DOMAIN)); } if (!isset($arg['posts_per_page'])) { $arg['posts_per_page'] = get_option('posts_per_page'); } if (!isset($arg['post_type'])) { $arg['post_type'] = 'post'; } if (get_query_var('paged')) { $arg['paged'] = get_query_var('paged'); } //var_dump($args); die(); //User json encode to "serialize" data, it's much faster $json_args = json_encode($arg, 256); //If cache is enabled if ($cache) { //Create cache key $cache_id = md5($json_args . $loop_template); //Get cache data $data = wp_cache_get($cache_id, $group); //var_dump($data, $cache_id); } //Check if we have anything in the cache if ($cache && $data) { //if we do, return cached data return $data; } $query = new WP_Query($arg); $return['data'] = ''; $return['query'] = $query; //Pre fetch users with one query // Clrz_user::bulk($query->posts, 'post_author'); if ($query->have_posts()) { $return['data'] = Partial::getPartial('loop', $loop_template, array('d' => $query), true); } unset($query); wp_reset_query(); return $return; }
<?php if (!empty($article)) { if ($multiple) { $data = array('total' => $total, 'perPage' => articles::PER_PAGE, 'page' => $page, 'url' => $url); echo Partial::render('pagination', $data); foreach ($article as $post) { echo Partial::render('articleQuickView', $post); } } else { $article[0]['mlt'] = $mlt; echo Partial::render('articleFull', $article[0]); if ($article[0]['commentable']) { echo Partial::render('comment', array('id' => $article[0]['_id'], 'page' => $commentPage, 'pageLoc' => $commentPageLoc)); } } }
<?php $partial = new Partial(); $page = $_POST['id']; $list = $partial->get_partial_payment_item($page); echo $list;
/** * Create a partial object with an optional default content * Can be usefull to use straight from the template file * @param string $name * @param string $default * @return Partial */ public function partial($name, $default = FALSE) { if ($this->exists($name)) { $partial = $this->_partials[$name]; } else { // create new partial $partial = new Partial($name); if ($this->_cache_ttl) { $partial->cache($this->_cache_ttl); } // detect local triggers if (method_exists($this, 'trigger_' . $name)) { $partial->bind($this, 'trigger_' . $name); } $this->_partials[$name] = $partial; } if (!$partial->content() && $default) { $partial->set($default); } return $partial; }
<div class="span6"><div class="well"> <h4>Active Forum Posts</h4> <?php if (!empty($fPosts)) { foreach ($fPosts as $post) { echo '<a href="' . Url::format($post['url']) . '">' . $post['topic'] . '</a><br />'; } } else { echo '<i>No active form posts.</i>'; } ?> </div></div> </div> <?php foreach ($news as $post) { echo Partial::render('newsShort', $post); } ?> <br /> <div class="well"> <strong>Most Recent Users:</strong><br /> <?php $links = array(); foreach ($onlineUsers as $user) { array_push($links, '<a href="' . Url::format('/user/view/' . $user) . '">' . $user . '</a>'); } echo implode(' - ', $links); ?> <br /> <strong>Users on IRC: (<?php
<?php require_once './classes/Partial.php'; $partial = new Partial(); $item = $_POST['item']; $list = $partial->search_item(trim($item)); echo $list;
<?php require_once './classes/Partial.php'; $partial = new Partial(); $total = $partial->get_partial_payments_total(); //echo "Total: ".$total."<br>"; $list = $partial->get_partial_payments_list(); echo $list; ?> <!-- <script type="text/javascript"> $(document).ready(function () { $(function () { $('#pagination').pagination({ items: <?php echo $total; ?> , itemsOnPage: <?php echo $partial->limit; ?> , cssStyle: 'light-theme' }); }); $("#pagination").click(function () { var page = $('#pagination').pagination('getCurrentPage');
<?php if (!empty($results)) { ?> <div class="page-header"><h1>Search</h1></div> <?php foreach ($results as $result) { switch ($result['type']) { case 'news': echo Partial::render('newsShort', $result); break; case 'article': echo Partial::render('articleQuickView', $result) . '<hr />'; break; case 'lecture': echo Partial::render('lecture', $result); break; } } }
function create_replacement_partials() { // construct a special variable which will hold all of the category lists $partials['/@Category_Lists/'] = ''; // find all categories $categories = $this->find_categories(); // category lists will become available as a variable as: '$.projects-folder' => @Projects_Folder foreach ($categories as $category) { // create new category $c = new ContentParser(); $replacements = $c->parse(new Category($category['name_clean'])); // store the output of the CategoryListPartial $category_list = Partial::render($this->page, $category['name'], $category['partial_file'], $replacements, 'CategoryList'); // create a partial that matches the name of the category $partials['/@' . ucfirst(preg_replace('/-(.)/e', "'_'.strtoupper('\\1')", $category['name_clean'])) . '/'] = $category_list; // append to the @Category_Lists variable $partials['/@Category_Lists/'] .= $category_list; } // construct the rest of the special variables $partials['/@Navigation/'] = Partial::render($this->page, '../content/', '../templates/partials/navigation.html', null, 'Navigation'); $partials['/@Pages/'] = Partial::render($this->page, '../content/', '../templates/partials/pages.html', null, 'Pages'); // construct asset variables $partials['/@Images/'] = Partial::render($this->page, null, '../templates/partials/images.html', null, 'Images'); $partials['/@Video/'] = Partial::render($this->page, null, '../templates/partials/video.html', null, 'Video'); $partials['/@Html/'] = Partial::render($this->page, null, null, null, 'Html'); $partials['/@Swfs/'] = Partial::render($this->page, null, '../templates/partials/swf.html', null, 'Swf'); $partials['/@Media/'] = $partials['/@Images/'] . $partials['/@Video/'] . $partials['/@Swfs/'] . $partials['/@Html/']; return $partials; }
<?php echo Layout::toUse('main'); ?> <?php echo Partial::toRender('form', $user);
<?php } ?> <li class="share-this"><!-- AddThis Button BEGIN --><script type="text/javascript">addthis_pub = 'seekingmichigan'; addthis_offset_top = -10; addthis_offset_left = 5; addthis_options = 'delicious, email, digg, facebook, google, technorati, twitter, myspace, more';</script><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()">Share This</a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script><!-- AddThis Button END --></li> <li class="view-collection"><a href="/custom/seek_results.php?CISOROOT=<?php echo $alias; ?> ">View Collection</a></li> </ul> </div> </div> <?php if ($_GET['show_all']) { for ($i = 1; $i < count($compound_items); $i++) { $current_item = get_sub_item($alias, $compound_items, $i, $requested_itnum); Partial::basic_view($alias, $current_item, $parent_item, $isImage, $seek_search_params, $search_position, $seek_search_params, $isthisCompoundObject, $previous_item, $next_item, $current_item_num, $totalitems); } } else { if ($isthisImage) { include "discover/pan_view.php"; } else { Partial::basic_view($alias, $display_item, $parent_item, $isImage, $seek_search_params, $search_position, $seek_search_params, $isthisCompoundObject, $previous_item, $next_item, $current_item_num, $totalitems); } } ?> </div> </div> <div id="main-whitebox-left"></div> <div id="main-whitebox-right"></div> <?php include 'footer.php';
<center> <?php $links = array(); if ($currCategory == 'new') { array_push($links, '<strong>Newest</strong>'); } else { array_push($links, '<a href="' . Url::format('/article/') . '">New</a>'); } foreach ($categories as $short => $category) { if ($currCategory == $short) { array_push($links, '<strong>' . $category . '</strong>'); } else { array_push($links, ' <a href="' . Url::format('/article/index/' . $short) . '">' . $category . '</a>'); } } echo implode(' - ', $links); ?> </center> <?php if ($currCategory != 'new') { $pageData = array('total' => $total, 'perPage' => articles::PER_PAGE, 'page' => $page, 'url' => '/article/index/' . $currCategory . '/'); echo Partial::render('pagination', $pageData); } foreach ($articles as $article) { echo Partial::render('articleQuickView', $article); } if ($currCategory != 'new') { echo Partial::render('pagination', $pageData); }
<?php /** * Created by PhpStorm. * User: Vilim Stubičan * Date: 12.10.2015. * Time: 19:18 */ ?> <section class="knowledge-base"> <div class="logos-wrapper container"> <?php Partial::getPartial("small", "logos"); ?> </div> <div class="content container"> </div> </section>
public static function display_full_main_block_page_code() { Partial::getPartial("", "full-height-main-page"); }
<?php require_once './classes/Partial.php'; $partial = new Partial(); $courseid = $_POST['courseid']; $userid = $_POST['userid']; $sum = $_POST['sum']; $source = $_POST['source']; $slotid = $_POST['slotid']; $period = $_POST['period']; $list = $partial->add_partial_payment($courseid, $userid, $sum, $source, $slotid, $period); echo $list;
<?php if (!empty($valid) && $valid) { foreach ($lectures as $lecture) { echo Partial::render('lecture', $lecture); } }
echo $description; ?> </blockquote> <?php } ?> <p><?php echo BBCode::parse($body); ?> </p> <?php if (!empty($mlt)) { ?> <p><h4>More Like This:</h4> <?php foreach ($mlt as $fetched) { echo '<a href="' . Url::format('article/view/' . Id::create($fetched, 'news')) . '">' . $fetched['title'] . '</a><br />'; } ?> </p> <?php } if ($published && empty($revision) && empty($preview)) { $data = array('_id' => $_id, 'rating' => $rating, 'type' => 'Articles', 'where' => 'article'); echo Partial::render('like', $data); } ?> </div>
<html <?php language_attributes(); ?> class="no-js"> <head> <meta charset="<?php bloginfo('charset'); ?> "> <meta name="viewport" content="width=device-width"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> "> <link rel="shortcut icon" href="/wp-content/themes/vdl/favicon.ico" type="image/x-icon"> <link rel="icon" href="/wp-content/themes/vdl/favicon.ico" type="image/x-icon"> <title> <?php echo get_bloginfo('name'); ?> </title> <?php wp_head(); ?> <?php if (StaticSettings::is_full_main_block_page()) { StaticSettings::display_full_main_block_page_code();
<?php require_once './classes/Partial.php'; $partial = new Partial(); $courseid = $_POST['courseid']; $userid = $_POST['userid']; $sum = $_POST['sum']; $ptype = $_POST['ptype']; $slotid = $_POST['slotid']; $list = $partial->get_payment_section($courseid, $userid, $sum, $ptype, $slotid); echo $list;
<?php /** * Created by PhpStorm. * User: Vilim Stubičan * Date: 17.7.2015. * Time: 13:45 */ StaticSettings::show_full_main_block_page(); get_header(); ?> <div class="container-block-1 container"> <div id="particlesBackground"></div> <div class="scroll-down-alert"> <p> <?php _e('Scroll down', 'vdl'); ?> </p> <i class="fa fa-chevron-down fa-3x"></i> </div> </div> <?php Partial::getPartial("", "knowledge-base"); get_footer();
<?php if (isset($revisions)) { ?> <h2><u>Current:</u></h2> <?php $current['preview'] = true; echo Partial::render('articleFull', $current); ?> <br /> <br /> <?php if (!empty($revisions)) { ?> <h2><u>Revisions:</u></h2><?php } foreach ($revisions as $revision) { $revision['revision'] = true; echo Partial::render('articleFull', $revision); } }
<?php if (!empty($valid) && $valid) { extract($post); if (!is_array($tags)) { $tags = explode(',', clean($tags)); } ?> <div class="page-header"><h1><?php echo ucwords($method); ?> News</h1></div> <?php if (!empty($preview) && $preview && !is_string($info)) { echo Partial::render('newsFull', $info); } ?> <form class="well form-vertical" action="<?php echo Url::format('/news/' . $method . (empty($_id) ? '' : '/' . $_id) . '/save'); ?> " method="post"> <label>Title: </label> <input type="text" name="title" value="<?php echo clean($title); ?> " /><br /> <label>Department: </label> <input type="text" name="department" value="<?php echo !empty($department) ? clean($department) : ''; ?> " /><br /> <label>Text: </label> <textarea style="width: 100%" rows="15" name="body"><?php
/** * Render partial * * @param string $template Partial name * @param array $vars Template variables [optional] * @return sfView::NONE */ public function renderPartial($template, $vars = null) { return $this->renderText(Partial::get($template, $vars)); }
<?php if (!empty($valid) && $valid) { extract($post); if (!is_array($tags)) { $tags = explode(',', clean($tags)); } $category = clean($category); ?> <div class="page-header"><h1><?php echo ucwords($method); ?> Article</h1></div> <?php if (!empty($preview) && $preview && !is_string($info)) { echo Partial::render('articleFull', $info); } ?> <form class="form-vertical well" action="<?php echo Url::format('/article/' . $method . (empty($_id) ? '' : '/' . $_id) . '/save'); ?> " method="post"> <label>Title: </label> <input type="text" name="title" value="<?php echo clean($title); ?> " /><br /> <label>Category: </label> <select name="category"> <?php foreach (articles::$categories as $short => $rCategory) { ?>
public function content() { if (!$this->_cached) { if (method_exists($this, 'display')) { // capture output ob_start(); $this->display($this->_args); $buffer = ob_get_clean(); // if no content is produced but there was direct ouput we set // that output as content if (!$this->_content && $buffer) { $this->set($buffer); } } } return parent::content(); }
<th id="sf_admin_list_th_actions" class="ui-th-column"><?php echo I18n::__('admin.labels.actions'); ?> </th> </tr> </thead> <tfoot> <tr> <th style="margin:0;padding:0;border:0;" colspan="5"> <div class="ui-widget-header ui-corner-bottom"> <div class="ui-th-column sf-list-foot"> <?php if ($pager->haveToPaginate()) { ?> <?php echo Partial::get('dinStdStaticCategory/pagination', array('pager' => $pager)); ?> <?php } ?> </div> </div> </th> </tr> </tfoot> <tbody> <?php if (!$pager->getNbResults()) { ?> <tr class="sf_admin_row ui-widget-content"><td colspan="20" height="30" align="center"> <p style="text-align:center"><?php