本文整理汇总了PHP中Storage::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::get方法的具体用法?PHP Storage::get怎么用?PHP Storage::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanUnsetAVariable
public function testCanUnsetAVariable()
{
$this->namespace->testUnset = 5;
$this->assertEquals(5, $this->storage->get('testUnset'));
$this->storage->remove('testUnset');
$this->assertFalse(isset($this->namespace->testUnset));
$this->assertFalse($this->storage->has('testUnset'));
}
示例2: testBase
/**
* Base testing
*/
public function testBase()
{
$storage = new Storage();
$alphabet = new Alphabet('en', array(), array(), array());
$storage->add($alphabet);
$this->assertEquals($alphabet, $storage->get('en'));
$this->assertEquals(array('en' => $alphabet), $storage->all());
$storage->remove($alphabet);
$this->assertNull($storage->get('en'));
}
示例3: configure
public static function configure( $home ){
self::$home = $home;
$js = ""; $css = "";
if( Authorization::isAuthorized() ){
$files = API::getFileList( INCLUDEPATH );
$files = array_merge(API::getFileList( PLUGINSPATH ), $files);
$pos = array_search("./include/cmf/js/lib.js",$files);
unset($files[$pos]);
}
else{
$files = API::getFileList( INCLUDEPATH,-1 );
$files[] = "./include/cmf/js/lib.js";
$files[] = "./include/cmf/css/cmf.notify.css";
$files[] = "./include/cmf/css/cmf.ui.css";
}
rsort($files);
foreach ($files as $path) {
$ext = pathinfo($path);
if( substr($ext['filename'], 0,1) == '_' ) continue;
$ext = $ext['extension'];
if($ext == "js"){
$js .= str_replace("{PATH}", $path, Storage::get("Template::jsInclude"));
}else if($ext == "css")
$css .= str_replace("{PATH}", $path, Storage::get("Template::cssInclude"));
}
self::assign("TITLE", Config::$SiteConf['name']);
self::assign("META", Config::$SiteConf['meta']);
self::assign("JSINCLUDE", $js);
self::assign("CSSINCLUDE", $css);
// l(self::$vars);
}
示例4: store
public function store()
{
$posts = \Input::get('posts');
$results = array();
if (count($posts)) {
$insertData = [];
foreach ($posts as $post) {
$tags = isset($post['tags']) ? $post['tags'] : array();
$result = Post::create(array('title' => $post['title'], 'body' => $post['body']));
if (count($tags) && $result) {
$this->savePostTags($result->id, $tags);
}
array_push($results, $result);
}
if (count($results)) {
$emails = json_decode(\Storage::get('emails.json'), true);
\Mail::send('emails.post', ['results' => $results], function ($message) use($emails) {
$message->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'));
$message->to($emails)->subject('New posts');
});
Cache::forget('all_post');
return self::makeResponse($results, 201);
} else {
return self::makeResponse(array(), 500, 'Server Error');
}
} else {
return self::makeResponse(array(), 400, 'Bad Request');
}
}
示例5: viewSitemap
/**
* вывод html-карты сайта по шорт-коду [sitemap-html]
*/
static function viewSitemap()
{
$sitemap = Storage::get(md5('mgPluginSitemapHtml'));
if ($sitemap == null) {
$pages = self::getPages();
$catalog = self::getCatalog();
$html = '
<div class="sitemap-html">
<h2 class="new-products-title">Карта сайта</h2>
<ul class="js_listSiteMap">';
foreach ($pages as $url => $title) {
$partsUrl = URL::getSections($url);
$priority = count($partsUrl);
if (is_array($title)) {
$html .= '<li><a href="' . SITE . '/' . $url . '">' . $title[$url] . '<ul>';
foreach ($title as $suburl => $subtitle) {
if ($suburl != $url) {
$html .= '<li><a href="' . SITE . '/' . $suburl . '" title="' . $subtitle . '">' . $subtitle . '</a></li>';
}
}
$html .= '</ul></li>';
} else {
$html .= '<li><a href="' . SITE . '/' . $url . '" title="' . $title . '">' . $title . '</a></li>';
if ($url == 'catalog') {
$html .= '<ul>' . $catalog . '</ul>';
}
}
}
$sitemap = $html . '</ul></div>';
Storage::save(md5('mgPluginSitemapHtml'), $sitemap);
}
return $sitemap;
}
示例6: action_parse
public function action_parse()
{
$source_file_content = \Storage::get('coolbaby_11082015.csv');
$source_file_rows = explode("\n", $source_file_content);
array_shift($source_file_rows);
if (empty($source_file_rows)) {
$this->error('Массив пуст');
return;
}
$this->output->progressStart(count($source_file_rows));
foreach ($source_file_rows as $row) {
$row = trim($row);
if (empty($row)) {
continue;
}
$fields = explode(';', $row);
$product_model = \App\Models\Product::create(['code' => trim($fields[0]), 'article' => trim($fields[1]), 'name' => trim($fields[2]), 'category_name' => trim($fields[3]), 'brand' => trim($fields[4]), 'price_2' => trim($fields[5]), 'price_1' => trim($fields[6]), 'catalog_id' => 2]);
$source_url = 'http://' . substr(trim($fields[7]), 0, -4) . '_big.jpg';
$media_model = new \App\Models\Media();
$media_model->product_id = $product_model->id;
$media_model->source_url = $source_url;
$media_model->save();
$this->output->progressAdvance();
}
$this->output->progressFinish();
}
示例7: __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');
}
}
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
if (!Storage::disk('local')->exists('seeds/develop')) {
$this->command->info('Dev seed data file not present. Creating...');
$this->createData();
} else {
$this->data = unserialize(Storage::get('seeds/develop'));
$this->command->info('Dev seed data file found.');
if (count($this->data) < 7) {
$this->command->info('Dev seed data file out of date. Creating...');
$this->createData();
}
}
foreach ($this->data as $class => $data) {
$full_class = 'App\\' . $class;
$model = new $full_class();
$table = $model->getTable();
DB::table($table)->delete();
$chunks = array_chunk($data, 500);
foreach ($chunks as $chunk) {
$model::insert($chunk);
}
$this->command->getOutput()->writeln("<info>Seeded:</info> {$table}");
}
}
示例9: getImg
private static function getImg(Meeting $meeting)
{
$name = 'meetings/' . $meeting->id;
if (!\Storage::exists($name)) {
return false;
}
return \Storage::get($name);
}
示例10: __construct
public function __construct()
{
$object = Storage::get('db', false);
// Sanity check
if ($object === false) {
return Error::log('Could not get Database class');
}
$this->db = $this->database = $object;
}
示例11: getArticle
public function getArticle($uri)
{
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new TableExtension());
$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));
$contents = \Storage::get($uri . '.md');
preg_match('/^.*$/m', $contents, $matches);
return view('portal', array('body' => $converter->convertToHtml($contents), 'title' => substr($matches[0], 2)));
}
示例12: __construct
function __construct()
{
$model = new Models_Product();
// Требуется только пересчет цены товара.
if (!empty($_REQUEST['calcPrice'])) {
$model->calcPrice();
exit;
}
$product = Storage::get(md5('ControllersProduct' . URL::getUrl()));
if ($product == null) {
$settings = MG::get('settings');
$product = $model->getProduct(URL::getQueryParametr('id'));
if (empty($product)) {
MG::redirect('/404');
exit;
}
$product['meta_title'] = $product['meta_title'] ? $product['meta_title'] : $product['title'];
$product['currency'] = $settings['currency'];
$blockVariants = $model->getBlockVariants($product['id']);
$blockedProp = $model->noPrintProperty();
$propertyFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => $product['thisUserFields'], 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants, 'currency_iso' => $product['currency_iso']));
// Легкая форма без характеристик.
$liteFormData = $model->createPropertyForm($param = array('id' => $product['id'], 'maxCount' => $product['count'], 'productUserFields' => null, 'action' => "/catalog", 'method' => "POST", 'ajax' => true, 'blockedProp' => $blockedProp, 'noneAmount' => false, 'noneButton' => $product['count'] ? false : true, 'titleBtn' => MG::getSetting('buttonBuyName'), 'blockVariants' => $blockVariants));
//echo viewData($propertyFormData['defaultSet']);
$product['price_course'] += $propertyFormData['marginPrice'];
$currencyRate = MG::getSetting('currencyRate');
$currencyShopIso = MG::getSetting('currencyShopIso');
$product['currency_iso'] = $product['currency_iso'] ? $product['currency_iso'] : $currencyShopIso;
$product['old_price'] = $product['old_price'] * $currencyRate[$product['currency_iso']];
$product['old_price'] = $product['old_price'] ? $product['old_price'] : 0;
$product['price'] = MG::priceCourse($product['price_course']);
$product['propertyForm'] = $propertyFormData['html'];
$product['propertyNodummy'] = $propertyFormData['propertyNodummy'];
$product['stringsProperties'] = $propertyFormData['stringsProperties'];
$product['liteFormData'] = $liteFormData['html'];
$product['description'] = MG::inlineEditor(PREFIX . 'product', "description", $product['id'], $product['description']);
$product['title'] = MG::modalEditor('catalog', $product['title'], 'edit', $product["id"]);
// Информация об отсутствии товара на складе.
if (MG::getSetting('printRemInfo') == "true") {
$message = 'Здравствуйте, меня интересует товар "' . str_replace("'", """, $product['title']) . '" с артикулом "' . $product['code'] . '", но его нет в наличии.
Сообщите, пожалуйста, о поступлении этого товара на склад. ';
if ($product['count'] != 0) {
$style = 'style="display:none;"';
}
$product['remInfo'] = "<span class='rem-info' " . $style . ">Товара временно нет на складе!<br/><a href='" . SITE . "/feedback?message=" . $message . "'>Сообщить когда будет в наличии.</a></span>";
}
if ($product['count'] < 0) {
$product['count'] = "много";
}
$product['related'] = $model->createRelatedForm($product['related']);
Storage::save(md5('ControllersProduct' . URL::getUrl()), $product);
}
// MG::set('propertyNodummy',$product['propertyNodummy']);
// $_SESSION['propertyNodummy'] = $product['propertyNodummy'];
$this->data = $product;
}
示例13: index
public function index()
{
$paths = \Storage::files('blog');
$articles = array();
foreach ($paths as $path) {
preg_match('/^.*$/m', \Storage::get($path), $matches);
$articles[] = array('uri' => substr($path, 5, -3), 'title' => substr($matches[0], 2));
}
return view('blog/index', array('articles' => $articles, 'title' => 'sinkcup的博客'));
}
示例14: download
public function download()
{
$contents = Http::get($_GET["url"]);
$fileInfo = new SplFileInfo($_GET["fname"]);
// Add the torrent to deluge using the RPC api
$tconfig = Storage::get("torrents");
$client = new HTTPClient((array) $tconfig->deluge);
$client->core->add_torrent_file($tconfig->dropPath . "/" . $fileInfo->getFilename() . ".torrent", base64_encode($contents), null);
return $this->redirect("/?alert=" . urlencode("Torrent download started"));
}
示例15: testPutContents
/**
* @covers mychaelstyle\Storage::putContents
*/
public function testPutContents()
{
$def1 = $this->dsnMap['Local'];
$def2 = $this->dsnMap['Local2'];
$this->object->addProvider($def2['dsn'], $def2['options']);
$expected = 'This is put contents test';
$this->object->putContents($this->uri_example, $expected, array('permission' => 0644));
$result = $this->object->get($this->uri_example);
$this->assertEquals($expected, $result);
}