PluginProbe
PayPlug for WooCommerce (Official) / 1.2.5
PayPlug for WooCommerce (Official) v1.2.5
3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 All 101 releases
payplug / woocommerce-compat.php

woocommerce-compat.php in PayPlug for WooCommerce (Official) 1.2.5, at woocommerce-compat.php

60 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 if ( ! function_exists( 'wc_print_r' ) ) {
9 /**
10 * Prints human-readable information about a variable.
11 *
12 * Some server environments blacklist some debugging functions. This function provides a safe way to
13 * turn an expression into a printable, readable form without calling blacklisted functions.
14 *
15 * @since 3.0
16 *
17 * @param mixed $expression The expression to be printed.
18 * @param bool $return Optional. Default false. Set to true to return the human-readable string.
19 *
20 * @return string|bool False if expression could not be printed. True if the expression was printed.
21 * If $return is true, a string representation will be returned.
22 */
23 function wc_print_r( $expression, $return = false ) {
24 $alternatives = array(
25 array(
26 'func' => 'print_r',
27 'args' => array( $expression, true ),
28 ),
29 array(
30 'func' => 'var_export',
31 'args' => array( $expression, true ),
32 ),
33 array(
34 'func' => 'json_encode',
35 'args' => array( $expression ),
36 ),
37 array(
38 'func' => 'serialize',
39 'args' => array( $expression ),
40 ),
41 );
42
43 $alternatives = apply_filters( 'woocommerce_print_r_alternatives', $alternatives, $expression );
44
45 foreach ( $alternatives as $alternative ) {
46 if ( function_exists( $alternative['func'] ) ) {
47 $res = call_user_func_array( $alternative['func'], $alternative['args'] );
48 if ( $return ) {
49 return $res;
50 } else {
51 echo $res; // WPCS: XSS ok.
52
53 return true;
54 }
55 }
56 }
57
58 return false;
59 }
60 }