| 1 |
<?php |
| 2 |
|
| 3 |
class WPUPG_Template_Link extends WPUPG_Template_Block { |
| 4 |
|
| 5 |
public $text; |
| 6 |
public $url = '#'; |
| 7 |
public $target = ''; |
| 8 |
|
| 9 |
public $editorField = 'link'; |
| 10 |
|
| 11 |
public function __construct( $type = 'link' ) |
| 12 |
{ |
| 13 |
parent::__construct( $type ); |
| 14 |
} |
| 15 |
|
| 16 |
public function text( $text ) |
| 17 |
{ |
| 18 |
$this->text = $text; |
| 19 |
return $this; |
| 20 |
} |
| 21 |
|
| 22 |
public function url( $url ) |
| 23 |
{ |
| 24 |
$this->url = $url; |
| 25 |
return $this; |
| 26 |
} |
| 27 |
|
| 28 |
public function target( $target ) |
| 29 |
{ |
| 30 |
$this->target = $target; |
| 31 |
return $this; |
| 32 |
} |
| 33 |
|
| 34 |
public function output( $post, $args = array() ) |
| 35 |
{ |
| 36 |
if( !$this->output_block( $post, $args ) ) return ''; |
| 37 |
|
| 38 |
$output = $this->before_output(); |
| 39 |
$output .= '<a href="' . $this->url . '" target="' . $this->target . '"'. $this->style() .'>' . $this->text . '</a>'; |
| 40 |
|
| 41 |
return $this->after_output( $output, $post ); |
| 42 |
} |
| 43 |
} |