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


PHP Storage::getInstance方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:stanislav-web,项目名称:phphighload.com,代码行数:7,代码来源:page_analyzer.php

示例2: analyze

 public function analyze()
 {
     if (!Storage::getInstance()->containsImage($this->url)) {
         if ($this->isValid()) {
             Storage::getInstance()->addImage($this->url);
         }
     }
 }
开发者ID:stanislav-web,项目名称:phphighload.com,代码行数:8,代码来源:image_analyzer.php

示例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);
     }
 }
开发者ID:oohook,项目名称:PTFrameWork,代码行数:10,代码来源:storage.php

示例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;
 }
开发者ID:vberzsin,项目名称:2014,代码行数:11,代码来源:ScreenUtils.php

示例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");
                     }
                 }
             }
         }
     }
 }
开发者ID:naisly,项目名称:WodenS,代码行数:54,代码来源:SearchController.php

示例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;
         }
     }
 }
开发者ID:huluwa,项目名称:grr,代码行数:18,代码来源:AdminController.php

示例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');
     }
 }
开发者ID:naisly,项目名称:WodenS,代码行数:44,代码来源:AccountBillingController.php

示例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;
         }
     }
 }
开发者ID:huluwa,项目名称:grr,代码行数:23,代码来源:ImportController.php

示例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
 }
开发者ID:srigi,项目名称:nette-patients,代码行数:8,代码来源:DefaultPresenter.php

示例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);
     }
 }
开发者ID:naisly,项目名称:WodenS,代码行数:46,代码来源:ProfileController.php

示例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);
     }
 }
开发者ID:naisly,项目名称:WodenS,代码行数:82,代码来源:CheckOrderController.php

示例12: action_index

 function action_index()
 {
     $posts = Storage::getInstance()->read_posts();
 }
开发者ID:OxanaKozlova,项目名称:Blog_PHP,代码行数:4,代码来源:controller_blog.php

示例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');
 }
开发者ID:naisly,项目名称:WodenS,代码行数:20,代码来源:AdminController.php

示例14: action_delete

 function action_delete($id)
 {
     Storage::getInstance()->removeData($id);
     header('Location: /blog');
 }
开发者ID:vladkanash,项目名称:PHP-Blog,代码行数:5,代码来源:Controller_blog.php

示例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();
开发者ID:stanislav-web,项目名称:phphighload.com,代码行数:31,代码来源:scanner.php


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