Plugin Directory

Changeset 2550347


Ignore:
Timestamp:
06/18/2021 10:54:43 AM (5 years ago)
Author:
resoc
Message:

Version 1.0.8

Location:
resoc/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • resoc/trunk/README.txt

    r2549572 r2550347  
    55Requires at least: 5.0
    66Tested up to: 5.7.2
    7 Stable tag: 1.0.7
     7Stable tag: 1.0.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8181== Changelog ==
    8282
     83= 1.0.8 =
     84* Improvements for the plugins list page
     85* Compatibility with Blog2Social
     86
    8387= 1.0.7 =
    8488* Compatibility with SEOPress
  • resoc/trunk/admin/class-resoc-admin.php

    r2548956 r2550347  
    5757
    5858    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;
    5976  }
    6077
  • resoc/trunk/includes/class-resoc-compatibility.php

    r2549572 r2550347  
    3333  public static function is_seopress_active() {
    3434    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;
    3548  }
    3649
  • resoc/trunk/public/class-resoc-public.php

    r2549572 r2550347  
    5656    add_filter( 'jetpack_enable_open_graph', '__return_false' );
    5757
     58    $image_patched = false;
     59
    5860    if ( Resoc_Compatibility::is_yoast_seo_active() ) {
    5961      add_filter(
     
    6163        array( $this, 'get_yoast_og_image' )
    6264      );
    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() ) {
    6570      add_filter(
    6671        'aioseo_facebook_tags',
     
    6873        10, 1
    6974      );
    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() ) {
    7290      add_filter(
    7391        'seopress_social_og_thumb',
     
    7593        10, 1
    7694      );
    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' ) );
    88112    }
    89113
     
    100124  }
    101125
     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
    102143  public function override_aiosp_image_meta( $facebookMeta ) {
    103144    $specific_image_id = get_post_meta(
     
    147188
    148189  public function add_opengraph_markups() {
     190    Resoc_Utils::log( "Inject OpenGraph markups" );
     191
    149192    $post_ID = get_the_ID();
    150193
  • resoc/trunk/resoc.php

    r2549572 r2550347  
    1414 *
    1515 * @wordpress-plugin
    16  * Plugin Name:       Resoc
     16 * Plugin Name:       Resoc Social Images
    1717 * 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.7
     18 * Description:       Improve the images used to illustrate your content when it is share on social networks and messaging services.
     19 * Version:           1.0.8
    2020 * Author:            Resoc
    2121 * Author URI:        https://resoc.io/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'RESOC_VERSION', '1.0.7' );
     38define( 'RESOC_VERSION', '1.0.8' );
    3939
    4040/**
     
    8181}
    8282run_resoc();
     83
     84function resoc_plugin_base_name() {
     85  return plugin_basename( __FILE__ );
     86};
Note: See TracChangeset for help on using the changeset viewer.