PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / 2.2.44
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel v2.2.44
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / admin / class-admin.php
foogallery / includes / admin Last commit date
class-admin-notices.php 3 years ago class-admin.php 3 years ago class-attachment-fields.php 3 years ago class-columns.php 3 years ago class-demo-content.php 3 years ago class-extensions.php 3 years ago class-gallery-attachment-modal.php 3 years ago class-gallery-datasources.php 3 years ago class-gallery-editor.php 3 years ago class-gallery-metabox-fields.php 3 years ago class-gallery-metabox-items.php 3 years ago class-gallery-metabox-settings-helper.php 3 years ago class-gallery-metabox-settings.php 3 years ago class-gallery-metaboxes.php 3 years ago class-menu.php 3 years ago class-pro-promotion.php 3 years ago class-settings.php 3 years ago class-silent-installer-skin.php 3 years ago demo-content-galleries.php 3 years ago demo-content-images.php 3 years ago index.php 3 years ago view-extensions.php 3 years ago view-help-demos.php 3 years ago view-help-getting-started.php 3 years ago view-help-pro.php 3 years ago view-help.php 3 years ago view-system-info.php 3 years ago
class-admin.php
128 lines
1 <?php
2 /*
3 * FooGallery Admin class
4 */
5
6 if ( ! class_exists( 'FooGallery_Admin' ) ) {
7
8 /**
9 * Class FooGallery_Admin
10 */
11 class FooGallery_Admin {
12
13 /**
14 *
15 */
16 function __construct() {
17 global $foogallery_admin_datasource_instance;
18
19 //init some other actions
20 add_action( 'init', array( $this, 'init' ) );
21
22 new FooGallery_Admin_Settings();
23 new FooGallery_Admin_Menu();
24 new FooGallery_Admin_Gallery_Editor();
25 new FooGallery_Admin_Gallery_MetaBoxes();
26 new FooGallery_Admin_Gallery_MetaBox_Items();
27 new FooGallery_Admin_Gallery_MetaBox_Settings();
28 new FooGallery_Admin_Gallery_MetaBox_Fields();
29 new FooGallery_Admin_Columns();
30 new FooGallery_Admin_Extensions();
31 new FooGallery_Attachment_Fields();
32 new FooGallery_Admin_Notices();
33 new FooGallery_Admin_Gallery_Attachment_Modal();
34 $foogallery_admin_datasource_instance = new FooGallery_Admin_Gallery_Datasources();
35
36 // include PRO promotion.
37 new FooGallery_Pro_Promotion();
38 }
39
40 function init() {
41 add_filter( 'foogallery_admin_has_settings_page', '__return_false' );
42 add_action( 'foogallery_admin_print_styles', array( $this, 'admin_print_styles' ) );
43 add_action( 'foogallery_admin_print_scripts', array( $this, 'admin_print_scripts' ) );
44 // Add a links to the plugin listing
45 add_filter( 'foogallery_admin_plugin_action_links', array( $this, 'plugin_listing_links' ) );
46 //output shortcode for javascript
47 add_action( 'admin_footer', array( $this, 'output_shortcode_variable' ), 200 );
48 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_and_styles' ) );
49
50 add_filter( 'fs_show_trial_foogallery', array( $this, 'force_trial_hide' ) );
51 add_action( 'admin_init', array( $this, 'force_hide_trial_notice' ), 99 );
52 }
53
54 public function enqueue_scripts_and_styles( $hook ) {
55 //check if the gallery edit page is being shown
56 $screen = get_current_screen();
57 if ( 'foogallery' !== $screen->id ) {
58 return;
59 }
60
61 foogallery_enqueue_core_gallery_template_script();
62 foogallery_enqueue_core_gallery_template_style();
63
64 $foogallery = FooGallery_Plugin::get_instance();
65 $foogallery->register_and_enqueue_js( 'admin-foogallery-edit.js' );
66
67 do_action('foogallery_admin_enqueue_scripts' );
68 }
69
70 function admin_print_styles() {
71 $page = safe_get_from_request( 'page' );
72 $foogallery = FooGallery_Plugin::get_instance();
73 $foogallery->register_and_enqueue_css( 'admin-page-' . $page . '.css' );
74 }
75
76 function admin_print_scripts() {
77 $page = safe_get_from_request( 'page' );
78 $foogallery = FooGallery_Plugin::get_instance();
79 $foogallery->register_and_enqueue_js( 'admin-page-' . $page . '.js' );
80 }
81
82 /**
83 * @param $links
84 *
85 * @return string[]
86 */
87 function plugin_listing_links( $links ) {
88 if ( !is_array( $links ) ) {
89 $links = array();
90 }
91
92 // Add a 'Settings' link to the plugin listing
93 $links[] = '<a href="' . esc_url( foogallery_admin_settings_url() ) . '"><b>' . __( 'Settings', 'foogallery' ) . '</b></a>';
94
95 $links[] = '<a href="' . esc_url( foogallery_admin_help_url() ) . '"><b>' . __( 'Help', 'foogallery' ) . '</b></a>';
96
97 return $links;
98 }
99
100 function output_shortcode_variable() {
101 if ( foogallery_gallery_shortcode_tag() != FOOGALLERY_CPT_GALLERY ) {
102 ?>
103 <script type="text/javascript">
104 window.FOOGALLERY_SHORTCODE = '<?php echo foogallery_gallery_shortcode_tag(); ?>';
105 </script>
106 <?php
107 }
108 }
109
110 function force_trial_hide( $show_trial ) {
111 if ( 'on' === foogallery_get_setting( 'force_hide_trial', false ) ) {
112 $show_trial = false;
113 }
114
115 return $show_trial;
116 }
117
118 function force_hide_trial_notice() {
119 if ( 'on' === foogallery_get_setting( 'force_hide_trial', false ) ) {
120 $freemius_sdk = foogallery_fs();
121 $plugin_id = $freemius_sdk->get_slug();
122 $admin_notice_manager = FS_Admin_Notice_Manager::instance( $plugin_id );
123 $admin_notice_manager->remove_sticky( 'trial_promotion' );
124 }
125 }
126 }
127 }
128