Mage_GoogleOptimizer_IndexController Class Reference

Inheritance diagram for Mage_GoogleOptimizer_IndexController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 codesAction ()


Detailed Description

Definition at line 35 of file IndexController.php.


Member Function Documentation

codesAction (  ) 

Retrieve js scripts by parsing remote Google Optimizer page

Definition at line 40 of file IndexController.php.

00041     {
00042         if ($this->getRequest()->getQuery('url')) {
00043             $client = new Varien_Http_Client($this->getRequest()->getQuery('url'));
00044             $response = $client->request(Varien_Http_Client::GET);
00045             $result = array();
00046             if (preg_match_all('/<textarea[^>]*id="([_a-zA-Z0-9]+)"[^>]*>([^<]+)<\/textarea>/', $response->getRawBody(), $matches)) {
00047                 $c = count($matches[1]);
00048                 for ($i = 0; $i < $c; $i++) {
00049                     $id = $matches[1][$i];
00050                     $code = $matches[2][$i];
00051                     $result[$id] = $code;
00052                 }
00053             }
00054             $this->getResponse()->setBody( Zend_Json::encode($result) );
00055         }
00056     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:17 2009 for Magento by  doxygen 1.5.8