| 1 |
<?php |
| 2 |
/** |
| 3 |
* The main plugin file. |
| 4 |
* |
| 5 |
* @link https://wpsocio.com |
| 6 |
* @since 1.0.0 |
| 7 |
* @package WPTelegram_Widget |
| 8 |
* |
| 9 |
* @wordpress-plugin |
| 10 |
* Plugin Name: WP Telegram Widget |
| 11 |
* Plugin URI: https://t.me/WPTelegram |
| 12 |
* Description: Display the Telegram Public Channel or Group Feed in a WordPress widget or anywhere you want using a shortcode. |
| 13 |
* Version: 2.2.4 |
| 14 |
* Requires at least: 6.4 |
| 15 |
* Requires PHP: 7.4 |
| 16 |
* Author: WP Socio |
| 17 |
* Author URI: https://wpsocio.com |
| 18 |
* License: GPL-2.0+ |
| 19 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 20 |
* Text Domain: wptelegram-widget |
| 21 |
* Domain Path: /languages |
| 22 |
*/ |
| 23 |
|
| 24 |
// If this file is called directly, abort. |
| 25 |
if ( ! defined( 'WPINC' ) ) { |
| 26 |
die; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Current plugin version. |
| 31 |
*/ |
| 32 |
define( 'WPTELEGRAM_WIDGET_VER', '2.2.4' ); |
| 33 |
|
| 34 |
defined( 'WPTELEGRAM_WIDGET_MAIN_FILE' ) || define( 'WPTELEGRAM_WIDGET_MAIN_FILE', __FILE__ ); |
| 35 |
|
| 36 |
defined( 'WPTELEGRAM_WIDGET_BASENAME' ) || define( 'WPTELEGRAM_WIDGET_BASENAME', plugin_basename( WPTELEGRAM_WIDGET_MAIN_FILE ) ); |
| 37 |
|
| 38 |
define( 'WPTELEGRAM_WIDGET_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 39 |
|
| 40 |
define( 'WPTELEGRAM_WIDGET_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) ); |
| 41 |
|
| 42 |
/** |
| 43 |
* Include autoloader. |
| 44 |
*/ |
| 45 |
require WPTELEGRAM_WIDGET_DIR . '/autoload.php'; |
| 46 |
require_once dirname( WPTELEGRAM_WIDGET_MAIN_FILE ) . '/vendor/autoload.php'; |
| 47 |
|
| 48 |
/** |
| 49 |
* The code that runs during plugin activation. |
| 50 |
*/ |
| 51 |
function activate_wptelegram_widget() { |
| 52 |
\WPTelegram\Widget\includes\Activator::activate(); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* The code that runs during plugin deactivation. |
| 57 |
*/ |
| 58 |
function deactivate_wptelegram_widget() { |
| 59 |
\WPTelegram\Widget\includes\Deactivator::deactivate(); |
| 60 |
} |
| 61 |
|
| 62 |
register_activation_hook( __FILE__, 'activate_wptelegram_widget' ); |
| 63 |
register_deactivation_hook( __FILE__, 'deactivate_wptelegram_widget' ); |
| 64 |
|
| 65 |
/** |
| 66 |
* Begins execution of the plugin and acts as the main instance of WPTelegram_Widget. |
| 67 |
* |
| 68 |
* Returns the main instance of WPTelegram_Widget to prevent the need to use globals. |
| 69 |
* |
| 70 |
* Since everything within the plugin is registered via hooks, |
| 71 |
* then kicking off the plugin from this point in the file does |
| 72 |
* not affect the page life cycle. |
| 73 |
* |
| 74 |
* @since 1.0.0 |
| 75 |
* |
| 76 |
* @return \WPTelegram\Widget\includes\Main |
| 77 |
*/ |
| 78 |
function WPTG_Widget() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName -- Ignore snake_case |
| 79 |
|
| 80 |
return \WPTelegram\Widget\includes\Main::instance(); |
| 81 |
} |
| 82 |
|
| 83 |
$requirements = new \WPTelegram\Widget\includes\Requirements( WPTELEGRAM_WIDGET_MAIN_FILE ); |
| 84 |
|
| 85 |
if ( $requirements->satisfied() ) { |
| 86 |
// Fire. |
| 87 |
WPTG_Widget()->init(); |
| 88 |
|
| 89 |
define( 'WPTELEGRAM_WIDGET_LOADED', true ); |
| 90 |
} else { |
| 91 |
add_filter( 'after_plugin_row_' . WPTELEGRAM_WIDGET_BASENAME, [ $requirements, 'display_requirements' ] ); |
| 92 |
} |
| 93 |
|