Debug website module
This commit is contained in:
parent
748aee9a54
commit
7d553f58f5
@ -29,14 +29,19 @@
|
|||||||
*
|
*
|
||||||
* @param Website $website Web site object
|
* @param Website $website Web site object
|
||||||
* @param string $content Content to replace
|
* @param string $content Content to replace
|
||||||
|
* @param int $removephppart 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections.
|
||||||
* @return boolean True if OK
|
* @return boolean True if OK
|
||||||
*/
|
*/
|
||||||
function dolWebsiteReplacementOfLinks($website, $content)
|
function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||||
{
|
{
|
||||||
// Replace php code. Note $content may come from database and does not contains body tags.
|
// Replace php code. Note $content may come from database and does not contains body tags.
|
||||||
|
$replacewith='...php...';
|
||||||
|
if ($removephppart) $replacewith='';
|
||||||
|
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
|
||||||
|
|
||||||
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="...php..."', $content);
|
$replacewith='<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>';
|
||||||
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
if ($removephppart) $replacewith='';
|
||||||
|
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||||
|
|
||||||
// Replace relative link / with dolibarr URL
|
// Replace relative link / with dolibarr URL
|
||||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||||
|
|||||||
@ -2007,9 +2007,9 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
|
|||||||
// REPLACEMENT OF LINKS When page called by website editor
|
// REPLACEMENT OF LINKS When page called by website editor
|
||||||
|
|
||||||
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||||
$out.= '<!-- Include website CSS file -->'."\n";
|
$out.= '/* Include website CSS file */'."\n";
|
||||||
$out.=dolWebsiteReplacementOfLinks($object, $csscontent);
|
$out.=dolWebsiteReplacementOfLinks($object, $csscontent, 1);
|
||||||
$out.= '<!-- Include HTML header from page inline block -->'."\n";
|
$out.= '/* Include HTML header from the inline block */'."\n";
|
||||||
$out.= $objectpage->htmlheader."\n";
|
$out.= $objectpage->htmlheader."\n";
|
||||||
$out.='</style>'."\n";
|
$out.='</style>'."\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user