本文整理匯總了PHP中sDB::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP sDB::select方法的具體用法?PHP sDB::select怎麽用?PHP sDB::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sDB
的用法示例。
在下文中一共展示了sDB::select方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: screen
public function screen()
{
if (!current_user_can('shopp_promotions')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$table = ShoppDatabaseObject::tablename(ShoppPromo::$table);
$defaults = array('page' => false, 'status' => false, 'type' => false, 'paged' => 1, 'per_page' => 20, 's' => '');
$args = array_merge($defaults, $_GET);
extract($args, EXTR_SKIP);
$url = add_query_arg(array_merge($_GET, array('page' => $this->page)), admin_url('admin.php'));
$f = array('action', 'selected', 's');
$url = remove_query_arg($f, $url);
$pagenum = absint($paged);
$start = $per_page * ($pagenum - 1);
$where = array();
if (!empty($s)) {
$where[] = "name LIKE '%{$s}%'";
}
if ($status) {
$datesql = ShoppPromo::activedates();
switch (strtolower($status)) {
case 'active':
$where[] = "status='enabled' AND {$datesql}";
break;
case 'inactive':
$where[] = "status='enabled' AND NOT {$datesql}";
break;
case 'enabled':
$where[] = "status='enabled'";
break;
case 'disabled':
$where[] = "status='disabled'";
break;
}
}
if ($type) {
switch (strtolower($type)) {
case 'catalog':
$where[] = "target='Catalog'";
break;
case 'cart':
$where[] = "target='Cart'";
break;
case 'cartitem':
$where[] = "target='Cart Item'";
break;
}
}
$select = sDB::select(array('table' => $table, 'columns' => 'SQL_CALC_FOUND_ROWS *', 'where' => $where, 'orderby' => 'created DESC', 'limit' => "{$start},{$per_page}"));
$Promotions = sDB::query($select, 'array');
$count = sDB::found();
$num_pages = ceil($count / $per_page);
$ListTable = ShoppUI::table_set_pagination($this->id, $count, $num_pages, $per_page);
$states = array('active' => __('Active', 'Shopp'), 'inactive' => __('Not Active', 'Shopp'), 'enabled' => __('Enabled', 'Shopp'), 'disabled' => __('Disabled', 'Shopp'));
$types = array('catalog' => __('Catalog Discounts', 'Shopp'), 'cart' => __('Cart Discounts', 'Shopp'), 'cartitem' => __('Cart Item Discounts', 'Shopp'));
$num_pages = ceil($count / $per_page);
$page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'total' => $num_pages, 'current' => $pagenum));
include $this->ui('discounts.php');
}
示例2: prepare_items
public function prepare_items()
{
$defaults = array('paged' => 1, 'per_page' => 25, 'action' => false, 'selected' => array());
$args = array_merge($defaults, $_GET);
extract($args, EXTR_SKIP);
$start = $per_page * ($paged - 1);
$edit = false;
$ImageSetting = new ShoppImageSetting($edit);
$table = $ImageSetting->_table;
$columns = 'SQL_CALC_FOUND_ROWS *';
$where = array("type='{$ImageSetting->type}'", "context='{$ImageSetting->context}'");
$limit = "{$start},{$per_page}";
$options = compact('columns', 'useindex', 'table', 'joins', 'where', 'groupby', 'having', 'limit', 'orderby');
$query = sDB::select($options);
$this->items = sDB::query($query, 'array', array($ImageSetting, 'loader'));
$found = sDB::found();
$json = array();
$skip = array('created', 'modified', 'numeral', 'context', 'type', 'sortorder', 'parent');
foreach ($this->items as &$Item) {
if (method_exists($Item, 'json')) {
$json[$Item->id] = $Item->json($skip);
}
}
shopp_custom_script('imageset', 'var images = ' . json_encode($json) . ';');
$this->set_pagination_args(array('total_items' => $found, 'total_pages' => $found / $per_page, 'per_page' => $per_page));
}
示例3: screen
public function screen()
{
global $wpdb;
$defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'paged' => false, 'per_page' => 20, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
$args = array_merge($defaults, $_GET);
extract($args, EXTR_SKIP);
if ($page == ShoppAdmin::pagename('customers') && !empty($deleting) && !empty($selected) && is_array($selected) && current_user_can('shopp_delete_customers')) {
foreach ($selected as $deletion) {
$Customer = new ShoppCustomer($deletion);
$Billing = new BillingAddress($Customer->id, 'customer');
$Billing->delete();
$Shipping = new ShippingAddress($Customer->id, 'customer');
$Shipping->delete();
$Customer->delete();
}
}
$updated = false;
// if (!empty($_POST['save'])) {
// check_admin_referer('shopp-save-customer');
// $wp_integration = ('wordpress' === shopp_setting( 'account_system' ));
//
// if ($_POST['id'] !== 'new') {
// $Customer = new ShoppCustomer($_POST['id']);
// $Billing = new BillingAddress($Customer->id, 'customer');
// $Shipping = new ShippingAddress($Customer->id, 'customer');
// } else $Customer = new ShoppCustomer();
//
// if (!empty($Customer->wpuser)) $user = get_user_by('id',$Customer->wpuser);
// $new_customer = empty( $Customer->id );
//
// $Customer->updates($_POST);
//
// // Reassign WordPress login
// if ($wp_integration && isset($_POST['userlogin']) && $_POST['userlogin'] != $user->user_login) {
// $newlogin = get_user_by('login', $_POST['userlogin']);
// if ( ! empty($newlogin->ID) ) {
// if (sDB::query("SELECT count(*) AS used FROM $Customer->_table WHERE wpuser=$newlogin->ID",'auto','col','used') == 0) {
// $Customer->wpuser = $newlogin->ID;
// $updated = sprintf(__('Updated customer login to %s.','Shopp'),"<strong>$newlogin->user_login</strong>");
// } else $updated = sprintf(__('Could not update customer login to "%s" because that user is already assigned to another customer.','Shopp'),'<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
//
// } else $updated = sprintf(__('Could not update customer login to "%s" because the user does not exist in WordPress.','Shopp'),'<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
// if ( empty($_POST['userlogin']) ) $Customer->wpuser = 0;
// }
//
// if ( ! empty($_POST['new-password']) && !empty($_POST['confirm-password'])
// && $_POST['new-password'] == $_POST['confirm-password']) {
// $Customer->password = wp_hash_password($_POST['new-password']);
// if (!empty($Customer->wpuser)) wp_set_password($_POST['new-password'], $Customer->wpuser);
// }
//
// $valid_email = filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL );
// $password = !empty( $_POST['new_password'] );
//
// if ($wp_integration && $new_customer && $valid_email && $password) {
// $Customer->loginname = $_POST['userlogin'];
// $Customer->email = $_POST['email'];
// $Customer->firstname = $_POST['firstname'];
// $Customer->lastname = $_POST['lastname'];
//
// $return = $Customer->create_wpuser();
//
// if ( $return ) {
// $updated = sprintf( __( 'The Shopp and WordPress accounts have been created with the username "%s".', 'Shopp'), '<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
// } else {
// $updated = sprintf( __( 'Could not create a WordPress account for customer "%s".','Shopp'), '<strong>'.sanitize_user($_POST['userlogin']).'</strong>');
// }
// }
// elseif ($new_customer && ( !$valid_email || !$password ) ) {
// $updated = __( 'Could not create new user. You must enter a valid email address and a password first.', 'Shopp' );
// $no_save = true;
// }
//
// if ( !isset( $new_save ) ) {
// $Customer->info = false; // No longer used from DB
// $Customer->save();
// }
//
//
// if (isset($_POST['info']) && !empty($_POST['info'])) {
// foreach ((array)$_POST['info'] as $id => $info) {
// $Meta = new ShoppMetaObject($id);
// $Meta->value = $info;
// $Meta->save();
// }
// }
//
// if (isset($Customer->id)) $Billing->customer = $Customer->id;
// $Billing->updates($_POST['billing']);
// $Billing->save();
//
// if (isset($Customer->id)) $Shipping->customer = $Customer->id;
// $Shipping->updates($_POST['shipping']);
// $Shipping->save();
// if (!$updated) __('Customer updated.','Shopp');
// $Customer = false;
//
// }
$pagenum = absint($paged);
if (empty($pagenum)) {
//.........這裏部分代碼省略.........
示例4: __construct
private function __construct()
{
$ImageSetting = new ShoppImageSetting();
$table = $ImageSetting->_table;
$where = array("type='{$ImageSetting->type}'", "context='{$ImageSetting->context}'");
$options = compact('table', 'where');
$query = sDB::select($options);
$this->populate(sDB::query($query, 'array', array($ImageSetting, 'loader'), false, 'name'));
$this->found = sDB::found();
}
示例5: images
public function images()
{
if (!current_user_can('shopp_settings')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$defaults = array('paged' => 1, 'per_page' => 25, 'action' => false, 'selected' => array());
$args = array_merge($defaults, $_REQUEST);
extract($args, EXTR_SKIP);
$edit = false;
if (isset($_GET['id'])) {
$edit = (int) $_GET['id'];
if ('new' == $_GET['id']) {
$edit = 'new';
}
}
if (isset($_GET['delete']) || 'delete' == $action) {
check_admin_referer('shopp-settings-images');
if (!empty($_GET['delete'])) {
$selected[] = (int) $_GET['delete'];
}
$selected = array_filter($selected);
foreach ($selected as $delete) {
$Record = new ImageSetting((int) $delete);
$Record->delete();
}
}
if (!empty($_POST['save'])) {
check_admin_referer('shopp-settings-images');
$ImageSetting = new ImageSetting($edit);
$_POST['name'] = sanitize_title_with_dashes($_POST['name']);
$_POST['sharpen'] = floatval(str_replace('%', '', $_POST['sharpen']));
$ImageSetting->updates($_POST);
if (!empty($ImageSetting->name)) {
$ImageSetting->save();
}
}
$start = $per_page * ($paged - 1);
$ImageSetting = new ImageSetting($edit);
$table = $ImageSetting->_table;
$columns = 'SQL_CALC_FOUND_ROWS *';
$where = array("type='{$ImageSetting->type}'", "context='{$ImageSetting->context}'");
$limit = "{$start},{$per_page}";
$options = compact('columns', 'useindex', 'table', 'joins', 'where', 'groupby', 'having', 'limit', 'orderby');
$query = sDB::select($options);
$settings = sDB::query($query, 'array', array($ImageSetting, 'loader'));
$total = sDB::found();
$num_pages = ceil($total / $per_page);
$ListTable = ShoppUI::table_set_pagination($this->screen, $total, $num_pages, $per_page);
$fit_menu = $ImageSetting->fit_menu();
$quality_menu = $ImageSetting->quality_menu();
$actions_menu = array('delete' => __('Delete', 'Shopp'));
$json_settings = array();
$skip = array('created', 'modified', 'numeral', 'context', 'type', 'sortorder', 'parent');
foreach ($settings as &$Setting) {
if (method_exists($Setting, 'json')) {
$json_settings[$Setting->id] = $Setting->json($skip);
}
}
include $this->ui('images.php');
}
示例6: load
//.........這裏部分代碼省略.........
$this->pagination = $hardlimit;
}
$start = $this->pagination * ($this->page - 1);
$limit = "{$start},{$this->pagination}";
} else {
$limit = $hardlimit;
}
$limited = false;
// Flag that the result set does not have forced limits
} else {
$limited = true;
}
// The result set has forced limits
// Core query components
// Load core product data and product summary columns
$cols = array('p.ID', 'p.post_title', 'p.post_name', 'p.post_excerpt', 'p.post_status', 'p.post_date', 'p.post_modified', 's.modified AS summed', 's.sold', 's.grossed', 's.maxprice', 's.minprice', 's.ranges', 's.taxed', 's.stock', 's.lowstock', 's.inventory', 's.featured', 's.variants', 's.addons', 's.sale');
if ($ids) {
$cols = array('p.ID');
}
$columns = "SQL_CALC_FOUND_ROWS " . join(',', $cols) . ($columns !== false ? ',' . $columns : '');
$table = "{$Processing->_table} AS p";
$where[] = "p.post_type='" . ShoppProduct::posttype() . "'";
$joins[$summary_table] = "LEFT OUTER JOIN {$summary_table} AS s ON s.product=p.ID";
$options = compact('columns', 'useindex', 'table', 'joins', 'where', 'groupby', 'having', 'limit', 'orderby');
// Alphabetic pagination
if ('alpha' === $pagination || preg_match('/(0\\-9|[A-Z])/', $page)) {
// Setup Roman alphabet navigation
$alphanav = array_merge(array('0-9'), range('A', 'Z'));
$this->alpha = array_combine($alphanav, array_fill(0, count($alphanav), 0));
// Setup alphabetized index query
$a = $options;
$a['columns'] = "count(DISTINCT p.ID) AS total,IF(LEFT(p.post_title,1) REGEXP '[0-9]',LEFT(p.post_title,1),LEFT(SOUNDEX(p.post_title),1)) AS letter";
$a['groupby'] = "letter";
$alphaquery = sDB::select($a);
$cachehash = 'collection_alphanav_' . md5($alphaquery);
$cached = Shopp::cache_get($cachehash, 'shopp_collection_alphanav');
if ($cached) {
// Load from object cache, if available
$this->alpha = $cached;
$cached = false;
} else {
// Run query and cache results
$expire = apply_filters('shopp_collection_cache_expire', 43200);
$alpha = sDB::query($alphaquery, 'array', array($this, 'alphatable'));
Shopp::cache_set($cachehash, $alpha, 'shopp_collection_alphanav', $expire);
}
$this->paged = true;
if ($this->page == 1) {
$this->page = '0-9';
}
$alphafilter = $this->page == "0-9" ? "(LEFT(p.post_title,1) REGEXP '[0-9]') = 1" : "IF(LEFT(p.post_title,1) REGEXP '[0-9]',LEFT(p.post_title,1),LEFT(SOUNDEX(p.post_title),1))='{$this->page}'";
$options['where'][] = $alphafilter;
}
$query = sDB::select(apply_filters('shopp_collection_query', $options));
if ($debug) {
echo $query . BR . BR;
}
// Load from cached results if available, or run the query and cache the results
$cachehash = 'collection_' . md5($query);
$cached = Shopp::cache_get($cachehash, 'shopp_collection');
if ($cached) {
$this->products = $cached->products;
$this->total = $cached->total;
} else {
$expire = apply_filters('shopp_collection_cache_expire', 43200);
$cache = new stdClass();
示例7: loader
//.........這裏部分代碼省略.........
$ps = ShoppDatabaseObject::tablename(ProductSummary::$table);
$orderdirs = array('asc', 'desc');
if (in_array($order, $orderdirs)) {
$orderd = strtolower($order);
} else {
$orderd = 'asc';
}
if (isset($subs[$this->view]['order'])) {
$order = $subs[$this->view]['order'];
}
$ordercols = '';
switch ($orderby) {
case 'name':
$order = 'title';
if ('desc' == $orderd) {
$order = 'reverse';
}
break;
case 'price':
$order = 'lowprice';
if ('desc' == $orderd) {
$order = 'highprice';
}
break;
case 'date':
$order = 'newest';
if ('desc' == $orderd) {
$order = 'oldest';
}
break;
case 'sold':
$ordercols = 's.sold ' . $orderd;
break;
case 'gross':
$ordercols = 's.grossed ' . $orderd;
break;
case 'inventory':
$ordercols = 's.stock ' . $orderd;
break;
case 'sku':
$ordercols = 'pt.sku ' . $orderd;
break;
}
if (in_array($this->view, array('onsale', 'featured', 'inventory'))) {
$joins[$ps] = "INNER JOIN {$ps} AS s ON p.ID=s.product";
}
$loading = array('where' => $where, 'joins' => $joins, 'limit' => "{$start},{$per_page}", 'load' => array('categories', 'coverimages'), 'published' => false, 'order' => $order, 'nostock' => true);
if (!empty($ordercols)) {
unset($loading['order']);
$loading['orderby'] = $ordercols;
}
if ($is_inventory) {
// Override for inventory products
$where[] = "(pt.context='product' OR pt.context='variation') AND pt.type != 'N/A'";
$loading = array('columns' => "pt.id AS stockid,IF(pt.context='variation',CONCAT(p.post_title,': ',pt.label),p.post_title) AS post_title,pt.sku AS sku,pt.stock AS stock", 'joins' => array_merge(array($pt => "LEFT JOIN {$pt} AS pt ON p.ID=pt.product"), $joins), 'where' => $where, 'groupby' => 'pt.id', 'orderby' => str_replace('s.', 'pt.', $ordercols), 'limit' => "{$start},{$per_page}", 'nostock' => true, 'published' => false);
}
// Override loading product meta and limiting by pagination in the workflow list
if ($workflow) {
unset($loading['limit']);
$loading['ids'] = true;
$loading['pagination'] = false;
$loading['load'] = array();
}
$this->products = new ProductCollection();
$this->products->load($loading);
// Overpagination protection, redirect to page 1 if the requested page doesn't exist
$num_pages = ceil($this->products->total / $per_page);
if ($paged > 1 && $paged > $num_pages) {
Shopp::redirect(add_query_arg('paged', null, $url));
}
// Return a list of product keys for workflow list requests
if ($workflow) {
return $this->products->worklist();
}
// Get sub-screen counts
$subcounts = Shopp::cache_get('shopp_product_subcounts', 'shopp_admin');
if ($subcounts) {
foreach ($subcounts as $name => $total) {
if (isset($subs[$name])) {
$subs[$name]['total'] = $total;
}
}
} else {
$subcounts = array();
foreach ($subs as $name => &$subquery) {
$subquery['total'] = 0;
$query = array('columns' => "count(*) AS total", 'table' => "{$pd} as p", 'joins' => array(), 'where' => array());
$query = array_merge($query, $subquery);
$query['where'][] = "p.post_type='shopp_product'";
if (in_array($name, array('onsale', 'bestselling', 'featured', 'inventory'))) {
$query['joins'][$ps] = "INNER JOIN {$ps} AS s ON p.ID=s.product";
}
$query = sDB::select($query);
$subquery['total'] = sDB::query($query, 'auto', 'col', 'total');
$subcounts[$name] = $subquery['total'];
}
Shopp::cache_set('shopp_product_subcounts', $subcounts, 'shopp_admin');
}
$this->subs = $subs;
}
示例8: select_customer
public function select_customer()
{
check_admin_referer('wp_ajax_shopp_select_customer');
$defaults = array('page' => false, 'paged' => 1, 'per_page' => 7, 'status' => false, 's' => '');
$args = wp_parse_args($_REQUEST, $defaults);
extract($args, EXTR_SKIP);
if (!empty($s)) {
$s = stripslashes($s);
$search = sDB::escape($s);
$where = array();
if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER)) {
foreach ($props as $search) {
$keyword = !empty($search[2]) ? $search[2] : $search[3];
switch (strtolower($search[1])) {
case "company":
$where[] = "c.company LIKE '%{$keyword}%'";
break;
case "login":
$where[] = "u.user_login LIKE '%{$keyword}%'";
break;
case "address":
$where[] = "(b.address LIKE '%{$keyword}%' OR b.xaddress='%{$keyword}%')";
break;
case "city":
$where[] = "b.city LIKE '%{$keyword}%'";
break;
case "province":
case "state":
$where[] = "b.state='{$keyword}'";
break;
case "zip":
case "zipcode":
case "postcode":
$where[] = "b.postcode='{$keyword}'";
break;
case "country":
$where[] = "b.country='{$keyword}'";
break;
}
}
} elseif (strpos($s, '@') !== false) {
$where[] = "c.email LIKE '%{$search}%'";
} elseif (is_numeric($s)) {
$where[] = "c.phone='{$search}'";
} else {
$where[] = "(CONCAT(c.firstname,' ',c.lastname) LIKE '%{$search}%' OR c.company LIKE '%{$s}%' OR u.user_login LIKE '%{$s}%')";
}
$pagenum = absint($paged);
if (empty($pagenum)) {
$pagenum = 1;
}
$index = $per_page * ($pagenum - 1);
$customer_table = ShoppDatabaseObject::tablename(Customer::$table);
$billing_table = ShoppDatabaseObject::tablename(BillingAddress::$table);
$purchase_table = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
global $wpdb;
$users_table = $wpdb->users;
$select = array('columns' => 'SQL_CALC_FOUND_ROWS c.*,city,state,country,user_login', 'table' => "{$customer_table} as c", 'joins' => array($billing_table => "LEFT JOIN {$billing_table} AS b ON b.customer=c.id AND b.type='billing'", $users_table => "LEFT JOIN {$users_table} AS u ON u.ID=c.wpuser AND (c.wpuser IS NULL OR c.wpuser != 0)"), 'where' => $where, 'groupby' => "c.id", 'orderby' => "c.created DESC", 'limit' => "{$index},{$per_page}");
$query = sDB::select($select);
}
// if (!empty($starts) && !empty($ends)) $where[] = ' (UNIX_TIMESTAMP(c.created) >= '.$starts.' AND UNIX_TIMESTAMP(c.created) <= '.$ends.')';
$list = sDB::query($query, 'array', 'index', 'id');
$results = array();
foreach ($list as $entry) {
$results[] = array('id' => $entry->id, 'user' => $entry->user, 'gravatar' => get_avatar($entry->email, 32), 'firstname' => $entry->firstname, 'lastname' => $entry->lastname, 'company' => $entry->company, 'email' => $entry->email, 'lastname' => $entry->lastname, 'phone' => $entry->phone);
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($results);
exit;
$url = admin_url('admin-ajax.php');
?>
<html>
<head>
<link rel="stylesheet" id="wp-admin" href="<?php
echo admin_url('css/wp-admin.css');
?>
" type="text/css" media="all" />
<link rel="stylesheet" id="shopp-admin" href="<?php
echo SHOPP_ADMIN_URI . '/styles/admin.css';
?>
" type="text/css" media="all" />
</head>
<body id="customer-select">
<?php
if (!empty($Customers)) {
?>
<ul>
<?php
foreach ($Customers as $Customer) {
?>
<li><a href="<?php
echo add_query_arg(array('order-action' => 'change-customer', 'page' => $_GET['page'], 'id' => (int) $_GET['id'], 'customerid' => $Customer->id), admin_url('admin.php'));
?>
" target="_parent">
<?php
$wp_user = get_userdata($Customer->wpuser);
$userlink = add_query_arg('user_id', $Customer->wpuser, admin_url('user-edit.php'));
echo get_avatar($Customer->wpuser, 48);
?>
<?php
//.........這裏部分代碼省略.........
示例9: load
/**
* Load active promotions
*
* @author Jonathan Davis
* @since 1.3
*
* @return array List of loaded ShoppOrderPromo objects
**/
public function load()
{
if ($this->loaded) {
return;
}
// Don't load twice in one request
$table = ShoppDatabaseObject::tablename(ShoppPromo::$table);
$where = array("status='enabled'", ShoppPromo::activedates(), "target IN ('" . join("','", self::$targets) . "')");
$orderby = 'target DESC';
$queryargs = compact('table', 'where', 'orderby');
$query = sDB::select($queryargs);
$loaded = sDB::query($query, 'array', array('ShoppPromotions', 'loader'));
if (!$loaded || 0 == count($loaded)) {
return;
}
$this->populate($loaded);
$this->loaded = true;
}
示例10: shopp_collections_meta_box
/**
* Registers the Shopp Collections meta box in the WordPress theme menus screen
*
* @author Jonathan Davis
* @since 1.2
*
* @return void
**/
public static function shopp_collections_meta_box()
{
global $_nav_menu_placeholder, $nav_menu_selected_id;
$Shopp = Shopp::object();
$removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce');
?>
<br />
<div class="shopp-collections-menu-item customlinkdiv" id="shopp-collections-menu-item">
<div id="tabs-panel-shopp-collections" class="tabs-panel tabs-panel-active">
<ul class="categorychecklist form-no-clear">
<?php
$collections = $Shopp->Collections;
foreach ($collections as $slug => $CollectionClass) {
$menu = get_class_property($CollectionClass, '_menu');
if (!$menu) {
continue;
}
$Collection = new $CollectionClass();
$Collection->smart();
$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
?>
<li>
<label class="menu-item-title">
<input type="checkbox" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-shopp-collection]" value="<?php
echo $slug;
?>
" class="menu-item-checkbox" /> <?php
echo esc_html($Collection->name);
?>
</label>
<input type="hidden" class="menu-item-db-id" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-db-id]" value="0" />
<input type="hidden" class="menu-item-object-id" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-object-id]" value="<?php
echo $slug;
?>
" />
<input type="hidden" class="menu-item-object" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-object]" value="<?php
echo $slug;
?>
" />
<input type="hidden" class="menu-item-parent-id" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-parent-id]" value="0">
<input type="hidden" class="menu-item-type" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-type]" value="<?php
echo SmartCollection::$taxon;
?>
" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-title]" value="<?php
echo $Collection->name;
?>
" />
</li>
<?php
}
?>
<?php
// Promo Collections
$select = sDB::select(array('table' => ShoppDatabaseObject::tablename(ShoppPromo::$table), 'columns' => 'SQL_CALC_FOUND_ROWS id,name', 'where' => array("target='Catalog'", "status='enabled'"), 'orderby' => 'created DESC'));
$Promotions = sDB::query($select, 'array');
foreach ($Promotions as $promo) {
$slug = sanitize_title_with_dashes($promo->name);
?>
<li>
<label class="menu-item-title">
<input type="checkbox" name="menu-item[<?php
echo $_nav_menu_placeholder;
?>
][menu-item-shopp-collection]" value="<?php
echo $slug;
?>
" class="menu-item-checkbox" /> <?php
//.........這裏部分代碼省略.........
示例11: images
public function images()
{
$settings = array('gallery-previews' => array('fit' => 'all', 'size' => 240, 'quality' => 100), 'gallery-thumbnails' => array('fit' => 'all', 'size' => 64, 'quality' => 100), 'thumbnails' => array('fit' => 'all', 'size' => 96, 'quality' => 100));
// Determine if any of the default settings exist to prevent overwriting changes
$defaults = array_keys($settings);
$ImageSetting = new ShoppImageSetting();
$options = array('columns' => 'name', 'table' => $ImageSetting->_table, 'where' => array("type='{$ImageSetting->type}'", "context='{$ImageSetting->context}'", "name IN ('" . join("', '", $defaults) . "')"), 'limit' => count($defaults));
$query = sDB::select($options);
$existing = sDB::query($query, 'array', 'col', 'name');
// Get the settings that need setup
$setup = array_diff($defaults, $existing);
foreach ($setup as $setting) {
shopp_set_image_setting($setting, $settings[$setting]);
}
}
示例12: array
" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php
echo $navmenu_placeholder;
?>
][menu-item-title]" value="<?php
echo $Collection->name;
?>
" />
</li>
<?php
}
?>
<?php
// Promo Collections
$select = sDB::select(array('table' => ShoppDatabaseObject::tablename(ShoppPromo::$table), 'columns' => 'SQL_CALC_FOUND_ROWS id,name', 'where' => array("target='Catalog'", "status='enabled'"), 'orderby' => 'created DESC'));
$Promotions = sDB::query($select, 'array');
foreach ((array) $Promotions as $promo) {
$slug = sanitize_title_with_dashes($promo->name);
?>
<li>
<label class="menu-item-title">
<input type="checkbox" name="menu-item[<?php
echo $navmenu_placeholder;
?>
][menu-item-shopp-collection]" value="<?php
echo $slug;
?>
" class="menu-item-checkbox" /> <?php
echo esc_html($promo->name);
?>