Example #1
0
 public function formatObservers($object)
 {
     $result = "\nObservers \n--------------------------------------------------" . "\n";
     if (isset($object->observers)) {
         foreach ($object->observers as $item) {
             foreach (get_object_vars($item) as $name => $props) {
                 if ($name == 'commercebug_name') {
                     continue;
                 }
                 if (!is_object($props)) {
                     continue;
                 }
                 $info = array();
                 $info[] = $name;
                 unset($props->args);
                 $info = array_merge($info, (array) $props);
                 Pzdgmailcom_Commercebug_Model_Shim::Log('Mage2 refactoring needed at ' . __CLASS__ . ' ' . __LINE__);
                 unset($info['config']);
                 $result .= implode("\t", $info) . "\n";
             }
         }
     }
     $this->_info[] = $result;
     return $this;
 }
Example #2
0
 public static function renderGraphMage2()
 {
     $shim = self::getShim();
     $layout = $shim->getSingleton('core/layout');
     $graph = self::getDotStart();
     foreach (self::$_elementStack as $block_name) {
         $parent_name = $layout->getParentName($block_name);
         if (!$parent_name) {
             Pzdgmailcom_Commercebug_Model_Shim::Log('Skipping ' . $block_name . ', no parent');
             continue;
         }
         $line = '"' . $parent_name . '"' . '->' . '"' . $block_name . '"' . ' [style=solid]';
         self::$_graphs[] = $line;
         if ($layout->isBlock($block_name) && ($block = $layout->getBlock($block_name))) {
             $template = $block->getTemplate() ? $block->getTemplate() : 'NO TEMPLATE';
             $definition = '"' . $block_name . '"' . '[label="' . $block_name . '\\\\n' . str_replace('\\', '\\\\', get_class($block)) . '\\\\n' . $template . '"]';
         }
         if ($layout->isContainer($block_name)) {
             $definition = '"' . $block_name . '"' . '[label="' . $block_name . '\\\\n' . 'CONTAINER\\n\\n"]';
         }
         self::$_definitions[$block_name] = $definition;
     }
     $graph .= implode(";\n", self::$_graphs) . ';';
     if (self::shouldRenderFullLabels()) {
         $graph .= implode(";\n", self::$_definitions) . ';';
     }
     $graph .= '}';
     return $graph;
 }
 /**
  * Returns a base URL for AJAX Requests
  */
 public function getUrl()
 {
     $shim = $this->getShim();
     $fake = 'fakeactiontotrimoff/';
     //not clear if 'commercebug/ajax/' route will return "index" in the URL or not
     $alias = 'core/url';
     $str_url = 'commercebug/ajax';
     if ($shim->isAdmin()) {
         $alias = 'adminhtml/url';
         $str_url = 'commercebugadmin/adminajax';
         if ($shim->isMage2()) {
             $str_url .= '/adminajax';
         }
     }
     Pzdgmailcom_Commercebug_Model_Shim::Log('Cleanup in ' . __CLASS__ . ' ' . __LINE__);
     if ($alias == 'adminhtml/url' && $shim->isMage2()) {
         $alias = 'backend/url';
     }
     $url_model = $shim->getModel($alias);
     $url = str_replace($fake, '', $url_model->getUrl($str_url . '/' . $fake, array('_secure' => $shim->getModel('core/store')->isCurrentlySecure())));
     if ($url[strlen($url) - 1] == '/') {
         $url = substr($url, 0, strlen($url) - 1);
     }
     return $url;
 }
Example #4
0
 protected function getConfig()
 {
     $shim = $this->getShim();
     if ($shim->isMage2()) {
         Pzdgmailcom_Commercebug_Model_Shim::Log('Cleanup at: ' . __CLASS__ . ' ' . __LINE__);
         $this->_config = simplexml_load_file(realpath(dirname(__FILE__) . '/../etc/commercebug.xml'));
         return $this->_config;
     }
     $config = Mage::getConfig()->loadModulesConfiguration('commercebug.xml');
     if (!$this->_config) {
         $this->_config = Mage::getConfig()->loadModulesConfiguration('commercebug.xml')->getNode('tabs');
     }
     return $this->_config;
 }