| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WP Multilang |
| 4 |
* Plugin URI: https://github.com/ahmedkaludi/wp-multilang |
| 5 |
* GitHub Plugin URI: https://github.com/ahmedkaludi/wp-multilang |
| 6 |
* Description: Multilingual plugin for WordPress. Go Multilingual in minutes with full WordPress support. Translate your site easily with this localization plugin. |
| 7 |
* Author: Valentyn Riaboshtan |
| 8 |
* Author URI: https://wp-multilang.com/ |
| 9 |
* License: GPL2 |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 |
* Text Domain: wp-multilang |
| 12 |
* Domain Path: /languages |
| 13 |
* Version: 2.4.33 |
| 14 |
* Copyright: © 2017-2019 Valentyn Riaboshtan |
| 15 |
* |
| 16 |
* @package WPM |
| 17 |
* @category Core |
| 18 |
* @author Valentyn Riaboshtan |
| 19 |
*/ |
| 20 |
|
| 21 |
use WPM\Includes\WP_Multilang; |
| 22 |
|
| 23 |
if ( ! defined( 'ABSPATH' ) ) { |
| 24 |
exit; // Exit if accessed directly. |
| 25 |
} |
| 26 |
|
| 27 |
// Define WPM_PLUGIN_FILE. |
| 28 |
if ( ! defined( 'WPM_PLUGIN_FILE' ) ) { |
| 29 |
define( 'WPM_PLUGIN_FILE', __FILE__ ); |
| 30 |
} |
| 31 |
|
| 32 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 33 |
require_once __DIR__ . '/includes/wpm-widget-block-editor.php'; |
| 34 |
|
| 35 |
function wpm() { |
| 36 |
return WP_Multilang::instance(); |
| 37 |
} |
| 38 |
|
| 39 |
wpm(); |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* Set transient on plugin activation |
| 44 |
* @since 1.0 |
| 45 |
* */ |
| 46 |
function wpm_activate_plugin( $network_active ) { |
| 47 |
|
| 48 |
// Not network active i.e. plugin is activated on a single install (normal WordPress install) or a single site on a multisite network |
| 49 |
if ( ! $network_active ) { |
| 50 |
|
| 51 |
// Set transient for single site activation notice |
| 52 |
set_transient( 'wpm_admin_notice_activation', true, 60 ); |
| 53 |
|
| 54 |
return; |
| 55 |
} |
| 56 |
} |
| 57 |
register_activation_hook( __FILE__, 'wpm_activate_plugin' ); |
| 58 |
|
| 59 |
|
| 60 |
/** |
| 61 |
* Admin notice on plugin activation |
| 62 |
* |
| 63 |
* @since 1.0 |
| 64 |
*/ |
| 65 |
function wpm_activation_admin_notices() { |
| 66 |
|
| 67 |
// Notices only for admins |
| 68 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 69 |
return; |
| 70 |
} |
| 71 |
|
| 72 |
// Admin notice on plugin activation |
| 73 |
if ( get_transient( 'wpm_admin_notice_activation' ) ) { |
| 74 |
|
| 75 |
// Do not display link to settings UI if we are already in the UI. |
| 76 |
$screen = get_current_screen(); |
| 77 |
?> |
| 78 |
<div class="updated notice is-dismissible"> |
| 79 |
<p> |
| 80 |
<?php echo esc_html__( 'Thank you for installing', 'wp-multilang' ); ?> |
| 81 |
<strong>WP Multilang!</strong> |
| 82 |
<?php |
| 83 |
if( strpos( $screen->id, 'wpm' ) === false ) { |
| 84 |
?> |
| 85 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wpm-settings' ) ); ?>"><?php echo esc_html__( 'Add your languages & Customize your settings →', 'wp-multilang');?> </a> |
| 86 |
<?php |
| 87 |
} |
| 88 |
?> |
| 89 |
</p> |
| 90 |
</div>'; |
| 91 |
<?php |
| 92 |
// Delete transient |
| 93 |
delete_transient( 'wpm_admin_notice_activation' ); |
| 94 |
} |
| 95 |
} |
| 96 |
add_action( 'admin_notices', 'wpm_activation_admin_notices' ); |