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


PHP Dsc\System类代码示例

本文整理汇总了PHP中Dsc\System的典型用法代码示例。如果您正苦于以下问题:PHP System类的具体用法?PHP System怎么用?PHP System使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: read

 public function read()
 {
     $slug = $this->inputfilter->clean($this->app->get('PARAMS.slug'), 'PATH');
     $flash = \Dsc\Flash::instance();
     $this->app->set('flash', $flash);
     $height = $this->app->get('PARAMS.height');
     $width = $this->app->get('PARAMS.width');
     if ($height && $width) {
         $this->app->set('height', $height);
         $this->app->set('width', $width);
     }
     $model = $this->getModel();
     $item = $this->getItem();
     if (empty($item->id)) {
         return $this->app->error(404, 'Invalid Item');
     }
     $this->app->set('model', $model);
     $this->app->set('item', $item);
     // $flash->store((array) $item->cast());
     switch ($item->storage) {
         case "s3":
         case "cloudfiles":
         case "cdn":
             $this->app->reroute($item->url);
             break;
         case "gridfs":
         default:
             $this->app->set('meta.title', $item->slug);
             $view = \Dsc\System::instance()->get('theme');
             echo $view->renderLayout('Assets/Site/Views::assets/view.php');
             break;
     }
 }
开发者ID:dioscouri,项目名称:f3-assets,代码行数:33,代码来源:Asset.php

示例2: index

 public function index()
 {
     // when ACL is ready
     // $this->checkAccess( __CLASS__, __FUNCTION__ );
     $model = $this->getModel();
     $state = $model->populateState()->getState();
     \Base::instance()->set('state', $state);
     $paginated = $model->paginate();
     \Base::instance()->set('paginated', $paginated);
     $categories_db = (array) $this->getModel("categories")->getItems();
     $categories = array(array('text' => 'All Categories', 'value' => ' '), array('text' => '- Uncategorized -', 'value' => '--'));
     array_walk($categories_db, function ($cat) use(&$categories) {
         $categories[] = array('text' => $cat->title, 'value' => (string) $cat->slug);
     });
     \Base::instance()->set('categories', $categories);
     $all_tags = array(array('text' => 'All Tags', 'value' => ' '), array('text' => '- Untagged -', 'value' => '--'));
     $tags = (array) $this->getModel()->getTags();
     array_walk($tags, function ($tag) use(&$all_tags) {
         $all_tags[] = array('text' => $tag, 'value' => $tag);
     });
     \Base::instance()->set('all_tags', $all_tags);
     $this->app->set('meta.title', 'Posts | Blog');
     $this->app->set('allow_preview', $this->canPreview(true));
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Blog/Admin/Views::posts/list.php');
 }
开发者ID:dioscouri,项目名称:f3-blog,代码行数:26,代码来源:Posts.php

示例3: html

 public function html()
 {
     \Base::instance()->set('module', $this);
     \Dsc\System::instance()->get('theme')->registerViewPath(__DIR__ . '/Views/', 'Modules/Html/Views');
     $string = \Dsc\System::instance()->get('theme')->renderLayout('Modules/Html/Views::default.php');
     return $string;
 }
开发者ID:dioscouri,项目名称:f3-modules,代码行数:7,代码来源:Module.php

示例4: restore

 public function restore()
 {
     //TODO try catch here
     $this->getItem()->restore();
     \Dsc\System::instance()->addMessage("Item was restored", 'success');
     $this->app->reroute($this->list_route);
 }
开发者ID:WLR86,项目名称:f3-admin,代码行数:7,代码来源:TrashItem.php

示例5: saveAsk

 public function saveAsk()
 {
     $this->app->set('pagetitle', 'About');
     $this->app->set('subtitle', '');
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Faq/Site/Views::faq/index.php');
 }
开发者ID:ammonitenetworks,项目名称:f3-faq,代码行数:7,代码来源:Faq.php

示例6: findAsset

 public function findAsset($resource = null)
 {
     if (empty($resource)) {
         return;
     }
     // TODO allow this to be modified, both by an admin interface and via a class::method
     $approved_extensions = array('bmp', 'gif', 'ico', 'jpg', 'jpeg', 'odg', 'png', 'svg', '3gp', 'amv', 'avi', 'divx', 'mov', 'mp4', 'mpg', 'qt', 'rm', 'wmv', 'swf', 'm4a', 'mp3', 'ogg', 'wma', 'wav', 'eot', 'otf', 'ttf', 'woff', 'csv', 'doc', 'odp', 'ods', 'odt', 'pdf', 'ppt', 'txt', 'xcf', 'xls');
     // Is the extension of the requested asset in the list of approved extensions?
     $extension = strtolower(pathinfo($resource, PATHINFO_EXTENSION));
     if (!in_array($extension, $approved_extensions)) {
         \Base::instance()->error(500);
         return;
     }
     $global_app_name = \Base::instance()->get('APP_NAME');
     // Loop through all the registered paths and try to find the requested asset
     // If it is found, send it with \Web::instance()->send($file, null, 0, false);
     $paths = (array) \Base::instance()->get($global_app_name . '.dsc.minify.paths');
     foreach ($paths as $path) {
         $file = realpath($path . $resource);
         if (file_exists($file)) {
             \Base::instance()->set('file', $file);
             $theme = \Dsc\System::instance()->get('theme');
             echo $theme->renderView('Minify\\Views::asset.php');
             return;
         }
     }
     // File not found.
     \Base::instance()->error(500);
     return;
 }
开发者ID:dioscouri,项目名称:f3-minify,代码行数:30,代码来源:Controller.php

示例7: update

 public function update()
 {
     $id = $this->inputfilter->clean($this->app->get('PARAMS.id'), 'cmd');
     try {
         $item = (new \Shop\Models\PaymentMethods())->setState('filter.identifier', $id)->getItem();
         if (empty($item->id)) {
             throw new \Exception('Payment Method not found');
         }
         $enabled = $this->app->get('POST.enabled');
         if (strlen($enabled)) {
             $item->enabled = false;
             if (!empty($enabled)) {
                 $item->enabled = true;
             }
         }
         if ($settings_array = (array) $this->inputfilter->clean($this->app->get('POST.settings'), 'array')) {
             $item->settings = $settings_array;
         }
         $item->save();
         \Dsc\System::addMessage('Settings updated', 'success');
         $this->app->reroute('/admin/shop/payment-method/edit/' . $id);
     } catch (\Exception $e) {
         \Dsc\System::addMessage("Invalid Payment Method", 'error');
         \Dsc\System::addMessage($e->getMessage(), 'error');
         $this->app->reroute('/admin/shop/payment-methods');
         return;
     }
 }
开发者ID:dioscouri,项目名称:f3-shop,代码行数:28,代码来源:PaymentMethods.php

示例8: passes

 public static function passes(\Modules\Models\Modules $module, $route = null, $options = array())
 {
     // if this ruleset is ignored, return null
     if (!in_array($module->{'assignment.login_status.method'}, array('include', 'exclude'))) {
         return null;
     }
     $user = \Dsc\System::instance()->get('auth')->getIdentity();
     $is_logged_in = empty($user->id) ? false : true;
     $match = false;
     switch ($module->{'assignment.login_status.value'}) {
         case "1":
             if ($is_logged_in) {
                 $match = true;
             }
             break;
         case "0":
         default:
             if (!$is_logged_in) {
                 $match = true;
             }
             break;
     }
     switch ($module->{'assignment.login_status.method'}) {
         case "exclude":
             $passes = $match ? false : true;
             break;
         default:
             $passes = $match;
             break;
     }
     return $passes;
 }
开发者ID:dioscouri,项目名称:f3-modules,代码行数:32,代码来源:LoginStatus.php

示例9: read

 public function read()
 {
     // TODO Check ACL against page.
     $slug = $this->inputfilter->clean($this->app->get('PARAMS.slug'), 'cmd');
     $model = $this->getModel()->populateState()->setState('filter.type', true)->setState('filter.slug', $slug);
     $preview = $this->input->get("preview", 0, 'int');
     if ($preview) {
         $this->canPreview();
     } else {
         $model->setState('filter.published_today', true)->setState('filter.publication_status', 'published');
     }
     try {
         $item = $model->getItem();
         if (empty($item->id)) {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Invalid Item", 'error');
         $this->app->error('404');
         return;
     }
     $this->app->set('item', $item);
     $this->app->set('meta.title', $item->seoTitle());
     $this->app->set('meta.description', $item->seoDescription());
     \Pages\Models\Activities::track('Viewed Page', array('Page Title' => $item->seoTitle(), 'page_id' => (string) $item->id));
     $view = \Dsc\System::instance()->get('theme');
     $view_file = 'view.php';
     if ($item->{'display.view'} && $view->findViewFile('Pages/Site/Views::pages/view/' . $item->{'display.view'})) {
         $view_file = 'view/' . $item->{'display.view'};
     }
     echo $view->renderTheme('Pages/Site/Views::pages/' . $view_file);
 }
开发者ID:dioscouri,项目名称:f3-pages,代码行数:32,代码来源:Page.php

示例10: addMessage

 /**
  * 
  * @param unknown_type $message
  * @param unknown_type $type
  */
 public static function addMessage($message, $type = 'info')
 {
     $messages = \Dsc\System::instance()->session->get('system.messages') ? \Dsc\System::instance()->session->get('system.messages') : array();
     switch (strtolower($type)) {
         case "good":
         case "success":
             $type = "success";
             break;
         case "high":
         case "bad":
         case "danger":
         case "error":
             $type = "danger";
             break;
         case "low":
         case "warn":
         case "warning":
         case "notice":
             $type = "warning";
             break;
         default:
             $type = "info";
             break;
     }
     $messages = array_merge((array) $messages, array(array('message' => $message, 'type' => $type)));
     \Dsc\System::instance()->session->set('system.messages', $messages);
 }
开发者ID:dioscouri,项目名称:f3-lib,代码行数:32,代码来源:System.php

示例11: isShippingMethodEnabled

 public function isShippingMethodEnabled($method = null)
 {
     $result = false;
     switch ($method) {
         case 'ups':
             $result = $this->{'shipping.ups.enabled'} && $this->{'shipping.ups.key'} && $this->{'shipping.ups.password'};
             break;
         case 'usps':
             $result = $this->{'shipping.usps.enabled'} && $this->{'shipping.usps.key'};
             break;
         case 'fedex':
             $result = $this->{'shipping.fedex.enabled'};
             break;
         case 'stamps':
             $result = $this->{'shipping.stamps.enabled'};
             break;
         case 'dhl':
             $result = $this->{'shipping.dhl.enabled'};
             break;
         case null:
             // are ANY of the social providers enabled?
             $enabled = $this->enabledShippingMethods();
             if (!empty($enabled)) {
                 $result = true;
             }
             break;
         default:
             $event = \Dsc\System::instance()->trigger('onShippingMethodEnabled', array('method' => $provider, 'result' => null));
             $result = $event->getArgument('result');
             break;
     }
     return $result;
 }
开发者ID:dioscouri,项目名称:f3-shop,代码行数:33,代码来源:Settings.php

示例12: index

 public function index()
 {
     $this->app->set('meta.title', 'Dashboard | Pusher');
     // $this->pusher->trigger('my-channel', 'my_event', 'hello world');
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Pusher/Admin/Views::home/index.php');
 }
开发者ID:dioscouri,项目名称:f3-pusher,代码行数:7,代码来源:Home.php

示例13: read

 public function read()
 {
     // TODO Check ACL against page.
     $slug = $this->inputfilter->clean($this->app->get('PARAMS.slug'), 'cmd');
     $model = $this->getModel()->populateState()->setState('filter.slug', $slug);
     $preview = $this->input->get("preview", 0, 'int');
     if ($preview) {
         $this->canPreview();
     } else {
         $model->setState('filter.published_today', true)->setState('filter.publication_status', 'published');
     }
     try {
         $item = $model->getItem();
         if (empty($item->id)) {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Invalid Item", 'error');
         $this->app->error('404');
         return;
     }
     $this->app->set('item', $item);
     $this->app->set('meta.title', $item->seoTitle());
     $this->app->set('meta.description', $item->seoDescription());
     $view = \Dsc\System::instance()->get('theme');
     echo $view->renderTheme('Forums/Site/Views::posts/read.php');
 }
开发者ID:ammonitenetworks,项目名称:f3-forums,代码行数:27,代码来源:Post.php

示例14: read

 public function read()
 {
     $f3 = \Base::instance();
     $slug = $this->inputfilter->clean($f3->get('PARAMS.slug'), 'cmd');
     $model = $this->getModel()->populateState()->setState('filter.slug', $slug);
     $preview = $this->input->get("preview", 0, 'int');
     if ($preview) {
         $this->canPreview();
     } else {
         $model->setState('filter.published_today', true)->setState('filter.publication_status', 'published');
     }
     try {
         $item = $model->getItem();
         if (empty($item->id)) {
             throw new \Exception();
         }
         // increase the view count
         $item->hit();
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Invalid Item", 'error');
         $f3->reroute('/blog');
         return;
     }
     $author = $this->getModel('users')->setState('filter.id', $item->{'author.id'})->getItem();
     $related = $item->getRelatedPosts();
     \Base::instance()->set('item', $item);
     \Base::instance()->set('author', $author);
     \Base::instance()->set('related', $related);
     $this->app->set('meta.title', $item->seoTitle() . ' | Blog');
     $this->app->set('meta.description', $item->seoDescription());
     \Blog\Models\Activities::track('Viewed Blog Post', array('Blog Title' => $item->seoTitle(), 'post_id' => (string) $item->id));
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Blog/Site/Views::posts/view.php');
 }
开发者ID:dioscouri,项目名称:f3-blog,代码行数:34,代码来源:Post.php

示例15: runSite

 protected function runSite()
 {
     $f3 = \Base::instance();
     $f3->set('ONERROR', function ($f3) {
         $response = \Redirect\Factory::handleError();
         // Run the response through a Listener event
         $event = \Dsc\System::instance()->trigger('onError', array('response' => $response));
         $response = $event->getArgument('response');
         switch ($response->action) {
             case "handle":
                 $f3->call($response->callable_handle);
                 break;
             case "html":
                 echo $response->html;
                 break;
             case "redirect":
                 $f3->reroute($response->redirect_route);
                 break;
             default:
                 // by returning false, let f3 default error handler handle the error
                 return false;
                 break;
         }
     });
 }
开发者ID:dioscouri,项目名称:f3-redirect,代码行数:25,代码来源:bootstrap.php


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