| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Shortcode Builder. |
| 5 |
* |
| 6 |
* @link https://plugins360.com |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package Automatic_YouTube_Gallery |
| 10 |
*/ |
| 11 |
|
| 12 |
// Exit if accessed directly |
| 13 |
if ( ! defined( 'WPINC' ) ) { |
| 14 |
die; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* AYG_Admin_Shortcode_Builder class. |
| 19 |
* |
| 20 |
* @since 1.0.0 |
| 21 |
*/ |
| 22 |
class AYG_Admin_Shortcode_Builder { |
| 23 |
|
| 24 |
/** |
| 25 |
* Adds an "Automatic YouTube Gallery" button above the classic TinyMCE Editor on add/edit screens. |
| 26 |
* |
| 27 |
* @since 1.0.0 |
| 28 |
*/ |
| 29 |
public function media_buttons() { |
| 30 |
global $pagenow; |
| 31 |
|
| 32 |
// Only run in post/page creation and edit screens |
| 33 |
if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) { |
| 34 |
printf( |
| 35 |
'<a href="javascript:void(0);" class="button button-primary" id="ayg-media-button"><span class="wp-media-buttons-icon dashicons dashicons-video-alt3"></span> %s</a>', |
| 36 |
__( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ) |
| 37 |
); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Prints the footer code needed for the "Automatic YouTube Gallery" TinyMCE button. |
| 43 |
* |
| 44 |
* @since 1.0.0 |
| 45 |
*/ |
| 46 |
public function admin_footer() { |
| 47 |
global $pagenow; |
| 48 |
|
| 49 |
// Only run in post/page creation and edit screens |
| 50 |
if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) { |
| 51 |
$fields = ayg_get_editor_fields(); |
| 52 |
require_once AYG_DIR . 'admin/templates/shortcode-builder.php'; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
} |
| 57 |
|