/** * Helper function that will create custom.php file, if it does not already exist. * * @uses prose_get_custom_php_path() * * @since 1.5.0 * */ function premise_edit_custom_php($text = '') { /** Create file, if it doesn't exist */ if (!file_exists(premise_get_custom_php_path())) { premise_create_custom_php(); } /** Now that it exists, write text to that file */ $handle = @fopen(premise_get_custom_php_path(), 'w+'); @fwrite($handle, stripslashes($text)); @fclose($handle); }
/** * PHP to edit. * * @author StudioPress * @since 1.5.0 */ function custom_php() { $php_file = premise_get_custom_php_path(); $custom_php = is_file($php_file) ? file_get_contents($php_file) : ''; printf('<textarea name="%s" id="%s" cols="80" rows="22">%s</textarea>', $this->get_field_name('php'), $this->get_field_id('php'), esc_textarea($custom_php)); }