diff options
Diffstat (limited to 'plugins/jetpack/3rd-party')
-rw-r--r-- | plugins/jetpack/3rd-party/3rd-party.php | 10 | ||||
-rw-r--r-- | plugins/jetpack/3rd-party/bitly.php | 29 | ||||
-rw-r--r-- | plugins/jetpack/3rd-party/buddypress.php | 9 | ||||
-rw-r--r-- | plugins/jetpack/3rd-party/wpml.php | 35 |
4 files changed, 83 insertions, 0 deletions
diff --git a/plugins/jetpack/3rd-party/3rd-party.php b/plugins/jetpack/3rd-party/3rd-party.php new file mode 100644 index 00000000..2ff07816 --- /dev/null +++ b/plugins/jetpack/3rd-party/3rd-party.php @@ -0,0 +1,10 @@ +<?php + +/* + * Placeholder to load 3rd party plugin tweaks until a legit system + * is architected + */ + +require_once( 'buddypress.php' ); +require_once( 'wpml.php' ); +require_once( 'bitly.php' );
\ No newline at end of file diff --git a/plugins/jetpack/3rd-party/bitly.php b/plugins/jetpack/3rd-party/bitly.php new file mode 100644 index 00000000..b8f3f63c --- /dev/null +++ b/plugins/jetpack/3rd-party/bitly.php @@ -0,0 +1,29 @@ +<?php + +/* + * Fixes issues with the Official Bitly for WordPress + * http://wordpress.org/plugins/bitly/ + */ +if( class_exists( 'Bitly' ) ) { + + if( isset( $GLOBALS['bitly'] ) ) { + remove_action( 'wp_head', array( $GLOBALS['bitly'], 'og_tags' ) ); + add_action( 'wp_head', 'jetpack_bitly_og_tag', 100 ); + } + +} + +/** + * jetpack_bitly_og_tag + * + * @return null + */ +function jetpack_bitly_og_tag() { + if( has_filter( 'wp_head', 'jetpack_og_tags') === false ) { + // Add the bitly part again back if we don't have any jetpack_og_tags added + $GLOBALS['bitly']->og_tags(); + } elseif ( isset( $GLOBALS['posts'] ) && $GLOBALS['posts'][0]->ID > 0 ) { + printf( "<meta property=\"bitly:url\" content=\"%s\" /> \n", esc_attr( $GLOBALS['bitly']->get_bitly_link_for_post_id( $GLOBALS['posts'][0]->ID ) ) ); + } + +}
\ No newline at end of file diff --git a/plugins/jetpack/3rd-party/buddypress.php b/plugins/jetpack/3rd-party/buddypress.php new file mode 100644 index 00000000..9ae35f3c --- /dev/null +++ b/plugins/jetpack/3rd-party/buddypress.php @@ -0,0 +1,9 @@ +<?php + +add_filter( 'bp_core_pre_avatar_handle_upload', 'blobphoto' ); +function blobphoto( $bool ) { + + add_filter( 'jetpack_photon_skip_image', '__return_true' ); + + return $bool; +} diff --git a/plugins/jetpack/3rd-party/wpml.php b/plugins/jetpack/3rd-party/wpml.php new file mode 100644 index 00000000..41e7a35c --- /dev/null +++ b/plugins/jetpack/3rd-party/wpml.php @@ -0,0 +1,35 @@ +<?php + +// Only load these if WPML is active. +if ( defined( 'ICL_SITEPRESS_VERSION' ) ) : + +add_action( 'jetpack_widget_get_top_posts', 'wpml_jetpack_widget_get_top_posts', 10, 3 ); +function wpml_jetpack_widget_get_top_posts( $posts, $post_ids, $count ) { + global $sitepress; + + foreach ( $posts as $k => $post ) { + $lang_information = wpml_get_language_information( $post['post_id'] ); + $post_language = substr( $lang_information['locale'], 0, 2 ); + if ( $post_language !== $sitepress->get_current_language() ) { + unset( $posts[ $k ] ); + } + } + + return $posts; +} + +add_filter( 'grunion_contact_form_field_html', 'grunion_contact_form_field_html_filter', 10, 3 ); +function grunion_contact_form_field_html_filter( $r, $field_label, $id ){ + global $sitepress; + + if ( function_exists( 'icl_translate' ) ) { + if ( $sitepress->get_current_language() !== $sitepress->get_default_language() ) { + $label_translation = icl_translate( 'jetpack ', $field_label . '_label', $field_label ); + $r = str_replace( $field_label, $label_translation, $r ); + } + } + + return $r; +} + +endif; |