| 1 |
<?php |
| 2 |
/* |
| 3 |
* Add inline css |
| 4 |
* |
| 5 |
* |
| 6 |
*/ |
| 7 |
if (!function_exists('gbox_admin_inline_css')) : |
| 8 |
function gbox_admin_inline_css() |
| 9 |
{ |
| 10 |
|
| 11 |
global $pagenow; |
| 12 |
|
| 13 |
if (!in_array($pagenow, array('post-new.php', 'post.php'))) { |
| 14 |
return; |
| 15 |
} |
| 16 |
|
| 17 |
global $post; |
| 18 |
$post_id = $post->ID; |
| 19 |
|
| 20 |
//simple image gallery meta |
| 21 |
$gbox_simple_imgs = get_post_meta($post_id, 'simple_imgs', true); |
| 22 |
//advance image gallery meta |
| 23 |
$gbox_img_main = get_post_meta($post_id, 'img_main', true); |
| 24 |
$image_title = !empty($gbox_img_main[0]['image_title']) ? $gbox_img_main[0]['image_title'] : ''; |
| 25 |
$image_small = !empty($gbox_img_main[0]['image_small']) ? $gbox_img_main[0]['image_small'] : ''; |
| 26 |
//Portfolio gallery meta |
| 27 |
$gbox_portfo_main = get_post_meta($post_id, 'portfo_main', true); |
| 28 |
$portfolio_title = !empty($gbox_portfo_main[0]['portfolio_title']) ? $gbox_portfo_main[0]['portfolio_title'] : ''; |
| 29 |
$port_img = !empty($gbox_portfo_main[0]['port_img']) ? $gbox_portfo_main[0]['port_img'] : ''; |
| 30 |
|
| 31 |
|
| 32 |
//Youtube gallery meta |
| 33 |
$gbox_youtube_main = get_post_meta($post_id, 'youtube_main', true); |
| 34 |
$you_url = !empty($gbox_youtube_main[0]['you_url']) ? $gbox_youtube_main[0]['you_url'] : ''; |
| 35 |
|
| 36 |
|
| 37 |
//Vimeo gallery meta |
| 38 |
$gbox_vimeo_main = get_post_meta($post_id, 'vimeo_main', true); |
| 39 |
$vimeo_url = !empty($gbox_vimeo_main[0]['vimeo_url']) ? $gbox_vimeo_main[0]['vimeo_url'] : ''; |
| 40 |
|
| 41 |
//Soundcloud gallery meta |
| 42 |
$gbox_Soundcloud_main = get_post_meta($post_id, 'Soundcloud_main', true); |
| 43 |
$sound_id = !empty($gbox_Soundcloud_main[0]['sound_id']) ? $gbox_Soundcloud_main[0]['sound_id'] : ''; |
| 44 |
|
| 45 |
//Iframe gallery meta |
| 46 |
$gbox_iframe_main = get_post_meta($post_id, 'iframe_main', true); |
| 47 |
$iframe_url = !empty($gbox_iframe_main[0]['iframe_url']) ? $gbox_iframe_main[0]['iframe_url'] : ''; |
| 48 |
|
| 49 |
$script = ''; |
| 50 |
?> |
| 51 |
<script type="text/javascript"> |
| 52 |
(function($) { |
| 53 |
"use strict"; |
| 54 |
$(document).ready(function() { |
| 55 |
<?php |
| 56 |
//quick image gallery |
| 57 |
if (!empty($gbox_simple_imgs)) { |
| 58 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-simg').addClass('cmb-tab-active');"; |
| 59 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 60 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-simg').addClass('show');"; |
| 61 |
} |
| 62 |
//Advance image gallery |
| 63 |
if (!empty($image_title) || !empty($image_small)) { |
| 64 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-image').addClass('cmb-tab-active');"; |
| 65 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 66 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-image').addClass('show');"; |
| 67 |
} |
| 68 |
//portfoli gallery |
| 69 |
if (!empty($portfolio_title) || !empty($port_img)) { |
| 70 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-portfolio ').addClass('cmb-tab-active');"; |
| 71 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 72 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-portfolio').addClass('show');"; |
| 73 |
} |
| 74 |
if (!empty($you_url)) {/* |
| 75 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-youtube').addClass('cmb-tab-active');"; |
| 76 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 77 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-youtube').addClass('show');"; |
| 78 |
*/ |
| 79 |
} |
| 80 |
if (!empty($vimeo_url)) {/* |
| 81 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-vimeo').addClass('cmb-tab-active');"; |
| 82 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 83 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-vimeo').addClass('show');"; |
| 84 |
*/ |
| 85 |
} |
| 86 |
if (!empty($iframe_url)) { |
| 87 |
echo "$('#m_gallery .cmb-tabs ul li.cmb-tab-iframe').addClass('cmb-tab-active');"; |
| 88 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-gbox_welcome').removeClass('show');"; |
| 89 |
echo "$('#cmb2-metabox-m_gallery .cmb-tab-panel-iframe').addClass('show');"; |
| 90 |
} |
| 91 |
?> |
| 92 |
}); |
| 93 |
}(jQuery)); |
| 94 |
</script> |
| 95 |
<?php |
| 96 |
|
| 97 |
} |
| 98 |
add_action('admin_footer', 'gbox_admin_inline_css'); |
| 99 |
endif; |
| 100 |
|
| 101 |
|
| 102 |
//update noticed |
| 103 |
|
| 104 |
function prefix_ms_plugin_update_message($file, $plugin) |
| 105 |
{ |
| 106 |
if (is_multisite() && version_compare($plugin['Version'], $plugin['new_version'], '<')) { |
| 107 |
$wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
| 108 |
printf( |
| 109 |
'<tr class="plugin-update-tr"><td colspan="%s" class="plugin-update update-message notice inline notice-warning notice-alt"><div class="update-message"><h4 style="margin: 0; font-size: 14px;">%s</h4>%s</div></td></tr>', |
| 110 |
$wp_list_table->get_column_count(), |
| 111 |
$plugin['Name'], |
| 112 |
wpautop($plugin['upgrade_notice']) |
| 113 |
); |
| 114 |
} |
| 115 |
} |
| 116 |
add_action('after_plugin_row_gallery-box/gallery-box.php', 'prefix_ms_plugin_update_message', 10, 2); |
| 117 |
|