PluginProbe
Image Carousel / trunk
Image Carousel vtrunk
trunk 1.0.0.0 1.0.0.1 1.0.0.10 1.0.0.11 1.0.0.13 1.0.0.15 1.0.0.17 1.0.0.19 1.0.0.21 1.0.0.23 1.0.0.25 1.0.0.27 1.0.0.29 1.0.0.3 1.0.0.30 1.0.0.31 1.0.0.33 1.0.0.35 1.0.0.37 1.0.0.39 1.0.0.41 1.0.0.5 1.0.0.7 1.0.0.9
image-carousel / image-carousel.php

image-carousel.php in Image Carousel trunk, at image-carousel.php

184 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: Image Carousel
5 Plugin URI: https://www.ghozylab.com/plugins/
6 Description: Touch enabled Wordpress plugin that lets you create a beautiful responsive image carousel
7 Author: PT. GHOZY LAB LLC
8 Text Domain: image-carousel
9 Domain Path: /languages
10 Version: 1.0.0.43
11 Author URI: https://www.ghozylab.com/plugins/
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 die( 'Please do not load this file directly.' );
16 }
17
18 /*-------------------------------------------------------------------------------*/
19 /* All DEFINES
20 /*-------------------------------------------------------------------------------*/
21 $icp_plugin_url = substr( plugin_dir_url( __FILE__ ), 0, -1 );
22 $icp_plugin_dir = substr( plugin_dir_path( __FILE__ ), 0, -1 );
23
24 define( 'ICP_VERSION', '1.0.0.43' );
25 define( 'ICP_URL', $icp_plugin_url );
26 define( 'ICP_DIR', $icp_plugin_dir );
27 define( 'ICP_ITEM_NAME', 'Image Carousel' );
28 define( 'ICP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
29 define( 'EWIC_BFITHUMB_UPLOAD_DIR', 'image_carousel_thumbs' );
30
31 $icp_upload_info = wp_upload_dir();
32 $icp_upload_dir = $icp_upload_info['basedir'];
33 define( 'EWIC_FULL_BFITHUMB_UPLOAD_DIR', $icp_upload_dir.'/'.EWIC_BFITHUMB_UPLOAD_DIR.'/' );
34 define( 'ICP_PLUGIN_SLUG', 'image-carousel/image-carousel.php' );
35 add_action( 'wp_enqueue_scripts', 'icp_jquery_scripts' );
36
37 /*-------------------------------------------------------------------------------*/
38 /* Plugin Init
39 /*-------------------------------------------------------------------------------*/
40 add_action( 'init', 'icp_general_init' );
41 /* Gutenberg Compatibility */
42 add_action( 'plugins_loaded', 'icp_run_gutenberg' );
43
44 function icp_general_init()
45 {
46
47 // Global
48 load_plugin_textdomain( 'image-carousel', false, dirname( plugin_basename( __FILE__ ) ).'/languages/' );
49
50 include_once ICP_PLUGIN_DIR.'inc/functions/icp-functions.php';
51
52 // Backend
53 if ( is_admin() ) {
54
55 add_action( 'admin_menu', 'icp_menu_page' );
56 add_filter( 'plugin_action_links', 'icp_settings_link', 10, 2 );
57 add_action( 'admin_enqueue_scripts', 'icp_admin_enqueue_scripts' );
58
59 include_once ICP_PLUGIN_DIR.'inc/icp-metabox.php';
60 include_once ICP_PLUGIN_DIR.'inc/settings/icp-global-settings.php';
61 include_once ICP_PLUGIN_DIR.'inc/functions/ajax/icp-admin-ajax.php';
62
63 }
64
65 // Frontend
66 if ( ! is_admin() ) {
67
68 require_once ICP_PLUGIN_DIR.'inc/class/BFI_Thumb.php';
69 add_action( 'wp_enqueue_scripts', 'icp_frontend_enqueue_scripts' );
70 add_filter( 'the_content', 'icp_post_page_hook' );
71 add_shortcode( 'icp_widget_carousel', 'icp_widget_shortcode' );
72
73 }
74
75 }
76
77 function icp_is_gutenberg()
78 {
79
80 // Gutenberg plugin is installed and activated.
81 $gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );
82
83 // Block editor since 5.0.
84 $block_editor = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
85
86 if ( ! $gutenberg && ! $block_editor ) {
87 return false;
88 }
89
90 if ( function_exists( 'is_classic_editor_plugin_active' ) && is_classic_editor_plugin_active() ) {
91 $editor_option = get_option( 'classic-editor-replace' );
92 $block_editor_active = array( 'no-replace', 'block' );
93
94 return in_array( $editor_option, $block_editor_active, true );
95 }
96
97 return true;
98
99 }
100
101 function icp_run_gutenberg()
102 {
103
104 if ( icp_is_gutenberg() ) {
105 include_once ICP_PLUGIN_DIR.'inc/block/class-block.php';
106 }
107
108 }
109
110 function icp_jquery_scripts()
111 {
112
113 wp_enqueue_script( 'jquery' );
114
115 }
116
117 /*-------------------------------------------------------------------------------*/
118 /* Plugin Settings Link @since 1.0.0.13
119 /*-------------------------------------------------------------------------------*/
120 function icp_settings_link( $link, $file )
121 {
122
123 static $this_plugin;
124
125 if ( ! $this_plugin ) {
126 $this_plugin = plugin_basename( __FILE__ );
127 }
128
129 if ( $file == $this_plugin ) {
130 $settings_link = '<a href="'.admin_url( 'admin.php?page=icp-carousel-settings' ).'"><span class="ipc_settings_icon dashicons dashicons-admin-generic"></span>&nbsp;'.__( 'Settings', 'image-carousel' ).'</a>';
131 array_unshift( $link, $settings_link );
132 }
133
134 return $link;
135 }
136
137 function icp_current_screen( $current_screen )
138 {
139
140 if ( 'plugins' == $current_screen->id ) {
141 add_action( 'admin_head', 'icp_custom_admin_head' );
142 }
143
144 }
145
146 add_action( 'current_screen', 'icp_current_screen' );
147
148 function icp_custom_admin_head()
149 {
150
151 echo '<style>.ipc_settings_icon:before {font-size: 20px !important;background-color: rgba(0, 0, 0, 0) !important;padding: 0 !important;box-shadow: none !important;width: 20px !important;height: 20px !important;}.ipc_settings_icon.dashicons {width: 20px !important;height: 20px !important;padding: 0 !important;position: relative;top: 1.3px;}</style>';
152
153 }
154
155 /*-------------------------------------------------------------------------------*/
156 /* Redirect on Activation
157 /*-------------------------------------------------------------------------------*/
158 function icp_plugin_activate()
159 {
160
161 add_option( 'activated_icp_plugin', 'icp-activate' );
162
163 }
164
165 register_activation_hook( __FILE__, 'icp_plugin_activate' );
166
167 function icp_load_plugin()
168 {
169
170 if ( is_admin() && get_option( 'activated_icp_plugin' ) == 'icp-activate' ) {
171
172 delete_option( 'activated_icp_plugin' );
173
174 if ( ! is_network_admin() ) {
175
176 wp_redirect( 'admin.php?page=icp-carousel-settings' );
177
178 }
179
180 }
181
182 }
183
184 add_action( 'admin_init', 'icp_load_plugin' );