Skip to content

Commit

Permalink
Merge pull request #3 from xxsimoxx/develop
Browse files Browse the repository at this point in the history
Merge develop
  • Loading branch information
xxsimoxx authored Nov 21, 2019
2 parents 2b7f458 + 159de66 commit 0a8c841
Show file tree
Hide file tree
Showing 8 changed files with 2,565 additions and 76 deletions.
34 changes: 2 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,6 @@ This plugin is for fixing some compatibility issues for ClassicPress.
* Mark plugins not compatible with WP version 4.9 in plugins admin page
* Add a menu under "tools" that displays top 200 plugins from wp.org and their compatibility

### Updating
This plugin supports [GitHub Updater](https://github.com/afragen/github-updater).
This allows to upgrade to the latest code.
If not installed, you will be noticed about new releases on the plugin page,
and you'll need to install the new version manually.

### Screenshots
![plugin page](img/plugin-page.jpg)
![pupolar page](img/popular-page.jpg)

## Changelog
* 2019/10/13 v0.0.12
* bugfix: PHP 7.4 compatibility
* 2019/10/02 v0.0.11
* bugfix: wp core check-update returned an extra line
* adds Caldera Forms > 1.8.4 (missing wp-components style)
* 2019/09/25 v0.0.10
* added `wp plugin latestgit` to install from GitHub
* function `cpcompatibility_fixed_plugin()` return an array of slugs of fixed plugins
* wp core check-update now supports --fields and --format options
* support for GitHub Updater (https://github.com/afragen/github-updater)
* self-checking for new releases
* 2019/09/05 v0.0.9
* split file/directory structure
* better CSS
* i18n
* 2019/09/02 v0.0.8
* bugfix
* 2019/08/29 v0.0.7
* wp core check-update response is closer at the original behaviour
* 2019/07/29 v0.0.6
* Fixed SEO by Rank Math (v. 1.0.30.2)
* moved to "Tools" menu
![plugin page](images/screenshot-1.jpg)
![pupolar page](images/screenshot-2.jpg)
55 changes: 11 additions & 44 deletions cpcompatibility.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
<?php
/*
/**
* Plugin Name: CPcompatibility
* Plugin URI: https://github.com/xxsimoxx/cpcompatibility
* Plugin URI: https://software.gieffeedizioni.it
* Description: Tweaks for working with CP: wpcli compatibility, plugin checks.
* Version: 0.0.12
* Version: 0.1.0
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Author: Gieffe edizioni srl
* Author URI: https://www.gieffeedizioni.it/classicpress
* Text Domain: cpc
* GitHub Plugin URI: xxsimoxx/cpcompatibility
*/

if (!defined('ABSPATH')) die('uh');

/**
*
* Add auto updater
* https://codepotent.com/classicpress/plugins/update-manager/
*
*/
require_once( 'inc/UpdateClient.class.php' );

/**
*
* General functions to get plugin information frof wpapi.org
Expand Down Expand Up @@ -56,44 +63,4 @@ function cpc_load_textdomain() {
load_plugin_textdomain( 'cpc', false, basename( dirname( __FILE__ ) ) . '/languages' );
}

// check for updates
function cpc_update_link(){
if ( is_plugin_active("github-updater/github-updater.php") ){
return false;
// let's github-updater handle this for us!
};
$slug = dirname( plugin_basename( __FILE__ ) );
$plugin_info = get_plugin_data(__FILE__);
$plugin_installed_version = $plugin_info['Version'];
$git_repo = "xxsimoxx/" . $slug;
if ( false === ( $plugin_current_version = get_transient( $slug . 'lastversion' ) ) ) {
$response = wp_remote_get( 'https://api.github.com/repos/' . $git_repo . '/releases/latest' , array( 'redirection' => 5 ) );
if ( 200 === $response['response']['code'] ){
$git_data = json_decode ( $response['body'], true );
$plugin_current_version = ltrim ( $git_data['tag_name'], 'v');
} else
{
$plugin_current_version = null;
};
if ( ! is_null( $plugin_current_version ) ) {
set_transient( $slug . 'lastversion', $plugin_current_version, DAY_IN_SECONDS );
};
};
if ( version_compare( $plugin_current_version, $plugin_installed_version , '>' ) ){
/*Translators: %s is the new version available */
$messagestring = sprintf( __( "NEW v%s", "cpc" ), $plugin_current_version );
return '<a target="_blank" href="https://www.github.com/' . $git_repo . '/releases/latest">' . $messagestring . '</a>';
} else {
return false;
}
};

add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'cpc_update' );
function cpc_update( $links ) {
$update_link = cpc_update_link();
if ( $update_link ){
array_push( $links, $update_link );
};
return $links;
}
?>
1,869 changes: 1,869 additions & 0 deletions images/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions images/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Loading

0 comments on commit 0a8c841

Please sign in to comment.