| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
if ( ! class_exists( 'ReduxFramework_raw' ) ) { |
| 9 |
class ReduxFramework_raw { |
| 10 |
|
| 11 |
/** |
| 12 |
* Field Constructor. |
| 13 |
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function |
| 14 |
* |
| 15 |
* @since ReduxFramework 3.0.4 |
| 16 |
*/ |
| 17 |
function __construct( $field = array(), $value = '', $parent ) { |
| 18 |
$this->parent = $parent; |
| 19 |
$this->field = $field; |
| 20 |
$this->value = $value; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Field Render Function. |
| 25 |
* Takes the vars and outputs the HTML for the field in the settings |
| 26 |
* |
| 27 |
* @since ReduxFramework 1.0.0 |
| 28 |
*/ |
| 29 |
function render() { |
| 30 |
|
| 31 |
if ( ! empty( $this->field['include'] ) && file_exists( $this->field['include'] ) ) { |
| 32 |
require_once $this->field['include']; |
| 33 |
} |
| 34 |
|
| 35 |
if ( isset( $this->field['content_path'] ) && ! empty( $this->field['content_path'] ) && file_exists( $this->field['content_path'] ) ) { |
| 36 |
$this->field['content'] = $this->parent->filesystem->execute( 'get_contents', $this->field['content_path'] ); |
| 37 |
} |
| 38 |
|
| 39 |
if ( ! empty( $this->field['content'] ) && isset( $this->field['content'] ) ) { |
| 40 |
if ( isset( $this->field['markdown'] ) && $this->field['markdown'] == true && ! empty( $this->field['content'] ) ) { |
| 41 |
require_once dirname( __FILE__ ) . "/parsedown.php"; |
| 42 |
$Parsedown = new Parsedown(); |
| 43 |
echo $Parsedown->text( $this->field['content'] ); |
| 44 |
} else { |
| 45 |
echo $this->field['content']; |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
do_action( 'redux-field-raw-' . $this->parent->args['opt_name'] . '-' . $this->field['id'] ); |
| 50 |
|
| 51 |
} |
| 52 |
} |
| 53 |
} |