| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: HT Feed |
| 4 |
* Description: The HT Feed is a elementor addons, Visul Composer addons, WordPress Widges. |
| 5 |
* Plugin URI: https://htplugins.com/ |
| 6 |
* Author: HasThemes |
| 7 |
* Author URI: https://hasthemes.com/ |
| 8 |
* Version: 1.3.1 |
| 9 |
* License: GPL2 |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 |
* Text Domain: ht-instagram |
| 12 |
* Domain Path: /languages |
| 13 |
*/ |
| 14 |
|
| 15 |
if( ! defined( 'ABSPATH' ) ) exit(); // Exit if accessed directly |
| 16 |
|
| 17 |
define( 'HTINSTA_VERSION', '1.3.1' ); |
| 18 |
define( 'HTINSTA_PL_URL', plugins_url( '/', __FILE__ ) ); |
| 19 |
define( 'HTINSTA_PL_PATH', plugin_dir_path( __FILE__ ) ); |
| 20 |
|
| 21 |
// Required File |
| 22 |
require_once HTINSTA_PL_PATH.'include/classes.php'; |
| 23 |
require_once HTINSTA_PL_PATH.'admin/admin-init.php'; |
| 24 |
require_once HTINSTA_PL_PATH.'include/default_widgets.php'; |
| 25 |
require_once HTINSTA_PL_PATH.'include/shortcode.php'; |
| 26 |
|
| 27 |
if( did_action( 'elementor/loaded' ) ){ |
| 28 |
require_once HTINSTA_PL_PATH. '/include/class.htinstagram-icon-manager.php'; |
| 29 |
} |
| 30 |
|
| 31 |
if ( in_array('js_composer/js_composer.php', get_option('active_plugins') ) ){ |
| 32 |
include( HTINSTA_PL_PATH.'include/vc_map.php' ); |
| 33 |
} |
| 34 |
|
| 35 |
function htinstagram_elementor_widgets(){ |
| 36 |
include( HTINSTA_PL_PATH.'include/elementor_widgets.php' ); |
| 37 |
} |
| 38 |
// add_action('elementor/widgets/widgets_registered','htinstagram_elementor_widgets'); |
| 39 |
|
| 40 |
|
| 41 |
/** |
| 42 |
* Elementor Version check |
| 43 |
* Return boolean value |
| 44 |
*/ |
| 45 |
function htinstagram_is_elementor_version( $operator = '<', $version = '2.6.0' ) { |
| 46 |
return defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, $version, $operator ); |
| 47 |
} |
| 48 |
|
| 49 |
// Init Widgets |
| 50 |
if ( htinstagram_is_elementor_version( '>=', '3.5.0' ) ) { |
| 51 |
add_action('elementor/widgets/register','htinstagram_elementor_widgets'); |
| 52 |
}else{ |
| 53 |
add_action('elementor/widgets/widgets_registered','htinstagram_elementor_widgets'); |
| 54 |
} |
| 55 |
|
| 56 |
// Compatibility with elementor version 3.6.1 |
| 57 |
function htinstagram_widget_register_manager($widget_class){ |
| 58 |
$widgets_manager = \Elementor\Plugin::instance()->widgets_manager; |
| 59 |
|
| 60 |
if ( htinstagram_is_elementor_version( '>=', '3.5.0' ) ){ |
| 61 |
$widgets_manager->register( $widget_class ); |
| 62 |
}else{ |
| 63 |
$widgets_manager->register_widget_type( $widget_class ); |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
// Options value fetch |
| 68 |
function htinstagram_get_option( $option, $section, $default = '' ) { |
| 69 |
$options = get_option( $section ); |
| 70 |
if ( isset( $options[$option] ) ) { |
| 71 |
return $options[$option]; |
| 72 |
} |
| 73 |
return $default; |
| 74 |
} |
| 75 |
|
| 76 |
//Enqueue style |
| 77 |
|
| 78 |
function htinstagram_assests_enqueue() { |
| 79 |
|
| 80 |
wp_enqueue_style('htinstagram-feed', HTINSTA_PL_URL . 'assests/css/ht-instagramfeed.css', '', HTINSTA_VERSION ); |
| 81 |
wp_enqueue_style('font-awesome', HTINSTA_PL_URL . 'assests/css/font-awesome.min.css', '', HTINSTA_VERSION ); |
| 82 |
|
| 83 |
// Register Style |
| 84 |
wp_register_style( 'slick', HTINSTA_PL_URL . 'assests/css/slick.min.css', array(), HTINSTA_VERSION ); |
| 85 |
|
| 86 |
// Script register |
| 87 |
wp_register_script( 'slick', HTINSTA_PL_URL . 'assests/js/slick.min.js', array(), HTINSTA_VERSION, TRUE ); |
| 88 |
wp_register_script( 'ht-instagramFeed', HTINSTA_PL_URL . 'assests/js/jquery.instagramFeed.min.js', array('jquery'), HTINSTA_VERSION, TRUE ); |
| 89 |
wp_register_script( 'ht-active', HTINSTA_PL_URL . 'assests/js/active.js', array('jquery'), HTINSTA_VERSION, TRUE ); |
| 90 |
|
| 91 |
} |
| 92 |
add_action( 'wp_enqueue_scripts', 'htinstagram_assests_enqueue' ); |
| 93 |
|
| 94 |
// Add settings link on plugin page. |
| 95 |
function htinstagram_pl_setting_links( $htinstagram_links ) { |
| 96 |
$htinstagram_settings_link = '<a href="admin.php?page=htinstagram">'.esc_html__( 'Settings', 'ht-instagram' ).'</a>'; |
| 97 |
array_unshift( $htinstagram_links, $htinstagram_settings_link ); |
| 98 |
return $htinstagram_links; |
| 99 |
} |
| 100 |
$htinstagram_plugin_name = plugin_basename(__FILE__); |
| 101 |
add_filter("plugin_action_links_$htinstagram_plugin_name", 'htinstagram_pl_setting_links' ); |
| 102 |
|
| 103 |
|