本文整理汇总了PHP中Shopp::str_true方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::str_true方法的具体用法?PHP Shopp::str_true怎么用?PHP Shopp::str_true使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shopp
的用法示例。
在下文中一共展示了Shopp::str_true方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the Shopp dashboard widgets
*
* @author Jonathan Davis
* @since 1.0
*
* @return void
**/
public static function init()
{
$dashboard = shopp_setting('dashboard');
if (!(current_user_can('shopp_financials') && Shopp::str_true($dashboard))) {
return false;
}
wp_add_dashboard_widget('dashboard_shopp_stats', __('Sales Stats', 'Shopp'), array(__CLASS__, 'stats_widget'), array('all_link' => '', 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
wp_add_dashboard_widget('dashboard_shopp_orders', __('Recent Orders', 'Shopp'), array(__CLASS__, 'orders_widget'), array('all_link' => 'admin.php?page=' . ShoppAdmin::pagename('orders'), 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
if (shopp_setting_enabled('inventory')) {
wp_add_dashboard_widget('dashboard_shopp_inventory', __('Inventory Monitor', 'Shopp'), array(__CLASS__, 'inventory_widget'), array('all_link' => 'admin.php?page=' . ShoppAdmin::pagename('products'), 'feed_link' => '', 'width' => 'half', 'height' => 'single'));
}
add_action('admin_print_styles-index.php', array(__CLASS__, 'styles'));
}
示例2: updates
public function updates()
{
$builtin_path = SHOPP_PATH . '/templates';
$theme_path = sanitize_path(STYLESHEETPATH . '/shopp');
if (Shopp::str_true($this->form('theme_templates')) && !is_dir($theme_path)) {
$this->form['theme_templates'] = 'off';
$this->notice(Shopp::__("Shopp theme templates can't be used because they don't exist."), 'error');
}
if (empty($this->form('catalog_pagination'))) {
$this->form['catalog_pagination'] = 0;
}
// Recount terms when this setting changes
if ($this->form('outofstock_catalog') != shopp_setting('outofstock_catalog')) {
$taxonomy = ProductCategory::$taxon;
$terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
if (!empty($terms)) {
wp_update_term_count_now($terms, $taxonomy);
}
}
shopp_set_formsettings();
$this->notice(Shopp::__('Presentation settings saved.'), 'notice', 20);
}
示例3: array
if (!$even) {
$classes[] = 'alternate';
}
$even = !$even;
if ($edit !== false && $edit === $index) {
$conditions = array();
foreach ($rules as $ruleid => $rule) {
$condition_template_data = array('${id}' => $edit, '${ruleid}' => $ruleid, '${property_menu}' => menuoptions($propertymenu, $rule['p'], true), '${rulevalue}' => esc_attr($rule['v']));
$conditions[] = str_replace(array_keys($condition_template_data), $condition_template_data, $conditional);
}
$localrates = array();
foreach ($locals as $localename => $localerate) {
$localrateui_data = array('${id}' => $edit, '${localename}' => $localename, '${localerate}' => (double) $localerate);
$localrates[] = str_replace(array_keys($localrateui_data), $localrateui_data, $localrateui);
}
$data = array('${id}' => $edit, '${rate}' => $rate, '${countries}' => menuoptions($countries, $country, true), '${zones}' => !empty($zones[$country]) ? menuoptions(array_merge(array('' => ''), $zones[$country]), $zone, true) : '', '${conditions}' => join('', $conditions), '${haslocals}' => $haslocals, '${localrates}' => join('', $localrates), '${errors}' => $localerror ? '<p class="error">' . $localerror . '</p>' : '', '${compounded}' => Shopp::str_true($compound) ? 'checked="checked"' : '', '${cancel_href}' => $this->url);
if ($conditions) {
$data['no-conditions'] = '';
}
if (!empty($zones[$country])) {
$data['no-zones'] = '';
}
if ($haslocals) {
$data['no-local-rates'] = '';
} else {
$data['has-local-rates'] = '';
}
if (count($locals) > 0) {
$data['instructions'] = 'hidden';
}
echo ShoppUI::template($editor, $data);
示例4: __construct
public function __construct(ShoppReportFramework $Report)
{
$this->ReportClass = get_class($Report);
$this->options = $Report->options;
$Report->load();
$this->columns = $Report->columns();
$this->data = $Report->data;
$this->records = $Report->total;
$report = $this->options['report'];
$settings = shopp_setting("{$report}_report_export");
$this->headings = Shopp::str_true($settings['headers']);
$this->selected = $settings['columns'];
}
示例5: editor
public function editor($Item)
{
extract($Item);
$conditions = array();
foreach ($rules as $ruleid => $rule) {
$conditionals = array('${id}' => $edit, '${ruleid}' => $ruleid, '${property_menu}' => $this->property_menu($rule['p']), '${rulevalue}' => esc_attr($rule['v']));
$conditions[] = str_replace(array_keys($conditionals), $conditionals, $this->template_conditional());
}
$localrates = array();
foreach ($locals as $localename => $localerate) {
$localrate_data = array('${id}' => $edit, '${localename}' => $localename, '${localerate}' => (double) $localerate);
$localrates[] = str_replace(array_keys($localrate_data), $localrate_data, $this->template_localrate());
}
$data = array('${id}' => $id, '${rate}' => percentage($rate, array('precision' => 4)), '${countries}' => menuoptions($this->countries, $country, true), '${zones}' => !empty($zones[$country]) ? menuoptions($zones[$country], $zone, true) : '', '${conditions}' => join('', $conditions), '${haslocals}' => $haslocals, '${localrates}' => join('', $localrates), '${instructions}' => $localerror ? '<p class="error">' . $localerror . '</p>' : $instructions, '${compounded}' => Shopp::str_true($compound) ? 'checked="checked"' : '', '${cancel_href}' => add_query_arg(array('id' => null, '_wpnonce' => null)));
if ($conditions) {
$data['no-conditions'] = '';
}
if (!empty($zones[$country])) {
$data['no-zones'] = '';
}
if ($haslocals) {
$data['no-local-rates'] = '';
} else {
$data['has-local-rates'] = '';
}
if (count($locals) > 0) {
$data['instructions'] = 'hidden';
}
echo ShoppUI::template($this->editor, $data);
}
示例6: shopp_setting_enabled
/**
* Returns true or false if the setting is toggled on or off
*
* @api
* @since 1.2
*
* @param string $name The name of the setting
* @return boolean True is enabled, false is disabled
**/
function shopp_setting_enabled($name)
{
$setting = shopp_setting($name);
return Shopp::str_true($setting);
}
示例7: subtotal
/**
* Provides the subtotal amount of the cart
*
* @api `shopp('cart.subtotal')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* - **wrap**: `on` (on, off) Wrap the amount in DOM-accessible markup
* - **money**: `on` (on, off) Format the amount in the current currency format
* - **number**: `off` (on, off) Provide the unformatted number (floating point)
* - **taxes**: `on` (on, off) Include taxes in the subtotal amount when inclusive taxes are used (or off to exclude them)
* @param ShoppCart $O The working object
* @return string The subtotal amount
**/
public static function subtotal($result, $options, $O)
{
$defaults = array('taxes' => 'on');
$options = array_merge($defaults, $options);
extract($options, EXTR_SKIP);
$subtotal = $O->total('order');
// Handle no-tax option for tax inclusive storefronts
if (!Shopp::str_true($taxes) && shopp_setting_enabled('tax_inclusive')) {
$tax = $O->Totals->entry('tax', 'Tax');
if (is_a($tax, 'OrderAmountItemTax')) {
$subtotal -= $tax->amount();
}
}
return (double) $subtotal;
}
示例8: residential_shipping_address
/**
* Provides a checkbox toggle to mark the shipping address as a residential address
*
* @api `shopp('checkout.residential-shipping-address')`
* @since 1.2
*
* @param string $result The output
* @param array $options The options
* - **label**: `Residential shipping address` The label for the checkbox input
* - **checked**: `on` (on, off) Specifies that an `<input>` element should be pre-selected when the page loads
* - **class**: The class attribute specifies one or more class-names for an element
* - **title**: Specifies extra information about an element
* @param ShoppOrder $O The working object
* @return string Markup for the residential address checkbox toggle
**/
public static function residential_shipping_address($result, $options, $O)
{
$allowed = array('class', 'checked', 'title');
$defaults = array('label' => Shopp::__('Residential shipping address'), 'checked' => 'on');
$options = array_merge($defaults, $options);
extract($options);
if (isset($O->Shipping->residential) && !Shopp::str_true($O->Shipping->residential) || !Shopp::str_true($checked)) {
$options['checked'] = 'off';
}
$_ = array();
$_[] = '<label for="residential-shipping">';
$_[] = '<input type="hidden" name="shipping[residential]" value="no" />';
$_[] = '<input type="checkbox" name="shipping[residential]" value="yes" id="residential-shipping"' . inputattrs($options, $allowed) . ' />';
$_[] = " {$label}</label>";
return join('', $_);
}
示例9: settings_meta_box
function settings_meta_box($Product)
{
$Shopp = Shopp::object();
$Admin =& $Shopp->Flow->Admin;
?>
<p><input type="hidden" name="featured" value="off" /><input type="checkbox" name="featured" value="on" id="featured" tabindex="12" <?php
if ($Product->featured == "on") {
echo ' checked="checked"';
}
?>
/><label for="featured"> <?php
_e('Featured Product', 'Shopp');
?>
</label></p>
<p><input type="hidden" name="variants" value="off" /><input type="checkbox" name="variants" value="on" id="variations-setting" tabindex="13"<?php
if ($Product->variants == "on") {
echo ' checked="checked"';
}
?>
/><label for="variations-setting"> <?php
_e('Variants', 'Shopp');
echo $Admin->boxhelp('product-editor-variations');
?>
</label></p>
<p><input type="hidden" name="addons" value="off" /><input type="checkbox" name="addons" value="on" id="addons-setting" tabindex="13"<?php
if ($Product->addons == "on") {
echo ' checked="checked"';
}
?>
/><label for="addons-setting"> <?php
_e('Add-ons', 'Shopp');
echo $Admin->boxhelp('product-editor-addons');
?>
</label></p>
<?php
if (shopp_setting_enabled('tax_inclusive')) {
?>
<p><input type="hidden" name="meta[excludetax]" value="off" /><input type="checkbox" name="meta[excludetax]" value="on" id="excludetax-setting" tabindex="18" <?php
if (isset($Product->meta['excludetax']) && Shopp::str_true($Product->meta['excludetax']->value)) {
echo 'checked="checked"';
}
?>
/> <label for="excludetax-setting"><?php
_e('Exclude Taxes', 'Shopp');
?>
</label></p>
<?php
}
?>
<?php
if ($Shopp->Shipping->realtime) {
?>
<p><input type="hidden" name="meta[packaging]" value="off" /><input type="checkbox" name="meta[packaging]" value="on" id="packaging-setting" tabindex="18" <?php
if (isset($Product->meta['packaging']) && $Product->meta['packaging']->value == "on") {
echo 'checked="checked"';
}
?>
/> <label for="packaging-setting"><?php
_e('Separate Packaging', 'Shopp');
?>
</label></p>
<?php
}
?>
<p><input type="hidden" name="comment_status" value="closed" /><input type="checkbox" name="comment_status" value="open" id="allow-comments" tabindex="18" <?php
if (Shopp::str_true($Product->comment_status)) {
echo 'checked="checked"';
}
?>
/> <label for="allow-comments"><?php
_e('Comments', 'Shopp');
?>
</label>
<p><input type="hidden" name="ping_status" value="closed" /><input type="checkbox" name="ping_status" value="open" id="allow-trackpings" tabindex="18" <?php
if (Shopp::str_true($Product->ping_status)) {
echo 'checked="checked"';
}
?>
/> <label for="allow-trackpings"><?php
_e('Trackbacks & Pingbacks', 'Shopp');
?>
</label>
<p><input type="hidden" name="meta[processing]" value="off" /><input type="checkbox" name="meta[processing]" value="on" id="process-time" tabindex="18" <?php
if (isset($Product->meta['processing']) && Shopp::str_true($Product->meta['processing']->value)) {
echo 'checked="checked"';
}
?>
/> <label for="process-time"><?php
_e('Processing Time', 'Shopp');
?>
</label>
<div id="processing" class="hide-if-js">
<select name="meta[minprocess]"><?php
//.........这里部分代码省略.........
示例10: _taxed
/**
* Helper to apply or exclude taxes from a single amount based on inclusive tax settings and the tax option
*
* @author Jonathan Davis
* @since 1.3
*
* @param float $amount The amount to add taxes to, or exclude taxes from
* @param ShoppProduct $O The product to get properties from
* @param boolean $istaxed Whether the amount can be taxed
* @param boolean $taxoption The Theme API tax option given the the tag
* @param array $taxrates A list of taxrates that apply to the product and amount
* @return float The amount with tax added or tax excluded
**/
private static function _taxed($amount, ShoppProduct $O, $istaxed, $taxoption = null, array $taxrates = array())
{
if (!$istaxed) {
return $amount;
}
if (empty($taxrates)) {
$taxrates = Shopp::taxrates($O);
}
if (isset($taxoption)) {
$taxoption = Shopp::str_true($taxoption);
}
$inclusivetax = self::_inclusive_taxes($O);
if ($inclusivetax) {
$adjustment = ShoppTax::adjustment($taxrates);
if (1 != $adjustment && false !== $taxoption) {
// Only adjust when taxes are not excluded @see #3041
return (double) ($amount / $adjustment);
}
}
// Handle inclusive/exclusive tax presentation options (product editor setting or api option)
// If the 'taxes' option is specified and the item either has inclusive taxes that apply,
// or the 'taxes' option is forced on (but not both) then handle taxes by either adding or excluding taxes
// This is an exclusive or known as XOR, the lesser known brother of Thor that gets left out of the family get togethers
if (isset($taxoption) && $inclusivetax ^ $taxoption) {
if ($taxoption) {
return ShoppTax::calculate($taxrates, (double) $amount);
} else {
return ShoppTax::exclusive($taxrates, (double) $amount);
}
}
return $amount;
}
示例11: has_faceted_menu
/**
* Checks if the current category has a faceted menu setup
*
* @api `shopp('collection.has-faceted-menu')`
* @since 1.1
*
* @param string $result The output
* @param array $options The options
* @param ShoppCollection $O The working object
* @return bool True if there are faceted menus, false otherwise
**/
public static function has_faceted_menu($result, $options, $O)
{
if (!is_a($O, 'ProductCategory')) {
return false;
}
if (empty($O->meta)) {
$O->load_meta();
}
if (property_exists($O, 'facetedmenus') && Shopp::str_true($O->facetedmenus)) {
$O->load_facets();
return true;
}
return false;
}
示例12: _e
_e('Comments', 'Shopp');
?>
</label>
<p><input type="hidden" name="ping_status" value="closed" /><input type="checkbox" name="ping_status" value="open" id="allow-trackpings" tabindex="18" <?php
if (Shopp::str_true($Product->ping_status)) {
echo 'checked="checked"';
}
?>
/> <label for="allow-trackpings"><?php
_e('Trackbacks & Pingbacks', 'Shopp');
?>
</label>
<p><input type="hidden" name="meta[processing]" value="off" /><input type="checkbox" name="meta[processing]" value="on" id="process-time" tabindex="18" <?php
if (isset($Product->meta['processing']) && Shopp::str_true($Product->meta['processing']->value)) {
echo 'checked="checked"';
}
?>
/> <label for="process-time"><?php
_e('Processing Time', 'Shopp');
?>
</label>
<div id="processing" class="hide-if-js">
<select name="meta[minprocess]"><?php
echo menuoptions(Lookup::timeframes_menu(), isset($Product->meta['minprocess']) ? $Product->meta['minprocess']->value : false, true);
?>
</select> —
<select name="meta[maxprocess]"><?php
echo menuoptions(Lookup::timeframes_menu(), isset($Product->meta['maxprocess']) ? $Product->meta['maxprocess']->value : false, true);
示例13: inputattrs
/**
* Generates attribute markup for HTML inputs based on specified options
*
* @author Jonathan Davis
* @since 1.0
*
* @param array $options An associative array of options
* @param array $allowed (optional) Allowable attribute options for the element
* @return string Attribute markup fragment
**/
public static function inputattrs($options, array $allowed = array())
{
if (!is_array($options)) {
return '';
}
if (empty($allowed)) {
$allowed = array('autocomplete', 'accesskey', 'alt', 'checked', 'class', 'disabled', 'format', 'minlength', 'maxlength', 'placeholder', 'readonly', 'required', 'size', 'src', 'tabindex', 'cols', 'rows', 'title', 'value');
}
$allowed = apply_filters('shopp_allowed_inputattrs', $allowed, $options);
$string = "";
$classes = "";
if (isset($options['label']) && !isset($options['value'])) {
$options['value'] = $options['label'];
}
foreach ($options as $key => $value) {
if (!in_array($key, $allowed)) {
continue;
}
switch ($key) {
case "class":
$classes .= " {$value}";
break;
case "checked":
if (Shopp::str_true($value)) {
$string .= ' checked="checked"';
}
break;
case "disabled":
if (Shopp::str_true($value)) {
$classes .= " disabled";
$string .= ' disabled="disabled"';
}
break;
case "readonly":
if (Shopp::str_true($value)) {
$classes .= " readonly";
$string .= ' readonly="readonly"';
}
break;
case "required":
if (Shopp::str_true($value)) {
$classes .= " required";
}
break;
case "minlength":
$classes .= " min{$value}";
break;
case "format":
$classes .= " {$value}";
break;
default:
$string .= ' ' . $key . '="' . esc_attr($value) . '"';
}
}
if (!empty($classes)) {
$string .= ' class="' . esc_attr(trim($classes)) . '"';
}
return $string;
}
示例14: start_el
/**
* Build the category menu
*
* @since 1.3.1
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $category Category data object.
* @param int $depth Depth of category. Used for padding.
* @param array $args Uses 'selected' and 'products' keys, if they exist. @see wp_dropdown_categories()
*/
public function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0)
{
$pad = str_repeat(' ', $depth * 3);
$link = get_term_link($category);
$cat_name = apply_filters('shopp_storefront_categorylist_option', $category->name, $category);
$output .= "\t<option class=\"level-{$depth}\" value=\"" . $link . "\"";
if ($category->term_id == $args['selected']) {
$output .= ' selected="selected"';
}
$output .= '>';
$output .= $pad . $cat_name;
if (Shopp::str_true($args['products']) && isset($category->count)) {
$output .= ' (' . $category->count . ')';
}
$output .= "</option>\n";
}
示例15: add_item
/**
* packager add item
*
* @author John Dillick
* @since 1.2
*
* @param Item $item the item to add to packages
**/
public function add_item($CartItem)
{
$Item = new ShippingPackageItem($CartItem, $CartItem->quantity);
if (Shopp::str_true($Item->packaging)) {
do_action_ref_array('shopp_packager_add_piece', array($Item, $this));
} else {
do_action_ref_array('shopp_packager_add_' . $this->pack, array($Item, $this));
}
}