當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Storage類代碼示例

本文整理匯總了PHP中Storage的典型用法代碼示例。如果您正苦於以下問題:PHP Storage類的具體用法?PHP Storage怎麽用?PHP Storage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Storage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildResponse

 /**
  * Converts the response in JSON format to the value object i.e Storage
  *
  * @params json
  *            - response in JSON format
  *
  * @return Storage object filled with json data
  *
  */
 function buildResponse($json)
 {
     $storageObj = new Storage();
     $jsonDocList = array();
     $storageObj->setJsonDocList($jsonDocList);
     $storageObj->setStrResponse($json);
     $jsonObj = new JSONObject($json);
     $jsonObjApp42 = $jsonObj->__get("app42");
     $jsonObjResponse = $jsonObjApp42->__get("response");
     $storageObj->setResponseSuccess($jsonObjResponse->__get("success"));
     $jsonObjStorage = $jsonObjResponse->__get("storage");
     $this->buildObjectFromJSONTree($storageObj, $jsonObjStorage);
     if (!$jsonObjStorage->has("jsonDoc")) {
         return $storageObj;
     }
     if ($jsonObjStorage->__get("jsonDoc") instanceof JSONObject) {
         // Only One attribute is there
         $jsonObjDoc = $jsonObjStorage->__get("jsonDoc");
         $document = new JSONDocument($storageObj);
         $this->buildJsonDocument($document, $jsonObjDoc);
     } else {
         // There is an Array of attribute
         $jsonObjDocArray = $jsonObjStorage->getJSONArray("jsonDoc");
         for ($i = 0; $i < count($jsonObjDocArray); $i++) {
             // Get Individual Attribute Node and set it into Object
             $jsonObjDoc = $jsonObjDocArray[$i];
             $document = new JSONDocument($storageObj);
             //$jsonObjDoc = new JSONObject($jsonObjDoc);
             $this->buildJsonDocument($document, $jsonObjDoc);
         }
     }
     return $storageObj;
 }
開發者ID:murnieza,項目名稱:App42_PHP_SDK,代碼行數:42,代碼來源:StorageResponseBuilder.php

示例2: testSerialize

 /**
  * Serialize/Unserialize testing
  */
 public function testSerialize()
 {
     $storage = new Storage();
     $alphabet = new Alphabet('en', array(), array(), array());
     $storage->add($alphabet);
     $serialized = serialize($storage);
     $this->assertEquals($storage, unserialize($serialized));
 }
開發者ID:jackblackjack,項目名稱:LanguageDetector,代碼行數:11,代碼來源:StorageTest.php

示例3: testKeysErrorWithEmptyPrefix

 public function testKeysErrorWithEmptyPrefix()
 {
     $redis = $this->getMockBuilder('\\Redis')->getMock();
     // we expect the exception is thrown, fails if it isn't
     $this->setExpectedException('Kaavii\\StorageException');
     $storage = new Storage($redis, '');
     $keys = $storage->keys();
 }
開發者ID:vicgarcia,項目名稱:kaavii,代碼行數:8,代碼來源:StorageTest.php

示例4: storageAction

 function storageAction()
 {
     $this->view->title = $this->view->translate->_("Storages");
     // get data for form
     $storages = new Storage();
     $this->view->storages = $storages->fetchAll();
     $this->view->meta_refresh = 300;
     // meta http-equiv="refresh"
 }
開發者ID:neverstoplwy,項目名稱:contrib-webacula,代碼行數:9,代碼來源:StorageController.php

示例5: remove

 /**
  * remove the entry for the storage
  *
  * @param string $storageId
  */
 public static function remove($storageId)
 {
     $storageCache = new Storage($storageId);
     $numericId = $storageCache->getNumericId();
     if (strlen($storageId) > 64) {
         $storageId = md5($storageId);
     }
     $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
     \OC_DB::executeAudited($sql, array($storageId));
     $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
     \OC_DB::executeAudited($sql, array($numericId));
 }
開發者ID:hjimmy,項目名稱:owncloud,代碼行數:17,代碼來源:storage.php

示例6: __construct

 public function __construct($args)
 {
     //$script = file_get_contents(LIB . "/OrongoScript/Tests/test.osc");
     //$parser = new OrongoScriptParser($script);
     //$parser->startParser();
     require 'TerminalPlugin.php';
     Plugin::hookTerminalPlugin(new TerminalPlugin());
     $stored = Plugin::getSettings($args['auth_key']);
     //Access the settings in the array.
     if (isset($stored['example_setting_2']) && $stored['example_setting_2']) {
         $this->injectHTML = true;
         $this->htmlToInject = $stored['example_setting_1'];
     } else {
         $this->injectHTML = false;
     }
     $store_string = 'this is a variable';
     $bool = Storage::store('a_storage_key', $store_string, true);
     if ($bool) {
         //This will fail and return false, because overwrite = false
         $bool2 = Storage::store('a_storage_key', 'will this overwrite?', false);
         if ($bool2 == false) {
             //This wil return: this is a variable
             $returnString = Storage::get('a_storage_key');
             //Delete the storage
             Storage::delete('a_storage_key');
         }
     }
 }
開發者ID:JacoRuit,項目名稱:orongocms,代碼行數:28,代碼來源:ExamplePHP.php

示例7: store

 public function store(Request $request)
 {
     //dd('jajaja');
     $file = $request->file('file');
     //obtenemos el campo file obtenido por el formulario
     $nombre = $file->getClientOriginalName();
     //indicamos que queremos guardar un nuevo archivo en el disco local
     \Storage::disk('local')->put($nombre, \File::get($file));
     \Excel::load('/storage/public/files/' . $nombre, function ($archivo) use(&$falla) {
         $result = $archivo->get();
         //leer todas las filas del archivo
         foreach ($result as $key => $value) {
             $var = new Periodo();
             $datos = ['bloque' => $value->bloque, 'inicio' => $value->inicio, 'fin' => $value->fin];
             $validator = Validator::make($datos, Periodo::storeRules());
             if ($validator->fails()) {
                 Session::flash('message', 'Los Periodos ya existen o el archivo ingresado no es valido');
                 $falla = true;
             } else {
                 $var->fill($datos);
                 $var->save();
             }
         }
     })->get();
     if ($falla) {
         // Fallo la validacion de algun campus, retornar al index con mensaje
         return redirect()->route('Administrador.periodos.index');
     }
     \Storage::delete($nombre);
     Session::flash('message', 'Los Periodos fueron agregados exitosamente!');
     return redirect()->route('Administrador.periodos.index');
 }
開發者ID:jaime1992,項目名稱:Proyecto-Sala-Utem,代碼行數:32,代碼來源:SubirArchivosPeriodosController.php

示例8: deleteUser_hook

 /**
  * @brief clean up user specific settings if user gets deleted
  * @param array with uid
  *
  * This function is connected to the pre_deleteUser signal of OC_Users
  * to remove the used space for versions stored in the database
  */
 public static function deleteUser_hook($params)
 {
     if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
         $uid = $params['uid'];
         Storage::deleteUser($uid);
     }
 }
開發者ID:CDN-Sparks,項目名稱:owncloud,代碼行數:14,代碼來源:hooks.php

示例9: draw

 public static function draw($slug, $options = false)
 {
     $menu = Storage::where('module', 'menu')->where('name', $slug)->first();
     $value = json_decode($menu->value, 1);
     #Helper::dd($value);
     #$menu = self::get_menu_level($value->items, $options);
 }
開發者ID:Grapheme,項目名稱:doktornarabote,代碼行數:7,代碼來源:Menu.php

示例10: load

 /**
  * function that load packages and register them in storage
  * @param integer
  * @return void
  **/
 public static function load(int $group) : bool
 {
     $packages = Database::query(TABLE_PACKAGE_TO_GROUP, ['packageid'], '`groupid` = ' . $group);
     $list = [];
     $store = [];
     foreach ($packages as $package) {
         $list[] = $package['packageid'];
     }
     if (!empty($list)) {
         $packages = Database::query(TABLE_PACKAGE, ['*'], '`packageid` IN ( ' . implode(', ', $list) . ' )');
         foreach ($packages as $package) {
             if (file_exists(DIR_PACKAGES . '/' . $package['repertory'] . '/confs.php')) {
                 require DIR_PACKAGES . '/' . $package['repertory'] . '/confs.php';
             }
             if (file_exists(DIR_PACKAGES . '/' . $package['repertory'] . '/models')) {
                 Document::get(DIR_PACKAGES . '/' . $package['repertory'] . '/models');
             }
             if (file_exists(DIR_PACKAGES . '/' . $package['repertory'] . '/controllers')) {
                 Document::get(DIR_PACKAGES . '/' . $package['repertory'] . '/controllers');
             }
             $store[] = $package;
         }
     }
     Storage::store(['packages' => $store]);
     return true;
 }
開發者ID:urazovm,項目名稱:portfolio,代碼行數:31,代碼來源:package.php

示例11: log

 /**
  * (non-PHPdoc)
  * @see util/Phirehose::log()
  */
 protected function log($message)
 {
     if (!isset($this->db)) {
         $this->db = Storage::getDatabase();
     }
     $this->db->log('Phirehose', $message);
 }
開發者ID:carriercomm,項目名稱:Twitterbot,代碼行數:11,代碼來源:aggregator.php

示例12: getInstance

 /**
  * Возвращет единственный экземпляр данного класса.
  * @return object - объект класса Storage
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
開發者ID:WinGood,項目名稱:24karcher,代碼行數:11,代碼來源:storage.php

示例13: postUpload

 public function postUpload(Request $req)
 {
     $response = array();
     if ($req->file('excelF')) {
         $file = $req->file('excelF');
         $extension = $file->getClientOriginalExtension();
         $filename = $file->getClientOriginalName();
         /*periksa extensi file */
         if ('xlsx' !== $extension) {
             $response['code'] = 404;
             $response['msg'] = "File berextensi {$extension} dengan nama {$filename}, file Seharusnya Berupa Excel";
             // $response['msg']="File Anda   $file->getClientOriginalName(), Pastikan File yang Anda upload sesuai dengan format ";
             return $response;
             // return $response;
         } elseif (\Storage::disk('local')->put($file->getFilename() . '.' . $extension, \File::get($file))) {
             // simpan kedadalam table
             $entry = new Fileentry();
             $entry->mime = $file->getClientMimeType();
             $entry->original_filename = $file->getClientOriginalName();
             $entry->filename = $file->getFilename() . '.' . $extension;
             $entry->save();
             $response['code'] = 200;
             $response['msg'] = "File  {$entry->original_filename} Telah disimpan";
             return $response;
         }
     }
     $response['code'] = 404;
     $response['msg'] = "Gagal Upload File !!!";
     return json_encode($response);
     // echo '{"TEST1": 454535353,"TEST2": "test2"}';
 }
開發者ID:acmadi,項目名稱:integrasi,代碼行數:31,代碼來源:BidangControllerBackup02.php

示例14: render

 /**
  * function that launch the framework
  * @param void
  * @return bool
  **/
 public static function render() : bool
 {
     self::get('confs');
     self::get(DIR_MODELS);
     self::get(DIR_CONTROLLERS);
     // ------------------------------------------------------------------------
     // get arguments
     $args = array_merge($_GET, $_POST);
     if (empty($args['url'])) {
         $args['url'] = '/';
     }
     try {
         // ------------------------------------------------------------------------
         // load external librairies
         Server::loadLibs();
         // ------------------------------------------------------------------------
         // allow storage for all applications
         Storage::init();
         // ------------------------------------------------------------------------
         // allow access to database
         Database::autoConnect();
         // ------------------------------------------------------------------------
         // launch controller
         if (!empty($args['task'])) {
             Task::exec($args['task'], $args);
         } else {
             Route::run($args['url'], $args);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return true;
 }
開發者ID:urazovm,項目名稱:portfolio,代碼行數:38,代碼來源:main.dis.php

示例15: salvaArquivosLocal

function salvaArquivosLocal($local, $arquivo, $prefix)
{
    $extArquivo = $arquivo->getClientOriginalExtension();
    $nomeArquivo = $prefix . '.' . $extArquivo;
    $salvaArquivo = Storage::disk($local)->put($nomeArquivo, File::get($arquivo));
    return $nomeArquivo;
}
開發者ID:igortrinidad,項目名稱:itevento.com,代碼行數:7,代碼來源:helperGeral.php


注:本文中的Storage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。