From 62a204096cc75b34238294a7f764731c57d0b020 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Fri, 19 Sep 2014 18:01:29 +0200 Subject: [PATCH] sandbox #16325 inspector gadget : add param inspector_gadget to absolute url --- .../ZendAfi/Controller/Plugin/InspectorGadget.php | 6 +++--- library/ZendAfi/View/Helper/AbsoluteUrl.php | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/library/ZendAfi/Controller/Plugin/InspectorGadget.php b/library/ZendAfi/Controller/Plugin/InspectorGadget.php index 3f62960ec64..62eaf8fb768 100644 --- a/library/ZendAfi/Controller/Plugin/InspectorGadget.php +++ b/library/ZendAfi/Controller/Plugin/InspectorGadget.php @@ -24,8 +24,8 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A protected $_calls = []; public function preDispatch(Zend_Controller_Request_Abstract $request) { - /*if (!$request->getParam('inspector_gadget', false)) - return;*/ + if (!$request->getParam('inspector_gadget', false)) + return; $this->beEnabled(); Class_WebService_SIGB_AbstractService::setLogger($this); @@ -43,7 +43,7 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A $html = '<ul>'; foreach($this->_calls as $call) { - $html .= sprintf('<li>%s, %s, %s</li>', + $html .= sprintf('<li><ul><li>%s</li>, <li>%s</li>, <li><textarea>%s</textarea></li></ul></li>', $call->request, $call->response_code, $call->response_body); } diff --git a/library/ZendAfi/View/Helper/AbsoluteUrl.php b/library/ZendAfi/View/Helper/AbsoluteUrl.php index 57d88de467b..eb75324708e 100644 --- a/library/ZendAfi/View/Helper/AbsoluteUrl.php +++ b/library/ZendAfi/View/Helper/AbsoluteUrl.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_AbsoluteUrl extends Zend_View_Helper_HtmlElement { protected static $_do_not_add_base_url; @@ -26,10 +26,14 @@ class ZendAfi_View_Helper_AbsoluteUrl extends Zend_View_Helper_HtmlElement { } public function absoluteUrl($url_array_or_string = [], $name = null, $reset = false, $encode = true) { - $url = is_string($url_array_or_string) - ? $url_array_or_string - : $this->view->url($url_array_or_string, $name, $reset, $encode); - + if ($url = is_string($url_array_or_string)) + $url=$url_array_or_string; + else { + $this->_request = Zend_Controller_Front::getInstance()->getRequest(); + if ($this->_request->getParam('inspector_gadget')) + $url_array_or_string['inspector_gadget'] = '1'; + $url=$this->view->url($url_array_or_string, $name, $reset, $encode); + } if (preg_match('/http[s]?:\/\//', $url)) return $url; -- GitLab