| 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 |
* @subpackage Automatic_YouTube_Gallery/admin |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly |
| 14 |
if ( ! defined( 'WPINC' ) ) { |
| 15 |
die; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* AYG_Admin_Shortcode_Builder class. |
| 20 |
* |
| 21 |
* @since 1.0.0 |
| 22 |
*/ |
| 23 |
class AYG_Admin_Shortcode_Builder { |
| 24 |
|
| 25 |
/** |
| 26 |
* Adds an "Automatic YouTube Gallery" button above the classic TinyMCE Editor on add/edit screens. |
| 27 |
* |
| 28 |
* @since 1.0.0 |
| 29 |
*/ |
| 30 |
public function media_buttons() { |
| 31 |
|
| 32 |
global $pagenow; |
| 33 |
|
| 34 |
// Only run in post/page creation and edit screens |
| 35 |
if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) { |
| 36 |
printf( |
| 37 |
'<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>', |
| 38 |
__( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ) |
| 39 |
); |
| 40 |
} |
| 41 |
|
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Prints the footer code needed for the "Automatic YouTube Gallery" TinyMCE button. |
| 46 |
* |
| 47 |
* @since 1.0.0 |
| 48 |
*/ |
| 49 |
public function admin_footer() { |
| 50 |
|
| 51 |
global $pagenow; |
| 52 |
|
| 53 |
// Only run in post/page creation and edit screens |
| 54 |
if ( in_array( $pagenow, array( 'post.php', 'page.php', 'post-new.php', 'post-edit.php' ) ) ) { |
| 55 |
|
| 56 |
$fields = ayg_get_editor_fields(); |
| 57 |
|
| 58 |
require_once AYG_DIR . 'admin/templates/shortcode-builder.php'; |
| 59 |
|
| 60 |
} |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
} |
| 65 |
|