本文整理汇总了PHP中Shopp类的典型用法代码示例。如果您正苦于以下问题:PHP Shopp类的具体用法?PHP Shopp怎么用?PHP Shopp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shopp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin
/**
* Boot up the core plugin
*
* @author Jonathan Davis
* @since 1.3
*
* @return void
**/
public static function plugin()
{
global $Shopp;
// Provide global for backwards compatibility
$Shopp = Shopp::object();
do_action('shopp_loaded');
}
示例2: shopp_register_collection
/**
* Registers a smart collection of products
*
* @api
* @since 1.2
*
* @param string $name Class name of the smart collection
* @return void
**/
function shopp_register_collection($name = '')
{
if (empty($name)) {
shopp_debug(__FUNCTION__ . " failed: Collection name required.");
return false;
}
$Shopp = Shopp::object();
$namespace = apply_filters('shopp_smart_collections_slug', SmartCollection::$namespace);
$permastruct = SmartCollection::$taxon;
$slugs = SmartCollection::slugs($name);
$slug = $slugs[0];
$Shopp->Collections[$slug] = $name;
do_action('shopp_register_collection', $name, $slug);
$slugs = SmartCollection::slugs($name);
add_rewrite_tag("%{$permastruct}%", "([^/]+)");
add_permastruct($permastruct, ShoppPages()->baseslug() . "/{$namespace}/%shopp_collection%", false);
add_filter($permastruct . '_rewrite_rules', array('ProductCollection', 'pagerewrites'));
$apicall = create_function('$result, $options, $O', 'ShoppCollection( new ' . $name . '($options) );
return ShoppStorefrontThemeAPI::category($result, $options, $O);');
foreach ((array) $slugs as $collection) {
$collection = str_replace(array('-', '_'), '', $collection);
// Sanitize slugs
add_filter('shopp_themeapi_storefront_' . $collection . 'products', $apicall, 10, 3);
// @deprecated
add_filter('shopp_themeapi_storefront_' . $collection . 'collection', $apicall, 10, 3);
}
// Add special default permalink handling for collection URLs (only add it once)
global $wp_rewrite;
if (!$wp_rewrite->using_permalinks() && false === has_filter('term_link', array('SmartCollection', 'defaultlinks'))) {
add_filter('term_link', array('SmartCollection', 'defaultlinks'), 10, 3);
}
}
示例3: screen
public function screen()
{
if (!current_user_can('shopp_settings')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
// Welcome screen handling
if (!empty($_POST['setup'])) {
shopp_set_setting('display_welcome', 'off');
}
$countries = ShoppLookup::countries();
$basecountry = ShoppBaseLocale()->country();
$countrymenu = Shopp::menuoptions($countries, $basecountry, true);
$basestates = ShoppLookup::country_zones(array($basecountry));
$statesmenu = '';
if (!empty($basestates)) {
$statesmenu = Shopp::menuoptions($basestates[$basecountry], ShoppBaseLocale()->state(), true);
}
$targets = shopp_setting('target_markets');
if (is_array($targets)) {
$targets = array_map('stripslashes', $targets);
}
if (!$targets) {
$targets = array();
}
$zones_ajaxurl = wp_nonce_url(admin_url('admin-ajax.php'), 'wp_ajax_shopp_country_zones');
include $this->ui('setup.php');
}
示例4: settings_meta_box
function settings_meta_box($Customer)
{
?>
<p>
<span>
<input type="hidden" name="marketing" value="no" />
<input type="checkbox" id="marketing" name="marketing" value="yes"<?php
echo $Customer->marketing == 'yes' ? ' checked="checked"' : '';
?>
/>
<label for="marketing" class="inline"> <?php
_e('Subscribes to marketing', 'Shopp');
?>
</label>
</span>
</p>
<br class="clear" />
<p>
<span>
<select name="type"><?php
echo Shopp::menuoptions(Lookup::customer_types(), $Customer->type);
?>
</select>
<label for="type"><?php
_e('Customer Type', 'Shopp');
?>
</label>
</span>
</p>
<br class="clear" />
<?php
do_action('shopp_customer_editor_settings', $Customer);
}
示例5: screen
public function screen()
{
$status = 'available';
if (!is_dir($this->theme_path)) {
$status = 'directory';
} else {
if (!is_writable($this->theme_path)) {
$status = 'permissions';
} else {
$builtin = array_filter(scandir($this->template_path), 'filter_dotfiles');
$theme = array_filter(scandir($this->theme_path), 'filter_dotfiles');
if (empty($theme)) {
$status = 'ready';
} elseif (array_diff($builtin, $theme)) {
$status = 'incomplete';
}
}
}
$category_views = array('grid' => Shopp::__('Grid'), 'list' => Shopp::__('List'));
$row_products = array(2, 3, 4, 5, 6, 7);
$productOrderOptions = ProductCategory::sortoptions();
$productOrderOptions['custom'] = Shopp::__('Custom');
$orderOptions = array('ASC' => Shopp::__('Order'), 'DESC' => Shopp::__('Reverse Order'), 'RAND' => Shopp::__('Shuffle'));
$orderBy = array('sortorder' => Shopp::__('Custom arrangement'), 'created' => Shopp::__('Upload date'));
include $this->ui('presentation.php');
}
示例6: updates
public function updates()
{
if (!isset($_POST['resetlog'])) {
return;
}
ShoppErrorLogging()->reset();
$this->notice(Shopp::__('The log file has been reset.'));
}
示例7: widget
function widget($args, $options)
{
$Shopp = Shopp::object();
extract($args);
$title = $before_title . $options['title'] . $after_title;
unset($options['title']);
if (empty(ShoppCollection()->id)) {
return false;
}
$menu = shopp(ShoppCollection(), 'get-section-list', $options);
echo $before_widget . $title . $menu . $after_widget;
}
示例8: widget
function widget($args, $options)
{
$Shopp = Shopp::object();
extract($args);
$title = $before_title . $options['title'] . $after_title;
unset($options['title']);
$content = shopp('storefront', 'get-sideproduct', $options);
if (empty($content)) {
return false;
}
echo $before_widget . $title . $content . $after_widget;
}
示例9: InlineStyles
static function InlineStyles($message)
{
if (false === strpos($message, '<html')) {
return $message;
}
$cssfile = Shopp::locate_template(array('email.css'));
$stylesheet = file_get_contents($cssfile);
if (!empty($stylesheet)) {
$Emogrifier = new Emogrifier($message, $stylesheet);
$message = $Emogrifier->emogrify();
}
return $message;
}
示例10: widget
function widget($args, $options)
{
$Shopp = Shopp::object();
if (!empty($args)) {
extract($args);
}
if (empty($options['title'])) {
$options['title'] = __('Shop Search', 'Shopp');
}
$title = $before_title . $options['title'] . $after_title;
$content = shopp('catalog', 'get-searchform');
echo $before_widget . $title . $content . $after_widget;
}
示例11: widget
function widget($args, $options)
{
$Shopp = Shopp::object();
if (!empty($args)) {
extract($args);
}
if (empty($options['title'])) {
$options['title'] = "Product Tags";
}
$title = $before_title . $options['title'] . $after_title;
$tagcloud = shopp('catalog', 'get-tagcloud', $options);
echo $before_widget . $title . $tagcloud . $after_widget;
}
示例12: screen
public function screen()
{
$Shopp = Shopp::object();
if (!current_user_can('shopp_settings_checkout')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
$next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1");
$next_setting = shopp_setting('next_order_id');
if ($next->id > $next_setting) {
$next_setting = $next->id;
}
$term_recount = false;
if (!empty($_POST['save'])) {
check_admin_referer('shopp-setup-management');
$next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']);
if ($next_order_id >= $next->id) {
if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) {
$next_setting = $next_order_id;
}
}
$_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']);
// Recount terms when this setting changes
if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) {
$term_recount = true;
}
shopp_set_formsettings();
$this->notice(Shopp::__('Management settings saved.'), 'notice', 20);
}
if ($term_recount) {
$taxonomy = ProductCategory::$taxon;
$terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
if (!empty($terms)) {
wp_update_term_count_now($terms, $taxonomy);
}
}
$states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels()));
$statusLabels = shopp_setting('order_status');
$statesLabels = shopp_setting('order_states');
$reasonLabels = shopp_setting('cancel_reasons');
if (empty($reasonLabels)) {
$reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp'));
}
$promolimit = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20', '25');
$lowstock = shopp_setting('lowstock_level');
if (empty($lowstock)) {
$lowstock = 0;
}
include $this->ui('management.php');
}
示例13: shopp_admin_add_submenu
/**
* Add a sub-menu to a Shopp menu
*
* @api
* @since 1.3
*
* @param string $label The translated label to use for the menu
* @param string $page The Shopp-internal menu page name (plugin prefix will be automatically added)
* @param string $menu The Shopp-internal menu page name to append the submenu to
* @param mixed $handler The callback handler to use to handle the page
* @param string $access The access capability required to see the menu
* @return integer The position the menu was added
**/
function shopp_admin_add_submenu($label, $page, $menu = null, $handler = false, $access = null)
{
$Admin = ShoppAdmin();
if (is_null($menu)) {
$Admin->mainmenu();
}
if (is_null($access)) {
$access = 'none';
}
// Restrict access by default
if (false === $handler) {
$handler = array(Shopp::object()->Flow, 'admin');
}
if (!is_callable($handler)) {
shopp_debug(__FUNCTION__ . " failed: The specified callback handler is not valid.");
return false;
}
$menupage = add_submenu_page($menu, $label, $label, $access, $page, $handler);
$Admin->menu($page, $menupage);
$Admin->addtab($page, $menu);
do_action("shopp_add_menu_{$page}");
return $menupage;
}
示例14: column_title
public function column_title($Item)
{
$title = empty($Item->title) ? '(' . Shopp::__('not set') . ')' : $Item->title;
$edit_link = wp_nonce_url(add_query_arg('edit', $Item->id), 'shopp-settings-pages');
echo '<a class="row-title edit" href="' . $edit_link . '" title="' . Shopp::__('Edit') . ' "' . esc_attr($title) . '"">' . esc_html($title) . '</a>';
echo $this->row_actions(array('edit' => '<a class="edit" href="' . $edit_link . '">' . __('Edit') . '</a>'));
}
示例15: bloginfo
?>
,
uidir = '<?php
echo SHOPP_ADMIN_URI;
?>
',
siteurl = '<?php
bloginfo('url');
?>
',
screenid = '<?php
echo get_current_screen()->id;
?>
',
canonurl = '<?php
echo trailingslashit(Shopp::url());
?>
',
adminurl = '<?php
echo admin_url();
?>
',
sugg_url = '<?php
echo wp_nonce_url(admin_url('admin-ajax.php'), "wp_ajax_shopp_storage_suggestions");
?>
',
tagsugg_url = '<?php
echo wp_nonce_url(admin_url('admin-ajax.php'), "wp_ajax_shopp_suggestions");
?>
',
spectemp_url = '<?php