| 1 |
<?php |
| 2 |
|
| 3 |
class WPUPG_Template_Image extends WPUPG_Template_Block { |
| 4 |
|
| 5 |
public $url; |
| 6 |
public $preset = false; |
| 7 |
|
| 8 |
public $editorField = 'image'; |
| 9 |
|
| 10 |
public function __construct( $type = 'image' ) |
| 11 |
{ |
| 12 |
parent::__construct( $type ); |
| 13 |
} |
| 14 |
|
| 15 |
public function url( $url ) |
| 16 |
{ |
| 17 |
$this->url = $url; |
| 18 |
return $this; |
| 19 |
} |
| 20 |
|
| 21 |
public function preset( $preset ) |
| 22 |
{ |
| 23 |
$this->preset = $preset; |
| 24 |
return $this; |
| 25 |
} |
| 26 |
|
| 27 |
public function output( $post, $args = array() ) |
| 28 |
{ |
| 29 |
if( !$this->output_block( $post, $args ) ) return ''; |
| 30 |
|
| 31 |
if( $this->preset ) { |
| 32 |
$this->url = WPUltimatePostGrid::addon( 'template-editor' )->addonUrl . '/img/' . $this->preset . '.png'; |
| 33 |
} |
| 34 |
|
| 35 |
$output = $this->before_output(); |
| 36 |
$output .= '<img src="' . $this->url . '"' . $this->style() . '\>'; |
| 37 |
|
| 38 |
return $this->after_output( $output, $post ); |
| 39 |
} |
| 40 |
} |