• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Dsc\System类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: index

 public function index()
 {
     // TODO get the slug param.  lookup the category.  Check ACL against both category.
     // get paginated list of pages pages associated with this category
     // only pages that are published as of now
     $f3 = \Base::instance();
     $id = $this->inputfilter->clean($f3->get('PARAMS.id'), 'alnum');
     $model = $this->getModel()->populateState()->setState('filter.creator.id', $id);
     try {
         $author = (new \Users\Models\Users())->setState('filter.id', $id)->getItem();
         if (empty($author->id)) {
             throw new \Exception();
         }
         $paginated = $model->paginate();
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Invalid Items", 'error');
         $f3->reroute('/');
         return;
     }
     $state = $model->getState();
     \Base::instance()->set('state', $state);
     \Base::instance()->set('paginated', $paginated);
     $this->app->set('meta.title', 'Pages by ' . $author->fullName());
     $view = \Dsc\System::instance()->get('theme');
     echo $view->render('Pages/Site/Views::pages/category.php');
 }
开发者ID:dioscouri,项目名称:f3-pages,代码行数:26,代码来源:Author.php


示例17: track

 public static function track($action, $properties = array())
 {
     if (class_exists('\\Activity\\Models\\Actions')) {
         \Activity\Models\Actions::track($action, $properties);
     }
     if (class_exists('\\Admin\\Models\\Settings') && class_exists('\\KM')) {
         $settings = \Admin\Models\Settings::fetch();
         if ($settings->enabledIntegration('kissmetrics') && $settings->{'integration.kissmetrics.key'}) {
             \KM::init($settings->{'integration.kissmetrics.key'});
             $identity = \Dsc\System::instance()->get('auth')->getIdentity();
             if ($identity->email) {
                 \KM::identify($identity->email);
             } elseif (isset($_COOKIE['km_ni'])) {
                 \KM::identify($_COOKIE['km_ni']);
             } elseif (isset($_COOKIE['km_ai'])) {
                 \KM::identify($_COOKIE['km_ai']);
             } else {
                 $mongo_id = new \MongoId();
                 \KM::identify((string) $mongo_id);
             }
             \KM::record($action, $properties);
         }
     }
     return null;
 }
开发者ID:dioscouri,项目名称:f3-lib,代码行数:25,代码来源:Activities.php


示例18: email

 public function email()
 {
     $f3 = \Base::instance();
     $id = $this->inputfilter->clean($f3->get('PARAMS.id'), 'alnum');
     $token = $this->inputfilter->clean($f3->get('PARAMS.token'), 'alnum');
     $data = array('sender_name' => $this->input->get('sender_name', null, 'string'), 'sender_email' => $this->input->get('sender_email', null, 'string'), 'recipient_name' => $this->input->get('recipient_name', null, 'string'), 'recipient_email' => $this->input->get('recipient_email', null, 'string'), 'message' => $this->input->get('message', null, 'string'));
     // TODO Validate the input from the form, require at least emails and names
     if (empty($data['sender_name']) || empty($data['sender_email']) || empty($data['recipient_name']) || empty($data['recipient_email'])) {
         \Dsc\System::instance()->addMessage("Please complete all required fields.  All name and email fields are required.", 'error');
         $f3->reroute('/shop/giftcard/' . $id . '/' . $token);
         return;
     }
     try {
         $item = (new \Shop\Models\OrderedGiftCards())->setState('filter.id', $id)->setState('filter.token', $token)->getItem();
         if (empty($item->id)) {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Invalid Gift Card", 'error');
         $f3->reroute('/shop');
         return;
     }
     // use the model to send the email so the model can add the history
     try {
         $item->sendEmailShareGiftCard($data);
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage("Error sending email.", 'error');
         $f3->reroute('/shop/giftcard/' . $id . '/' . $token);
         return;
     }
     \Dsc\System::instance()->addMessage("Gift card has been sent to " . $data['recipient_email']);
     $f3->reroute('/shop');
 }
开发者ID:dioscouri,项目名称:f3-shop,代码行数:33,代码来源:OrderedGiftCard.php


示例19: passes

 /**
  * Determines whether or not this condition passes
  *
  * @param string $route
  * @param unknown $options
  */
 public function passes(\Modules\Models\Modules $module, $route = null, $options = array())
 {
     // if this ruleset is ignored, return null
     if (!in_array($module->{'assignment.shop_orders.method'}, array('include'))) {
         return null;
     }
     // user must be logged in for this condition to ever evaluate to be true
     $user = \Dsc\System::instance()->auth->getIdentity();
     if (empty($user->id)) {
         return false;
     }
     $customer = new \Shop\Models\Customers($user);
     $order_count = $customer->ordersCount(true);
     $return = null;
     switch ($module->{'assignment.shop_orders.has_converted'}) {
         case "1":
             // user has made an order
             if ($order_count > 0) {
                 $return = true;
             } else {
                 $return = false;
             }
             break;
         case "0":
             // user has never made an order
             if ($order_count > 0) {
                 $return = false;
             } else {
                 $return = true;
             }
             break;
     }
     return $return;
 }
开发者ID:dioscouri,项目名称:f3-shop,代码行数:40,代码来源:Condition.php


示例20: charge

 public function charge()
 {
     $id = $this->inputfilter->clean($this->app->get('PARAMS.id'), 'alnum');
     $request = $this->getModel()->setState('filter.id', $id)->getItem();
     $settings = \Striper\Models\Settings::fetch();
     // Set your secret key: remember to change this to your live secret key in production
     // See your keys here https://manage.stripe.com/account
     \Stripe::setApiKey($settings->{$settings->mode . '.secret_key'});
     // Get the credit card token submitted by the form
     $token = $this->inputfilter->clean($this->app->get('POST.stripeToken'), 'string');
     // Create the charge on Stripe's servers - this will charge the user's card
     try {
         $charge = \Stripe_Charge::create(array("amount" => $request->amountForStripe(), "currency" => "usd", "card" => $token, "description" => $request->{'client.email'}));
         // this needs to be created empty in model
         $request->acceptPayment($charge);
         // SEND email to the client
         $request->sendChargeEmailClient($charge);
         $request->sendChargeEmailAdmin($charge);
         $this->app->set('charge', $charge);
         $this->app->set('paymentrequest', $request);
         $view = \Dsc\System::instance()->get('theme');
         echo $view->render('Striper/Site/Views::paymentrequest/success.php');
     } catch (\Stripe_CardError $e) {
         // The card has been declined
         $view = \Dsc\System::instance()->get('theme');
         echo $view->render('Striper/Site/Views::paymentrequest/index.php');
     }
 }
开发者ID:dioscouri,项目名称:f3-striper,代码行数:28,代码来源:PaymentRequest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Types\AbstractRequestType类代码示例发布时间:2022-05-23
下一篇:
PHP Tests\ViewUnitTestBase类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap