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

PHP WebApp类代码示例

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

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



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


示例16: processPage

 public function processPage()
 {
     if (WebApp::get('cat2') !== NULL) {
         $pagefile = $this->ctrl->_getFilename();
     } else {
         $pagefile = $this->_getFilename();
     }
     if (!file_exists($pagefile . '.php')) {
         $this->parent->parent->debug($this::name_space . ': Failed to load page file "' . str_replace(__LIBDIR__, '', $pagefile) . '.php!');
         return false;
     }
     $this->parent->parent->debug($this::name_space . ': Loading file "' . str_replace(__LIBDIR__, '', $pagefile . '.php') . '"...');
     if (WebApp::get('cat2') !== NULL) {
         $this->parent->setContent($this->ctrl->_processPage($pagefile . '.php'));
     } else {
         $this->parent->setContent($this->_processPage($pagefile . '.php'));
     }
     return true;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:19,代码来源:controller.php


示例17: secondary_groups

 public function secondary_groups()
 {
     $q = WebApp::get('q');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('groups' => array()));
     }
     $groups = array();
     $q = '%' . $q . '%';
     $group_query = $this->mySQL_r->prepare("SELECT `GID`,`name` FROM `core_groups` WHERE `name` LIKE ? AND `type`='s'");
     $group_query->bind_param('s', $q);
     $group_query->execute();
     $group_query->store_result();
     $group_query->bind_result($id, $value);
     while ($group_query->fetch()) {
         $group['id'] = $id;
         $group['text'] = $value;
         $groups[] = $group;
     }
     return new ActionResult($this, '/admin/email', 0, 'Success', B_T_SUCCESS, array('groups' => $groups));
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:20,代码来源:ajax.php


示例18: setFile

 public function setFile()
 {
     include __LIBDIR__ . '/fileMIMEs.php';
     $this->MIMEs = $MIME_type;
     if (WebApp::get('cat1') == 'css' || WebApp::get('cat1') == 'js' || WebApp::get('cat1') == 'images') {
         $filename = strtolower(WebApp::get('cat2')) . '/' . WebApp::get('cat1') . '/' . WebApp::get('cat3');
         $i = 4;
         while (WebApp::get('cat' . $i) !== NULL) {
             $filename .= '/' . WebApp::get('cat' . $i);
             $i++;
         }
         $this->parent->addHeader('file', $filename);
         $file = __MODULE__ . '/' . $filename;
     } elseif (WebApp::get('cat1') == 'fonts') {
         $file = __EXECDIR__ . '/' . Server::get('REQUEST_URI');
     }
     if (file_exists($file)) {
         $this->file = $file;
     } else {
         $this->file = false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:22,代码来源:file.php


示例19: check

 public function check()
 {
     $this->parent->parent->debug($this::name_space . ': Checking for login token...');
     if (!$this->parent->parent->config->config['core']['database']) {
         return false;
     }
     // Check for token cookie
     if (Cookie::get('ltkn') === NULL) {
         $this->parent->parent->debug($this::name_space . ': Login token not found!');
         return false;
     }
     $this->parent->parent->debug($this::name_space . ': Found token');
     $token = Cookie::get('ltkn');
     $sessID = Session::getID();
     $userID = Session::get('WebApp.User', 'userID');
     // It does exist so...
     // Find token in database where userID = the userID in the token
     $this->parent->parent->debug($this::name_space . ': Checking sessions table for:');
     $this->parent->parent->debug('T: ' . $token . '/ S: ' . $sessID . '/ U: ' . $userID);
     $token_query = $this->mySQL_r->prepare("SELECT INET_NTOA(`IP`), `auth` FROM `core_sessions` WHERE `token`=? AND `session`=? AND `user`=?");
     $token_query->bind_param('ssi', $token, $sessID, $userID);
     $token_query->execute();
     $token_query->store_result();
     if ($token_query->num_rows != 1) {
         $this->parent->parent->debug($this::name_space . ': Failed to find session.');
         return false;
     }
     $token_query->bind_result($ip, $auth);
     $token_query->fetch();
     if (Server::get('remote_addr') != $ip || $auth) {
         $update_query = $this->mySQL_w->prepare("UPDATE `core_sessions` SET `auth`=1 WHERE `token`=?");
         $update_query->bind_param('s', $token);
         $update_query->execute();
         WebApp::forceRedirect('/user/auth?r=' . urlencode(Server::get('request_uri')));
     }
     $this->parent->parent->debug($this::name_space . ': Found session. Token Check successful!');
     return true;
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:38,代码来源:class.sessiontokeniser.php


示例20: contacts

 public function contacts()
 {
     $q = WebApp::get('q');
     if ($q === NULL) {
         return new ActionResult($this, '/admin/email', 0, 'No search term sent', B_T_FAIL, array('contacts' => array()));
     }
     $contacts = array();
     if (filter_var($q, FILTER_VALIDATE_EMAIL)) {
         $contact['id'] = $q;
         $contact['text'] = $q;
         $contacts[] = $contact;
     }
     $q = '%' . $q . '%';
     $user_query = $this->mySQL_r->prepare("SELECT `username`, CONCAT(`f_name`, ' ', `s_name`) FROM `core_users` WHERE CONCAT(`username`, ' ', `email`) LIKE ?");
     $group_query = $this->mySQL_r->prepare("SELECT `name` FROM `core_groups` WHERE `name` LIKE ?");
     $user_query->bind_param('s', $q);
     $user_query->execute();
     $user_query->store_result();
     $user_query->bind_result($id, $value);
     while ($user_query->fetch()) {
         $contact['id'] = $id;
         $contact['text'] = $value;
         $contacts[] = $contact;
     }
     $user_query->free_result();
     $group_query->bind_param('s', $q);
     $group_query->execute();
     $group_query->store_result();
     $group_query->bind_result($value);
     while ($group_query->fetch()) {
         $contact['id'] = $value;
         $contact['text'] = '* ' . $value;
         $contacts[] = $contact;
     }
     return new ActionResult($this, '/admin/email', 0, 'Success', B_T_SUCCESS, array('contacts' => $contacts));
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:36,代码来源:ajax.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP WebDriverBy类代码示例发布时间:2022-05-23
下一篇:
PHP Web类代码示例发布时间: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