本文整理汇总了PHP中Storage::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::update方法的具体用法?PHP Storage::update怎么用?PHP Storage::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateCompositeKey
public function testUpdateCompositeKey()
{
if (!$this->storage->supportsCompositePrimaryKeys()) {
$this->markTestSkipped('Composite keys need to be supported for this test to run.');
}
$key = ['dist' => 'foo', 'range' => 100];
$data = ['dist' => 'foo', 'range' => 100, 'name' => 'Test', 'value' => 1, 'amount' => 200.23, 'timestamp' => new \DateTime('2012-03-26 12:12:12')];
$this->mockUpdateCompositeKey($key, $data);
$this->storage->update('stdClass', $key, $data);
}
示例2: catch
// Get the gateway driver.
// Don't forget to use your own vendor name.
// Always "Server". "Direct" will never get here.
$gateway = OmniPay::create('SagePay\\Server')->setVendor(getenv('VENDOR'))->setTestMode(true);
// Get the "complete purchase" message.
$requestMessage = $gateway->completePurchase(['transactionReference' => $transactionReference]);
// Do a "send" - this will validate everything.
try {
$responseMessage = $requestMessage->send();
} catch (\Exception $e) {
// InvalidResponseException will not catch a null transactionReference.
// You may want to catch them separately and return different error messages.
// This is a nasty hack, manually creating a message in the
// event of an exception caused by a security failure.
$requestMessage = $gateway->completePurchase([]);
$responseMessage = new ServerCompleteAuthorizeResponse($requestMessage, []);
$responseMessage->invalid($finalUrl, $e->getMessage());
}
// Handle the actions based on successful (or not) authorisation
// of the transaction.
if ($responseMessage->isSuccessful()) {
$finalStatus = 'APPROVED';
// Set the ball rolling here with processing the transaction.
// Perhaps throw the result in a queue.
} else {
$finalStatus = 'REJECTED';
}
// Store the result.
Storage::update($transactionId, ['finalStatus' => $finalStatus, 'status' => $responseMessage->getStatus(), 'message' => $responseMessage->getMessage(), 'notifyData' => $responseMessage->getData()]);
// Return to SagePay with a big, fat "got it, thanks" message.
$responseMessage->confirm($finalUrl);
示例3: Storage
<?php
require_once '../libs/Storage.php';
$db = new Storage();
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
$index = $_GET['id'];
if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/x-png" || $_FILES["file"]["type"] == "image/png") && in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo json_encode($allowedExts);
} else {
$ext = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
$file_name = $_FILES["file"]["name"];
$tmp_url = 'img/thumbnail/' . $file_name . '_' . date('Y-m-d_H:m:s') . '.' . $ext;
$file_url = $_SERVER['DOCUMENT_ROOT'] . '/videotube/' . $tmp_url;
$edit['new_thumbnail'] = $tmp_url;
$data_video = $db->select("SELECT * FROM yapi WHERE id = '" . $index . "' LIMIT 1");
$old_picture = $data_video[0]['new_thumbnail'];
if ($old_picture != '') {
unlink($_SERVER['DOCUMENT_ROOT'] . '/videotube/' . $old_picture);
}
if (move_uploaded_file($_FILES["file"]["tmp_name"], $file_url)) {
$db->update('yapi', $edit, 'id="' . $index . '"');
$edit['status'] = 1;
$edit['tmp_url'] = $tmp_url;
echo json_encode($edit);
}
}
}
//end of if FILE
示例4: postSave
public function postSave($id = false)
{
Allow::permission($this->module['group'], $this->module['name']);
$json_request = array('status' => FALSE, 'responseText' => '', 'responseErrorText' => '', 'redirect' => FALSE);
if (!Request::ajax()) {
App::abort(404);
}
if ($id > 0 && NULL !== ($element = Storage::find($id))) {
$exist = true;
$rules = array();
$redirect = false;
$input = $element->toArray();
$input['value'] = json_decode($input['value'], 1);
} else {
$exist = false;
$rules = Storage::$rules;
$redirect = true;
$element = new Storage();
$input = array('module' => 'menu');
}
#Helper::dd($input);
#Helper::dd(is_null(Input::get('nesting_level2')));
/**
* Основные параметры
*/
if (!is_null(Input::get('name'))) {
$input['name'] = Input::get('name');
}
if (!is_null(Input::get('title'))) {
$input['value']['title'] = Input::get('title');
}
if (!is_null(Input::get('nesting_level'))) {
$input['value']['nesting_level'] = Input::get('nesting_level');
}
/**
* Дополнительные параметры
*/
if (!is_null(Input::get('container'))) {
$input['value']['container'] = Input::get('container');
}
if (!is_null(Input::get('element_container'))) {
$input['value']['element_container'] = Input::get('element_container');
}
if (!is_null(Input::get('element'))) {
$input['value']['element'] = Input::get('element');
}
if (!is_null(Input::get('active_class'))) {
$input['value']['active_class'] = Input::get('active_class');
}
/**
* Элементы меню и их порядок
*/
if (!is_null(Input::get('items'))) {
$input['value']['items'] = Input::get('items');
}
if (!is_null(Input::get('order'))) {
$input['value']['order'] = Input::get('order');
}
#Helper::dd($input);
$input['value'] = json_encode($input['value']);
#Helper::dd($input);
$validation = Validator::make($input, $rules);
if ($validation->passes()) {
## CREATE OR UPDATE CURRENT MENU
if ($exist) {
$element->update($input);
} else {
$element = $element->create($input);
}
/**
* Предустановленные места для меню
*/
if (!is_null(Input::get('update_placements'))) {
$placements = (array) Input::get('placements');
#Helper::dd($placements);
#dd($placements);
$placements_values = array_flip($placements);
#Helper::dd($placements_values);
$layout_placements = Helper::getLayoutProperties();
$layout_placements = @(array) $layout_placements['MENU_PLACEMENTS'];
#Helper::dd($layout_placements);
$menu_placement = Storage::firstOrNew(array('module' => 'menu_placement', 'name' => 'menu_placement'));
#Helper::dd($menu_placement);
$menu_placement_value = is_object($menu_placement) ? json_decode($menu_placement->value, 1) : array();
$array = array();
foreach ($layout_placements as $layout_placement_key => $layout_placement_value) {
#Helper::d("$layout_placement_key => $layout_placement_value");
$value = false;
if (isset($placements_values[$layout_placement_key])) {
$value = $element->name;
} elseif (isset($menu_placement_value[$layout_placement_key]) && $menu_placement_value[$layout_placement_key] != $element->name) {
$value = $menu_placement_value[$layout_placement_key];
} else {
$value = false;
}
$array[$layout_placement_key] = $value;
}
#Helper::d($array);
$menu_placement->value = json_encode($array);
#Helper::ta($menu_placement);
//.........这里部分代码省略.........
示例5: method_exists
}
// Get the message for the service we want - purchase in this case.
$requestMessage = $gateway->purchase(['amount' => '99.99', 'currency' => 'GBP', 'card' => $card, 'transactionId' => $transactionId, 'description' => 'Pizzas for everyone', 'returnUrl' => URL::directory() . '/sagepay-confirm.php', 'notifyUrl' => URL::directory() . '/authorizenet-confirm.php']);
// Process the service request.
// It may involve sending it to the gateway, and it may not.
$responseMessage = $requestMessage->send();
// Store the result.
// Note here that SagePay has getStatus() while Authorize.Net has getCode(). These all need
// to be nornalised.
$transaction = Storage::update($transactionId, ['finalStatus' => 'PENDING', 'status' => method_exists($responseMessage, 'getStatus') ? $responseMessage->getStatus() : $responseMessage->getCode(), 'message' => 'Awaiting notify', 'transactionReference' => $responseMessage->getTransactionReference()]);
if ($responseMessage->isSuccessful()) {
echo "<h2 class='alert alert-success'><span class='glyphicon glyphicon-ok-sign'></span><strong>All finished and all successful.</strong></h2>";
$transaction = Storage::update($transactionId, ['finalStatus' => 'APPROVED']);
echo "<p>The final stored transaction:</p>";
dump($transaction);
} elseif ($responseMessage->isRedirect()) {
// OmniPay provides a POST redirect method for convenience.
// You will probably want to write your own that fits in
// better with your framework.
// Some gateways will be happy with a GET redierect, others will
// need a POST redirect, so be aware of that.
$responseMessage->redirect();
} else {
echo "<h2 class='alert alert-danger'><span class='glyphicon glyphicon-remove-sign'></span>Some kind of error: <strong>" . $responseMessage->getMessage() . "</strong></h2>";
$transaction = Storage::update($transactionId, ['finalStatus' => 'ERROR', 'status' => $responseMessage->getStatus(), 'message' => $responseMessage->getMessage()]);
echo "<p>The final stored transaction:</p>";
dump($transaction);
}
echo '<p><a href="authorize.php" class="btn btn-default btn-lg">Try again</a></p>';
// Footer
include "page.php";
示例6: function
success: function(response){
console.log(response);
}
});
}
</script>
<?php
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit_video') {
$data['title'] = filter_var($_GET['title'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$data['author'] = filter_var($_GET['author'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$change_img = filter_var($_GET['change_img'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
if ($change_img != 1) {
$data['new_thumbnail'] = '';
}
$id = $_GET['id'];
$db->update('yapi', $data, 'id="' . $id . '"');
} elseif (isset($_GET['action']) && $_GET['action'] == 'list_video') {
$q = '%';
if (isset($_GET['q']) && $_GET['q'] != '') {
$key = $_GET['q'];
$result = $db->select("SELECT * FROM yapi WHERE title IS NOT NULL AND title != '' AND BINARY LOWER(title) LIKE LOWER('%{$key}%') OR REPLACE(title, ' ', '') LIKE LOWER('%{$key}%') AND suggest != 1 ORDER by meta_id DESC LIMIT 25");
} else {
$key = '%';
$result = $db->select("SELECT * FROM yapi WHERE title IS NOT NULL AND title != '' AND suggest != 1 ORDER BY meta_id DESC LIMIT 25");
}
$i = 1;
foreach ($result as $keys => $value) {
?>
<div class="row">
<div class="col l3 offset-l1">
<?php
示例7: urldecode
$_GET['daten'] = urldecode(stripslashes($_GET['daten']));
$daten['lists'] = $_GET['daten'];
$daten['name'] = strtolower($_GET['name']);
$daten['password'] = $password->hash($_GET['password']);
$daten['created_at'] = date("Y-m-d H:i:s");
$db->insert('playlist', $daten);
} elseif ($_GET['action'] == 'delete') {
$id = $_GET['playlist_id'];
echo $id;
$db->delete('playlist', 'id=' . $id);
} elseif ($_GET['action'] == 'update') {
$_GET['daten'] = urldecode(stripslashes($_GET['daten']));
$daten['lists'] = $_GET['daten'];
$daten['name'] = $_GET['name'];
$daten['updated_at'] = date("Y-m-d H:i:s");
$db->update('playlist', $daten, 'name="' . $daten["name"] . '"');
} elseif ($_GET['action'] == 'check_name') {
$name = $_GET['name'];
$result = $db->select("SELECT EXISTS(SELECT 1 FROM playlist WHERE name ='{$name}' LIMIT 1) as checked");
/*
* if exists result is 1 else is 0
*/
print_r($result[0]['checked']);
} elseif ($_GET['action'] == 'check_password') {
$name = $_GET['name'];
$pass = $_GET['password'];
$result = $db->select("SELECT password FROM playlist WHERE name='{$name}' ");
if ($password->validate($pass, $result[0]['password'])) {
echo 1;
} else {
echo 0;