@@ -58,18 +58,18 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $source = $args->getReturn(); |
| 60 | 60 | |
| 61 | - if(strpos($source, '<html') === false && !$this->container->get('front')->Request()->isXmlHttpRequest()) { |
|
| 61 | + if (strpos($source, '<html') === false && !$this->container->get('front')->Request()->isXmlHttpRequest()) { |
|
| 62 | 62 | return $source; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $containerId = $this->container->get('config')->getByNamespace('WbmTagManager', 'wbmTagManagerContainer'); |
| 66 | 66 | $prettyPrint = $this->container->get('config')->getByNamespace('WbmTagManager', 'wbmTagManagerJsonPrettyPrint'); |
| 67 | 67 | |
| 68 | - if( |
|
| 68 | + if ( |
|
| 69 | 69 | !empty($containerId) && |
| 70 | 70 | strtolower($this->container->get('front')->Request()->getModuleName()) != 'backend' |
| 71 | 71 | ) { |
| 72 | - if(!$this->container->get('front')->Request()->isXmlHttpRequest()) { |
|
| 72 | + if (!$this->container->get('front')->Request()->isXmlHttpRequest()) { |
|
| 73 | 73 | $headTag = file_get_contents($this->container->getParameter('wbm_tag_manager.plugin_dir') . '/Resources/tags/head.html'); |
| 74 | 74 | $bodyTag = file_get_contents($this->container->getParameter('wbm_tag_manager.plugin_dir') . '/Resources/tags/body.html'); |
| 75 | 75 | |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | 1 |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - if($dataLayer = $this->container->get('wbm_tag_manager.variables')->getVariables()) { |
|
| 86 | + if ($dataLayer = $this->container->get('wbm_tag_manager.variables')->getVariables()) { |
|
| 87 | 87 | array_walk_recursive($dataLayer, array($this, 'castArrayValues')); |
| 88 | 88 | |
| 89 | 89 | $bodyTag = $bodyTag . |
| 90 | 90 | "<script>dataLayer.push(" . |
| 91 | - json_encode($dataLayer,($prettyPrint) ? JSON_PRETTY_PRINT : null) . |
|
| 91 | + json_encode($dataLayer, ($prettyPrint) ? JSON_PRETTY_PRINT : null) . |
|
| 92 | 92 | ");</script>"; |
| 93 | 93 | |
| 94 | 94 | $this->container->get('wbm_tag_manager.variables')->setVariables(null); |
@@ -101,15 +101,15 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | $matches = preg_split('/(<body.*?>)/i', $source, 2, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
| 103 | 103 | |
| 104 | - if(!empty($matches)) { |
|
| 104 | + if (!empty($matches)) { |
|
| 105 | 105 | /* assemble the HTML output back with the iframe code in it */ |
| 106 | 106 | $source = $matches[0] . $matches[1] . $bodyTag . $matches[2]; |
| 107 | 107 | } |
| 108 | - } else if($dataLayer = $this->container->get('wbm_tag_manager.variables')->getVariables()) { |
|
| 108 | + } else if ($dataLayer = $this->container->get('wbm_tag_manager.variables')->getVariables()) { |
|
| 109 | 109 | array_walk_recursive($dataLayer, array($this, 'castArrayValues')); |
| 110 | 110 | |
| 111 | 111 | $source = "<script>dataLayer.push(" . |
| 112 | - json_encode($dataLayer,($prettyPrint) ? JSON_PRETTY_PRINT : null) . |
|
| 112 | + json_encode($dataLayer, ($prettyPrint) ? JSON_PRETTY_PRINT : null) . |
|
| 113 | 113 | ");</script>" . |
| 114 | 114 | $source; |
| 115 | 115 | |