PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.2.4
Jetpack – WP Security, Backup, Speed, & Growth v7.2.4
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / publicize.php
publicize.php
81 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Module Name: Publicize
4 * Module Description: Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.
5 * Sort Order: 10
6 * Recommendation Order: 7
7 * First Introduced: 2.0
8 * Requires Connection: Yes
9 * Auto Activate: Yes
10 * Module Tags: Social, Recommended
11 * Feature: Engagement
12 * Additional Search Queries: facebook, jetpack publicize, twitter, tumblr, linkedin, social, tweet, connections, sharing, social media, automated, automated sharing, auto publish, auto tweet and like, auto tweet, facebook auto post, facebook posting
13 */
14
15 class Jetpack_Publicize {
16
17 public $in_jetpack = true;
18
19 function __construct() {
20 global $publicize_ui;
21
22 $this->in_jetpack = ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'enable_module_configurable' ) ) ? true : false;
23
24 if ( $this->in_jetpack && method_exists( 'Jetpack', 'module_configuration_load' ) ) {
25 Jetpack::enable_module_configurable( __FILE__ );
26 Jetpack::module_configuration_load( __FILE__, array( $this, 'jetpack_configuration_load' ) );
27 }
28
29 require_once dirname( __FILE__ ) . '/publicize/publicize.php';
30
31 if ( $this->in_jetpack )
32 require_once dirname( __FILE__ ) . '/publicize/publicize-jetpack.php';
33 else {
34 require_once dirname( dirname( __FILE__ ) ) . '/mu-plugins/keyring/keyring.php';
35 require_once dirname( __FILE__ ) . '/publicize/publicize-wpcom.php';
36 }
37
38 require_once dirname( __FILE__ ) . '/publicize/ui.php';
39 $publicize_ui = new Publicize_UI();
40 $publicize_ui->in_jetpack = $this->in_jetpack;
41
42 // Jetpack specific checks / hooks
43 if ( $this->in_jetpack ) {
44 // if sharedaddy isn't active, the sharing menu hasn't been added yet
45 $active = Jetpack::get_active_modules();
46 if ( in_array( 'publicize', $active ) && ! in_array( 'sharedaddy', $active ) ) {
47 add_action( 'admin_menu', array( &$publicize_ui, 'sharing_menu' ) );
48 }
49 }
50 }
51
52 function jetpack_configuration_load() {
53 wp_safe_redirect( menu_page_url( 'sharing', false ) );
54 exit;
55 }
56 }
57
58 global $publicize_ui;
59 new Jetpack_Publicize;
60
61 if( ! ( defined( 'IS_WPCOM' ) && IS_WPCOM ) && ! function_exists( 'publicize_init' ) ) {
62 /**
63 * Helper for grabbing a Publicize object from the "front-end" (non-admin) of
64 * a site. Normally Publicize is only loaded in wp-admin, so there's a little
65 * set up that you might need to do if you want to use it on the front end.
66 * Just call this function and it returns a Publicize object.
67 *
68 * @return Publicize Object
69 */
70 function publicize_init() {
71 global $publicize;
72
73 if ( ! class_exists( 'Publicize' ) ) {
74 require_once dirname( __FILE__ ) . '/publicize/publicize.php';
75 }
76
77 return $publicize;
78 }
79
80 }
81