Changeset 2550347
- Timestamp:
- 06/18/2021 10:54:43 AM (5 years ago)
- Location:
- resoc/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
admin/class-resoc-admin.php (modified) (1 diff)
-
includes/class-resoc-compatibility.php (modified) (1 diff)
-
public/class-resoc-public.php (modified) (6 diffs)
-
resoc.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
resoc/trunk/README.txt
r2549572 r2550347 5 5 Requires at least: 5.0 6 6 Tested up to: 5.7.2 7 Stable tag: 1.0. 77 Stable tag: 1.0.8 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 81 81 == Changelog == 82 82 83 = 1.0.8 = 84 * Improvements for the plugins list page 85 * Compatibility with Blog2Social 86 83 87 = 1.0.7 = 84 88 * Compatibility with SEOPress -
resoc/trunk/admin/class-resoc-admin.php
r2548956 r2550347 57 57 58 58 add_action( 'admin_notices', array( $this, 'finish_setup_notice' )); 59 60 add_filter('plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2); 61 } 62 63 public function plugin_action_links( $links, $file ) { 64 static $this_plugin; 65 66 if ( ! $this_plugin ) { 67 $this_plugin = resoc_plugin_base_name(); 68 } 69 70 if ( $file == 'resoc/resoc.php' ) { 71 $settings_link = '<a href="' . admin_url( '/themes.php?page=resoc_social_images_appearance_menu' ) . '">' . 'Settings' . '</a>'; 72 array_unshift( $links, $settings_link ); 73 } 74 75 return $links; 59 76 } 60 77 -
resoc/trunk/includes/class-resoc-compatibility.php
r2549572 r2550347 33 33 public static function is_seopress_active() { 34 34 return is_plugin_active( 'wp-seopress/seopress.php' ); 35 } 36 37 public static function is_blog2social_active() { 38 return is_plugin_active( 'blog2social/blog2social.php' ); 39 } 40 41 public static function is_blog2social_og_tags_enabled() { 42 $blog2social_options = get_option( 'B2S_PLUGIN_GENERAL_OPTIONS' ); 43 if ( $blog2social_options && !$blog2social_options[ 'og_active' ] ) { 44 return false; 45 } 46 47 return true; 35 48 } 36 49 -
resoc/trunk/public/class-resoc-public.php
r2549572 r2550347 56 56 add_filter( 'jetpack_enable_open_graph', '__return_false' ); 57 57 58 $image_patched = false; 59 58 60 if ( Resoc_Compatibility::is_yoast_seo_active() ) { 59 61 add_filter( … … 61 63 array( $this, 'get_yoast_og_image' ) 62 64 ); 63 } 64 else if ( Resoc_Compatibility::is_aiosp_active() ) { 65 Resoc_Utils::log( "Yoast is active, override its OpenGraph image" ); 66 $image_patched = true; 67 } 68 69 if ( Resoc_Compatibility::is_aiosp_active() ) { 65 70 add_filter( 66 71 'aioseo_facebook_tags', … … 68 73 10, 1 69 74 ); 70 } 71 else if ( Resoc_Compatibility::is_seopress_active() ) { 75 Resoc_Utils::log( "All in One SEO is active, override its OpenGraph image" ); 76 $image_patched = true; 77 } 78 79 if ( Resoc_Compatibility::is_blog2social_active() && Resoc_Compatibility::is_blog2social_og_tags_enabled() ) { 80 add_filter( 81 'b2s_og_meta_image', 82 array( $this, 'override_blog2social_image' ), 83 10, 1 84 ); 85 Resoc_Utils::log( "Blog2Social is active, override its OpenGraph image" ); 86 $image_patched = true; 87 } 88 89 if ( Resoc_Compatibility::is_seopress_active() ) { 72 90 add_filter( 73 91 'seopress_social_og_thumb', … … 75 93 10, 1 76 94 ); 77 } 78 else { 79 $conflicting_plugin = Resoc_Compatibility::conflicting_plugin(); 80 81 if ( $conflicting_plugin ) { 82 Resoc_Utils::log( "Conflict with " . $conflicting_plugin . ", do nothing" ); 83 return; 84 } 85 86 add_action( 'wp_head', array( $this, 'add_opengraph_markups' ) ); 87 } 95 Resoc_Utils::log( "SEOPress is active, override its OpenGraph image" ); 96 $image_patched = true; 97 } 98 99 if ( $image_patched ) { 100 Resoc_Utils::log( "OpenGraph image of another plugin has been overriden, nothing to do" ); 101 return; 102 } 103 104 $conflicting_plugin = Resoc_Compatibility::conflicting_plugin(); 105 106 if ( $conflicting_plugin ) { 107 Resoc_Utils::log( "Conflict with " . $conflicting_plugin . ", do nothing" ); 108 return; 109 } 110 111 add_action( 'wp_head', array( $this, 'add_opengraph_markups' ) ); 88 112 } 89 113 … … 100 124 } 101 125 126 public function override_blog2social_image( $blog2social_image ) { 127 $specific_image_id = get_post_meta( 128 get_the_ID(), 129 Resoc::POST_META_OG_IMAGE_ID, 130 true 131 ); 132 if ( $specific_image_id ) { 133 $image_data = wp_get_attachment_metadata( $specific_image_id ); 134 135 if ( is_array( $image_data ) ) { 136 return wp_get_attachment_image_url( $specific_image_id, 'full' ); 137 } 138 } 139 140 return $blog2social_image; 141 } 142 102 143 public function override_aiosp_image_meta( $facebookMeta ) { 103 144 $specific_image_id = get_post_meta( … … 147 188 148 189 public function add_opengraph_markups() { 190 Resoc_Utils::log( "Inject OpenGraph markups" ); 191 149 192 $post_ID = get_the_ID(); 150 193 -
resoc/trunk/resoc.php
r2549572 r2550347 14 14 * 15 15 * @wordpress-plugin 16 * Plugin Name: Resoc 16 * Plugin Name: Resoc Social Images 17 17 * Plugin URI: https://resoc.io/resoc-uri/ 18 * Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.19 * Version: 1.0. 718 * Description: Improve the images used to illustrate your content when it is share on social networks and messaging services. 19 * Version: 1.0.8 20 20 * Author: Resoc 21 21 * Author URI: https://resoc.io/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'RESOC_VERSION', '1.0. 7' );38 define( 'RESOC_VERSION', '1.0.8' ); 39 39 40 40 /** … … 81 81 } 82 82 run_resoc(); 83 84 function resoc_plugin_base_name() { 85 return plugin_basename( __FILE__ ); 86 };
Note: See TracChangeset
for help on using the changeset viewer.