| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
* Plugin Name: Jetpack Social |
| 5 |
* Plugin URI: https://wordpress.org/plugins/jetpack-social |
| 6 |
* Description: Share your site’s posts on several social media networks automatically when you publish a new post. |
| 7 |
* Version: 9.0.2 |
| 8 |
* Author: Automattic - Jetpack Social team |
| 9 |
* Author URI: https://jetpack.com/social/ |
| 10 |
* License: GPLv2 or later |
| 11 |
* Text Domain: jetpack-social |
| 12 |
* |
| 13 |
* @package automattic/jetpack-social |
| 14 |
*/ |
| 15 |
|
| 16 |
/* |
| 17 |
This program is free software; you can redistribute it and/or |
| 18 |
modify it under the terms of the GNU General Public License |
| 19 |
as published by the Free Software Foundation; either version 2 |
| 20 |
of the License, or (at your option) any later version. |
| 21 |
|
| 22 |
This program is distributed in the hope that it will be useful, |
| 23 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
GNU General Public License for more details. |
| 26 |
|
| 27 |
You should have received a copy of the GNU General Public License |
| 28 |
along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 29 |
*/ |
| 30 |
|
| 31 |
if ( ! defined( 'ABSPATH' ) ) { |
| 32 |
exit( 0 ); |
| 33 |
} |
| 34 |
|
| 35 |
define( 'JETPACK_SOCIAL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 36 |
define( 'JETPACK_SOCIAL_PLUGIN_ROOT_FILE', __FILE__ ); |
| 37 |
define( 'JETPACK_SOCIAL_PLUGIN_ROOT_FILE_RELATIVE_PATH', plugin_basename( __FILE__ ) ); |
| 38 |
define( 'JETPACK_SOCIAL_PLUGIN_SLUG', 'jetpack-social' ); |
| 39 |
define( 'JETPACK_SOCIAL_PLUGIN_NAME', 'Jetpack Social' ); |
| 40 |
define( 'JETPACK_SOCIAL_PLUGIN_URI', 'https://jetpack.com/jetpack-social' ); |
| 41 |
define( 'JETPACK_SOCIAL_PLUGIN_FOLDER', dirname( plugin_basename( __FILE__ ) ) ); |
| 42 |
|
| 43 |
// Jetpack Autoloader. |
| 44 |
$jetpack_autoloader = JETPACK_SOCIAL_PLUGIN_DIR . 'vendor/autoload_packages.php'; |
| 45 |
if ( is_readable( $jetpack_autoloader ) ) { |
| 46 |
require_once $jetpack_autoloader; |
| 47 |
if ( method_exists( \Automattic\Jetpack\Assets::class, 'alias_textdomains_from_file' ) ) { |
| 48 |
\Automattic\Jetpack\Assets::alias_textdomains_from_file( JETPACK_SOCIAL_PLUGIN_DIR . 'jetpack_vendor/i18n-map.php' ); |
| 49 |
} |
| 50 |
} else { // Something very unexpected. Error out gently with an admin_notice and exit loading. |
| 51 |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
| 52 |
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
| 53 |
__( 'Error loading autoloader file for Jetpack Social plugin', 'jetpack-social' ) |
| 54 |
); |
| 55 |
} |
| 56 |
|
| 57 |
// Add a red bubble notification to My Jetpack if the installation is bad. |
| 58 |
add_filter( |
| 59 |
'my_jetpack_red_bubble_notification_slugs', |
| 60 |
function ( $slugs ) { |
| 61 |
$slugs['jetpack-social-plugin-bad-installation'] = array( |
| 62 |
'data' => array( |
| 63 |
'plugin' => 'Jetpack Social', |
| 64 |
), |
| 65 |
); |
| 66 |
|
| 67 |
return $slugs; |
| 68 |
} |
| 69 |
); |
| 70 |
|
| 71 |
add_action( |
| 72 |
'admin_notices', |
| 73 |
function () { |
| 74 |
if ( get_current_screen()->id !== 'plugins' ) { |
| 75 |
return; |
| 76 |
} |
| 77 |
|
| 78 |
$message = sprintf( |
| 79 |
wp_kses( |
| 80 |
/* translators: Placeholder is a link to a support document. */ |
| 81 |
__( 'Your installation of Jetpack Social is incomplete. If you installed Jetpack Social from GitHub, please refer to <a href="%1$s" target="_blank" rel="noopener noreferrer">this document</a> to set up your development environment. Jetpack Social must have Composer dependencies installed and built via the build command.', 'jetpack-social' ), |
| 82 |
array( |
| 83 |
'a' => array( |
| 84 |
'href' => array(), |
| 85 |
'target' => array(), |
| 86 |
'rel' => array(), |
| 87 |
), |
| 88 |
) |
| 89 |
), |
| 90 |
'https://github.com/Automattic/jetpack/blob/trunk/docs/development-environment.md#building-your-project' |
| 91 |
); |
| 92 |
wp_admin_notice( |
| 93 |
$message, |
| 94 |
array( |
| 95 |
'type' => 'error', |
| 96 |
'dismissible' => true, |
| 97 |
) |
| 98 |
); |
| 99 |
} |
| 100 |
); |
| 101 |
|
| 102 |
return; |
| 103 |
} |
| 104 |
|
| 105 |
register_activation_hook( JETPACK_SOCIAL_PLUGIN_ROOT_FILE_RELATIVE_PATH, array( 'Jetpack_Social', 'plugin_activation' ) ); |
| 106 |
|
| 107 |
// Main plugin class. |
| 108 |
new Jetpack_Social(); |
| 109 |
|