本文整理汇总了PHP中Lookup::paycards方法的典型用法代码示例。如果您正苦于以下问题:PHP Lookup::paycards方法的具体用法?PHP Lookup::paycards怎么用?PHP Lookup::paycards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup::paycards方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadcards
/**
* Loads the enabled payment cards
*
* @since 1.1
*
* @return void
**/
private function _loadcards () {
if (empty($this->settings['cards'])) $this->settings['cards'] = $this->cards;
if ($this->cards) {
$cards = array();
$pcs = Lookup::paycards();
foreach ($this->cards as $card) {
$card = strtolower($card);
if (isset($pcs[$card])) $cards[] = $pcs[$card];
}
$this->cards = $cards;
}
}
示例2: upgrade_110
//.........这里部分代码省略.........
} else {
$value->storage = "FSStorage";
$value->uri = $name;
}
$value = mysql_real_escape_string(serialize($value));
$db->query("UPDATE $meta_table set name='$name',value='$value' WHERE id=$r->id");
}
// Update promotions
$promo_table = DatabaseObject::tablename('promo');
$records = $db->query("UPDATE $promo_table SET target='Cart' WHERE scope='Order'",AS_ARRAY);
$FSStorage = array('path' => array());
// Migrate Asset storage settings
$image_storage = $this->Settings->get('image_storage_pref');
if ($image_storage == "fs") {
$image_storage = "FSStorage";
$FSStorage['path']['image'] = $this->Settings->get('image_path');
} else $image_storage = "DBStorage";
$this->Settings->save('image_storage',$image_storage);
$product_storage = $this->Settings->get('product_storage_pref');
if ($product_storage == "fs") {
$product_storage = "FSStorage";
$FSStorage['path']['download'] = $this->Settings->get('products_path');
} else $product_storage = "DBStorage";
$this->Settings->save('product_storage',$product_storage);
if (!empty($FSStorage['path'])) $this->Settings->save('FSStorage',$FSStorage);
// Preserve payment settings
// Determine active gateways
$active_gateways = array($this->Settings->get('payment_gateway'));
$xco_gateways = (array)$this->Settings->get('xco_gateways');
if (!empty($xco_gateways))
$active_gateways = array_merge($active_gateways,$xco_gateways);
// Load 1.0 payment gateway settings for active gateways
$gateways = array();
foreach ($active_gateways as $reference) {
list($dir,$filename) = explode('/',$reference);
$gateways[] = preg_replace('/[^\w+]/','',substr($filename,0,strrpos($filename,'.')));
}
$where = "name like '%".join("%' OR name like '%",$gateways)."%'";
$query = "SELECT name,value FROM wp_ecart_setting WHERE $where";
$result = $db->query($query,AS_ARRAY);
require_once(ECART_MODEL_PATH.'/Lookup.php');
$paycards = Lookup::paycards();
// Convert settings to 1.1-compatible settings
$active_gateways = array();
foreach ($result as $_) {
$active_gateways[] = $_->name; // Add gateway to the active gateways list
$setting = unserialize($_->value); // Parse the settings
// Get rid of legacy settings
unset($setting['enabled'],$setting['path'],$setting['billing-required']);
// Convert accepted payment cards
$accepted = array();
if (isset($setting['cards']) && is_array($setting['cards'])) {
foreach ($setting['cards'] as $cardname) {
// Normalize card names
$cardname = str_replace(
array( "Discover",
"Diner’s Club",
"Diners"
),
array( "Discover Card",
"Diner's Club",
"Diner's Club"
),
$cardname);
foreach ($paycards as $card)
if ($cardname == $card->name) $accepted[] = $card->symbol;
}
$setting['cards'] = $accepted;
}
$this->Settings->save($_->name,$setting); // Save the gateway settings
}
// Save the active gateways to populate the payment settings page
$this->Settings->save('active_gateways',join(',',$active_gateways));
// Preserve update key
$oldkey = $this->Settings->get('updatekey');
if (!empty($oldkey)) {
$newkey = array(
($oldkey['status'] == "activated"?1:0),
$oldkey['key'],
$oldkey['type']
);
$this->Settings->save('updatekey',$newkey);
}
$this->roles(); // Setup Roles and Capabilities
}
示例3: paycard
/**
* Gets a specified payment card
*
* @author Jonathan Davis
* @since 1.1
*
* @return object PayCard object
**/
public static function paycard($card)
{
$cards = Lookup::paycards();
if (isset($cards[strtolower($card)])) {
return $cards[strtolower($card)];
}
return false;
}
示例4: upgrade_110
//.........这里部分代码省略.........
$meta_table = ShoppDatabaseObject::tablename('meta');
$asset_table = ShoppDatabaseObject::tablename('asset');
$query = "INSERT INTO {$meta_table} (parent, context, type, name, value, numeral, sortorder, created, modified)\n\t\t\t\t\tSELECT parent, context, 'download', 'processing', CONCAT_WS('::', id, name, value, size, properties, LENGTH(data)), '0', sortorder, created, modified FROM {$asset_table} WHERE datatype='download' AND parent != 0";
sDB::query($query);
$records = sDB::query("SELECT id, value FROM {$meta_table} WHERE type='download' AND name='processing'", 'array');
foreach ($records as $r) {
list($src, $name, $value, $size, $properties, $datasize) = explode("::", $r->value);
$p = unserialize($properties);
$value = new StdClass();
$value->filename = $name;
$value->mime = $p['mimetype'];
$value->size = $size;
if ($datasize > 0) {
$value->storage = "DBStorage";
$value->uri = $src;
} else {
$value->storage = "FSStorage";
$value->uri = $name;
}
$value = mysqli_real_escape_string(sDB::get()->dbh, serialize($value));
sDB::query("UPDATE {$meta_table} set name='{$name}', value='{$value}' WHERE id={$r->id}");
}
// Update promotions
$promo_table = ShoppDatabaseObject::tablename('promo');
$records = sDB::query("UPDATE {$promo_table} SET target='Cart' WHERE scope='Order'", 'array');
$FSStorage = array('path' => array());
// Migrate Asset storage settings
$image_storage = shopp_setting('image_storage_pref');
if ($image_storage == "fs") {
$image_storage = "FSStorage";
$FSStorage['path']['image'] = shopp_setting('image_path');
} else {
$image_storage = "DBStorage";
}
shopp_set_setting('image_storage', $image_storage);
$product_storage = shopp_setting('product_storage_pref');
if ($product_storage == "fs") {
$product_storage = "FSStorage";
$FSStorage['path']['download'] = shopp_setting('products_path');
} else {
$product_storage = "DBStorage";
}
shopp_set_setting('product_storage', $product_storage);
if (!empty($FSStorage['path'])) {
shopp_set_setting('FSStorage', $FSStorage);
}
// Preserve payment settings
// Determine active gateways
$active_gateways = array(shopp_setting('payment_gateway'));
$xco_gateways = (array) shopp_setting('xco_gateways');
if (!empty($xco_gateways)) {
$active_gateways = array_merge($active_gateways, $xco_gateways);
}
// Load 1.0 payment gateway settings for active gateways
$gateways = array();
foreach ($active_gateways as $reference) {
list($dir, $filename) = explode('/', $reference);
$gateways[] = preg_replace('/[^\\w+]/', '', substr($filename, 0, strrpos($filename, '.')));
}
$where = "name like '%" . join("%' OR name like '%", $gateways) . "%'";
$query = "SELECT name, value FROM {$setting_table} WHERE {$where}";
$result = sDB::query($query, 'array');
$paycards = Lookup::paycards();
// Convert settings to 1.1-compatible settings
$active_gateways = array();
foreach ($result as $_) {
$active_gateways[] = $_->name;
// Add gateway to the active gateways list
$setting = unserialize($_->value);
// Parse the settings
// Get rid of legacy settings
unset($setting['enabled'], $setting['path'], $setting['billing-required']);
// Convert accepted payment cards
$accepted = array();
if (isset($setting['cards']) && is_array($setting['cards'])) {
foreach ($setting['cards'] as $cardname) {
// Normalize card names
$cardname = str_replace(array("Discover", "Diner’s Club", "Diners"), array("Discover Card", "Diner's Club", "Diner's Club"), $cardname);
foreach ($paycards as $card) {
if ($cardname == $card->name) {
$accepted[] = $card->symbol;
}
}
}
$setting['cards'] = $accepted;
}
shopp_set_setting($_->name, $setting);
// Save the gateway settings
}
// Save the active gateways to populate the payment settings page
shopp_set_setting('active_gateways', join(', ', $active_gateways));
// Preserve update key
$oldkey = shopp_setting('updatekey');
if (!empty($oldkey)) {
$newkey = array($oldkey['status'] == "activated" ? 1 : 0, $oldkey['key'], $oldkey['type']);
shopp_set_setting('updatekey', $newkey);
}
$this->roles();
// Setup Roles and Capabilities
}