本文整理汇总了PHP中Zend_Controller_Action::_getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action::_getParam方法的具体用法?PHP Zend_Controller_Action::_getParam怎么用?PHP Zend_Controller_Action::_getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action
的用法示例。
在下文中一共展示了Zend_Controller_Action::_getParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorAction
public function errorAction()
{
$config = Zend_Registry::get('config');
$this->_helper->layout->setLayout('error');
Zend_Layout::getMvcInstance()->setLayout('error');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($this->view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$this->getResponse()->clearBody();
require_once 'Zend/Log.php';
require_once 'Zend/Log/Writer/Stream.php';
$logger = new Zend_Log();
$error = Zend_Controller_Action::_getParam('error_handler');
$errorMsg = $error->exception->getMessage();
try {
$writer = new Zend_Log_Writer_Stream($config->setup->logfile);
$logger->addWriter($writer);
$logger->log($this->getRequest()->getRequestUri() . ' ' . $errorMsg, Zend_Log::ERR);
$this->view->errorMsg = $errorMsg;
} catch (Zend_Exception $e) {
$this->view->errorMsg = 'oopsie, problem with writing log files ... WTF ?';
}
}
示例2: setlocationAction
public function setlocationAction()
{
//used in ajax
try {
$common = new Common();
$datasUser = $common->GeoIPArray();
$timeZone = DateTimeZone::listIdentifiers();
$townRandom[0] = array('city' => 'Los Angeles', 'timezone' => 'America/Los_Angeles', 'state' => 'Ca');
$townRandom[1] = array('city' => 'New york', 'timezone' => 'America/New_York', 'state' => 'Ny');
$townRandom[2] = array('city' => 'Tennessee', 'timezone' => 'America/Chicago', 'state' => 'Il');
$townRandom[3] = array('city' => 'Denver', 'timezone' => 'America/New_York', 'state' => 'Ny');
$townRandom[4] = array('city' => 'Las vegas', 'timezone' => 'America/Denver', 'state' => 'Nv');
if (Zend_Controller_Action::_getParam('name') == 'autodetect') {
$city_name = strtolower(Tag::myUrlEncode($datasUser['city']));
$state_code = strtolower(Tag::myUrlEncode($datasUser['region']));
$this->view->locationweather = ucfirst($city_name) . ', ' . ucfirst($state_code);
//always a state from geoip
$timezoneUser = $datasUser['timezone'];
if (empty($timezoneUser)) {
//in case there is a bug
$nbtown = count($townRandom);
$whichone = rand(0, $nbtown - 1);
$this->view->locationweather = $townRandom[$whichone]['city'] . ', ' . $townRandom[$whichone]['state'];
$timezoneUser = $townRandom[$whichone]['timezone'];
logEmpty('Weather issue: ', Tag::myUrlEncode($datasUser['city']));
}
setcookie("yellowpages_location", '', -1);
//delete cookie
} elseif (strpos(Zend_Controller_Action::_getParam('name'), '*')) {
//submit search - basic
$city = str_replace('*', '', Zend_Controller_Action::_getParam('name'));
$citys = explode(',', $city);
$city_name = trim(strtolower($citys[0]));
$state_code = isset($citys[1]) && $citys[1] != '' ? trim(strtolower($citys[1])) : '';
$this->view->locationweather = $state_code != '' ? ucfirst($city_name) . ", " . ucfirst($state_code) : ucfirst($city_name);
$coord = $this->getCoordinates($city_name, $state_code);
$timezoneUser = $coord['timezone'];
if (empty($timezoneUser)) {
//in case of bug
$nbtown = count($townRandom);
$whichone = rand(0, $nbtown - 1);
$this->view->locationweather = ucfirst($townRandom[$whichone]['city']) . ', ' . ucfirst($townRandom[$whichone]['state']);
$timezoneUser = $townRandom[$whichone]['timezone'];
logEmpty('Weather issue: ', $city);
}
setcookie("yellowpages_location", '', -1);
//delete cookie
} elseif (isset($_COOKIE["yellowpages_location"])) {
//if there is a cookie
$this->view->locationweather = $_COOKIE["yellowpages_location"];
$city = explode(',', $_COOKIE["yellowpages_location"]);
$city_name = strtolower($city[0]);
$state_code = isset($citys[1]) && $citys[1] != '' ? trim(strtolower($citys[1])) : '';
$coord = $this->getCoordinates($city_name, $state_code);
$timezoneUser = $coord['timezone'];
if (empty($timezoneUser)) {
//in case of bug
$nbtown = count($townRandom);
$whichone = rand(0, $nbtown - 1);
$this->view->locationweather = $townRandom[$whichone]['city'] . ', ' . $townRandom[$whichone]['state'];
$timezoneUser = $townRandom[$whichone]['timezone'];
logEmpty('Weather issue: ', $_COOKIE["yellowpages_location"]);
}
} else {
$varcity = Zend_Controller_Action::_getParam('name');
if (empty($varcity)) {
//then its first page
$this->view->locationweather = ucfirst(strtolower(Tag::myUrlEncode($datasUser['city']))) . ', ' . ucfirst(strtolower(Tag::myUrlEncode($datasUser['region'])));
$timezoneUser = $datasUser['timezone'];
if (empty($timezoneUser)) {
//in case there is a bug
$nbtown = count($townRandom);
$whichone = rand(0, $nbtown - 1);
$this->view->locationweather = $townRandom[$whichone]['city'] . ', ' . $townRandom[$whichone]['state'];
$timezoneUser = $townRandom[$whichone]['timezone'];
logEmpty('Weather issue: ', Tag::myUrlEncode($datasUser['city']));
}
} else {
//save for the future
$citys = explode(',', $varcity);
$city_name = strtolower($citys[0]);
$state_code = isset($citys[1]) && $citys[1] != '' ? trim(strtolower($citys[1])) : '';
$this->view->locationweather = $state_code != '' ? ucfirst($city_name) . ", " . ucfirst($state_code) : ucfirst($city_name);
$coord = $this->getCoordinates($city_name, $state_code);
$timezoneUser = $coord['timezone'];
if (empty($timezoneUser)) {
//in case of bug
$nbtown = count($townRandom);
$whichone = rand(0, $nbtown - 1);
$this->view->locationweather = $townRandom[$whichone]['city'] . ', ' . $townRandom[$whichone]['state'];
$timezoneUser = $townRandom[$whichone]['timezone'];
logEmpty('Weather issue: ', $_COOKIE["yellowpages_location"]);
}
}
}
$city = trim($this->view->locationweather);
$googleapiweather = 'http://www.google.com/ig/api?weather=' . $city . ',' . $datasUser['country_name'];
//time
if (isset($timezoneUser) && in_array($timezoneUser, $timeZone)) {
//changed by xinghao 27/02/2009 for feature #97
//.........这里部分代码省略.........
示例3: _getParam
/**
* Using patern 'extend parent' we add extra functionality to check
* PHP magic quotes and if them on remove slashes from value
*
* @param string $paramName
* @param mixed $default
* @return mixed
*/
protected function _getParam($paramName, $default = null)
{
$value = parent::_getParam($paramName, $default);
if (get_magic_quotes_gpc() && $value !== $default) {
$value = $this->_getParamFilter($value);
}
return $value;
}