| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP to Buffer WordPress Plugin. |
| 4 |
* |
| 5 |
* @package WP_To_Buffer |
| 6 |
* @author WP Zinc |
| 7 |
* |
| 8 |
* @wordpress-plugin |
| 9 |
* Plugin Name: WP to Buffer |
| 10 |
* Plugin URI: https://www.wpzinc.com/plugins/wordpress-to-buffer-pro |
| 11 |
* Version: 6.2.3 |
| 12 |
* Author: WP Zinc |
| 13 |
* Author URI: https://www.wpzinc.com |
| 14 |
* Description: Send WordPress Pages, Posts or Custom Post Types to your Buffer (buffer.com) account for scheduled publishing to social networks. |
| 15 |
* Text Domain: wp-to-buffer |
| 16 |
* License: GPLv3 or later |
| 17 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 18 |
*/ |
| 19 |
|
| 20 |
if ( ! defined( 'ABSPATH' ) ) { |
| 21 |
exit; // Exit if accessed directly. |
| 22 |
} |
| 23 |
|
| 24 |
// Bail if Plugin is alread loaded. |
| 25 |
if ( class_exists( 'WP_To_Buffer' ) ) { |
| 26 |
return; |
| 27 |
} |
| 28 |
|
| 29 |
// Define Plugin version and build date. |
| 30 |
define( 'WP_TO_BUFFER_PLUGIN_VERSION', '6.2.3' ); |
| 31 |
define( 'WP_TO_BUFFER_PLUGIN_BUILD_DATE', '2026-08-24 10:00:00' ); |
| 32 |
|
| 33 |
// Define Plugin paths. |
| 34 |
define( 'WP_TO_BUFFER_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 35 |
define( 'WP_TO_BUFFER_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 36 |
|
| 37 |
/** |
| 38 |
* Define the autoloader for this Plugin |
| 39 |
* |
| 40 |
* @since 3.4.7 |
| 41 |
* |
| 42 |
* @param string $class_name The class to load. |
| 43 |
*/ |
| 44 |
function wp_to_buffer_autoloader( $class_name ) { |
| 45 |
|
| 46 |
// Only handle this vendor's namespaced classes. |
| 47 |
if ( strpos( $class_name, 'WPZinc\\' ) !== 0 ) { |
| 48 |
return; |
| 49 |
} |
| 50 |
|
| 51 |
// Build the file name from the class' short name. |
| 52 |
// e.g. WPZinc\Social\Log_Table -> class-log-table.php. |
| 53 |
$class_parts = explode( '\\', $class_name ); |
| 54 |
$short_name = end( $class_parts ); |
| 55 |
$file_name = 'class-' . str_replace( '_', '-', strtolower( $short_name ) ) . '.php'; |
| 56 |
|
| 57 |
// Map the sub-namespace to the directories to search. |
| 58 |
$namespace_paths = array( |
| 59 |
'Social' => array( |
| 60 |
WP_TO_BUFFER_PLUGIN_PATH . 'lib/social/includes', |
| 61 |
WP_TO_BUFFER_PLUGIN_PATH . 'includes', |
| 62 |
), |
| 63 |
'Shared' => array( |
| 64 |
WP_TO_BUFFER_PLUGIN_PATH . 'lib/shared', |
| 65 |
), |
| 66 |
); |
| 67 |
|
| 68 |
$sub_namespace = isset( $class_parts[1] ) ? $class_parts[1] : ''; |
| 69 |
if ( ! isset( $namespace_paths[ $sub_namespace ] ) ) { |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
foreach ( $namespace_paths[ $sub_namespace ] as $path ) { |
| 74 |
if ( file_exists( $path . '/' . $file_name ) ) { |
| 75 |
require_once $path . '/' . $file_name; |
| 76 |
return; |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
} |
| 81 |
spl_autoload_register( 'wp_to_buffer_autoloader' ); |
| 82 |
|
| 83 |
// Load Activation, Cron and Deactivation functions. |
| 84 |
require_once WP_TO_BUFFER_PLUGIN_PATH . 'includes/activation.php'; |
| 85 |
require_once WP_TO_BUFFER_PLUGIN_PATH . 'includes/cron.php'; |
| 86 |
require_once WP_TO_BUFFER_PLUGIN_PATH . 'includes/functions.php'; |
| 87 |
require_once WP_TO_BUFFER_PLUGIN_PATH . 'includes/deactivation.php'; |
| 88 |
register_activation_hook( __FILE__, 'wp_to_buffer_activate' ); |
| 89 |
if ( version_compare( get_bloginfo( 'version' ), '5.1', '>=' ) ) { |
| 90 |
add_action( 'wp_insert_site', 'wp_to_buffer_activate_new_site' ); |
| 91 |
} else { |
| 92 |
add_action( 'wpmu_new_blog', 'wp_to_buffer_activate_new_site' ); |
| 93 |
} |
| 94 |
add_action( 'activate_blog', 'wp_to_buffer_activate_new_site' ); |
| 95 |
register_deactivation_hook( __FILE__, 'wp_to_buffer_deactivate' ); |
| 96 |
|
| 97 |
/** |
| 98 |
* Main function to return Plugin instance. |
| 99 |
* |
| 100 |
* @since 3.8.1 |
| 101 |
*/ |
| 102 |
function WP_To_Buffer() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName |
| 103 |
|
| 104 |
return WP_To_Buffer::get_instance(); |
| 105 |
|
| 106 |
} |
| 107 |
|
| 108 |
// Finally, initialize the Plugin. |
| 109 |
require_once WP_TO_BUFFER_PLUGIN_PATH . 'includes/class-wp-to-buffer.php'; |
| 110 |
$wp_to_buffer = WP_To_Buffer(); |
| 111 |
|