Home | Index

SearchMonkey Guide

Appendix C. PHP Reference

Table of Contents

SearchMonkey PHP Whitelist
DOM Class Whitelist
Other Class Whitelist
String Functions Whitelist
Array Functions Whitelist
Variable Functions Whitelist
Output Functions Whitelist
Date Functions Whitelist
Regex Functions Whitelist
JSON Functions Whitelist
Math Functions Whitelist
Reflection Functions Whitelist
Other Functions Whitelist
The Data Class
public static function get()
Parameters
Returns
public static function getImage()
Parameters
Returns
public static function getStars()
Parameters
Returns
public static function getStarsFromNum()
Parameters
Returns
public static function xpath()
Parameters
Returns
public static function xpathString()
Parameters
Returns

PHP is the language SearchMonkey supports for mapping your XML data to your application's various visual components, such as the title, summary, thumbnail, and links. This section provides more background about how to use PHP to extract and display search data. It includes:

For a detailed example of using PHP to write a SearchMonkey application, refer to “Creating a Presentation Application”. For documentation about the associative array used to construct applications, refer to “Presentation Application PHP Structure”.

[Note] Note

All user PHP code is run inside a class. If you write your own functions, you must call them using self::function() instead of just function().

SearchMonkey PHP Whitelist

SearchMonkey supports a limited subset of PHP for mapping data to your presentation application. SearchMonkey's PHP functionality includes classes and functions designed to:

  • manipulate the DOM

  • manipulate strings

  • manipulate dates

  • manipulate arrays

  • execute regular expressions

  • perform operations on variables

  • perform mathematical operations

  • encode and decode JSON data

and more.

All language constructs except the backtick operator, alias to shell_exec(), are available. Note that __FILE__ and __DIR__ return a value without an error, but the value they return is an empty string. You cannot read or write to the filesystem, access network sockets, or execute processes.

Other Class Whitelist

datetimezone    

Output Functions Whitelist

print_r echo  
print var_dump  

JSON Functions Whitelist

json_encode json_decode  

Reflection Functions Whitelist

class_exists is_a