-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtenandtwo-xslt-functions.php
56 lines (51 loc) · 1.5 KB
/
tenandtwo-xslt-functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* XSLT Functions
*
* usage:
* require_once plugin_dir_path( __FILE__ ) . 'tenandtwo-xslt-functions.php';
*
* @package tenandtwo-wp-plugins
* @subpackage tenandtwo-xslt-processor
* @author Ten & Two Systems
* @copyright 2023 Ten & Two Systems
*/
defined( 'ABSPATH' ) or die( 'Not for browsing' );
/**
* Global list of functions calls allowed within XSLT
* passed to XSLTProcessor::registerPHPFunctions() in XSLT_Processor_XSL::getProcessor()
*
* Functions should return a scalar value (int, float, string, bool)
* <xsl:value-of select="php:functionString('fname', string($param))" />
*
* OR return a DomDocument(), as demonstrated in includes/sample-xslt-functions.php
* <xsl:copy-of select="php:function('fname', string($param))" />
*
* @see https://www.php.net/manual/en/xsltprocessor.registerphpfunctions.php
*/
global $XSLT_PLUGIN_PHP_FUNCTIONS;
$XSLT_PLUGIN_PHP_FUNCTIONS = array(
// date.xsl
//'date',
// string.xsl
'html_entity_decode',
'mb_convert_case',
'nl2br',
'str_replace',
'trim','ltrim','rtrim',
'urlencode',
// util.xsl
'hash',
//'trigger_error',
// wp.xsl
'sanitize_title',
);
/**
* Sample extension
*
* built-in: convert_uuencode( string $string ): string
* custom: xslt_function_sample( string $param1, string $param2 ) : DomDocument
*/
if (is_readable(XSLT_PLUGIN_DIR.'includes/sample-xslt-functions.php')) {
require_once(XSLT_PLUGIN_DIR.'includes/sample-xslt-functions.php');
}