| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if( ! class_exists( 'MywpShortcodeAbstractModule' ) ) { |
| 8 |
return false; |
| 9 |
} |
| 10 |
|
| 11 |
if ( ! class_exists( 'MywpShortcodeModuleToolbarItem' ) ) : |
| 12 |
|
| 13 |
final class MywpShortcodeModuleToolbarItem extends MywpShortcodeAbstractModule { |
| 14 |
|
| 15 |
protected static $id = 'mywp_toolbar_item'; |
| 16 |
|
| 17 |
public static function do_shortcode( $atts = false , $content = false , $tag = false ) { |
| 18 |
|
| 19 |
if( empty( $atts['item'] ) ) { |
| 20 |
|
| 21 |
return $content; |
| 22 |
|
| 23 |
} |
| 24 |
|
| 25 |
if( $atts['item'] === 'search' ) { |
| 26 |
|
| 27 |
$content = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch">'; |
| 28 |
$content .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />'; |
| 29 |
$content .= '<label for="adminbar-search" class="screen-reader-text">' . __( 'Search' ) . '</label>'; |
| 30 |
$content .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '"/>'; |
| 31 |
$content .= '</form>'; |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
$content = apply_filters( 'mywp_shortcode_toolbar_item' , $content , $atts ); |
| 36 |
|
| 37 |
return $content; |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
} |
| 42 |
|
| 43 |
MywpShortcodeModuleToolbarItem::init(); |
| 44 |
|
| 45 |
endif; |
| 46 |
|