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


PHP WebApp类代码示例

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


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

示例1: testExecuteController

 public function testExecuteController()
 {
     $logger = $this->getMock('Conpago\\Logging\\Contract\\ILogger');
     $response = $this->getMock('Conpago\\Helpers\\Contract\\IResponse');
     $requestDataReader = $this->getMock('Conpago\\Helpers\\Contract\\IRequestDataReader');
     $requestData = $this->getMock('Conpago\\Helpers\\Contract\\IRequestData');
     $requestDataReader->expects($this->any())->method('getRequestData')->willReturn($requestData);
     $controller = $this->getMock('Conpago\\Presentation\\Contract\\IController');
     $controller->expects($this->once())->method('execute')->with($requestData);
     $appConfig = $this->getMock('Conpago\\Config\\Contract\\IAppConfig');
     $webApp = new WebApp($requestDataReader, $controller, $response, $logger, $appConfig);
     $webApp->run();
 }
开发者ID:agborkowski,项目名称:conpago,代码行数:13,代码来源:WebAppTest.php

示例2: build

 function build()
 {
     $page = $this->parent;
     $breadcrumb = '    <ul class="breadcrumb">' . PHP_EOL;
     if ($page->parent->config->config['core']['maintenance']) {
         $breadcrumb .= '      <li class="active">Maintenance</li>' . PHP_EOL;
     } elseif (!$page->parent->config->config['core']['database']) {
         $breadcrumb .= '      <li class="active">Site Error</li>' . PHP_EOL;
     } else {
         if ($page->getStatus() != 200) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat3') !== NULL) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '">' . ucfirst(WebApp::get('cat1')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '/' . WebApp::get('cat2') . '">' . ucfirst(WebApp::get('cat2')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat2') !== NULL) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '">' . ucfirst(WebApp::get('cat1')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat1') !== 'core') {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } else {
             $breadcrumb .= '      <li class="active">Home</li>' . PHP_EOL;
         }
     }
     $breadcrumb .= '    </ul>' . PHP_EOL;
     $this->breadcrumb = $breadcrumb;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:31,代码来源:breadcrumb.php

示例3: setAjax

 public function setAjax()
 {
     //$this->parent->addHeader('content-type', 'application/json');
     // Check to see if we are in maintenance mode
     if (!$this->parent->config->config['core']['database']) {
         $this->setStatus(500);
         return;
     }
     for ($i = 1; $i != 3; $i++) {
         ${'cat' . $i} = WebApp::get('cat' . $i);
     }
     if (!file_exists(__MODULE__ . '/' . $cat2 . '/ajax.php')) {
         $this->parent->debug($this::name_space . ':  Could not find "ajax.php"!');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax Ctrl not found</code>');
         return;
     }
     if (!@(include_once __MODULE__ . '/' . $cat2 . '/ajax.php')) {
         $this->parent->debug($this::name_space . ':  Could not access "ajax.php"! Check r/w permissions');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Failed to open Ajax</code>');
         return;
     }
     if (class_exists('AjaxController')) {
         $this->ctrl = new AjaxController($this);
         $this->parent->debug($this::name_space . ': AjaxController loaded');
     } else {
         $this->parent->debug($this::name_space . ': Could not find AjaxController class in "ajax.php"!');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax Ctrl Ob not found</code>');
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:29,代码来源:ajax.php

示例4: menu_pages

 public function menu_pages()
 {
     $q = WebApp::get('q');
     $m = WebApp::get('m');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('pages' => array()));
     }
     if ($m === NULL || $m === '') {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No module selected', B_T_FAIL, array('pages' => array()));
     }
     $pages = array();
     $q = '%' . $q . '%';
     $page_query = $this->mySQL_r->prepare("SELECT `ID`,`title` FROM `core_pages` WHERE `title` LIKE ? AND `module_id`=?");
     if (!$page_query) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'Query failed', B_T_FAIL, array('pages' => array()));
     }
     $page_query->bind_param('si', $q, $m);
     $page_query->execute();
     $page_query->store_result();
     $page_query->bind_result($id, $value);
     while ($page_query->fetch()) {
         $page['id'] = $id;
         $page['text'] = $value;
         if ($id >= pow(10, 6)) {
             $page['text'] = '* ' . $page['text'];
         }
         $pages[] = $page;
     }
     return new ActionResult($this, '/admin/core/menu_add', 0, 'Success', B_T_SUCCESS, array('pages' => $pages));
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:30,代码来源:ajax.php

示例5: delete

 public function delete()
 {
     $options = WebApp::post('options') === NULL ? array() : strgetcsv(WebApp::post('options'));
     if (count($options) == 0) {
         return new ActionResult($this, '/admin/core/option_view', 0, 'No option(s) were selected!', B_T_FAIL);
     }
     foreach ($options as $option) {
         $validated = GUMP::is_valid(array('opt' => $option), array('opt' => 'integer'));
         if ($validated !== true) {
             return new ActionResult($this, '/admin/core/option_view', 0, 'No option(s) were selected!', B_T_FAIL);
         }
     }
     $delete = $this->mySQL_w->prepare("DELETE FROM `core_options` WHERE `id`=?");
     $affected_rows = 0;
     foreach ($options as $id) {
         $delete->bind_param('i', $id);
         $delete->execute();
         $delete->store_result();
         $affected_rows += $delete->affected_rows;
     }
     if ($affected_rows == count($options)) {
         $this->parent->parent->logEvent($this::name_space, 'Deleted options: ' . csvgetstr($options));
         return new ActionResult($this, '/admin/core/option_view', 1, 'Successfully deleted selected option(s)!', B_T_SUCCESS);
     } else {
         $this->parent->parent->logEvent($this::name_space, 'Deleted some options: ' . csvgetstr($options));
         return new ActionResult($this, '/admin/core/option_view', 1, 'Successfully deleted ' . $affected_rows . '/' . count($options) . ' selected option(s)!<br /><small>Possible cause: <code>Unknown</code></small>', B_T_WARNING);
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:28,代码来源:option.action.php

示例6: getFooter

 function getFooter($parent)
 {
     if (WebApp::get('cat1') == 'admin' && $this->parent->parent->user->is_loggedIn()) {
         return $this->_processPage(__LIBDIR__ . '/modules/admin/pages/footer.php');
     } else {
         return $this->_processPage(__LIBDIR__ . '/modules/core/pages/footer.php');
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:8,代码来源:controller.php

示例7: uninstall

function uninstall($ctrl)
{
    $uninstall = file_get_contents(dirname(__FILE__) . '/sql/uninstall.sql');
    if ($ctrl->mySQL_w->multi_query($uninstall) !== false) {
        WebApp::clearQuery($ctrl->mySQL_w);
        return true;
    } else {
        return false;
    }
}
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:10,代码来源:uninstall.php

示例8: _getFilename

 function _getFilename()
 {
     $pagefile = __MODULE__ . '/location/admin/';
     if (WebApp::get('cat3') !== NULL) {
         $pagefile .= WebApp::get('cat3');
     } else {
         $pagefile .= 'dash';
     }
     return $pagefile;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:10,代码来源:admin.php

示例9: before

 /**
  * Configure Backend Controllers
  */
 public function before()
 {
     parent::before();
     // Configure Backend
     require_once APPPATH . 'config' . DIRECTORY_SEPARATOR . 'backend.php';
     // Navigation init
     Navigation::init(Kohana::$config->load('sitemap')->as_array());
     // Configure WebApp init data
     WebApp::set_init_data(array('is_backend' => true, 'backend_url' => URL::backend(), 'base_url' => URL::site()));
 }
开发者ID:NegoCore,项目名称:core,代码行数:13,代码来源:Backend.php

示例10: processAction

 function processAction()
 {
     $action = WebApp::get('cat3');
     if (is_callable(array($this, $action))) {
         $this->result = $this->{$action}();
         return true;
     } else {
         $this->result = new ActionResult($this, Server::get('Request_URI'), 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Action not found: "' . Server::get('Request_URI') . '"</code>');
         return false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:11,代码来源:class.baseaction.php

示例11: _getFilename

 function _getFilename()
 {
     $pagefile = __LIBDIR__ . '/modules/' . WebApp::get('cat2') . '/admin/';
     if (WebApp::get('cat3') !== NULL) {
         $pagefile .= WebApp::get('cat3');
         if (WebApp::get('cat4') !== NULL) {
             $pagefile .= '_' . WebApp::get('cat4');
         }
     } else {
         $pagefile .= 'dash';
     }
     return $pagefile;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:13,代码来源:class.baseadminpagecontroller.php

示例12: processAjax

 function processAjax()
 {
     $ajax = WebApp::get('cat3');
     if (WebApp::get('cat4') !== NULL) {
         $ajax .= '_' . WebApp::get('cat4');
     }
     if (is_callable(array($this, $ajax))) {
         $this->result = $this->{$ajax}();
         return true;
     } else {
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax not found</code>');
         return false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:14,代码来源:class.baseajax.php

示例13: array

 /**
  * Gets the list of the available valid webapps.
  *
  * @return array
  */
 public function &getWebAppsList()
 {
     $list = array();
     if ($dh = opendir($this->home)) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' and $file != '..' and is_dir($this->home . $file)) {
                 if (WebApp::isValid($this->home . $file)) {
                     $list[] = $file;
                 }
             }
         }
         closedir($dh);
     }
     return $list;
 }
开发者ID:kchizi,项目名称:innomatic-legacy,代码行数:20,代码来源:WebAppContainer.php

示例14: clear_status_msg

 public function clear_status_msg()
 {
     $msg_id = WebApp::get('msg_id');
     if ($msg_id === NULL) {
         $msg_id = WebApp::post('msg_id');
     }
     if ($msg_id === NULL) {
         $this->parent->parent->debug($this::name_space . ': MSG ID was not provided!');
         return new ActionResult($this, '/', 0, 'Failed to clear status message. No ID found.', B_T_FAIL);
     }
     $msg_id = trim(str_replace('alert_', '', $msg_id));
     $msg_id = base64_decode($msg_id);
     Session::del('status_msg', $msg_id);
     $this->parent->parent->debug($this::name_space . ': MSG ID "' . $msg_id . '" was ' . (Session::get('status_msg', $msg_id) === NULL ? '' : 'not ') . 'cleared');
     return new ActionResult($this, '/', 0, 'Cleared status message.', B_T_SUCCESS);
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:16,代码来源:action.php

示例15: _getFilename

 function _getFilename($cat1 = '', $cat2 = '', $cat3 = '', $cat4 = '')
 {
     if ($cat1 == '') {
         for ($i = 1; $i <= 4; $i++) {
             ${'cat' . $i} = WebApp::get('cat' . $i);
         }
     }
     $pagefile = __LIBDIR__ . '/modules/' . $cat1 . '/pages/';
     if ($cat2 !== NULL && $cat2 !== '') {
         $pagefile .= $cat2;
         if ($cat3 !== NULL && $cat3 !== '') {
             $pagefile .= '_' . $cat3;
         }
     } else {
         $pagefile .= 'home';
     }
     return $pagefile;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:18,代码来源:class.basepagecontroller.php


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