Skip to content

Commit

Permalink
v. 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xxsimoxx committed Jan 12, 2021
1 parent a12e23f commit d689efc
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 152 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ This plugin is for fixing and alerting some compatibility issues for ClassicPres

### Fix wp-cli
* Fix `wp core check-update`
* Bring in scope `$cp_version`

### Fix compatibility with plugins
* SEO by Rank Math (v. 1.0.30.2)
* Caldera Forms > 1.8.4

## Screenshots
![plugin page](images/screenshot-1.jpg)
Expand Down
16 changes: 1 addition & 15 deletions cpcompatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: CPcompatibility
* Plugin URI: https://software.gieffeedizioni.it
* Description: Tweaks for working with CP: wpcli compatibility, plugin checks.
* Version: 0.5.1
* Version: 0.6.0
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Author: Gieffe edizioni srl
Expand All @@ -23,20 +23,6 @@
*/
require_once 'inc/UpdateClient.class.php';

/**
*
* General functions to get plugin information frof wpapi.org
*
*/
require 'inc/plugin-info.php';

/**
*
* Functios to fix various plugins
*
*/
require 'inc/fix-plugins.php';

/**
*
* Here we fix wp-cli
Expand Down
1 change: 0 additions & 1 deletion css/fake.min.css

This file was deleted.

48 changes: 37 additions & 11 deletions inc/change-plugin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,50 @@
die('uh');
}

// Modify installed plugin list to add an alert to plugin info
// if there is an update that don't support WP4
// or if this plugin fixed it
function cp_plugin_info() {

// Check if we already have a transient for that
$plugin_info = get_transient('cpc_plugin_info');
if ($plugin_info !== false) {
return $plugin_info;
}

// Get an array of all installed plugins.
$all_plugins = get_plugins();
foreach ($all_plugins as $path => $value) {
$slugs[] = dirname($path);
}

// Run a query to get informations
include_once (ABSPATH.'wp-admin/includes/plugin-install.php');
$queryfor = ['slugs' => $slugs];
if (is_wp_error($plugin_info = plugins_api('plugin_information', $queryfor))) {
return false;
}

foreach ($plugin_info as $slug => $info) {
foreach ($info as $property_name => $property_value) {
if (!in_array($property_name, ['version', 'requires'])) {
unset($plugin_info->{$slug}[$property_name]);
}
}
}

set_transient('cpc_plugin_info', $plugin_info, 6 * HOUR_IN_SECONDS);
return $plugin_info;

}

add_filter('plugin_row_meta', 'cp_plugin_row_meta', 10, 2);
function cp_plugin_row_meta($links, $file) {
$fixed_plugins = cpcompatibility_fixed_plugin();
$slug = dirname($file);
if (in_array($slug, $fixed_plugins)) {
array_push($links, '<span class="dashicons-before dashicons-hammer"> '.__('Fixed by cpcompatibility', 'cpc').'</span>');
}
$plugin_info = CPplugin_info($slug);
if ($plugin_info === '') {
$plugin_info = cp_plugin_info();
if ($plugin_info === false) {
return $links;
}
if (version_compare($plugin_info[0], '5', '>=')) {
if (isset($plugin_info->{$slug}['version']) && version_compare($plugin_info->{$slug}['requires'], '5', '>=')) {
/* translators: %1$s: WP version required, %2$s: plugin version. */
array_push($links, '<span class="dashicons-before dashicons-warning">'.sprintf (__('Requires WordPress %1$s for version %2$s.<br>', 'cpc'), $plugin_info[0], $plugin_info[1]).'</span>');
array_push($links, '<span class="dashicons-before dashicons-warning">'.sprintf (__('Requires WordPress %1$s for version %2$s.<br>', 'cpc'), $plugin_info->{$slug}['requires'], $plugin_info->{$slug}['version']).'</span>');
}
return $links;
}
Expand Down
71 changes: 0 additions & 71 deletions inc/fix-plugins.php

This file was deleted.

41 changes: 0 additions & 41 deletions inc/plugin-info.php

This file was deleted.

14 changes: 6 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== cpcompatibility ===
Plugin Name: CPcompatibility
Description: Tweaks for working with CP: wpcli compatibility, plugin checks.
Version: 0.5.1
Version: 0.6.0
Text Domain: cpc
Domain Path: /languages
Requires PHP: 5.6
Expand All @@ -10,7 +10,7 @@ Tested: 4.9.99
Author: Gieffe edizioni
Author URI: https://www.gieffeedizioni.it
Plugin URI: https://software.gieffeedizioni.it
Download link: https://github.com/xxsimoxx/cpcompatibility/releases/download/v0.5.1/cpcompatibility-0.5.1.zip
Download link: https://github.com/xxsimoxx/cpcompatibility/releases/download/v0.6.0/cpcompatibility-0.6.0.zip
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -22,12 +22,6 @@ This plugin is for fixing and alerting some compatibility issues for ClassicPres

**Fix wp-cli**
* Fix `wp core check-update`
* Bring in scope `$cp_version`

**Fix compatibility with plugins**
* SEO by Rank Math (v. 1.0.30.2)
* Caldera Forms > 1.8.4


To help us know the number of active installations of this plugin, we collect and store anonymized data when the plugin check in for updates. The date and unique plugin identifier are stored as plain text and the requesting URL is stored as a non-reversible hashed value. This data is stored for up to 28 days.

Expand All @@ -37,6 +31,10 @@ To help us know the number of active installations of this plugin, we collect an
2. Most popular plugins and their compatibility

== Changelog ==
= 0.6.0 =
* Removed compatibility hacks for plugins deprecated in v. 0.4.0.
* Recoded change_menu_page.php

= 0.5.1 =
* Don't link plugin without link.

Expand Down

0 comments on commit d689efc

Please sign in to comment.