コード例 #1
0
ファイル: index.php プロジェクト: HeliWang/EngSoc-Website
							</a>
						</th>
						<th><?php 
    _e('Slides', $this->plugin_name);
    ?>
</th>
						<th><?php 
    _e('Shortcode', $this->plugin_name);
    ?>
</th>
						<th class="column-modified <?php 
    echo $orderby == "modified" ? 'sorted ' . $order : 'sortable desc';
    ?>
">
							<a href="<?php 
    echo GalleryHtmlHelper::retainquery('orderby=modified&order=' . ($orderby == "modified" ? $otherorder : "asc"));
    ?>
">
								<span><?php 
    _e('Date', $this->plugin_name);
    ?>
</span>
								<span class="sorting-indicator"></span>
							</a>
						</th>
					</tr>
				</tfoot>
				<tbody>
					<?php 
    foreach ($galleries as $gallery) {
        ?>
コード例 #2
0
    /**


     * WHERE conditions


     * This should be an array


     *


     */
    var $where = '';
    /**


     * ORDER condition


     *


     */
    var $order = array('modified', "DESC");
    var $plugin_url = '';
    var $sub = '';
    var $parent = '';
    var $allcount = 0;
    var $allRecords = array();
    var $pagination = '';
    function GalleryPaginate($table = '', $fields = '', $sub = '', $parent = '')
    {
        $this->sub = $sub;
        $this->parentd = $parent;
        if (!empty($table)) {
            $this->table = $table;
        }
        if (!empty($fields)) {
            $this->fields = $fields;
        }
    }
    function start_paging($page = '')
    {
        global $wpdb;
        $page = empty($page) ? 1 : $page;
        if (!empty($page)) {
            $this->page = $page;
        }
        if (!empty($this->fields)) {
            if (is_array($this->fields)) {
                $this->fields = implode(", ", $this->fields);
            }
        }
        $query = "SELECT " . $this->fields . " FROM `" . $this->table . "`";
        $countquery = "SELECT COUNT(*) FROM `" . $this->table . "`";
        //check if some conditions where passed.
        if (!empty($this->where)) {
            //append the "WHERE" command to the query
            $query .= " WHERE";
            $countquery .= " WHERE";
            $c = 1;
            foreach ($this->where as $key => $val) {
                if (!empty($val) && is_array($val)) {
                    $k = 1;
                    foreach ($val as $vkey => $vval) {
                        if (eregi("LIKE", $val)) {
                            $query .= " `" . $key . "` " . $vval . "";
                            $countquery .= " `" . $key . "` " . $vval . "";
                        } elseif (preg_match("/SE (.*)/si", $vval, $vmatches)) {
                            if (!empty($vmatches[1])) {
                                $query .= " `" . $key . "` <= " . $vmatches[1] . "";
                                $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";
                            }
                        } elseif (preg_match("/LE (.*)/si", $vval, $vmatches)) {
                            if (!empty($vmatches[1])) {
                                $query .= " `" . $key . "` >= " . $vmatches[1] . "";
                                $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
                            }
                        } else {
                            $query .= " `" . $key . "` = '" . $vval . "'";
                            $countquery .= " `" . $key . "` = '" . $vval . "'";
                        }
                        if ($k < count($val)) {
                            $query .= " AND";
                            $countquery .= " AND";
                        }
                        $k++;
                        $vmatches = false;
                    }
                } else {
                    if (eregi("LIKE", $val)) {
                        $query .= " `" . $key . "` " . $val . "";
                        $countquery .= " `" . $key . "` " . $val . "";
                    } elseif (preg_match("/SE (.*)/si", $val, $vmatches)) {
                        if (!empty($vmatches[1])) {
                            $query .= " `" . $key . "` <= " . $vmatches[1] . "";
                            $countquery .= " `" . $key . "` <= " . $vmatches[1] . "";
                        }
                    } elseif (preg_match("/LE (.*)/si", $val, $vmatches)) {
                        if (!empty($vmatches[1])) {
                            $query .= " `" . $key . "` >= " . $vmatches[1] . "";
                            $countquery .= " `" . $key . "` >= " . $vmatches[1] . "";
                        }
                    } else {
                        $query .= " `" . $key . "` = '" . $val . "'";
                        $countquery .= " `" . $key . "` = '" . $val . "'";
                    }
                    if ($c < count($this->where)) {
                        $query .= " AND";
                        $countquery .= " AND";
                    }
                    $c++;
                    $vmatches = false;
                }
コード例 #3
0
    echo GalleryHtmlHelper::retainquery('orderby=modified&order=' . ($orderby == "modified" ? $otherorder : "asc"));
    ?>
">
								<span><?php 
    _e('Date', $this->plugin_name);
    ?>
</span>
								<span class="sorting-indicator"></span>
							</a>
						</th>
						<th class="column-order <?php 
    echo $orderby == "order" ? 'sorted ' . $order : 'sortable desc';
    ?>
">
							<a href="<?php 
    echo GalleryHtmlHelper::retainquery('orderby=order&order=' . ($orderby == "order" ? $otherorder : "asc"));
    ?>
">
								<span><?php 
    _e('Order', $this->plugin_name);
    ?>
</span>
								<span class="sorting-indicator"></span>
							</a>
						</th>
					</tr>
				</tfoot>
				<tbody>
					<?php 
    foreach ($slides as $slide) {
        ?>