本文整理汇总了PHP中Storage::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::getInstance方法的具体用法?PHP Storage::getInstance怎么用?PHP Storage::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: analyze
public function analyze()
{
if (!Storage::getInstance()->containsPage($this->url)) {
$title = $this->getDom()->getElementsByTagName("title")->item(0)->textContent;
Storage::getInstance()->addPage($title, $this->url);
}
}
示例2: analyze
public function analyze()
{
if (!Storage::getInstance()->containsImage($this->url)) {
if ($this->isValid()) {
Storage::getInstance()->addImage($this->url);
}
}
}
示例3: __callstatic
public static function __callstatic($method, $args)
{
if (self::$handler === null) {
Storage::getInstance(C('STORAGE_DRIVER', null, 'file'));
}
//调用缓存驱动的方法
if (method_exists(self::$handler, $method)) {
return call_user_func_array(array(self::$handler, $method), $args);
}
}
示例4: __construct
public function __construct()
{
$this->session = Session::getInstance();
$this->log = Log::getInstance();
$this->user = User::getInstance();
$this->storage = Storage::getInstance();
$this->webDBUtils = WebDBUtils::getInstance();
$this->dpUtils = DataProviderUtils::getInstance();
$this->screen = false;
$this->availableFeatures = false;
}
示例5: actionSearch
/**
* Do Search
*
* @var $title_array
* @var $url_array
* @var $description_array
*
* ! REDIRECT
*/
private function actionSearch()
{
$this->actionGetLanguage();
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
$sql_stmt = $mysqli->prepare("set names 'utf8'");
$sql_stmt->execute();
if (isset($_GET['generalnav'])) {
$search = $_GET['generalnav'];
$sql_query = "SELECT * FROM search WHERE description LIKE '%{$search}%' ORDER BY CHAR_LENGTH(description) DESC";
$result = $mysqli->query($sql_query);
$title_array = array();
$url_array = array();
$description_array = array();
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
array_push($title_array, $row['title']);
array_push($url_array, $row['url']);
array_push($description_array, $row['description']);
}
}
$this->model->setTitle($title_array);
$this->model->setUrl($url_array);
$this->model->setDescription($description_array);
$this->model->setCountResults($result->num_rows);
if (isset($_GET['page'])) {
if ($this->model->getCountPages() != 0) {
if ($_GET['page'] > $this->model->getCountPages()) {
if ($_SESSION['language'] !== 'us') {
header("Location: /" . $_SESSION['language'] . "/search/result?generalnav=" . $_GET['generalnav'] . "&page=" . $this->model->getCountPages());
} else {
header("Location: /search/result?generalnav=" . $_GET['generalnav'] . "&page=" . $this->model->getCountPages());
}
} elseif ($_GET['page'] < 1) {
if ($_SESSION['language'] !== 'us') {
header("Location: /" . $_SESSION['language'] . "/search/result?generalnav=" . $_GET['generalnav'] . "&page=1");
} else {
header("Location: /search/result?generalnav=" . $_GET['generalnav'] . "&page=1");
}
}
}
}
}
}
示例6: createTokenRoute
function createTokenRoute($dummy, $description)
{
$this->description = trim($description);
$this->message = null;
$this->errorMessage = null;
if (strlen($this->description) < 1) {
$this->errorMessage = l("Enter a valid description");
} else {
$tokenHash = sha1(sha1(sprintf("%d,%s,%d", time(), $this->description, rand())));
$storage = Storage::getInstance();
if (!$storage->addWelcomeToken($tokenHash, $this->description, $this->user)) {
$this->errorMessage = l("Error generating a new token. Try again");
} else {
$this->message = l("Token successfully created");
$this->description = null;
}
}
}
示例7: actionInsertBillingData
/**
* Adding Billing Data to the DB
* @var $table : billing
*/
private function actionInsertBillingData()
{
$this->actionGetLanguage();
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
session_start();
if (isset($_SESSION['login_user'])) {
$user = $_SESSION['login_user'];
}
if (isset($_POST['name'])) {
$name = $_POST['name'];
}
if (isset($_POST['street'])) {
$street = $_POST['street'];
}
if (isset($_POST['city'])) {
$city = $_POST['city'];
}
if (isset($_POST['state'])) {
$state = $_POST['state'];
}
if (isset($_POST['zip'])) {
$zip = $_POST['zip'];
}
if (isset($_POST['country'])) {
$country = $_POST['country'];
}
if (isset($_POST['giftwrap'])) {
$giftwrap = $_POST['giftwrap'];
} else {
$giftwrap = 0;
}
if (isset($name) && isset($street) && isset($city) && isset($state) && isset($zip) && isset($country) && isset($giftwrap) && isset($user)) {
$sql_query = $mysqli->prepare("INSERT INTO billing VALUES ('{$user}', '{$name}', '{$street}', '{$city}', '{$state}', '{$zip}', '{$country}',\n {$giftwrap})");
$sql_query->execute();
} else {
header('HTTP/1.0 403 Forbidden');
}
}
示例8: completedRoute
function completedRoute($feedsJson)
{
$this->feeds = json_decode($feedsJson, true);
if ($this->feeds === false) {
$this->redirectTo("import");
return;
}
$this->selection = $_POST["selection"];
if (!$this->selection || !is_array($this->selection)) {
$this->selection = array();
}
if (($this->errorMessage = $this->isSelectionValid($this->feeds, $this->selection)) !== true) {
$this->setTemplate("selectFeeds");
} else {
$storage = Storage::getInstance();
$this->rowsImported = $storage->importFeeds($this->user->id, $this->feeds, $this->selection);
if ($this->rowsImported === false) {
$this->errorMessage = l("An error occurred while importing feeds");
$this->setTemplate("selectFeeds");
return;
}
}
}
示例9: SubmittedPatientAdd
public function SubmittedPatientAdd(AppForm $form)
{
Storage::getInstance()->createPatient($form->values);
Graphs::model()->clearAll();
$this->flashMessage('Novy pacient bol úspešne pridaný', 'info');
$this->redirect('default');
// redirect to listing
}
示例10: actionGetBilling
/**
* Get Default Billing Data
* for Account
*
* @var $name
* @var $street
* @var $city
* @var $state
* @var $zip
* @var $country
* @var $wrap
*/
protected function actionGetBilling()
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
if (isset($_SESSION['login_user'])) {
$user = $_SESSION['login_user'];
}
$sql_query = "SELECT name, street, city, state, zip, country, wrap FROM billing WHERE user='{$user}'";
$result = $mysqli->query($sql_query);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$name = $row['name'];
$street = $row['street'];
$city = $row['city'];
$state = $row['state'];
$zip = $row['zip'];
$country = $row['country'];
$wrap = $row['wrap'];
}
}
if ($result->num_rows !== 0) {
$this->model->setBillingName($name);
$this->model->setBillingStreet($street);
$this->model->setBillingCity($city);
$this->model->setBillingState($state);
$this->model->setBillingZip($zip);
$this->model->setBillingCountry($country);
$this->model->setBillingWrap($wrap);
$this->model->setBillingNotFound(0);
} else {
$this->model->setBillingNotFound(1);
}
}
示例11: actionGetOrderedItems
/**
* Getting Data of Order
*
* (items) Sum, quantity, original_name, shipping, photo, price
* category
*/
private function actionGetOrderedItems()
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
if (isset($_GET['order_number'])) {
$order_number = $_GET['order_number'];
}
if (isset($_GET['order_email'])) {
$order_email = $_GET['order_email'];
}
if ($this->model->getStatus() == 'done') {
$status = 'doneorders';
} else {
if ($this->model->getStatus() == 'wait') {
$status = 'completeorders';
}
}
if (isset($status)) {
$sql_stmt = "SELECT product_table, id FROM {$status} WHERE order_id='{$order_number}'";
$result_stmt = $mysqli->query($sql_stmt);
$product_table_array = array();
$id_array = array();
if ($result_stmt->num_rows > 0) {
while ($row = $result_stmt->fetch_assoc()) {
$product_table_array = array_merge($product_table_array, array_map('trim', explode(",", $row['product_table'])));
$id_array = array_merge($id_array, array_map('trim', explode(",", $row['id'])));
}
}
$i = 0;
$original_name_array = array();
$photo_array = array();
$shipping_array = array();
$price_array = array();
$category_array = array();
$product_name_array = array();
while ($i < count($id_array)) {
$sql_query = "SELECT {$product_table_array[$i]}.original_name, {$product_table_array[$i]}.photo, {$product_table_array[$i]}.shipping,\n {$status}.price, {$status}.category, {$status}.id, {$product_table_array[$i]}.product_name FROM\n {$product_table_array[$i]} INNER JOIN {$status} WHERE {$status}.id = {$product_table_array[$i]}.id AND {$status}.id = {$id_array[$i]}\n AND {$status}.order_id = '{$order_number}' LIMIT 1";
$result = $mysqli->query($sql_query);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$original_name_array = array_merge($original_name_array, array_map('trim', explode(",", $row['original_name'])));
$photo_array = array_merge($photo_array, array_map('trim', explode(",", $row['photo'])));
$shipping_array = array_merge($shipping_array, array_map('trim', explode(",", $row['shipping'])));
$price_array = array_merge($price_array, array_map('trim', explode(",", $row['price'])));
$category_array = array_merge($category_array, array_map('trim', explode(",", $row['category'])));
$product_name_array = array_merge($product_name_array, array_map('trim', explode(",", $row['product_name'])));
}
}
$i++;
}
$count_price = 0;
$i = 0;
while ($i < count($category_array)) {
if ($category_array[$i] == 'AppleTV' || $category_array[$i] == 'IMac') {
$category_array[$i] = 'Apple';
} else {
if ($category_array[$i] == 'ShowTop') {
$category_array[$i] = 'Amazon';
}
}
$count_price += $price_array[$i];
$i++;
}
$this->model->setId($id_array);
$this->model->setTable($product_table_array);
$this->model->setOriginalName($original_name_array);
$this->model->setPhoto($photo_array);
$this->model->setShipping($shipping_array);
$this->model->setPrice($price_array);
$this->model->setCategory($category_array);
$this->model->setProductName($product_name_array);
$this->model->setCountItems($original_name_array);
$this->model->setCountPrice($count_price);
}
}
示例12: action_index
function action_index()
{
$posts = Storage::getInstance()->read_posts();
}
示例13: actionDeleteData
/**
* Method for deleting data from
* Products page
*
* @var $id
*
* ! REDIRECTION
*/
public function actionDeleteData()
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/Storage.php';
$db = Storage::getInstance();
$mysqli = $db->getConnection();
if (isset($_POST['edit_id'])) {
$id = $_POST['edit_id'];
}
$sql_stmt = $mysqli->prepare("DELETE FROM phones WHERE id='{$id}'");
$sql_stmt->execute();
header('Location: admin-products');
}
示例14: action_delete
function action_delete($id)
{
Storage::getInstance()->removeData($id);
header('Location: /blog');
}
示例15: WebScanner
$url = $page->getBody();
echo "Scanning: {$url}\n";
$scanner = new WebScanner($url);
$links = $scanner->getAllLinks();
foreach ($links as $link) {
/**
* Если страница относится к указанному домену и еще не была проиндексирована -- добавляем ее в очередь на индексацию
*/
if (strpos($link, $domain) !== FALSE && !Storage::getInstance()->containsPage($link)) {
$queue->publish($link, 'scan');
}
}
/**
* Также если на странице есть картинки добавляем их для анализа
*/
$images = $scanner->getAllImages();
foreach ($images as $image) {
/**
* Если картинка относится к указанному домену и еще не была проанализирована -- добавляем ее в очередь
*/
if (strpos($image, $imageDomain) !== FALSE && !Storage::getInstance()->containsImage($image)) {
$queue->publish($image, 'analyze_image');
}
}
/**
* Текущую страницу тоже в очередь для анализации
*/
$queue->publish($url, 'analyze_page');
$q->ack($page->getDeliveryTag());
}
$rabbit->disconnect();