Skip to content

Commit

Permalink
add version collision detection for TypeRocket core
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindees committed Nov 16, 2022
1 parent c009fd7 commit fd2af4f
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions typerocket-v5.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,51 @@ final class TypeRocketPlugin

public function __construct()
{
add_action('plugins_loaded', function() {
if(defined('TYPEROCKET_PLUGIN_INSTALL') || defined('TYPEROCKET_PATH')) {
add_filter('plugin_action_links',function ($actions, $plugin_file) {
if( $found = strpos(__FILE__, $plugin_file) ) {
$actions['settings'] = '<span style="color: red">Inactive Install</span>';
}
add_action('plugins_loaded', [$this, 'plugins_loaded'], 15);
register_activation_hook( __FILE__, [$this, 'activation']);
}

return $actions;
}, 10, 2 );
public function plugins_loaded()
{
if(defined('TYPEROCKET_PLUGIN_INSTALL') || defined('TYPEROCKET_PATH')) {
add_filter('plugin_action_links', function($actions, $plugin_file) {
if( strpos(__FILE__, $plugin_file) ) {
$actions['settings'] = '<span style="color: red">Inactive Install</span>';
}

return;
}
return $actions;
}, 10, 2 );

define('TYPEROCKET_PLUGIN_VERSION', '5.1.16');
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
return;
}

if(!defined('TYPEROCKET_ROOT_WP'))
define('TYPEROCKET_ROOT_WP', ABSPATH);
define('TYPEROCKET_PLUGIN_VERSION', '5.1.16');
define('TYPEROCKET_PLUGIN_INSTALL', __DIR__);
define('TYPEROCKET_PLUGIN_PRO', false);

$this->loadConfig();
require 'typerocket/init.php';
if(!defined('TYPEROCKET_ROOT_WP')) {
define('TYPEROCKET_ROOT_WP', ABSPATH);
}

if(typerocket_env('TYPEROCKET_UPDATES', true)) {
add_filter('http_request_host_is_external', function($value, $host) {
return $value || $host == 'typerocket.com';
}, 10, 2);
$this->loadConfig();
require 'typerocket/init.php';

new \TypeRocketPlugin\Updater([
'slug' => 'typerocket-v5',
'api_url' => 'https://typerocket.com/plugins/typerocket-v5/'
]);
}
if(typerocket_env('TYPEROCKET_UPDATES', true)) {
add_filter('http_request_host_is_external', function($value, $host) {
return $value || $host == 'typerocket.com';
}, 10, 2);

$this->path = plugin_dir_path(__FILE__);
define('TYPEROCKET_AUTO_LOADER', '__return_false');
add_action('admin_notices', [$this, 'activation_notice']);
add_action('typerocket_loaded', [$this, 'typerocket_loaded']);
add_filter('plugin_action_links', [$this, 'links'], 10, 2 );
}, 15);
new \TypeRocketPlugin\Updater([
'slug' => 'typerocket-v5',
'api_url' => 'https://typerocket.com/plugins/typerocket-v5/'
]);
}

register_activation_hook( __FILE__, [$this, 'activation']);
$this->path = plugin_dir_path(__FILE__);
define('TYPEROCKET_AUTO_LOADER', '__return_false');
add_action('admin_notices', [$this, 'activation_notice']);
add_action('typerocket_loaded', [$this, 'typerocket_loaded']);
add_filter('plugin_action_links', [$this, 'links'], 10, 2 );
}

public function links($actions, $plugin_file)
Expand Down

0 comments on commit fd2af4f

Please sign in to comment.