Skip to content

Commit

Permalink
use get variable in expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
MDevster committed Jun 18, 2017
1 parent 4a2942f commit 260c83c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdir/amphtml-bundle",
"version": "0.1.6",
"version": "0.1.7",
"description": "Amphtml Bundle for Contao 4",
"scripts": {},
"repository": {
Expand Down
7 changes: 3 additions & 4 deletions src/Resources/contao/classes/AmphtmlHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function ampGetPageLayout($objPage, &$objLayout, $objPty)
$objLayout->head .= '<link rel="amphtml" href="' . $strUrl . '?amp" />';
}

if(\Input::get('amp') !== null)
if(isset($_GET['amp']))
{
$ampLayout = (int) \PageModel::findByPk($objPage->rootId)->ampLayout;
$ampUseInLayout = \PageModel::findByPk($objPage->rootId)->ampUseInLayout;
Expand Down Expand Up @@ -107,7 +107,7 @@ public function ampGetPageLayout($objPage, &$objLayout, $objPty)
*/
public function ampGenerateFrontendUrl($arrRow, $strParams, $strUrl)
{
if(\Input::get('amp') !== null)
if(isset($_GET['amp']))
{
return $strUrl = $strUrl . '?amp';
}
Expand All @@ -120,12 +120,11 @@ public function ampGenerateFrontendUrl($arrRow, $strParams, $strUrl)
*/
public function unbindDynamicScriptTags($strBuffer)
{
if(\Input::get('amp') !== null)
if(isset($_GET['amp']))
{
$search = array('[[TL_HEAD]]', '[[TL_CSS]]');
$replace = array('', '');
return str_replace($search, $replace, $strBuffer);
// return ' ';
}

return $strBuffer;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
$GLOBALS['TL_HOOKS']['getPageLayout'][] = array('\Pdir\AmphtmlHooks', 'ampGetPageLayout');
$GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('\Pdir\AmphtmlHooks', 'ampGenerateFrontendUrl');
$GLOBALS['TL_HOOKS']['replaceDynamicScriptTags'][] = array('\Pdir\AmphtmlHooks', 'unbindDynamicScriptTags');
$GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('\Pdir\AmphtmlHooks', 'ampGenerateFrontendUrl');
//$GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('\Pdir\AmphtmlHooks', 'ampGenerateFrontendUrl');

0 comments on commit 260c83c

Please sign in to comment.