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


PHP shopp_custom_script函数代码示例

本文整理汇总了PHP中shopp_custom_script函数的典型用法代码示例。如果您正苦于以下问题:PHP shopp_custom_script函数的具体用法?PHP shopp_custom_script怎么用?PHP shopp_custom_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: prepare_items

 public function prepare_items()
 {
     $this->id = 'pages';
     $settings = ShoppPages()->settings();
     $template = array('id' => '', 'title' => '', 'slug' => '', 'description' => '');
     foreach ($settings as $name => $page) {
         $page['id'] = $name;
         $this->items[$name] = (object) array_merge($template, $page);
     }
     $per_page = 25;
     $total = count($this->items);
     $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
     shopp_custom_script('pageset', 'var pages = ' . json_encode($this->items) . ';');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:14,代码来源:Pages.php

示例2: __construct

 /**
  * Service constructor
  *
  * @return void
  * @author Jonathan Davis
  **/
 public function __construct()
 {
     parent::__construct();
     if (isset($_GET['id'])) {
         wp_enqueue_script('postbox');
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('jquery-tmpl');
         shopp_enqueue_script('orders');
         shopp_localize_script('orders', '$om', array('co' => __('Cancel Order', 'Shopp'), 'mr' => __('Mark Refunded', 'Shopp'), 'pr' => __('Process Refund', 'Shopp'), 'dnc' => __('Do Not Cancel', 'Shopp'), 'ro' => __('Refund Order', 'Shopp'), 'cancel' => __('Cancel', 'Shopp'), 'rr' => __('Reason for refund', 'Shopp'), 'rc' => __('Reason for cancellation', 'Shopp'), 'mc' => __('Mark Cancelled', 'Shopp'), 'stg' => __('Send to gateway', 'Shopp')));
         shopp_enqueue_script('address');
         shopp_custom_script('address', 'var regions = ' . json_encode(Lookup::country_zones()) . ';');
         add_action('load-' . $this->screen, array($this, 'workflow'));
         add_action('load-' . $this->screen, array($this, 'layout'));
         do_action('shopp_order_management_scripts');
     } else {
         add_action('load-' . $this->screen, array($this, 'loader'));
         add_action('admin_print_scripts', array($this, 'columns'));
     }
     do_action('shopp_order_admin_scripts');
 }
开发者ID:jonathandavis,项目名称:shopp,代码行数:26,代码来源:Service.php

示例3: editor

 public static function editor($Customer, $type = 'billing')
 {
     shopp_custom_script('orders', 'var address = [];');
     ob_start();
     include SHOPP_ADMIN_PATH . '/customers/address.php';
     return ob_get_clean();
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:7,代码来源:Customers.php

示例4: footer

 /**
  * Renders footer content and extra scripting as needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function footer()
 {
     $globals = false;
     if (isset($this->behaviors['global'])) {
         $globals = $this->behaviors['global'];
         unset($this->behaviors['global']);
     }
     $script = '';
     if (!empty($globals)) {
         $script .= "\t" . join("\n\t", $globals) . "\n";
     }
     if (!empty($this->behaviors)) {
         $script .= 'jQuery(window).ready(function($){' . "\n";
         $script .= "\t" . join("\t\n", $this->behaviors) . "\n";
         $script .= '});' . "\n";
     }
     shopp_custom_script('shopp', $script);
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:26,代码来源:Storefront.php

示例5: prepare_items

    public function prepare_items()
    {
        $this->id = 'taxrates';
        $defaults = array('paged' => 1, 'per_page' => 25, 'action' => false);
        $args = array_merge($defaults, $_GET);
        extract($args, EXTR_SKIP);
        $rates = (array) shopp_setting('taxrates');
        $this->items = array();
        foreach ($rates as $index => $taxrate) {
            $this->items[$index] = array_merge(self::$template, array('id' => $index), $taxrate);
        }
        $specials = array(ShoppTax::ALL => Shopp::__('All Markets'));
        if (ShoppTax::euvat(false, ShoppBaseLocale()->country(), ShoppTax::EUVAT)) {
            $specials[ShoppTax::EUVAT] = Shopp::__('European Union');
        }
        $this->countries = array_filter(array_merge($specials, (array) shopp_setting('target_markets')));
        $this->zones = ShoppLookup::country_zones();
        $total = count($this->items);
        $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
        shopp_custom_script('taxrates', '
			var suggurl = "' . wp_nonce_url(admin_url('admin-ajax.php'), 'wp_ajax_shopp_suggestions') . '",
				rates   = ' . json_encode($this->items) . ',
				zones   = ' . json_encode($this->zones) . ',
				lookup  = ' . json_encode(ShoppLookup::localities()) . ',
				taxrates = [];
		');
    }
开发者ID:msigley,项目名称:shopp,代码行数:27,代码来源:Taxes.php

示例6: prepare_items


//.........这里部分代码省略.........
        $Shipping->ui();
        // Setup setting UIs
        $settings = array();
        // Registry of loaded settings for table-based shipping rates for JS
        $this->items = array();
        // Registry for activated shipping rate modules
        $this->installed = array();
        // Registry of available shipping modules installed
        foreach ($Shipping->active as $name => $Module) {
            if (version_compare($Shipping->modules[$name]->since, '1.2') == -1) {
                continue;
            }
            // Skip 1.1 modules, they are incompatible
            $default_name = strtolower($name);
            $fullname = $Module->methods();
            $this->installed[$name] = $fullname;
            if ($Module->ui->tables) {
                $defaults[$default_name] = $Module->ui->settings();
                $defaults[$default_name]['name'] = $fullname;
                $defaults[$default_name]['label'] = Shopp::__('Shipping Method');
            }
            if (array_key_exists($name, $active)) {
                $ModuleSetting = $active[$name];
            } else {
                continue;
            }
            // Not an activated shipping module, go to the next one
            $Entry = new StdClass();
            $Entry->id = sanitize_title_with_dashes($name);
            $Entry->label = $Shipping->modules[$name]->name;
            $Entry->type = $Shipping->modules[$name]->name;
            $Entry->setting = $name;
            if ($this->request('id') == $Entry->setting) {
                $Entry->editor = $Module->ui();
            }
            // Setup shipping service shipping rate entries and settings
            if (!is_array($ModuleSetting)) {
                $Entry->destinations = array($Shipping->active[$name]->destinations);
                $this->items[$name] = $Entry;
                continue;
            }
            // Setup shipping calcualtor shipping rate entries and settings
            foreach ($ModuleSetting as $id => $m) {
                $Entry->setting = "{$name}-{$id}";
                $Entry->settings = shopp_setting($Entry->setting);
                if ($this->request('id') == $Entry->setting) {
                    $Entry->editor = $Module->ui();
                }
                if (isset($Entry->settings['label'])) {
                    $Entry->label = $Entry->settings['label'];
                }
                $Entry->destinations = array();
                $min = $max = false;
                if (isset($Entry->settings['table']) && is_array($Entry->settings['table'])) {
                    foreach ($Entry->settings['table'] as $tablerate) {
                        $destination = false;
                        $d = ShippingSettingsUI::parse_location($tablerate['destination']);
                        if (!empty($d['zone'])) {
                            $Entry->destinations[] = $d['zone'] . ' (' . $d['countrycode'] . ')';
                        } elseif (!empty($d['area'])) {
                            $Entry->destinations[] = $d['area'];
                        } elseif (!empty($d['country'])) {
                            $Entry->destinations[] = $d['country'];
                        } elseif (!empty($d['region'])) {
                            $Entry->destinations[] = $d['region'];
                        }
                    }
                    if (!empty($Entry->destinations)) {
                        $Entry->destinations = array_keys(array_flip($Entry->destinations));
                    }
                    // Combine duplicate destinations
                }
                $this->items[$Entry->setting] = $Entry;
                $settings[$Entry->setting] = shopp_setting($Entry->setting);
                $settings[$Entry->setting]['id'] = $Entry->setting;
                $settings[$Entry->setting] = array_merge($defaults[$default_name], $settings[$Entry->setting]);
                if (isset($settings[$Entry->setting]['table'])) {
                    usort($settings[$Entry->setting]['table'], array('ShippingFramework', '_sorttier'));
                    foreach ($settings[$Entry->setting]['table'] as &$r) {
                        if (isset($r['tiers'])) {
                            usort($r['tiers'], array('ShippingFramework', '_sorttier'));
                        }
                    }
                }
            }
            // end foreach ( $ModuleSetting )
        }
        // end foreach ( $Shipping->active )
        $this->set_pagination_args(array('total_items' => count($this->items), 'total_pages' => 1));
        $postcodes = ShoppLookup::postcodes();
        foreach ($postcodes as &$postcode) {
            $postcode = !empty($postcode);
        }
        $lookup = array('regions' => array_merge(array('*' => Shopp::__('Anywhere')), ShoppLookup::regions()), 'regionmap' => ShoppLookup::regions('id'), 'countries' => ShoppLookup::countries(), 'areas' => ShoppLookup::country_areas(), 'zones' => ShoppLookup::country_zones(), 'postcodes' => $postcodesscre);
        shopp_custom_script('shiprates', '
			var shipping = ' . json_encode(array_map('sanitize_title_with_dashes', array_keys($this->installed))) . ',
				defaults = ' . json_encode($defaults) . ',
				settings = ' . json_encode($settings) . ',
				lookup   = ' . json_encode($lookup) . ';');
    }
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:ShippingRates.php

示例7: contact_meta_box

function contact_meta_box($Purchase)
{
    $screen = get_current_screen();
    $pre = 'page_';
    $page = substr($screen->id, strpos($screen->id, $pre) + strlen($pre));
    ?>
	<script id="customer-editor" type="text/x-jquery-tmpl">
	<?php 
    ob_start();
    ?>

	<div class="editor ${action}">
		<input type="hidden" name="order-action" value="${action}" />
		<p class="inline-fields">
			<span>
			<input type="text" name="customer[firstname]" id="customer-firstname" value="${firstname}" /><br />
			<label for="address-city"><?php 
    _e('First Name', 'Shopp');
    ?>
</label>
			</span>
			<span>
			<input type="text" name="customer[lastname]" id="customer-lastname" value="${lastname}" /><br />
			<label for="address-city"><?php 
    _e('Last Name', 'Shopp');
    ?>
</label>
			</span>
		</p>
		<p>
			<input type="text" name="customer[company]" id="customer-company" value="${company}" /><br />
			<label for="address-address"><?php 
    _e('Company', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[email]" id="customer-email" value="${email}" /><br />
			<label for="customer-email"><?php 
    _e('Email', 'Shopp');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="customer[phone]" id="customer-phone" value="${phone}" /><br />
			<label for="customer-phone"><?php 
    _e('Phone', 'Shopp');
    ?>
</label>
		</p>
		<?php 
    if ('wordpress' == shopp_setting('account_system')) {
        ?>
		<p class="loginname">
			<input type="text" name="customer[loginname]" id="customer-loginname" value="${loginname}" /><br />
			<label for="customer-loginname"><?php 
        _e('Login Name', 'Shopp');
        ?>
</label>
		</p>
		<?php 
    }
    ?>
		<div>
			<input type="submit" id="cancel-edit-customer" name="cancel-edit-customer" value="<?php 
    Shopp::esc_attr_e('Cancel');
    ?>
" class="button-secondary" />
			<input type="submit" name="save" value="<?php 
    Shopp::esc_attr_e('Save Customer');
    ?>
" class="button-primary alignright" />
		</div>
		<?php 
    if (!isset($_POST['select-customer'])) {
        ?>
		<p class="change-button"><br class="clear" /><input type="submit" id="change-customer" name="change-customer" value="<?php 
        _e('Change Customer', 'Shopp');
        ?>
" class="button-secondary" /></p>
		<?php 
    }
    ?>
	</div>
	<?php 
    $editcustomer = ob_get_contents();
    ob_end_clean();
    echo $editcustomer;
    $customer = array('${action}' => 'update-customer', '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${company}' => $Purchase->company, '${email}' => $Purchase->email, '${phone}' => $Purchase->phone, '${marketing}' => isset($Purchase->marketing) ? $Purchase->marketing : false, '${login}' => 'wordpress' == shopp_setting('account_system'));
    $js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($customer));
    shopp_custom_script('orders', 'var customer = ' . $js . ';');
    ?>
	</script>

	<script id="customer-s" type="text/x-jquery-tmpl">
	<?php 
    $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : false;
    ob_start();
    if (isset($_POST['select-customer']) && empty($s)) {
        $searchurl = wp_nonce_url(ShoppAdminController::url(array('page' => $page, 'id' => $Purchase->id)), 'wp_ajax_shopp_select_customer');
//.........这里部分代码省略.........
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:101,代码来源:ui.php

示例8: prepare_items

 public function prepare_items()
 {
     $defaults = array('paged' => 1, 'per_page' => 25, 'action' => false);
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     $start = $per_page * ($paged - 1);
     $edit = false;
     $Gateways = Shopp::object()->Gateways;
     $Gateways->settings();
     // Load all installed gateways for settings UIs
     do_action('shopp_setup_payments_init');
     $Gateways->ui();
     // Setup setting UIs
     $activated = $Gateways->activated();
     foreach ($activated as $slug => $classname) {
         $Gateway = $Gateways->get($classname);
         $Gateway->payid = $slug;
         $this->items[] = $Gateway;
         if ($this->request('id') == $slug) {
             $this->editor = $Gateway->ui();
         }
     }
     add_action('shopp_gateway_module_settings', array($Gateways, 'templates'));
     $total = count($this->items);
     $this->set_pagination_args(array('total_items' => $total, 'total_pages' => $total / $per_page, 'per_page' => $per_page));
     $installed = array();
     foreach ((array) $Gateways->modules as $slug => $module) {
         $installed[$slug] = $module->name;
     }
     asort($installed);
     $this->installed = $installed;
     shopp_custom_script('payments', 'var gateways = ' . json_encode(array_map('sanitize_title_with_dashes', array_keys($installed))) . ';' . ($event ? "jQuery(document).ready(function(\$) { \$(document).trigger('" . $event . "Settings',[\$('#payments-settings-table tr." . $event . "-editing')]); });" : ''));
 }
开发者ID:msigley,项目名称:shopp,代码行数:33,代码来源:Payments.php

示例9: behaviors

 public function behaviors($script)
 {
     shopp_custom_script('payments', $script);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:4,代码来源:Gateway.php

示例10: debug

 /**
  * Outputs debug structures to the browser console.
  *
  * @since 1.3.9
  *
  * @param mixed $data The data to display in the console.
  * @return void
  **/
 public static function debug($data)
 {
     $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     list($debugcall, $callby, ) = $backtrace;
     $stack = array();
     foreach ($backtrace as $id => $call) {
         if ('debug' == $caller['function']) {
             continue;
         }
         $ref = empty($call['file']) ? 'Call #' . $id : basename($call['file']) . ' @ ' . $call['line'];
         $stack[$ref] = isset($call['class']) ? $call['class'] . $call['type'] . $call['function'] . "()" : $call['function'];
     }
     $callstack = (object) $stack;
     $caller = (empty($callby['class']) ? '' : $callby['class'] . $callby['type']) . $callby['function'] . '() from ' . $debugcall['file'] . ' @ ' . $debugcall['line'];
     shopp_custom_script('shopp', "\n\t\t\tconsole.group('Debug " . $caller . "');\n\t\t\tconsole.debug(" . json_encode($data) . ");\n\t\t\tconsole.log('Call stack: %O', " . json_encode($stack) . ");\n\t\t\tconsole.groupEnd();\n\t\t");
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:24,代码来源:Core.php

示例11: json

 public function json(array $data = array())
 {
     $data = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($data));
     shopp_custom_script('orders', 'address["' . $this->type . '"] = ' . $data . ';');
 }
开发者ID:msigley,项目名称:shopp,代码行数:5,代码来源:Orders.php

示例12: ob_get_clean

		<input type="submit" id="cancel-edit-customer" name="cancel-edit-customer" value="<?php 
Shopp::esc_attr_e('Cancel');
?>
" class="button-secondary" />
		<input type="submit" name="save" value="<?php 
Shopp::esc_attr_e('Update');
?>
" class="button-primary alignright" />
	</div>
</div>
<?php 
$editcustomer = ob_get_clean();
echo $editcustomer;
$customer = array('${action}' => 'update-customer', '${id}' => $Purchase->customer, '${firstname}' => $Purchase->firstname, '${lastname}' => $Purchase->lastname, '${company}' => $Purchase->company, '${email}' => $Purchase->email, '${phone}' => $Purchase->phone, '${login}' => 'wordpress' == shopp_setting('account_system'));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($customer));
shopp_custom_script('orders', 'var customer = ' . $js . ';');
?>
</script>

<?php 
if (isset($_POST['select-customer'])) {
    $customer = array();
}
if (isset($_REQUEST['s']) && isset($_REQUEST['select-customer'])) {
    echo ShoppUI::template($search);
    return;
} elseif (empty($Purchase->customer)) {
    echo ShoppUI::template($editcustomer);
    return;
} elseif (isset($_REQUEST['edit-customer'])) {
    ?>
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:contact.php

示例13: 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));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:26,代码来源:Images.php

示例14: array

<?php

$editaddress = ShoppAdminCustomerBillingAddressBox::editor($Customer, 'shipping');
$address = array('${type}' => 'shipping', '${address}' => $Customer->Shipping->address, '${xaddress}' => $Customer->Shipping->xaddress, '${city}' => $Customer->Shipping->city, '${state}' => $Customer->Shipping->state, '${postcode}' => $Customer->Shipping->postcode, '${country}' => $Customer->Shipping->country, '${statemenu}' => Shopp::menuoptions($Customer->_shipping_states, $Customer->Shipping->state, true), '${countrymenu}' => Shopp::menuoptions($Customer->_countries, $Customer->Shipping->country, true));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($address));
shopp_custom_script('customers', 'address["shipping"] = ' . $js . ';');
?>
<div id="shipping-address-editor" class="editor">
<?php 
echo ShoppUI::template($editaddress, $address);
?>
</div>
开发者ID:forthrobot,项目名称:inuvik,代码行数:12,代码来源:shipping.php

示例15: array

<script id="address-editor" type="text/x-jquery-tmpl">
<?php 
$editaddress = ShoppAdminCustomerBillingAddressBox::editor($Customer, 'billing');
echo $editaddress;
$address = array('${type}' => 'billing', '${address}' => $Customer->Billing->address, '${xaddress}' => $Customer->Billing->xaddress, '${city}' => $Customer->Billing->city, '${state}' => $Customer->Billing->state, '${postcode}' => $Customer->Billing->postcode, '${country}' => $Customer->Billing->country, '${statemenu}' => Shopp::menuoptions($Customer->_billing_states, $Customer->Billing->state, true), '${countrymenu}' => Shopp::menuoptions($Customer->_countries, $Customer->Billing->country, true));
$js = preg_replace('/\\${([-\\w]+)}/', '$1', json_encode($address));
shopp_custom_script('customers', 'address["billing"] = ' . $js . ';');
?>
</script>
<div id="billing-address-editor" class="editor">
<?php 
echo ShoppUI::template($editaddress, $address);
?>
</div>
开发者ID:forthrobot,项目名称:inuvik,代码行数:14,代码来源:billing.php


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