本文整理汇总了PHP中Storage类的典型用法代码示例。如果您正苦于以下问题:PHP Storage类的具体用法?PHP Storage怎么用?PHP Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Storage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: validate
/**
* validate
*
* Run validation process
*
* @return null
*/
public function validate()
{
parent::validate();
// compare protection code
if (property_exists($this->_data, 'protection_code')) {
$protectionCode = \Storage::read('protection-code-register');
\Storage::remove('protection-code-register');
if ($this->_data->protection_code !== $protectionCode) {
$this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid);
}
}
// compare password confirmation
if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) {
$this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch);
}
// check for existence
if ($this->isValid()) {
$checkedFields = array('email', 'login');
$UserModel = \App::getInstance('common\\UserModel');
foreach ($checkedFields as $fName) {
if ($UserModel->isExists($fName, $this->_data->{$fName})) {
$mKey = 'register_form_' . $fName . '_is_exists';
$this->addMessage($fName, \View::$language->{$mKey});
}
}
}
}
开发者ID:nsedenkov,项目名称:phpsu,代码行数:34,代码来源:RegisterForm.php
示例17: execute
public function execute($parameters, $db)
{
global $base;
chdir($base);
if (sizeof($parameters) == 0 || $parameters[0] == "") {
CLI::out("Usage: |g|help <command>|n| To see a list of commands, use: |g|list", true);
}
$command = $parameters[0];
switch ($command) {
case "all":
// Cleanup old sessions
$db->execute("delete from zz_users_sessions where validTill < now()");
$killsLastHour = $db->queryField("select count(*) count from zz_killmails where insertTime > date_sub(now(), interval 1 hour)", "count");
Storage::store("KillsLastHour", $killsLastHour);
$db->execute("delete from zz_analytics where dttm < date_sub(now(), interval 24 hour)");
$fc = new FileCache("{$base}/cache/queryCache/");
$fc->cleanUp();
break;
case "killsLastHour":
$killsLastHour = $db->queryField("select count(*) count from zz_killmails where insertTime > date_sub(now(), interval 1 hour)", "count");
Storage::store("KillsLastHour", $killsLastHour);
break;
case "fileCacheClean":
$fc = new FileCache();
$fc->cleanUp();
break;
}
}
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:28,代码来源:cli_minutely.php
示例18: listAll
/**
* lists the documents the user has access to (including shared files, once the code in core has been fixed)
* also adds session and member info for these files
*/
public static function listAll()
{
self::preDispatch();
$found = Storage::getDocuments();
$fileIds = array();
$documents = array();
foreach ($found as $key => $document) {
if (is_object($document)) {
$documents[] = $document->getData();
} else {
$documents[$key] = $document;
}
$documents[$key]['icon'] = preg_replace('/\\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
$fileIds[] = $document['fileid'];
}
usort($documents, function ($a, $b) {
return @$b['mtime'] - @$a['mtime'];
});
$session = new Db\Session();
$sessions = $session->getCollectionBy('file_id', $fileIds);
$members = array();
$member = new Db\Member();
foreach ($sessions as $session) {
$members[$session['es_id']] = $member->getActiveCollection($session['es_id']);
}
\OCP\JSON::success(array('documents' => $documents, 'sessions' => $sessions, 'members' => $members));
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:31,代码来源:documentController.php
示例19: postStorepeople
/**
* Store a newly created resource in storage.
*
* @param CreatePersonRequest $request
* @return Response
*/
public function postStorepeople(CreatePersonRequest $request)
{
$people = new People();
$people->document = $request->get('document');
$people->names = $request->get('names');
$people->surnames = $request->get('surnames');
$people->date_of_birth = $request->get('date_of_birth');
$people->landline = $request->get('landline');
$people->address = $request->get('address');
$people->date_of_admission = $request->get('date_of_admission');
$people->cellular = $request->get('cellular');
$upload_dir = \Storage::disk('photos');
$img = $request->get('photo');
$img = str_replace('data:image/png;base64,', '', $img);
$data = base64_decode($img);
$name = date('YmdHis') . '.png';
$upload_dir->put($name, $data);
$people->photo = $name;
$people->save();
$email = $request->get('email');
$password = $request->get('password');
$user = new User(['email' => $email, 'password' => $password]);
$people->user()->save($user);
Session::flash('message', 'Usuario registro correctamente en el sistema.');
return redirect('auth/login');
}
开发者ID:EstebanJesus,项目名称:bancopedagogico,代码行数:32,代码来源:AuthController.php
示例20: getFileSystem
/**
* 获取Filesystem
* @return Filesystem
*/
public static function getFileSystem()
{
if (is_null(static::$driver)) {
static::$driver = \Storage::drive('local');
}
return static::$driver;
}
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:11,代码来源:LocalStoredFile.php
注:本文中的Storage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论