更新助手类,添加新功能 getHostLink()
This commit is contained in:
parent
d33d9934be
commit
7fe66c8b4b
|
@ -80,6 +80,10 @@ class dbh
|
||||||
{
|
{
|
||||||
$v = preg_replace("/\'/","''",$v);
|
$v = preg_replace("/\'/","''",$v);
|
||||||
}
|
}
|
||||||
|
if(preg_match("/\"/",$v))
|
||||||
|
{
|
||||||
|
$v = preg_replace("/\"/","''",$v);
|
||||||
|
}
|
||||||
$ups[] = '"'.$k.'"=\''.$v."'";
|
$ups[] = '"'.$k.'"=\''.$v."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
class view extends Zend_Controller_Plugin_Abstract
|
class view extends \Zend_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象.
|
private $db; //传入PDO对象.
|
||||||
private $product = 0; //产品环境
|
private $product = 0; //产品环境
|
||||||
|
@ -9,7 +9,7 @@ class view extends Zend_Controller_Plugin_Abstract
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request = NULL,$limit = 10)
|
static function addPaginator($data,$ctl,\Zend_Controller_Request_Abstract $request = NULL,$limit = 10)
|
||||||
{
|
{
|
||||||
if(empty($request))
|
if(empty($request))
|
||||||
{
|
{
|
||||||
|
@ -21,11 +21,11 @@ class view extends Zend_Controller_Plugin_Abstract
|
||||||
$view = $ctl;
|
$view = $ctl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$paginator = Zend_Paginator::factory($data);
|
$paginator = \Zend_Paginator::factory($data);
|
||||||
$paginator->setCurrentPageNumber($page);
|
$paginator->setCurrentPageNumber($page);
|
||||||
$paginator->setItemCountPerPage($limit);
|
$paginator->setItemCountPerPage($limit);
|
||||||
$paginator->setView($view);
|
$paginator->setView($view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
\Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$view->paginator = $paginator;
|
$view->paginator = $paginator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class view extends Zend_Controller_Plugin_Abstract
|
||||||
}
|
}
|
||||||
|
|
||||||
static function User($param){
|
static function User($param){
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = \Zend_Auth::getInstance();
|
||||||
if($auth->hasIdentity())
|
if($auth->hasIdentity())
|
||||||
{
|
{
|
||||||
$user = $auth->getIdentity();
|
$user = $auth->getIdentity();
|
||||||
|
@ -90,7 +90,7 @@ class view extends Zend_Controller_Plugin_Abstract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function Post(Zend_Controller_Action $ctl,$msg,$url=""){
|
static function Post(\Zend_Controller_Action $ctl,$msg,$url=""){
|
||||||
|
|
||||||
if(empty($msg))
|
if(empty($msg))
|
||||||
{
|
{
|
||||||
|
@ -101,10 +101,20 @@ class view extends Zend_Controller_Plugin_Abstract
|
||||||
$msg = array('content'=>$msg,'url'=>$url);
|
$msg = array('content'=>$msg,'url'=>$url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$helper = new Zend_Controller_Action_HelperBroker($ctl);
|
$helper = new \Zend_Controller_Action_HelperBroker($ctl);
|
||||||
$helper->layout->setLayout('layout');
|
$helper->layout->setLayout('layout');
|
||||||
$helper->viewRenderer->setNoRender();
|
$helper->viewRenderer->setNoRender();
|
||||||
echo $ctl->view->partial('post-message.phtml', $msg);
|
echo $ctl->view->partial('post-message.phtml', $msg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function getHostLink()
|
||||||
|
{
|
||||||
|
$protocol = "http";
|
||||||
|
if(strpos(strtolower($_SERVER['SERVER_PROTOCOL']),"https"))
|
||||||
|
{
|
||||||
|
$protocol = "https";
|
||||||
|
}
|
||||||
|
return $protocol."://".$_SERVER['SERVER_NAME'];
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue