本文整理汇总了PHP中Home类的典型用法代码示例。如果您正苦于以下问题:PHP Home类的具体用法?PHP Home怎么用?PHP Home使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Home类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: parseData
/**
* aangepaste parseData functie die overweg kan met 1 rij ipv een array met daarin een array
*
* @param unknown_type $data
* @return unknown
*/
function parseData($data)
{
$result = array();
$result['gebruikersnaam'] = $data["uid"][0];
$result['voornaam'] = $data["ugentpreferredgivenname"][0];
$result['achternaam'] = $data["ugentpreferredsn"][0];
$result['email'] = $data["mail"][0];
$kot = $data["ugentdormpostaladdress"][0];
if ($kot != "") {
$kot = explode("\$", $kot);
if (strpos(" " . $kot[0], "HOME")) {
//VUILE LDAP HACK :(
$kot[0] = $kot[0] == "HOME BERTHA DE VRIES" ? "HOME BERTHA DE VRIESE" : $kot[0];
$home = Home::getHome("ldapNaam", $kot[0]);
$result['homeId'] = $home->getId();
$result['home'] = $home->getLangeNaam();
$temp = explode(":", $kot[1]);
if (sizeof($temp) > 1) {
$result['kamer'] = $temp[1];
} else {
$temp = explode("(", $kot[1]);
$temp = explode(")", $temp[1]);
if (sizeof($temp) > 1) {
$result['kamer'] = $home->getKamerPrefix() . "." . $temp[0];
} else {
$temp = explode("K. ", $kot[1]);
$result['kamer'] = $home->getKamerPrefix() . "." . converteer($temp[0]);
//er wordt nog een oud kamernummer gebruikt
}
}
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:repair-svn,代码行数:40,代码来源:ldapTest.php
示例2: __construct
public function __construct()
{
$this->splitUrl();
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
require APP . 'controllers/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
开发者ID:EmmanuelSW,项目名称:DaemonPHP,代码行数:27,代码来源:application.php
示例3: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->splitUrl();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controller/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
require APP . 'controller/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
开发者ID:N-Porsh,项目名称:chat,代码行数:36,代码来源:application.php
示例4: index
public function index()
{
$aViewParameter = array();
$aViewParameter['page'] = 'home';
$this->load->model('analog_model');
$aViewParameter['sucess'] = '0';
$aObjHome = new Home();
$aObjHome->checkSettingsSaved();
$sResponse = get_rlb_status();
$sValves = $sResponse['valves'];
$sRelays = $sResponse['relay'];
$sPowercenter = $sResponse['powercenter'];
$sPump = array($sResponse['pump_seq_0_st'], $sResponse['pump_seq_1_st'], $sResponse['pump_seq_2_st']);
$aViewParameter['sValves'] = $sValves;
$aViewParameter['sRelays'] = $sRelays;
$aViewParameter['sPowercenter'] = $sPowercenter;
$aViewParameter['sPump'] = $sPump;
$aViewParameter['relay_count'] = strlen($sRelays);
$aViewParameter['valve_count'] = strlen($sValves);
$aViewParameter['power_count'] = strlen($sPowercenter);
$aViewParameter['pump_count'] = count($sPump);
if ($this->input->post('command') == 'Save') {
$sDeviceName = $this->input->post('sDeviceName');
$this->analog_model->saveAnalogDevice($sDeviceName);
$aViewParameter['sucess'] = '1';
}
$aAllAnalogDevice = $this->analog_model->getAllAnalogDevice();
$aAllANalogDeviceDirection = $this->analog_model->getAllAnalogDeviceDirection();
$aViewParameter['aResponse'] = array('AP0' => $sResponse['AP0'], 'AP1' => $sResponse['AP1'], 'AP2' => $sResponse['AP2'], 'AP3' => $sResponse['AP3']);
$aViewParameter['aAllAnalogDevice'] = $aAllAnalogDevice;
$aViewParameter['aAllANalogDeviceDirection'] = $aAllANalogDeviceDirection;
$this->load->view('Analog', $aViewParameter);
}
开发者ID:sandeepnetwin,项目名称:relay_framework,代码行数:33,代码来源:analog.php
示例5: run
public static function run($url)
{
if (!empty($url) && strtolower($url) != "home") {
$url = explode("/", $url);
$class = ucfirst(strtolower($url[0]));
if (count($url) > 1) {
$method = $url[1] ? strtolower($url[1]) : null;
if (count($url) > 2) {
$param = $url[2] ? $url[2] : null;
}
}
if (file_exists(DIR_CONTROLLER . $class . '.php')) {
$obj = new $class();
if (isset($method) && method_exists($obj, $method)) {
if (isset($param)) {
$obj->{$method}($param);
} else {
$obj->{$method}();
}
} else {
if (isset($method)) {
include DIR_BASE . 'app/view/erro500.php';
}
}
$obj->show();
} else {
include DIR_BASE . 'app/view/erro500.php';
}
} else {
$obj = new Home();
$obj->show();
}
}
开发者ID:alanfm,项目名称:biblioteca,代码行数:33,代码来源:App.php
示例6: __construct
public function __construct()
{
$this->getUrlWithoutModRewrite();
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
require APP . 'controllers/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Llama el metodo y le pasa los argumentos
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
//Si no hay parametros llama a el metodo sin argumentos.
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// Si no se define alguna accion defino por defecto la index
$this->url_controller->index();
} else {
//Si la accion no existe lanzo el error
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
开发者ID:EmmanuelSW,项目名称:Eswood,代码行数:35,代码来源:application.php
示例7: get
function get()
{
$profile_uid = intval($_GET['p']) ? intval($_GET['p']) : -1;
$load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
header("Content-type: text/html");
echo "<!DOCTYPE html><html><body>\r\n";
echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '<div>' : '<section>';
$mod = new Home();
$text = $mod->get($profile_uid, $load);
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
$text = preg_replace($pattern, $replace, $text);
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
*/
echo str_replace("\t", ' ', $text);
echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '</div>' : '</section>';
echo "</body></html>\r\n";
// logger('update_home: ' . $text);
killme();
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:Update_home.php
示例8: get_article_list
public function get_article_list($start = 0, $limit = 10, $keyword, $type = 1)
{
$obj = new Home();
$query = $this->article_model->get_article_list($type, $start, $limit, $keyword);
if ($query != NULL) {
$i = 0;
foreach ($query->result() as $q) {
$path = !isset($q->path_image) ? "" : $q->path_image;
$title = !isset($q->title) ? "" : $q->title;
$tag = !isset($q->tag) ? "" : $q->tag;
$article_id = !isset($q->article_id) ? "" : $q->article_id;
$read_more = base_url("article/read/" . $article_id . "/" . $obj->slug($title) . "");
$year = !isset($q->year) ? 0 : $q->year;
$month = !isset($q->month) ? 0 : $q->month;
$day = !isset($q->day) ? 0 : $q->day;
$default = base_url('assets/img/article/default-image.png');
$article_id = !isset($q->article_id) ? "" : $q->article_id;
$read_more = base_url("article/read/" . $year . '/' . $month . '/' . $day . '/' . $article_id . "/" . $this->slug($title) . "");
$title = $type == 2 || $type == 3 || $type == 4 ? $this->global_common->get_title(26, $title) : $title;
$img = "<p><a target='_blank' href='" . $read_more . "'>";
//$img .= "<img class='img-responsive opacity' width='480px' src='". base_url($path) ."' alt='".$title."'/>";
$img .= "<img class='img-responsive opacity lazy' width='480px' src='" . $default . "' data-original='" . base_url($path) . "' alt='" . $title . "'>";
$img .= "</a></p>";
$category = !isset($q->category) ? "" : $q->category;
$recent_article_category = "<a href='" . base_url('article/page/0/0/' . $category) . "'>" . $category . "</a>";
$data[$i] = array("article_id" => $article_id, "article_category_id" => !isset($q->article_category_id) ? "" : $q->article_category_id, "image_id" => !isset($q->image_id) ? "" : $q->image_id, "title" => "<a href='" . $read_more . "'>" . $title . "</a>", "read_more" => "<a class='btn btn-primary' href='" . $read_more . "'>Read More</a>", "tag" => $this->global_common->get_list_tag($tag, 'article'), "summary" => !isset($q->summary) ? "" : $obj->get_preview_summary($q->summary), "full_name" => !isset($q->nama_lengkap) ? "" : $q->nama_lengkap, "created_date" => !isset($q->created_date) ? "" : $q->created_date, "image" => $img, "recent_article_category" => $recent_article_category, "count_article_comment" => $this->article_model->count_article_comment($article_id)->count_article_comment, "count_article_stat" => $this->article_model->count_article_stat($article_id)->count_article_stat);
$i++;
}
} else {
$data = NULL;
}
return $data;
}
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:33,代码来源:article.php
示例9: sitemap
function sitemap($t)
{
$result = $this->sitemap_model->get_url_sitemap($t);
$home = new Home();
if ($result != false) {
foreach ($result as $row) {
$date = explode(" ", $row->created_date);
$y = explode("-", $date[0]);
$m = explode("-", $date[0]);
$d = explode("-", $date[0]);
if ($t == 'article') {
$url = base_url("article/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->article_id . "/" . $home->slug($row->title) . "");
}
if ($t == 'news') {
$url = base_url("news/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->news_id . "/" . $home->slug($row->title) . "");
}
if ($t == 'video') {
$url = base_url("video/watch/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->video_id . "/" . $home->slug($row->title) . "");
}
$datetime = new DateTime($row->created_date);
$data[] = array("loc" => $url, "lastmod" => $datetime->format('Y-m-d\\TH:i:sP'), "priority" => 0.5, "changefreq" => "daily");
}
}
return $data;
}
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:25,代码来源:sitemap.php
示例10: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->splitUrl();
// check for controller: no controller given ? then load start-page
if ($this->url_controller) {
$controller = ucfirst(strtolower($this->url_controller));
$pathController = APP . "controllers/{$controller}.controller.php";
if (file_exists($pathController)) {
// llamamos al archivo controlador
require $pathController;
$action = strtolower($this->url_action) . 'Action';
if (!empty($this->url_params)) {
$this->url_controller = new $controller($this->url_params);
} else {
$this->url_controller = new $controller();
}
// comprobamos si la accion existe
if (method_exists($this->url_controller, $action)) {
$this->url_controller->{$action}($this->url_params);
} else {
$params = array_merge(array($this->url_action), $this->url_params);
$this->url_controller->index($params);
}
} else {
header('location: ' . URL . 'error');
}
} elseif (!$this->url_controller) {
require APP . 'controllers/Home.controller.php';
$page = new Home();
$page->index();
}
}
开发者ID:GNURub,项目名称:daw2,代码行数:37,代码来源:application.php
示例11: testWebDriver
/**
* @test
* @group session
* @group blacklist
*/
public function testWebDriver()
{
$home_page = new Home(self::$session);
$home_page->open();
$schedule_page = $home_page->navigate_to('Schedule');
$schedule_page->open_session('WebDriver!');
$this->assertEquals($schedule_page->title, "WebDriver!");
}
开发者ID:rivlinp,项目名称:tnphp-webdriver,代码行数:13,代码来源:SecondTest.php
示例12: enter
/**
*
* @param $controller
*/
function enter($controller)
{
// Call a given controller, except when the segment1 is "null", in which, call Home.
if ($controller != "null") {
$instance = new $controller();
$instance->main();
} else {
$instance = new Home();
$instance->main();
}
}
开发者ID:ThrownDice,项目名称:SimpleChat,代码行数:15,代码来源:Vim.php
示例13: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->getUrlWithoutModRewrite();
$GLOBALS["beans"] = new stdClass();
$this->openDatabaseConnection();
$this->loadModels();
$this->loadHelpers();
date_default_timezone_set('UTC');
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// If user is not logged in, restrict to the login page only
$this->checkLoggedIn();
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controllers/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
// defined action not existent: show the error page
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
开发者ID:divyabalakrishna,项目名称:CS428PNP,代码行数:52,代码来源:application.php
示例14: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->getUrlWithoutModRewrite();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controllers/' . $this->url_controller . '.php';
/**
* Bad workaround due to list being a reserved keyword. Should probably rename to something other than list in production.
**/
if ($this->url_controller == 'list') {
$this->url_controller = new days();
} else {
$this->url_controller = new $this->url_controller();
}
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
// defined action not existent: show the error page
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
开发者ID:KealJones,项目名称:weather-data-crud-example,代码行数:52,代码来源:application.php
示例15: errors
public static function errors($code = 404, $title = '', $message = '')
{
$ajax = Request::ajax();
if (!$code) {
$code = 500;
$title = 'Internal Server Error';
$message = 'We got problems over here. Please try again later!';
} else {
if ($code == 404) {
$title = 'Oops! You\'re lost.';
$message = 'We can not find the page you\'re looking for.';
}
}
if (Request::ajax()) {
return Response::json(['error' => ['message' => $message]], $code);
}
$arrData = [];
$arrData['content'] = View::make('frontend.errors.error')->with(['title' => $title, 'code' => $code, 'message' => $message]);
$arrData['metaInfo'] = Home::getMetaInfo();
$arrData['metaInfo']['meta_title'] = $title;
$arrData['types'] = Home::getTypes();
$arrData['categories'] = Home::getCategories();
$arrData['headerMenu'] = Menu::getCache(['header' => true]);
return View::make('frontend.layout.default')->with($arrData);
}
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:25,代码来源:BaseController.php
示例16: launch
/**
* Process incoming parameters and display the page.
*
* @return void
* @access public
*/
public function launch()
{
global $interface;
global $configArray;
if (isset($_POST['submit'])) {
$result = $this->sendEmail($_POST['to'], $_POST['from'], $_POST['message']);
if (!PEAR::isError($result)) {
include_once 'Home.php';
Home::launch();
exit;
} else {
$interface->assign('errorMsg', $result->getMessage());
}
}
// Display Page
$interface->assign('formTargetPath', '/MetaLib/' . urlencode($_GET['id']) . '/Email');
$interface->assign('recordId', urlencode($_GET['id']));
if (isset($_GET['lightbox'])) {
$interface->assign('title', $_GET['message']);
return $interface->fetch('MetaLib/email.tpl');
} else {
$interface->setPageTitle('Email Record');
$interface->assign('subTemplate', 'email.tpl');
$interface->setTemplate('view-alt.tpl');
$interface->display('layout.tpl', 'RecordEmail' . $_GET['id']);
}
}
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:33,代码来源:Email.php
示例17: launch
/**
* Process incoming parameters and display the page.
*
* @return void
* @access public
*/
public function launch()
{
global $interface;
global $configArray;
if (isset($_POST['submit'])) {
$result = $this->sendEmail($_POST['from'], $_POST['message']);
if (!PEAR::isError($result)) {
include_once 'Home.php';
Home::launch();
exit;
} else {
$interface->assign('errorMsg', $result->getMessage());
}
}
// Display Page
$institutionDetails = $this->recordDriver->getInstitutionDetails();
$datasources = getExtraConfigArray('datasources');
if (!$institutionDetails['institution']) {
$interface->assign('institution', $configArray['Site']['title']);
$interface->assign('datasource', $configArray['Site']['title']);
} else {
$interface->assign('institution', $institutionDetails['institution']);
$interface->assign('datasource', $institutionDetails['datasource']);
}
$interface->assign('formTargetPath', '/MetaLib/Record?id=' . urlencode($_GET['id']) . '/Feedback');
if (isset($_GET['lightbox'])) {
$interface->assign('title', $_GET['message']);
return $interface->fetch('Record/Feedback.tpl');
} else {
$interface->setPageTitle('Give Feedback on a Record');
$interface->assign('subTemplate', 'Feedback.tpl');
$interface->setTemplate('view-alt.tpl');
$interface->display('layout.tpl', 'RecordFeedback' . $_GET['id']);
}
}
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:41,代码来源:Feedback.php
示例18: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_CORELANG, $subMenuTitle, $objTemplate;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$cachedRoot = $this->cx->getTemplate()->getRoot();
$this->cx->getTemplate()->setRoot($this->getDirectory() . '/View/Template/Backend');
$objTemplate->setVariable('CONTAINER_DASHBOARD_CLASS', 'dashboard');
$objFWUser = \FWUser::getFWUserObject();
$subMenuTitle = $_CORELANG['TXT_WELCOME_MESSAGE'] . ", <a href='index.php?cmd=Access&act=user&tpl=modify&id=" . $objFWUser->objUser->getId() . "' title='" . $objFWUser->objUser->getId() . "'>" . ($objFWUser->objUser->getProfileAttribute('firstname') || $objFWUser->objUser->getProfileAttribute('lastname') ? htmlentities($objFWUser->objUser->getProfileAttribute('firstname'), ENT_QUOTES, CONTREXX_CHARSET) . ' ' . htmlentities($objFWUser->objUser->getProfileAttribute('lastname'), ENT_QUOTES, CONTREXX_CHARSET) : htmlentities($objFWUser->objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET)) . "</a>";
$objAdminNav = new Home();
$objAdminNav->getPage();
$this->cx->getTemplate()->setRoot($cachedRoot);
break;
}
}
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:22,代码来源:ComponentController.class.php
示例19: __construct
function __construct()
{
//get url
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = rtrim($url, '/');
$url = explode('/', $url);
//print_r($url);
if (empty($url[0])) {
require 'controllers/home.php';
$controller = new Home();
$controller->index();
return false;
}
//load controler with file
$file = 'controllers/' . $url[0] . '.php';
//check if file exists
if (file_exists($file)) {
require $file;
} else {
require 'controllers/error.php';
$controller = new Error();
throw new Exception("The file: {$file} Does not exist!");
return false;
}
//initialize controler and load model
$controller = new $url[0]();
$controller->LoadModel($url[0]);
//if function was set load function, else load index
if (isset($url[2])) {
if (method_exists($controller, $url[1])) {
$controller->{$url[1]}($url[2]);
} else {
echo "Napaka: funkcija {$url['1']} ne obstaja.";
}
return false;
} elseif (isset($url[1])) {
if (method_exists($controller, $url[1])) {
$controller->{$url[1]}();
} else {
echo "Napaka: funkcija {$url['1']} ne obstaja.";
}
return false;
} else {
$controller->index();
}
}
开发者ID:blazdivjak,项目名称:tech_support_php,代码行数:46,代码来源:Bootstrap.php
示例20: __construct
function __construct()
{
$url = isset($_GET["url"]) ? $_GET["url"] : null;
$url = rtrim($url, '/');
$url = explode('/', $url);
if (empty($url[0])) {
// If Empty array then invoke Defualt Home page
require 'Controller/Home.php';
$controller = new Home();
echo "I am here";
$controller->loadModel("home");
$controller->index();
return false;
}
$file = 'Controller/' . $url[0] . '.php';
//Check File Is exist in the Controller
if (file_exists($file)) {
require $file;
} else {
$this->error();
}
$controller = new $url[0]();
// Home Controller
$controller->loadModel($url[0]);
if (isset($url[2])) {
//Check Function parameter is set in the URL
$_method_name = 'execute' . $url[1];
if (method_exists($controller, $_method_name)) {
$controller->{'execute' . $url[1]}($url[2]);
} else {
$this->error();
}
} else {
if (isset($url[1])) {
$_method_name = 'execute' . $url[1];
if (method_exists($controller, $_method_name)) {
$controller->{'execute' . $url[1]}();
} else {
$this->error();
}
} else {
$controller->index();
}
}
}
开发者ID:sw7x,项目名称:simple-mvc,代码行数:45,代码来源:Router.php
注:本文中的Home类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论