correct amp site errors
This commit is contained in:
@@ -11,10 +11,10 @@ configFiles = $(wildcard config/*.php)
|
||||
uploadMarker = \
|
||||
$(patsubst build/%.php, build/.uploadMarker/%.php, $(phpFiles)) \
|
||||
$(patsubst build/amp/%.php, build/.uploadMarker/amp/%.php, $(ampFiles)) \
|
||||
$(patsubst phpLib/%.php, build/.uploadMarker/phpLib/%.php, $(phpLibFiles)) \
|
||||
$(patsubst config/%.php, build/.uploadMarker/config/%.php, $(configFiles)) \
|
||||
build/.uploadMarker/config/.htaccess \
|
||||
build/.uploadMarker/css/cwsvJudo.css
|
||||
$(patsubst phpLib/%.php, build/.uploadMarker/phpLib/%.php, $(phpLibFiles)) \
|
||||
#$(patsubst phpLib/cwsvJudo/%.php, build/.uploadMarker/phpLib/cwsvJudo/%.php, $(phpLibFiles)) \
|
||||
|
||||
.PHONY: all
|
||||
@@ -25,7 +25,6 @@ clean:
|
||||
$(RM) -rf build
|
||||
mkdir -p build
|
||||
|
||||
|
||||
.PHONY: echo
|
||||
echo:
|
||||
@echo "phpFiles:"
|
||||
@@ -39,7 +38,6 @@ echo:
|
||||
@echo "uploadMarker:"
|
||||
@echo $(uploadMarker)
|
||||
|
||||
|
||||
.PHONY: ampTest
|
||||
ampTest: $(ampFiles)
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ $for(header-includes)$
|
||||
$endfor$
|
||||
<script async src="https://cdn.ampproject.org/v0.js"></script>
|
||||
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
|
||||
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
|
||||
<script type='application/ld+json'>
|
||||
{
|
||||
"@context": "http://www.schema.org",
|
||||
@@ -161,7 +162,6 @@ $endif$
|
||||
title="Judo im Chemnitzer WSV"
|
||||
alt="Judo im Chemnitzer WSV - Logo"
|
||||
src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.128w.png"
|
||||
srcset=http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png 2x"
|
||||
></amp-img>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ $options = getKeyValueArray($someOptions);
|
||||
$aNews['promoImg'] = json_decode($aNews['promoImg'], true);
|
||||
}
|
||||
}
|
||||
// var_dump($aNews);
|
||||
if( !filter_var($aNews['promoImg'], FILTER_VALIDATE_URL) && !filter_var($aNews['promoImg']['src'], FILTER_VALIDATE_URL) ){
|
||||
$domDoc = new DOMDocument();
|
||||
$domDoc->loadHTML( mb_convert_encoding($aNews['nachricht'], 'HTML-ENTITIES', "UTF-8") );
|
||||
@@ -126,8 +125,6 @@ $options = getKeyValueArray($someOptions);
|
||||
|
||||
$domDoc->formatOutput = true;
|
||||
$aNews['nachricht'] = get_inner_html( $domDoc->getElementsByTagName('body')[0] );
|
||||
// $aNews['nachricht'] = str_replace(" ", "", $aNews['nachricht']);
|
||||
// var_dump($aNews);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +145,8 @@ $options = getKeyValueArray($someOptions);
|
||||
$retHtml = str_replace("/>", "></amp-img>", $retHtml);
|
||||
}
|
||||
}
|
||||
$retHtml .= "<div class=\"newsText\">" . $aNews['nachricht'] . "</div>";
|
||||
|
||||
$retHtml .= "<div class=\"newsText\">".ampTagReplace( $aNews['nachricht'] )."</div>";
|
||||
$retHtml .= "</div>";
|
||||
$retHtml .= "<div class=\"newsFooter\">";
|
||||
$retHtml .= "<div class=\"newsAutor\">".$aNews['autor']."</div>";
|
||||
@@ -200,4 +198,36 @@ function getHtmlNewsTitle(){
|
||||
}
|
||||
return $htmlTitle;
|
||||
}
|
||||
|
||||
function img2ampimg($inText){
|
||||
$outText = $inText;
|
||||
// Zuweilen sind im Nachtrichtentext selbst auch schon Bilder, auch diese müssen bei ampSeiten angepasst werden
|
||||
if( strpos( $_SERVER['ORIG_PATH_TRANSLATED'], "pages/amp" ) !== false ){
|
||||
// bei bereits im Newstext vorhandenen Bildern, gehen wir davon aus, dass widt+heigth bereits gesetzt sind
|
||||
$outText = str_replace("<img ", "<amp-img layout=\"responsive\" ", $outText);
|
||||
$outText = str_replace("/>", "></amp-img>", $outText);
|
||||
}
|
||||
|
||||
return $outText;
|
||||
}
|
||||
|
||||
function video2ampvideo($inText){
|
||||
$outText = $inText;
|
||||
// Zuweilen sind im Nachtrichtentext selbst auch schon Bilder, auch diese müssen bei ampSeiten angepasst werden
|
||||
if( strpos( $_SERVER['ORIG_PATH_TRANSLATED'], "pages/amp" ) !== false ){
|
||||
// bei bereits im Newstext vorhandenen Bildern, gehen wir davon aus, dass widt+heigth bereits gesetzt sind
|
||||
$outText = str_replace("<video ", "<amp-video ", $outText);
|
||||
$outText = str_replace("<source ", "<source type=\"video/webm\" ", $outText);
|
||||
$outText = str_replace("</video>", "</amp-video>", $outText);
|
||||
}
|
||||
|
||||
return $outText;
|
||||
}
|
||||
|
||||
function ampTagReplace($inText){
|
||||
// replace the amp tags
|
||||
return video2ampvideo(
|
||||
img2ampimg( $inText )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user