Compare commits
2 Commits
2a154a6eea
...
598d28551d
Author | SHA1 | Date | |
---|---|---|---|
598d28551d | |||
dd7f80ee5a |
|
@ -0,0 +1,8 @@
|
||||||
|
<div id="hosted-on" class="widget widget_text">
|
||||||
|
<h5>Auto-hébergé sur mon NAS</h5>
|
||||||
|
<div class="textwidget">
|
||||||
|
<div style="text-align: center">
|
||||||
|
Ce blog est hébergé à la maison avec de l'Internet fournit par <a href="https://www.franciliens.net">Franciliens.net</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
4
www/.content.EZtzwPjb/includes/warning_new_blog.php
Normal file
4
www/.content.EZtzwPjb/includes/warning_new_blog.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<div style="background-color: orange;border-radius: 6px;font-weight: bold;margin-bottom: 10px;" class="container">
|
||||||
|
Ceci est la version legacy de mon blog si vous voulez voir les nouveaux articles et et savoir pourquoi c'est par
|
||||||
|
<a href="/new">ICI</a>
|
||||||
|
</div>
|
|
@ -111,6 +111,24 @@ const ARCHIVARIX_INCLUDE_CUSTOM = array(
|
||||||
'REGEX' => 0,
|
'REGEX' => 0,
|
||||||
'POSITION' => -1,
|
'POSITION' => -1,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// remove twitter widget in the right column on all the pages
|
||||||
|
[
|
||||||
|
'OPERATION' => 'REMOVE',
|
||||||
|
'XPATH' => '//*[@id="twitter-2"]',
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'OPERATION' => 'REPLACE',
|
||||||
|
'XPATH' => '//*[@id="text-6"]',
|
||||||
|
'FILE' => 'hosted_by_franciliens.html',
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'OPERATION' => 'APPEND',
|
||||||
|
'XPATH' => '//nav[contains(@class, "navbar")]',
|
||||||
|
'FILE' => 'warning_new_blog.php',
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -368,7 +386,7 @@ function prepareContent( $file, $sourcePath )
|
||||||
$content = file_get_contents( $file );
|
$content = file_get_contents( $file );
|
||||||
|
|
||||||
foreach ( $LOADER['ARCHIVARIX_INCLUDE_CUSTOM'] as $includeCustom ) {
|
foreach ( $LOADER['ARCHIVARIX_INCLUDE_CUSTOM'] as $includeCustom ) {
|
||||||
if ( $includeCustom['FILE'] ) {
|
if ( $includeCustom['FILE'] && $includeCustom['KEYPHRASE'] ) {
|
||||||
global $includeRule;
|
global $includeRule;
|
||||||
$includeRule = $includeCustom;
|
$includeRule = $includeCustom;
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -391,8 +409,36 @@ function prepareContent( $file, $sourcePath )
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = preg_replace( '~' . $includeCustom['KEYPHRASE'] . '~is', $includedContent, $content, $includeCustom['LIMIT'] );
|
$content = preg_replace( '~' . $includeCustom['KEYPHRASE'] . '~is', $includedContent, $content, $includeCustom['LIMIT'] );
|
||||||
|
} else if ( $includeCustom['OPERATION'] && $includeCustom['XPATH'] ) {
|
||||||
|
$doc = new DOMDocument();
|
||||||
|
$doc->loadHTML($content);
|
||||||
|
$xpath = new DOMXpath($doc);
|
||||||
|
$elementsToChange = $xpath->query($includeCustom['XPATH']);
|
||||||
|
|
||||||
|
foreach ( $elementsToChange as $elementToChange ) {
|
||||||
|
switch ( $includeCustom['OPERATION'] ) {
|
||||||
|
case 'APPEND':
|
||||||
|
case 'REPLACE' :
|
||||||
|
$fragment = $doc->createDocumentFragment();
|
||||||
|
ob_start();
|
||||||
|
require($sourcePath . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . $includeCustom['FILE']);
|
||||||
|
$fragment->appendXML(ob_get_clean());
|
||||||
|
if ($includeCustom['OPERATION'] === 'APPEND') {
|
||||||
|
$elementToChange->append($fragment->firstChild);
|
||||||
|
} else {
|
||||||
|
$elementToChange->replaceWith($fragment->firstChild);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'REMOVE' :
|
||||||
|
$elementToChange->remove();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = $doc->saveHTML();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( function_exists( 'mb_strlen' ) ) {
|
if ( function_exists( 'mb_strlen' ) ) {
|
||||||
header( 'Content-Length: ' . mb_strlen( $content, '8bit' ), true );
|
header( 'Content-Length: ' . mb_strlen( $content, '8bit' ), true );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user