* @copyright (c) 2012, Lance Cleveland * * @since 2.0.0 * @version 2.0.13 * * @package wpCSL * @subpackage wpCSL_helper */ class wpCSL_helper__adpress { /** * * @param type $params */ function __construct($params=null) { // Defaults // // Set by incoming parameters // foreach ($params as $name => $value) { $this->$name = $value; } // Override incoming parameters } /** * Executes the included php (or html) file and returns the output as a string. * * Parameters: * @param string $file - required fully qualified file name */ function get_string_from_phpexec($file) { if (file_exists($file)) { ob_start(); include($file); return ob_get_clean(); } } /** * * Executes the a php file in ./templates/ file and prints out the results. * * Makes for easy include templates that depend on processing logic to be * dumped mid-stream into a WordPress page. * * @param string $file - required file name in the ./templates directory * @param type $dir - optional directory path, defaults to plugin_dir_path */ function execute_and_output_template($file,$dir=null) { if ($dir == null) { $dir = $this->parent->plugin_path; } print $this->get_string_from_phpexec($dir.'templates/'.$file); } /** * Convert text in the WP readme file format (wiki markup) to basic HTML * * Parameters: * @param string $file - optional name of the file in the plugin dir defaults to readme.txt * @param type $dir - optional directory path, defaults to plugin_dir_path */ function convert_text_to_html($file='readme.txt',$dir=null) { if ($dir == null) { $dir = $this->parent->plugin_path; } ob_start(); include($dir.$file); $content=ob_get_contents(); ob_end_clean(); $content=preg_replace('#\=\=\= #', "