| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * WP to Buffer class. |
| 4 | 4 | * |
| 5 | - * @package WP_To_Buffer_Pro | |
| 5 | + * @package WP_To_Buffer | |
| 6 | 6 | * @author WP Zinc |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | /** |
| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | * Holds the class object. |
| 20 | 20 | * |
| 21 | 21 | * @since 3.1.4 |
| 22 | 22 | * |
| 23 | - * @var object | |
| 23 | + * @var object|null | |
| 24 | 24 | */ |
| 25 | 25 | public static $instance; |
| 26 | 26 | |
| 27 | 27 | /** |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | * @since 3.0.0 |
| 31 | 31 | * |
| 32 | 32 | * @var object |
| 33 | 33 | */ |
| 34 | - public $plugin = ''; | |
| 34 | + public $plugin; | |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Dashboard |
| 38 | 38 | * |
| @@ -39,9 +39,9 @@ | ||
| 39 | 39 | * @since 3.1.4 |
| 40 | 40 | * |
| 41 | 41 | * @var object |
| 42 | 42 | */ |
| 43 | - public $dashboard = ''; | |
| 43 | + public $dashboard; | |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Classes |
| 47 | 47 | * |
| @@ -46,11 +46,11 @@ | ||
| 46 | 46 | * Classes |
| 47 | 47 | * |
| 48 | 48 | * @since 3.4.9 |
| 49 | 49 | * |
| 50 | - * @var array | |
| 50 | + * @var object | |
| 51 | 51 | */ |
| 52 | - public $classes = ''; | |
| 52 | + public $classes; | |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Constructor. Acts as a bootstrap to load the rest of the plugin |
| 56 | 56 | * |
| @@ -74,9 +74,9 @@ | ||
| 74 | 74 | $this->plugin->support_url = 'https://www.wpzinc.com/support'; |
| 75 | 75 | $this->plugin->upgrade_url = 'https://www.wpzinc.com/plugins/wordpress-to-buffer-pro'; |
| 76 | 76 | |
| 77 | 77 | // Logo. |
| 78 | - $this->plugin->logo = WP_TO_BUFFER_PLUGIN_URL . 'lib/assets/images/icons/buffer-dark.svg'; | |
| 78 | + $this->plugin->logo = WP_TO_BUFFER_PLUGIN_URL . 'lib/social/assets/images/icons/buffer-dark.svg'; | |
| 79 | 79 | $this->plugin->header_background_color = '#ffffff'; |
| 80 | 80 | $this->plugin->header_primary_text_color = '#3d3d3d'; |
| 81 | 81 | $this->plugin->header_secondary_text_color = '#6e6e6e'; |
| 82 | 82 | |
| @@ -91,9 +91,9 @@ | ||
| 91 | 91 | // ConvertKit Form UID. |
| 92 | 92 | $this->plugin->convertkit_form_uid = '71346c6086'; |
| 93 | 93 | |
| 94 | 94 | // Default Settings. |
| 95 | - $this->plugin->default_schedule = 'queue_end'; | |
| 95 | + $this->plugin->default_schedule = 'immediate'; | |
| 96 | 96 | |
| 97 | 97 | // Defer loading of Plugin Classes. |
| 98 | 98 | add_action( 'init', array( $this, 'initialize' ), 1 ); |
| 99 | 99 | add_action( 'init', array( $this, 'upgrade' ), 2 ); |
| @@ -100,11 +100,31 @@ | ||
| 100 | 100 | |
| 101 | 101 | // Admin Menus. |
| 102 | 102 | add_action( $this->plugin->filter_name . '_admin_admin_menu', array( $this, 'admin_menus' ) ); |
| 103 | 103 | |
| 104 | + // Add queue_end Schedule Option. | |
| 105 | + add_filter( $this->plugin->filter_name . '_get_schedule_options', array( $this, 'get_schedule_options' ) ); | |
| 106 | + | |
| 104 | 107 | } |
| 105 | 108 | |
| 106 | 109 | /** |
| 110 | + * Defines the schedule options available for statuses in WP to Buffer (Free). | |
| 111 | + * | |
| 112 | + * @since 6.2.0 | |
| 113 | + * | |
| 114 | + * @param array $schedule Schedule Options. | |
| 115 | + * @return array Schedule Options | |
| 116 | + */ | |
| 117 | + public function get_schedule_options( $schedule ) { | |
| 118 | + | |
| 119 | + // Buffer supports a queue, in addition to the always-available immediate option. | |
| 120 | + $schedule['queue_end'] = __( 'Add to End of Queue', 'wp-to-buffer' ); | |
| 121 | + | |
| 122 | + return $schedule; | |
| 123 | + | |
| 124 | + } | |
| 125 | + | |
| 126 | + /** | |
| 107 | 127 | * Register menus and submenus. |
| 108 | 128 | * |
| 109 | 129 | * @since 3.9.7 |
| 110 | 130 | * |
| @@ -112,9 +132,9 @@ | ||
| 112 | 132 | */ |
| 113 | 133 | public function admin_menus( $minimum_capability ) { |
| 114 | 134 | |
| 115 | 135 | // Menus. |
| 116 | - add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); | |
| 136 | + add_menu_page( $this->plugin->displayName, $this->plugin->displayName, $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ), $this->plugin->url . 'lib/social/assets/images/icons/' . strtolower( $this->plugin->account ) . '-light.svg' ); | |
| 117 | 137 | |
| 118 | 138 | // Register Submenu Pages. |
| 119 | 139 | $settings_page = add_submenu_page( $this->plugin->name . '-settings', __( 'Settings', 'wp-to-buffer' ), __( 'Settings', 'wp-to-buffer' ), $minimum_capability, $this->plugin->name . '-settings', array( $this->get_class( 'admin' ), 'settings_screen' ) ); |
| 120 | 140 | |
| @@ -136,11 +156,12 @@ | ||
| 136 | 156 | public function initialize() { |
| 137 | 157 | |
| 138 | 158 | // Define translation strings. |
| 139 | 159 | $this->plugin->review_notice = sprintf( |
| 140 | - /* translators: Plugin Name */ | |
| 141 | - __( 'Thanks for using %s to schedule your social media statuses on Buffer!', 'wp-to-buffer' ), | |
| 142 | - $this->plugin->displayName | |
| 160 | + /* translators: 1: Plugin Name, 2: Social Network */ | |
| 161 | + __( 'Thanks for using %1$s to schedule your social media statuses on %2$s!', 'wp-to-buffer' ), | |
| 162 | + $this->plugin->displayName, | |
| 163 | + $this->plugin->account | |
| 143 | 164 | ); |
| 144 | 165 | |
| 145 | 166 | // Upgrade Reasons. |
| 146 | 167 | $this->plugin->upgrade_reasons = array( |
| @@ -213,35 +234,31 @@ | ||
| 213 | 234 | __( 'Optionally enable WP-Cron to send status updates via Cron, speeding up UI performance and/or choose to use WP-CLI for reposting old posts', 'wp-to-buffer' ), |
| 214 | 235 | ), |
| 215 | 236 | ); |
| 216 | 237 | |
| 217 | - // Dashboard Submodule. | |
| 218 | - if ( ! class_exists( 'WPZincDashboardWidget' ) ) { | |
| 219 | - require_once $this->plugin->folder . '_modules/dashboard/class-wpzincdashboardwidget.php'; | |
| 220 | - } | |
| 221 | - $this->dashboard = new WPZincDashboardWidget( $this->plugin, 'https://www.wpzinc.com/wp-content/plugins/lum-deactivation' ); | |
| 238 | + // Shared admin module (autoloaded from lib/shared). | |
| 239 | + $this->dashboard = new \WPZinc\Shared\Admin_UI( $this->plugin ); | |
| 222 | 240 | |
| 223 | 241 | // Initialize Plugin classes. |
| 224 | 242 | $this->classes = new stdClass(); |
| 225 | 243 | |
| 226 | 244 | // Initialize required classes. |
| 227 | - $this->classes->admin = new WP_To_Social_Pro_Admin( self::$instance ); | |
| 228 | - $this->classes->ajax = new WP_To_Social_Pro_AJAX( self::$instance ); | |
| 229 | - $this->classes->api = new WP_To_Social_Pro_Buffer_API( self::$instance ); | |
| 230 | - $this->classes->common = new WP_To_Social_Pro_Common( self::$instance ); | |
| 231 | - $this->classes->cron = new WP_To_Social_Pro_Cron( self::$instance ); | |
| 232 | - $this->classes->date = new WP_To_Social_Pro_Date( self::$instance ); | |
| 233 | - $this->classes->image = new WP_To_Social_Pro_Image( self::$instance ); | |
| 234 | - $this->classes->install = new WP_To_Social_Pro_Install( self::$instance ); | |
| 235 | - $this->classes->log = new WP_To_Social_Pro_Log( self::$instance ); | |
| 236 | - $this->classes->media_library = new WP_To_Social_Pro_Media_Library( self::$instance ); | |
| 237 | - $this->classes->notices = new WP_To_Social_Pro_Notices( self::$instance ); | |
| 238 | - $this->classes->post = new WP_To_Social_Pro_Post( self::$instance ); | |
| 239 | - $this->classes->publish = new WP_To_Social_Pro_Publish( self::$instance ); | |
| 240 | - $this->classes->screen = new WP_To_Social_Pro_Screen( self::$instance ); | |
| 241 | - $this->classes->settings = new WP_To_Social_Pro_Settings( self::$instance ); | |
| 242 | - $this->classes->twitter_api = new WP_To_Social_Pro_Twitter_API( self::$instance ); | |
| 243 | - $this->classes->validation = new WP_To_Social_Pro_Validation( self::$instance ); | |
| 245 | + $this->classes->admin = new \WPZinc\Social\Admin( self::$instance ); | |
| 246 | + $this->classes->ajax = new \WPZinc\Social\Ajax( self::$instance ); | |
| 247 | + $this->classes->api = new \WPZinc\Social\Buffer_API( self::$instance ); | |
| 248 | + $this->classes->common = new \WPZinc\Social\Common( self::$instance ); | |
| 249 | + $this->classes->cron = new \WPZinc\Social\Cron( self::$instance ); | |
| 250 | + $this->classes->date = new \WPZinc\Social\Date( self::$instance ); | |
| 251 | + $this->classes->image = new \WPZinc\Social\Image( self::$instance ); | |
| 252 | + $this->classes->install = new \WPZinc\Social\Install( self::$instance ); | |
| 253 | + $this->classes->log = new \WPZinc\Social\Log( self::$instance ); | |
| 254 | + $this->classes->media_library = new \WPZinc\Social\Media_Library( self::$instance ); | |
| 255 | + $this->classes->notices = new \WPZinc\Social\Notices( self::$instance ); | |
| 256 | + $this->classes->post = new \WPZinc\Social\Post( self::$instance ); | |
| 257 | + $this->classes->publish = new \WPZinc\Social\Publish( self::$instance ); | |
| 258 | + $this->classes->screen = new \WPZinc\Social\Screen( self::$instance ); | |
| 259 | + $this->classes->settings = new \WPZinc\Social\Settings( self::$instance ); | |
| 260 | + $this->classes->validation = new \WPZinc\Social\Validation( self::$instance ); | |
| 244 | 261 | |
| 245 | 262 | } |
| 246 | 263 | |
| 247 | 264 | /** |
| @@ -333,9 +350,9 @@ | ||
| 333 | 350 | * @return object Class. |
| 334 | 351 | */ |
| 335 | 352 | public static function get_instance() { |
| 336 | 353 | |
| 337 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { | |
| 354 | + if ( ! self::$instance instanceof self ) { | |
| 338 | 355 | self::$instance = new self(); |
| 339 | 356 | } |
| 340 | 357 | |
| 341 | 358 | return self::$instance; |