当前位置: 首页>>代码示例>>PHP>>正文


PHP pagination::items方法代码示例

本文整理汇总了PHP中pagination::items方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::items方法的具体用法?PHP pagination::items怎么用?PHP pagination::items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pagination的用法示例。


在下文中一共展示了pagination::items方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: paginate

function paginate($model, $options = array())
{
    $m = new Model();
    $limit = preg_match("/LIMIT (\\d+) OFFSET (\\d+)/", $model->last_query, $matches);
    $limit = $matches[1];
    $offset = $matches[2];
    $page = $offset / $limit + 1;
    $query = preg_replace("/^SELECT (.*) FROM/", "SELECT COUNT(*) AS count FROM", $model->last_query);
    $query = preg_replace("/LIMIT (.*)\$/", "", $query);
    $m->find_by_sql($query);
    $pagination = new pagination();
    $pagination->page = $page;
    $pagination->target = $options['target'];
    $pagination->items($m->fields['count']);
    $pagination->limit($limit);
    return $pagination->show();
}
开发者ID:russ,项目名称:jacks-php,代码行数:17,代码来源:pagination.php

示例2: pagination

} else {
    $items = mysql_num_rows(mysql_query("SELECT * from {$table_name} where status='{$filtrar_por}'"));
    // number of total rows in the database
}
if ($items > 0) {
    if ($filtrar_por == 'todos') {
        $filtrar_por = false;
    }
    if ($ordenar_por) {
        $ordenar_query = "&ordenar_por=" . $ordenar_por;
    }
    if ($filtrar_por) {
        $filtrar_query = "&filtrar_por=" . $filtrar_por;
    }
    $p = new pagination();
    $p->items($items);
    $p->limit(30);
    // Limit entries per page
    $p->currentPage($_GET[$p->paging]);
    // Gets and validates the current page
    // Calculates what to show
    $p->parameterName('paging');
    $p->adjacents(1);
    //No. of page away from the current page
    $p->target("tools.php?page=" . plugin_basename(dirname(__FILE__)) . "/modulo-vendas.php" . $ordenar_query . $filtrar_query);
    if (!isset($_GET['paging'])) {
        $p->page = 1;
    } else {
        $p->page = $_GET['paging'];
    }
    $p->calculate();
开发者ID:alexanmtz,项目名称:M-dulo-de-pagamento-para-wordpress,代码行数:31,代码来源:modulo-vendas.php

示例3: Iscritti

function Iscritti()
{
    require 'pagination.class.php';
    global $_POST;
    global $wpdb;
    $table_email = $wpdb->prefix . "nl_email";
    //cancellazione provamoce
    if ($_POST['delete'] && $_POST['id_email']) {
        $delete = $wpdb->query("delete from {$table_email} where id_email = '{$_POST['id_email']}'");
        echo '<div id="message" class="updated fade"><p><strong>' . __("Email deleted succesfully!", "sendit") . '</strong></p></div>';
        //print_r($_POST);
    }
    //modifica provamoce
    if ($_POST['update']) {
        //$code = md5(uniqid(rand(), true));
        $update = $wpdb->query("update {$table_email} set email = '{$_POST['email']}', magic_string='{$_POST['code']}', accepted = '{$_POST['status']}' where id_email = '{$_POST['id_email']}'");
        echo '<div id="message" class="updated fade"><p><strong>' . sprintf(__('email %s edited succesfully', 'sendit'), $_POST[email]) . '</p></div>';
        //print_r($_POST);
    }
    //aggiunta indirizzo o indirizzi email dalla textarea
    if ($_POST['emails_add'] != "") {
        //ver 1.1 multiaddress support
        $email_add = explode("\n", $_POST['emails_add']);
        foreach ($email_add as $key => $value) {
            //echo $value."<br />";
            //validation fix 1.5.6 (also there!) {2,4}
            if (!ereg("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$", trim($value))) {
                echo '<div id="message" class="error"><p><strong>indirizzo email ' . $value . ' non valido!</strong></p></div>';
            } else {
                $user_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_email} where email ='{$value}' and id_lista = '{$_GET['lista']}' order by email;");
                if ($user_count > 0) {
                    echo "<div class=\"error\"><p><strong>" . sprintf(__('email %s already present', 'sendit'), $value) . "</strong></p></div>";
                } else {
                    //genero stringa univoca x conferme e cancellazioni sicure
                    $code = md5(uniqid(rand(), true));
                    $wpdb->query("INSERT INTO {$table_email} (email,id_lista, magic_string, accepted) VALUES ('{$value}', '{$_POST['id_lista']}', '{$code}', 'y')");
                    echo '<div class="updated fade"><p><strong>' . sprintf(__('email %s added succesfully!', 'sendit'), $value) . '</strong></p></div>';
                }
            }
        }
        //fine ciclo for
    }
    $email_items = $wpdb->get_var("SELECT count(*) FROM {$table_email} where id_lista= '{$_GET['lista']}'");
    // number of total rows in the database
    if ($email_items > 0) {
        $p = new pagination();
        $p->items($email_items);
        $p->limit(20);
        // Limit entries per page
        $p->target("admin.php?page=lista-iscritti&lista=" . $_GET['lista']);
        $p->currentPage($_GET[$p->paging]);
        // Gets and validates the current page
        $p->calculate();
        // Calculates what to show
        $p->parameterName('paging');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['paging'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['paging'];
        }
        //Query for limit paging
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    } else {
        //echo "No Record Found";
    }
    $emails = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' order by email {$limit}");
    //email confermat
    $emails_confirmed = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' and accepted='y'");
    echo "<div class=\"wrap\"><h2>" . __('Subscribers', 'sendit') . "</h2>";
    //estraggo le liste
    $table_liste = $wpdb->prefix . "nl_liste";
    $liste = $wpdb->get_results("SELECT id_lista, nomelista FROM {$table_liste} ");
    // print_r($_POST);
    echo "<div class=\"table\">\n\t\t\t<table class=\"widefat  fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>" . __('id', 'sendit') . "</th>\n\t\t\t\t\t\t<th class=" . $css_list . ">" . __('mailing list', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</thead><tbody>";
    foreach ($liste as $lista) {
        if ($_GET['lista'] == $lista->id_lista) {
            $selected = " class=\"updated fade\"";
        } else {
            $selected = "";
        }
        echo "<tr >\n                \t\t<td>" . $lista->id_lista . "</td>\n                \t\t<td " . $selected . "><a class=\"\" href=\"admin.php?page=lista-iscritti&lista=" . $lista->id_lista . "\">" . $lista->nomelista . "</a></td>\n                \t\t<td></td><tr>";
    }
    echo "</tbody></table>\n        </div><br clear=\"all\\ />";
    /*miglioro facendo comparire la form x aggiungere solo se selezionata una lista*/
    if ($_GET['lista']) {
        echo "<h3>" . __('Manual Subscribe mailing list ', 'sendit') . " " . $_POST['lista'] . "</h3>\n\n                <label for=\"email_add\">" . __('email address (one or more: default separator= line break)', 'sendit') . "<br />\n               <div id=\"dashboard-widgets\" class=\"metabox-holder\">\n               <div class='postbox-container' style='width:49%;'>\n\t\t\t\t<div id=\"normal-sortables\" class=\"meta-box-sortables\">\n\t\t\t\t<div id=\"dashboard_right_now\" class=\"postbox \" >\n\t\t\t\t\t<div class=\"handlediv\" title=\"Fare clic per cambiare.\"><br /></div>\n\t\t\t\t<h3 class='hndle'><span>" . __('Subscription', 'sendit') . "</span></h3>\n\t\t\t\t<div class=\"inside\">\n\t\t\t\t        <p>" . __('Copy here one or more email address', 'sendit') . "</p>\n\n\t\t\t\t\t           <form id=\"add\" name=\"add\" method=\"post\" action=\"admin.php?page=lista-iscritti&lista=" . $_GET[lista] . "\">\n\n                \n                <textarea id=\"emails_add\" type=\"text\" value=\"\" name=\"emails_add\" rows=\"10\" cols=\"50\"/></textarea></label>\n                 <input type=\"hidden\" name=\"id_lista\" value=\"" . $_GET[lista] . "\" /> \n\n                <input class=\"button\" type=\"submit\" value=\"" . __('Add', 'sendit') . "\"/>\n                </p>\n                            </form>\n                </div>\n               </div>\n               </div>\n               </div>\n               </div>\n               <br clear=\"all\" />";
        //posiziono la paginazione
        echo "<h3>" . __('Subscribers', 'sendit') . " n." . $email_items . " (" . __('Subscriptions confirmed', 'sendit') . ": " . count($emails_confirmed) . ")</h3>";
        if ($p) {
            echo $p->show();
        }
        echo "\n        <br clear=\"all\" />\n\t\t\t<table class=\"widefat post fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>";
        if (get_option('sendit_gravatar') == 'yes') {
            echo "<th style=\"width:30px !important;\"></th>";
        }
        echo "<th>" . __('email', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('status', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('Additional info', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n    \t\n        ";
        foreach ($emails as $email) {
            //coloro le input per distinguere tra chi ha confermato e chi no
//.........这里部分代码省略.........
开发者ID:tammia,项目名称:sendit,代码行数:101,代码来源:admin.php

示例4: COUNT

    $ltw_group_sql = ' WHERE g.`id` = %d ';
}
//	Get all testimonials
$sql = $wpdb->prepare("SELECT COUNT(tes.`id`) AS counter\n\t\tFROM `" . LTW_TES_TESTIMONIALS_TABLE . "` AS tes\n\t\tLEFT JOIN `" . LTW_TES_TESTIMONIAL_GROUPS_TABLE . "` AS g ON (g.`id` = tes.`group_id`)\n\t\t" . $ltw_group_sql, array($ltw_group_sql_id));
$ltw_testimonials_count = '';
$ltw_testimonials_count = $wpdb->get_results($sql, ARRAY_A);
/**
* Get all available groups
*
*/
$sql = "SELECT `id`, `group_name`, `page_id`\n\t\tFROM `" . LTW_TES_TESTIMONIAL_GROUPS_TABLE . "`\n\t\tORDER BY `group_name` ASC";
$ltw_tes_group_info = array();
$ltw_tes_group_info = $wpdb->get_results($sql, ARRAY_A);
if ($ltw_testimonials_count[0]['counter'] > 0) {
    $p = new pagination();
    $p->items($ltw_testimonials_count[0]['counter']);
    $p->limit(15);
    // Limit entries per page
    $p->target("admin.php?page=ltw_manage_testimonials" . $ltw_group_qs);
    $p->currentPage(isset($_GET['paging']) == TRUE ? $_GET['paging'] : 0);
    // Gets and validates the current page
    $p->calculate();
    // Calculates what to show
    $p->parameterName('paging');
    $p->adjacents(1);
    //No. of page away from the current page
    if (!isset($_GET['paging'])) {
        $p->page = 1;
    } else {
        $p->page = $_GET['paging'];
    }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:31,代码来源:testimonial_index.php

示例5: WassUp


//.........这里部分代码省略.........
			<ul class="url">
	<?php 
			$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY `timestamp` ASC");
			$i=0;
			foreach ($qryCD as $cd) {	
			$time2 = gmdate("H:i:s", $cd->timestamp);
			$num = ($i&1);
			$char_len = round($max_char_len*.9,0);
			if ($num == 0) $classodd = "urlodd"; else  $classodd = "url";
			if ($i >= 1) {
	?>
				<li class="<?php print $classodd; ?> navi<?php echo $cv->id ?>"><span class="indent-li"><?php print $time2; ?> - 
				<?php
				print '<a href="'.wAddSiteurl(htmlspecialchars(html_entity_decode($cd->urlrequested))).'" target="_BLANK">';
				print stringShortener(urlencode(html_entity_decode($cd->urlrequested)), $char_len).'</a></span></li>'."\n";
			}
			$i++;
			} //end foreach qryCD
			print '</ul>';
			print '</div>';
			print '<p class="sum-footer"></p>';
		} //end foreach qryC
		} //end if currenttot ?>
	<br /><p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All", "wassup"); ?></a></p>
	
<?php	// HERE IS THE SPY MODE VIEW
	} elseif ($_GET['page'] == "wassup-spy") { 
	?>
		<h2><?php _e("SPY Visitors", "wassup"); ?></h2>
		<p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log">&nbsp;&nbsp;</span> '.__("Logged-in Users", "wassup").' <span class="box-aut">&nbsp;&nbsp;</span> '.__("Comments Authors", "wassup").' <span class="box-spider">&nbsp;&nbsp;</span> '.__("Spiders/bots", "wassup"); ?></p><br />
		<div>
		<a href="#?" onclick="return pauseSpy();"><span id="spy-pause"><?php _e("Pause", "wassup"); ?></span></a>
		<a href="#?" onclick="return playSpy();"><span id="spy-play"><?php _e("Play", "wassup"); ?></span></a>
                - <span style="font-size: 11px;"><?php _e('Spy items by','wassup'); ?>: <select name="navi" style="font-size: 11px;" onChange="window.location.href=this.options[this.selectedIndex].value;">
                <?php
                //## selectable filter by type of record (wassup_default_spy_type)
		if (isset($_GET['spytype'])) {
			$spytype = htmlentities(attribute_escape($_GET['spytype']));
		} elseif ($wassup_options->wassup_default_spy_type != '') {
			$spytype = $wassup_options->wassup_default_spy_type;
		}
                $selected=$spytype;
                $optionargs="?page=wassup-spy&spytype=";
                $wassup_options->showFormOptions("wassup_default_spy_type","$selected","$optionargs");
                ?>
                </select>
                </span>
		<br />&nbsp;<br /></div>

	<?php // GEO IP Map
	if ($wassup_options->wassup_geoip_map == 1 AND $wassup_options->wassup_googlemaps_key != "") { ?>
		<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $wassup_options->wassup_googlemaps_key; ?>" type="text/javascript"></script>
		<div id="map" style="width: <?php echo ($screen_res_size*95/100); ?>px; height: 220px;border:2px solid #999;"></div>
		    <script type="text/javascript">
		    //<![CDATA[
		    if (GBrowserIsCompatible()) { 
		      // Display the map, with some controls and set the initial location 
		      var map = new GMap2(document.getElementById("map"));
		      map.addControl(new GSmallMapControl());
		      map.addControl(new GMapTypeControl());
		      //map.enableScrollWheelZoom();
		      map.setCenter(new GLatLng(0,0),3);
		    }
		    // display a warning if the browser was not compatible
		    else {
		      alert("Sorry, the Google Maps API is not compatible with this browser");
开发者ID:alx,项目名称:alexgirard.com-blog,代码行数:67,代码来源:wassup.php

示例6: wp_ulike_bbpress_likes_logs

/**
 * Create WP ULike bbPress Logs page with separate pagination
 *
 * @author       	Alimir	 	
 * @since           2.2
 * @return			String
 */
function wp_ulike_bbpress_likes_logs()
{
    global $wpdb;
    $alternate = true;
    $items = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "ulike_forums");
    if ($items > 0) {
        $p = new pagination();
        $p->items($items);
        $p->limit(wp_ulike_logs_return_per_page());
        // Limit entries per page
        $p->target("admin.php?page=wp-ulike-bbpress-logs");
        $p->calculate();
        // Calculates what to show
        $p->parameterName('page_number');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['page_number'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['page_number'];
        }
        //Query for limit page_number
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
        $get_ulike_logs = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ulike_forums ORDER BY id DESC " . $limit . "");
        ?>
	<div class="wrap">
		<h2><?php 
        _e('WP ULike Logs', 'alimir');
        ?>
</h2>
		<h3><?php 
        _e('Topics Likes Logs', 'alimir');
        ?>
</h3>
		<div class="tablenav">
			<div class='tablenav-pages'>
				<span class="displaying-num"><?php 
        echo $items . ' ' . __('Logs', 'alimir');
        ?>
</span>
				<?php 
        echo $p->show();
        // Echo out the list of paging.
        ?>
			</div>
		</div>
		<table class="widefat">
			<thead>
				<tr>
					<th width="2%"><?php 
        _e('ID', 'alimir');
        ?>
</th>
					<th width="10%"><?php 
        _e('Username', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Status', 'alimir');
        ?>
</th>
					<th width="6%"><?php 
        _e('Topic ID', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Topic Title', 'alimir');
        ?>
</th>
					<th width="20%"><?php 
        _e('Date / Time', 'alimir');
        ?>
</th>
					<th><?php 
        _e('IP', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Actions', 'alimir');
        ?>
</th>
				</tr>
			</thead>
			<tbody class="wp_ulike_logs">
				<?php 
        foreach ($get_ulike_logs as $get_ulike_log) {
            ?>
				<tr <?php 
            if ($alternate == true) {
                echo 'class="alternate"';
            }
            ?>
>
//.........这里部分代码省略.........
开发者ID:hyperweb2,项目名称:wp-ulike,代码行数:101,代码来源:logs.php

示例7: url


//.........这里部分代码省略.........
</span> -->
				    								</td>
				    							</tr>
				    							
												</table>
											</div>
										</div>
									</div>
							  <p class="submit">
								<input type="submit" name="Submit" class="button-primary" value="<?php 
                    esc_attr_e('Save Changes', 'woocommerce-ac');
                    ?>
" />
							  </p>
						    </form>
						  </div>
						<?php 
                } elseif ($action == 'listcart' || $action == '') {
                    ?>
						
			<p> <?php 
                    _e('The list below shows all Abandoned Carts which have remained in cart for a time higher than the "Cart abandoned cut-off time" setting.', 'woocommerce-ac');
                    ?>
 </p>
			
			<?php 
                    //echo plugins_url();
                    include_once "pagination.class.php";
                    /* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
                    $wpdb->get_results("SELECT wpac . * , wpu.user_login, wpu.user_email \n\t\t\t\t\t  FROM `" . $wpdb->prefix . "ac_abandoned_cart_history` AS wpac \n\t\t\t\t\t  LEFT JOIN " . $wpdb->prefix . "users AS wpu ON wpac.user_id = wpu.id\n\t\t\t\t\t  WHERE recovered_cart='0' AND unsubscribe_link='0' ");
                    $count = $wpdb->num_rows;
                    if ($count > 0) {
                        $p = new pagination();
                        $p->items($count);
                        $p->limit(10);
                        // Limit entries per page
                        $p->target("admin.php?page=woocommerce_ac_page&action=listcart");
                        if (isset($p->paging)) {
                            if (isset($_GET[$p->paging])) {
                                $p->currentPage($_GET[$p->paging]);
                            }
                            // Gets and validates the current page
                        }
                        $p->calculate();
                        // Calculates what to show
                        $p->parameterName('paging');
                        $p->adjacents(1);
                        //No. of page away from the current page
                        $p->showCounter(true);
                        if (!isset($_GET['paging'])) {
                            $p->page = 1;
                        } else {
                            $p->page = $_GET['paging'];
                        }
                        //Query for limit paging
                        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
                    } else {
                        $limit = "";
                    }
                    ?>
			  
			<div class="tablenav">
			    <div class='tablenav-pages'>
			    	<?php 
                    if ($count > 0) {
                        echo $p->show();
开发者ID:shahadat014,项目名称:geleyi,代码行数:67,代码来源:woocommerce-ac.php

示例8: catch

     $q_do = $db->prepare($q);
     $q_do->execute();
     $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn();
 } catch (PDOException $e) {
     $log->logError($e . " - " . basename(__FILE__));
 }
 echo "<div class=\"page-header\"><h1>" . _("Access Logs") . "</h1></div>";
 echo "<h6>" . _("Options") . " : <a href=\"{$website}/" . ADMIN_DIRECTORY . "/settings#/misc\">" . _("Access Settings") . "</a></h6><br/>";
 echo "<ul class=\"breadcrumb\">\n\t\t<li><a href=\"{$website}/" . ADMIN_DIRECTORY . "/settings\">" . _("Home") . "</a> <span class=\"divider\">/</span></li>\n\t\t<li class=\"active\">" . _("Access Logs") . "</li>\n\t\t</ul>";
 if (!empty($number)) {
     /*
     initializing the ip2country class for converting ip address to country.
     */
     $ip2country = new ip2country($db);
     $p = new pagination();
     $p->items($number);
     $p->limit($max_show);
     $p->currentPage($page);
     $p->parameterName("p");
     $p->urlFriendly();
     $p->target("{$website}/" . ADMIN_DIRECTORY . "/access/%");
     $from2 = $page * $max_show;
     if ($from2 > $number) {
         $diff = $number % $max_show;
         $from2 = $number;
         $from1 = $from2 - $diff;
     } else {
         $from1 = $from2 - $max_show;
     }
     echo "<table class=\"table table-condensed\">";
     echo "<thead><tr>\n\t\t\t<th>" . _("ID") . "</th>\n\t\t\t<th>" . _("IP Address") . "</th>\n\t\t\t<th>" . _("Username") . "</th>\n\t\t\t<th>" . _("Country") . "</th>\n\t\t\t<th>" . _("Access") . "</th>\n\t\t\t</tr></thead>";
开发者ID:Abysmal,项目名称:AuthManager,代码行数:31,代码来源:access.php

示例9: show_easy_gallery

function show_easy_gallery($atts, $content = null)
{
    $order = 'desc';
    $pagesql = '';
    $limit = '';
    $count = 8;
    $page = true;
    $page_st = true;
    $theme = 'fancybox';
    $view = 'album';
    $album = '';
    global $wpdb;
    //echo "select * from easy_photos order  by $order limit $limit offset $offset";
    if (isset($atts['order'])) {
        $order = $atts['order'];
    }
    if (isset($atts['theme'])) {
        $theme = trim($atts['theme']);
        if ($theme != 'fancybox' && $theme != 'swipebox') {
            $theme = 'fancybox';
        }
    }
    if (isset($atts['view'])) {
        $view = trim($atts['view']);
        if ($view != 'album' && $view != 'image') {
            $view = 'album';
        }
    }
    if (isset($atts['album'])) {
        $album = trim($atts['album']);
    }
    if (isset($atts['limit'])) {
        $count = trim($atts['limit']);
        if ($count < 1) {
            $count = 2;
        }
    }
    $order = strtolower($order);
    if ($order != 'asc' && $order != 'desc') {
        $order = 'desc';
    }
    if (isset($atts['pagination'])) {
        $page_st = trim($atts['pagination']);
        if ($page_st != 'true' && $page_st != 'false') {
            $page_st = 'true';
        }
    }
    if ($page_st == 'true') {
        $page = true;
        $sql = "  SELECT DISTINCT(a.album_id) FROM easy_album a,easy_photos b WHERE a.album_id=b.album_id AND a.disabled=0 AND b.disabled=0";
        if ($album != '') {
            $sql = $sql . " and a.album_id = {$album}";
        }
        if ($view == 'image') {
            $sql = "select * from easy_photos  where album_id not in(select album_id from easy_album b where b.disabled=1) and disabled=0";
            if ($album != '') {
                $sql = $sql . " and album_id = {$album}";
            }
        }
        $rows = $wpdb->get_results($sql);
        $items = count($rows);
        if ($items > 0) {
            $p = new pagination();
            $p->items($items);
            $p->limit($count);
            // Limit entries per page
            if ($album != '') {
                $p->target(get_permalink() . '?album=' . $album);
            } else {
                $p->target(get_permalink());
            }
            //$p->urlFriendly();
            if (isset($p->paging)) {
                $p->currentPage($_GET[$p->paging]);
            }
            // Gets and validates the current page
            $p->calculate();
            // Calculates what to show
            $p->parameterName('paging');
            $p->nextLabel('');
            //removing next text
            $p->prevLabel('');
            //removing previous text
            $p->nextIcon('&#9658;');
            //Changing the next icon
            $p->prevIcon('&#9668;');
            //Changing the previous icon
            $p->adjacents(1);
            //No. of page away from the current page
            if (!isset($_GET['paging'])) {
                $p->page = 1;
            } else {
                $p->page = $_GET['paging'];
            }
            //Query for limit paging
            $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
        } else {
            echo "No Images";
        }
    } else {
//.........这里部分代码省略.........
开发者ID:shankpaul,项目名称:easygallery,代码行数:101,代码来源:easy-front-end.php

示例10: create_paginator

function create_paginator($currentpage, $nb_items, $path)
{
    require_once ROOT_DIR . '/' . INC_DIR . '/paginator-digg/pagination.php';
    $p = new pagination();
    $p->items($nb_items);
    $p->currentPage($currentpage);
    $p->limit(1);
    $p->urlFriendly();
    $p->target(URL . "/{$path}/page/%");
    if ("" === $path) {
        $p->target(URL . "/page/%");
    }
    $p->adjacents(1);
    if (!$p->calculate) {
        if ($p->calculate()) {
            return "<div class=\"{$p->className}\">{$p->pagination}</div>";
        }
    }
}
开发者ID:holdensmagicalunicorn,项目名称:Volatile,代码行数:19,代码来源:functions.php

示例11: list_voucher_display_settings

function list_voucher_display_settings()
{
    global $wpdb;
    $sql = 'SELECT COUNT(*) FROM wp_voucher_post';
    $items = $wpdb->get_var($sql);
    //  $items = mysql_num_rows(mysql_query("SELECT * FROM wp_voucher_post")); // number of total rows in the database
    if ($items > 0) {
        $p = new pagination();
        $p->items($items);
        $p->limit(500);
        // Limit entries per page
        $p->target("admin.php?page=list_voucher_settings");
        $p->currentPage($_GET[$p->paging]);
        // Gets and validates the current page
        $p->calculate();
        // Calculates what to show
        $p->parameterName('paging');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['paging'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['paging'];
        }
        //Query for limit paging
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    } else {
        echo "No Record Found";
    }
    echo '<div class="wrap">
	<h2>List of Records</h2>
 
	<div class="tablenav">
		<div class="tablenav-pages">';
    echo $p->show();
    echo '</div>
	</div>
 
	<table class="widefat">
		<thead>
			 <tr>
				 <th><strong>ID</strong></th>
				 <th><strong>Người nhận</strong></th>
				 <th><strong>Email</strong></th>
                 <th><strong>Điện thoại</strong></th>
                 <th><strong>Tên voucher</strong></th>
                 <th><strong>Số lượng</strong></th>
			 </tr>
		</thead>
		<tbody>';
    $sql = "SELECT * FROM wp_voucher_post, wp_posts where wp_voucher_post.post_id = wp_posts.id ORDER BY wp_voucher_post.id DESC {$limit}";
    $result = $wpdb->get_results($sql) or die('Error, query failed');
    foreach ($result as $value) {
        echo '<tr>
				<td>' . $value->post_id . '</td>
				<td>' . $value->fullname . '</td>
				<td>' . $value->email . '</td>
                <td>' . $value->phone . '</td>
                <td>' . $value->post_title . '</td>
                <td>' . $value->total . '</td>
			</tr>';
    }
    echo '</tbody>
	</table>
</div>';
}
开发者ID:vanlong200880,项目名称:tmdt,代码行数:66,代码来源:voucher.php

示例12: showTestimonial

function showTestimonial()
{
    $x = 0;
    $data = get_option('testimonials_manager');
    $testimonialboxcount = count($data['data']);
    switch ($data['dorder']) {
        case 'random':
            shuffle($data['data']);
            break;
        case 'desc':
            $data['data'] = array_reverse($data['data']);
            ksort($data['data']);
            break;
        default:
    }
    echo <<<EOF
<style>
.clearfloat {
clear: both;
}
</style>
EOF;
    $p = new pagination();
    $p->items($testimonialboxcount);
    $p->limit($data['items']);
    if (empty($_GET['pg'])) {
        $page = 1;
    } else {
        $page = $_GET['pg'];
    }
    $p->currentPage($page);
    $p->target(get_permalink());
    $result = $p->getOutput();
    // print_r($data);
    if ($testimonialboxcount > $data['items']) {
        $testimonialboxcount = $data['items'];
        // now to make the array smaller
        $newarray = array_slice($data['data'], ($page - 1) * $data['items'], $data['items']);
        $data['data'] = $newarray;
        $testimonialboxcount = count($newarray);
    }
    if ($testimonialboxcount == 0) {
        $result .= '<div class="testimonial" style="text-align:center;">';
        $result .= '<strong>There are no testimonial yet</strong>';
        $result .= '</div>';
    } else {
        while ($x < $testimonialboxcount) {
            $url = $data['data'][$x]['url'];
            if (substr($url, 0, 7) != 'http://') {
                $url = 'http://' . $url;
            }
            $result .= '<div class="testimonial">';
            if ($data['data'][$x]['avatar']) {
                if ($data['data'][$x]['avatar'] == "gravatar") {
                    $result .= get_avatar($data['data'][$x]['email'], $size = $data['imagex']);
                } else {
                    $result .= '<img src="' . $data['data'][$x]['own_avatar'] . '" class="avatar" alt="avatar" width="' . $data['imagex'] . '" height="' . $data['imagey'] . '" />';
                }
            }
            $result .= stripslashes(nl2br($data['data'][$x]['text']));
            $result .= '<cite>' . stripslashes($data['data'][$x]['name']);
            if ($data['data'][$x]['title']) {
                $result .= ', ' . stripslashes($data['data'][$x]['title']);
            }
            if ($data['data'][$x]['company_name']) {
                $result .= '<em>' . stripslashes($data['data'][$x]['company_name']) . '</em>';
            }
            $result .= '</cite>';
            if ($data['data'][$x]['url']) {
                $result .= '<a href="' . stripslashes($url) . '">';
            }
            if ($data['data'][$x]['company']) {
                $result .= stripslashes($data['data'][$x]['company']);
            }
            if ($data['data'][$x]['url']) {
                $result .= '</a>';
            }
            $result .= '<div class="clearfloat"></div></div>';
            $x++;
        }
    }
    /*
        $s=  <<<EOF
    <style>
    .copyyy,.copyyy a {
    font-size: 10px !important;
    font-family; veranda !important;
    color: #666666 !important;
    }
    </style>
    EOF;
    * 
    */
    $result .= $p->getOutput();
    $result .= '<div class="testimonial" style="background: transparent; border:none; margin:0 0 20px 0; text-align:right;size:10px">Powered by the <a href="http://www.profitplugs.com/testimonials-manager-wordpress/" title="Testimonial Manager">Testimonial Manager Plugin for Wordpress.</a></div>';
    return $result;
}
开发者ID:pnomolos,项目名称:Testimonials-Manager,代码行数:97,代码来源:index.php

示例13: sc_render_manager_page


//.........这里部分代码省略.........
            }
            break;
        case 'upload':
            ?>
	
			<form action="" enctype="multipart/form-data" method="post" id ="add_track">
				<table class="form-table">
					<tr valign="top">
					  <th scope="row"><label for="track_title">Track title:</label></th>
					  <td><input type="text" name="track_title" size="30" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="track_file">Please specify a track:</label></th>
					  <td><input type="file" name="track_file" id="track_file" size="40" accept="audio/*" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="track_art">Please specify track artwork:</label></th>
					  <td><input type="file" name="track_art" id="track_art" size="40" accept="image/*" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="tag">Track tags:</label></th>
					  <td><input type="text" name="tag" id="tag" size="30"><input type="button" id="add_tag" name="add_tag" class="button" value="Add Tag" />
						<br><ul id="tags"></ul></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="sharing">Track privacy:</label></th>
					  <td><select name="sharing">
						<option value="public">Public</option>
						<option value="private">Private</option>
					  </select></td>
					</tr>
					</table>
			<p class="submit"><input type="submit" value="Upload" class="button-primary"></p>
			</form>					
			<?php 
            try {
                $tmp_file = '/tmp/' . stripslashes($_FILES['track_file']['name']);
                $tmp_art_file = '/tmp/' . stripslashes($_FILES['track_art']['name']);
                if (move_uploaded_file($_FILES['track_file']['tmp_name'], $tmp_file) && move_uploaded_file($_FILES['track_art']['tmp_name'], $tmp_art_file)) {
                    // upload audio file
                    $track = json_decode($client->post('tracks', array('track[title]' => $_POST['track_title'], 'track[asset_data]' => '@' . $tmp_file, 'track[artwork_data]' => '@' . $tmp_art_file, 'track[tags]' => strlen($_POST['tags']) ? $_POST['tags'] : null, 'track[sharing]' => $_POST['sharing'])));
                    unlink(realpath($tmp_file));
                    unlink(realpath($tmp_art_file));
                }
            } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
                var_dump($e->getMessage());
                exit;
            }
            break;
        case 'tracks':
            try {
                echo '</br>';
                $page_size = 5;
                // Pagination code
                $p = new pagination();
                $p->items($me['track_count']);
                $p->limit($page_size);
                // Limit entries per page
                $p->target("admin.php?page=soundcloud-manager&tab=tracks");
                $p->currentPage($_GET[$p->paging]);
                // Gets and validates the current page
                $p->calculate();
                // Calculates what to show
                $p->parameterName('paging');
                $p->adjacents(1);
                //No. of page away from the current page
                if (!isset($_GET['paging'])) {
                    $p->page = 1;
                } else {
                    $p->page = $_GET['paging'];
                }
                if ($p->page == 1) {
                    // get first page of tracks
                    $tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size)));
                } else {
                    // get additional pages of tracks
                    $tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size, 'offset' => $page_size * $page)));
                }
                ?>
				<div class="tablenav">
					<div class='tablenav-pages'>
						<?php 
                echo $p->show();
                ?>
					</div>
				</div>
				<?php 
                foreach ($tracks as $track) {
                    $client->setCurlOptions(array(CURLOPT_FOLLOWLOCATION => 1));
                    $embed_info = json_decode($client->get('oembed', array('url' => $track->permalink_url)));
                    // render the html for the player widget
                    echo $embed_info->html . '</br></br>';
                }
            } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
                var_dump($e->getMessage());
                exit;
            }
            break;
    }
}
开发者ID:rdetwiler,项目名称:wp-soundcloud,代码行数:101,代码来源:soundcloud.php

示例14: managetestimonial

    function managetestimonial()
    {
        $x = 0;
        $data = get_option('testimonials_manager');
        if ($_GET['action'] == 'delete') {
            $id = $_GET['testimonial_id'];
            $data = get_option('testimonials_manager');
            unset($data['data'][$id]);
            $data['data'] = array_values($data['data']);
            update_option('testimonials_manager', $data);
            echo "Testimonial Deleted<br/>";
        }
        $testimonialboxcount = count($data['data']);
        $p = new pagination();
        $p->items($testimonialboxcount);
        $p->limit(25);
        if (empty($_GET['pg'])) {
            $page = 1;
        } else {
            $page = $_GET['pg'];
        }
        $p->currentPage($page);
        $p->target('admin.php?page=testimonials_manage');
        ?>
        <div class="tablenav">
            <div class='tablenav-pages'>
                 <?php 
        echo $p->show();
        // Echo out the list of paging.
        ?>
            </div>
            <div class = "alignleft actions" > <select name = "act" > <option value = "-1" selected = "selected" > Bulk Actions</option > <option value = "trash" > Delete</option >
                </select > <input type = "submit" name = "doaction" id = "doaction" value = "Apply" class = "button-secondary apply" / >
            </div><br class = "clear" / >
        </div >
        <?php 
        // print_r($data);
        if ($testimonialboxcount > 25) {
            $testimonialboxcount = 25;
            // now to make the array smaller
            $newarray = array_slice($data['data'], ($page - 1) * 25, 25);
            $data['data'] = $newarray;
            $testimonialboxcount = count($newarray);
        }
        ?>
        <table class="widefat" cellspacing="0">
            <thead>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" class="checkall"/></th>
                    <th scope="col" width="250px">Name</th>
                    <th scope="col">Testimonial</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" class="checkall" /></th>
                    <th scope="col">Name</th>
                    <th scope="col">Testimonial</th>
                </tr>
            </tfoot>
            <tbody>
                <?php 
        if ($testimonialboxcount == 0) {
            ?>
                    <tr style="background:#eeeeee;">
                        <td colspan="3" align="center"><strong>No testimonial yet, add one below.</strong></td>
                    </tr>
                <?php 
        } else {
            while ($x < $testimonialboxcount) {
                $num = $x;
                $num = $num + 1 + ($page - 1) * 25;
                $url = $data['data'][$x]['url'];
                if (substr($url, 0, 7) != 'http://') {
                    $url = 'http://' . $url;
                }
                if ($data['data'][$x]['avatar']) {
                    if ($data['data'][$x]['avatar'] == "gravatar") {
                        $av = get_avatar($data['data'][$x]['email'], 48);
                    } else {
                        $av = '<img src="' . $data['data'][$x]['own_avatar'] . '" class="avatar" alt="avatar" width="48" height="48" />';
                    }
                }
                ?>
                        <tr>
                            <td align="center" valign="top"><input type='checkbox' name='delete_comments[]' class="tobedeleted" value='<?php 
                echo $num - 1;
                ?>
' /></td>
                            <td class="author column-author">
                                <strong><?php 
                echo $av;
                ?>
 <?php 
                echo $data['data'][$x]['name'];
                ?>
</strong><br>
                                <?php 
                echo $data['data'][$x]['company'];
                ?>
//.........这里部分代码省略.........
开发者ID:pnomolos,项目名称:Testimonials-Manager,代码行数:101,代码来源:testimonial_manager.php

示例15: count

        if ($_GET['project'] !== "0") {
            $project_filter = esc_attr($_GET['project']);
            $sql = "SELECT * FROM " . $wpdb->prefix . "ign_pay_info WHERE product_id = " . $project_filter . " ORDER BY " . $orderby . " " . $sort . " " . $limit;
            $sql_count = $wpdb->prepare("SELECT count(*) as count FROM " . $wpdb->prefix . "ign_pay_info WHERE product_id = %d", $project_filter);
        } else {
            $sql = "SELECT * FROM " . $wpdb->prefix . "ign_pay_info ORDER BY " . $orderby . " " . $sort . " " . $limit;
            $sql_count = "SELECT count(*) as count FROM " . $wpdb->prefix . "ign_pay_info";
        }
    } else {
        $sql = "SELECT * FROM " . $wpdb->prefix . "ign_pay_info ORDER BY " . $orderby . " " . $sort . " " . $limit;
        $sql_count = "SELECT count(*) as count FROM " . $wpdb->prefix . "ign_pay_info";
    }
}
$items = $wpdb->get_results($sql);
$items_count = $wpdb->get_results($sql_count);
$p->items($items_count[0]->count);
$p->limit($page_count);
// Limit entries per page
if (isset($_GET['s'])) {
    $p->target("admin.php?page=order_details&" . $query_string);
} else {
    $p->target("admin.php?page=order_details&" . $query_string);
}
if (isset($_GET['order_page'])) {
    $cp = $_GET['order_page'];
} else {
    $cp = 1;
}
$p->parameterName('order_page');
$p->currentPage($cp);
// Gets and validates the current page
开发者ID:christopherreay,项目名称:freeFreeCrowdfunding_ignitiondeck_crowdfunding,代码行数:31,代码来源:_orderDetails.php


注:本文中的pagination::items方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。