本文整理汇总了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;
}
示例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));
}
示例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();
}
示例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"
}
示例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));
}
示例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');
}
}
}
示例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');
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例12: getInstance
/**
* Возвращет единственный экземпляр данного класса.
* @return object - объект класса Storage
*/
public static function getInstance()
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
示例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"}';
}
示例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;
}
示例15: salvaArquivosLocal
function salvaArquivosLocal($local, $arquivo, $prefix)
{
$extArquivo = $arquivo->getClientOriginalExtension();
$nomeArquivo = $prefix . '.' . $extArquivo;
$salvaArquivo = Storage::disk($local)->put($nomeArquivo, File::get($arquivo));
return $nomeArquivo;
}