[Solar-svn] Revision 3281

pmjones at solarphp.com pmjones at solarphp.com
Wed Jul 30 09:57:00 CDT 2008


Solar_View_Helper_(Action|ActionImage): [REF] Refactor to use the actionHref() helper for href values.



Modified: trunk/Solar/View/Helper/Action.php
===================================================================
--- trunk/Solar/View/Helper/Action.php	2008-07-30 14:53:01 UTC (rev 3280)
+++ trunk/Solar/View/Helper/Action.php	2008-07-30 14:57:00 UTC (rev 3281)
@@ -18,31 +18,6 @@
 {
     /**
      * 
-     * Internal URI object for creating links.
-     * 
-     * @var Solar_Uri_Action
-     * 
-     */
-    protected $_uri = null;
-    
-    /**
-     * 
-     * Constructor.
-     * 
-     * @param array $config User-specified configuration.
-     * 
-     */
-    public function __construct($config = null)
-    {
-        // do the real configuration
-        parent::__construct($config);
-        
-        // get a URI processor
-        $this->_uri = Solar::factory('Solar_Uri_Action');
-    }
-    
-    /**
-     * 
      * Returns an action anchor, or just an action href.
      * 
      * If the $text link text is empty, will just return the
@@ -59,16 +34,9 @@
      */
     public function action($spec, $text = null, $attribs = null)
     {
-        if ($spec instanceof Solar_Uri_Action) {
-            // already an action uri object
-            $href = $spec->get();
-        } else {
-            // build-and-fetch the string as an action spec
-            $href = $this->_uri->quick($spec);
-        }
+        // get an escaped href action value
+        $href = $this->_view->actionHref($spec);
         
-        // escape the href itself
-        $href = $this->_view->escape($href);
         // return the href, or an anchor?
         if (empty($text)) {
             return $href;

Modified: trunk/Solar/View/Helper/ActionImage.php
===================================================================
--- trunk/Solar/View/Helper/ActionImage.php	2008-07-30 14:53:01 UTC (rev 3280)
+++ trunk/Solar/View/Helper/ActionImage.php	2008-07-30 14:57:00 UTC (rev 3281)
@@ -18,31 +18,6 @@
 {
     /**
      * 
-     * Internal URI object for creating links.
-     * 
-     * @var Solar_Uri_Action
-     * 
-     */
-    protected $_uri = null;
-    
-    /**
-     * 
-     * Constructor.
-     * 
-     * @param array $config User-specified configuration.
-     * 
-     */
-    public function __construct($config = null)
-    {
-        // do the real configuration
-        parent::__construct($config);
-        
-        // get a URI processor
-        $this->_uri = Solar::factory('Solar_Uri_Action');
-    }
-    
-    /**
-     * 
      * Returns an action image anchor.
      * 
      * @param string|Solar_Uri_Action $spec The action specification.
@@ -58,17 +33,9 @@
      */
     public function actionImage($spec, $src, $attribs = array())
     {
-        if ($spec instanceof Solar_Uri_Action) {
-            // already an action uri object
-            $href = $spec->get();
-        } else {
-            // build-and-fetch the string as an action spec
-            $href = $this->_uri->quick($spec);
-        }
+        // get an escaped href action value
+        $href = $this->_view->actionHref($spec);
         
-        // escape the href itself
-        $href = $this->_view->escape($href);
-        
         // get the <img /> tag
         $img = $this->_view->image($src, $attribs);
         




More information about the Solar-svn mailing list