|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * @package ADL Post Slider |
| 4 | + */ |
| 5 | +/* |
| 6 | +Plugin Name: ADL Post Slider |
| 7 | +Plugin URI: https://aazztech.com/product/adl-post-slider-pro |
| 8 | +Description: This excellent plugin allows you to display your posts with a very beautiful slider without coding knowledge. |
| 9 | +Version: 1.4 |
| 10 | +Author: AazzTech |
| 11 | +Author URI: https://aazztech.com |
| 12 | +License: GPLv2 or later |
| 13 | +Domain Path: /languages/ |
| 14 | +Text Domain: adl-post-slider |
| 15 | +*/ |
| 16 | + |
| 17 | +/* |
| 18 | +This program is free software; you can redistribute it and/or |
| 19 | +modify it under the terms of the GNU General Public License |
| 20 | +as published by the Free Software Foundation; either version 2 |
| 21 | +of the License, or (at your option) any later version. |
| 22 | +
|
| 23 | +This program is distributed in the hope that it will be useful, |
| 24 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | +GNU General Public License for more details. |
| 27 | +
|
| 28 | +You should have received a copy of the GNU General Public License |
| 29 | +along with this program; if not, write to the Free Software |
| 30 | +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 31 | +
|
| 32 | +Copyright ADL Plugins. |
| 33 | +*/ |
| 34 | + |
| 35 | + |
| 36 | +/** |
| 37 | + * Deny direct access |
| 38 | + */ |
| 39 | + |
| 40 | +if ( !defined('ABSPATH') ) die( 'Sorry! This is not your place!' ); |
| 41 | + |
| 42 | +// check for required php version and deactivate the plugin if php version is less. |
| 43 | +if ( version_compare( PHP_VERSION, '5.4', '<' )) { |
| 44 | + add_action( 'admin_notices', 'aps_notice' ); |
| 45 | + function aps_notice() { ?> |
| 46 | + <div class="error notice is-dismissible"> <p> |
| 47 | + <?php |
| 48 | + echo 'ADL Post Slider requires minimum PHP 5.4 to function properly. Please upgrade PHP version. The Plugin has been auto-deactivated.. You have PHP version '.PHP_VERSION; |
| 49 | + ?> |
| 50 | + </p></div> |
| 51 | + <?php |
| 52 | + if ( isset( $_GET['activate'] ) ) { |
| 53 | + unset( $_GET['activate'] ); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + // deactivate the plugin because required php version is less. |
| 58 | + add_action( 'admin_init', 'aps_deactivate_self' ); |
| 59 | + function aps_deactivate_self() { |
| 60 | + deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 61 | + } |
| 62 | + return; |
| 63 | +} |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +/* |
| 68 | + * All Constants |
| 69 | + */ |
| 70 | +if (!defined('APS_VERSION')) define( 'APS_VERSION', '1.0.0' ); |
| 71 | +if (!defined('APS_BASENAME')) define( 'APS_BASENAME', plugin_basename(__FILE__) ); |
| 72 | +if (!defined('APS_MINIMUM_WP_VERSION')) define( 'APS_MINIMUM_WP_VERSION', '3.5' ); |
| 73 | +if (!defined('APS_PLUGIN_DIR')) define( 'APS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 74 | +if (!defined('APS_PLUGIN_URI')) define( 'APS_PLUGIN_URI', plugins_url('', __FILE__) ); |
| 75 | +if (!defined('APS_TEXTDOMAIN')) define( 'APS_TEXTDOMAIN', 'adl-post-slider' ); |
| 76 | +if (!defined('APS_DEFAULT_IMG')) define( 'APS_DEFAULT_IMG', APS_PLUGIN_URI .'/img/featured_image_placeholder.jpg' ); |
| 77 | +if (!defined('APS_ALERT_MSG')) define( 'APS_ALERT_MSG', __( 'Sorry! This is not your place!', APS_TEXTDOMAIN ) ); |
| 78 | + |
| 79 | +// All includes |
| 80 | + |
| 81 | +require_once APS_PLUGIN_DIR . 'includes/aps-helper.php'; |
| 82 | +require_once APS_PLUGIN_DIR . 'includes/aps-cpt.php'; |
| 83 | +require_once APS_PLUGIN_DIR . 'includes/aps-cpt-columns.php'; |
| 84 | +require_once APS_PLUGIN_DIR . 'includes/aps-featured-post.php'; |
| 85 | +require_once APS_PLUGIN_DIR . 'includes/aps-popular-post.php'; |
| 86 | +require_once APS_PLUGIN_DIR . 'includes/aps-image-resizer.php'; |
| 87 | +require_once APS_PLUGIN_DIR . 'includes/aps-metabox.php'; |
| 88 | +require_once APS_PLUGIN_DIR . 'includes/aps-metabox-save.php'; |
| 89 | +require_once APS_PLUGIN_DIR . 'includes/aps-shortcode.php'; |
| 90 | +require_once APS_PLUGIN_DIR . 'includes/upgrade-support.php'; |
| 91 | + |
| 92 | +// warn if unsupported WordPress Version. This function should be called after including helper.php |
| 93 | +if ( aps_check_min_wp_version(APS_MINIMUM_WP_VERSION) ) { |
| 94 | + add_action('admin_notices', 'aps_warn_if_unsupported_wp'); |
| 95 | + add_action( 'admin_init', 'aps_deactivate_self' ); |
| 96 | + function aps_deactivate_self() { |
| 97 | + deactivate_plugins( APS_BASENAME ); |
| 98 | + } |
| 99 | +} |
| 100 | +// Registering all styles and scripts |
| 101 | +function aps_enqueue_styles() { |
| 102 | + //styles |
| 103 | + wp_register_style('owl-carousel-min-style', APS_PLUGIN_URI. '/css/owl.carousel.css',false, APS_VERSION); |
| 104 | + wp_register_style('aps-frontend', APS_PLUGIN_URI. '/css/aps-frontend.css',false, APS_VERSION); |
| 105 | + wp_register_style('fontello-style', APS_PLUGIN_URI. '/css/fontello.css',false, APS_VERSION); |
| 106 | + wp_register_style('owl-theme-default-min-style', APS_PLUGIN_URI. '/css/owl.theme.default.min.css',array('owl-carousel-min-style'), APS_VERSION); |
| 107 | + |
| 108 | + //scripts |
| 109 | + wp_register_script('owl-carousel-min-script', APS_PLUGIN_URI. '/js/owl.carousel.min.js', array('jquery'), APS_VERSION, true); |
| 110 | + wp_register_script('aps-front-end-script', APS_PLUGIN_URI. '/js/aps-front-end.js', array('jquery'), APS_VERSION, true); |
| 111 | +} |
| 112 | +add_action('wp_enqueue_scripts', 'aps_enqueue_styles'); |
| 113 | + |
| 114 | +function aps_enqueue_admin_scripts_and_styles( ){ |
| 115 | +global $typenow; |
| 116 | + if ( 'adlpostslider' === $typenow ) { |
| 117 | + wp_enqueue_style('cmb2-style', APS_PLUGIN_URI. '/css/cmb2.min.css',false, APS_VERSION); |
| 118 | + wp_enqueue_script('admin-script', APS_PLUGIN_URI. '/js/aps-admin.js',array('jquery', 'wp-color-picker'), APS_VERSION, true); |
| 119 | + wp_enqueue_style('wp-color-picker'); |
| 120 | + wp_enqueue_media(); |
| 121 | + |
| 122 | + } |
| 123 | + if ( 'adlpostslider' === $typenow || 'post' === $typenow) { |
| 124 | + wp_enqueue_style('admin-style', APS_PLUGIN_URI. '/css/aps-admin.css',false, APS_VERSION); |
| 125 | + } |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +} |
| 132 | +add_action('admin_enqueue_scripts', 'aps_enqueue_admin_scripts_and_styles'); |
| 133 | + |
| 134 | + |
0 commit comments