<?php if (!defined('PmWiki')) exit(); /* Copyright 2016-2023 Petko Yotov www.pmwiki.org/petko This file is written for PmWiki; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. See pmwiki.php for full details. */ $RecipeInfo['GUIEditSnippets']['Version'] = '20230403'; SDVA($PostConfig, array('GUIEditSnippetsInit' => 15)); SDV($GUIEditSnippetsPage, 'Site.GUIEditSnippets'); function GUIEditSnippetsInit($pagename) { global $GUIButtons, $GUIEditSnippetsPage; foreach($GUIButtons as $k=>$a) { for($i=1; $i<4; $i++) $GUIButtons[$k][$i] = GUIEditOneSnippet($pagename, $a[$i], false); $GUIButtons[$k][4] = trim(GUIEditOneSnippet($pagename, $a[4], true)); } } function GUIEditOneSnippet($pagename, $txt, $icon=false) { if(! preg_match('/^\\$:\\w(?:[\\w-]*\\w)?$/', $txt, $m)) return $txt; global $VersionNum, $GUIEditSnippetsPage; $pn = FmtPageName($GUIEditSnippetsPage, $pagename); $val = PageVar($pn, $m[0]); if(is_null($val)) $val = ''; $rArr = array( '/"/' => '\\"', "/'/" => "\\'", "/\n/" => '\\n', ); $iArr = array( "/'/" => "'", "/</" => '<', "/>/" => '>', "/\n/" => ' ', ); if($VersionNum < 2003015) { if(! $icon) $val = PHSC(PPRA($rArr, $val), ENT_QUOTES); else $val = PPRA($iArr, $val); } return $val; }