Skip to content

Commit

Permalink
Merge branch 'release/2.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
asaquzzaman committed Jul 27, 2018
2 parents 90faa62 + afec854 commit 90a6f0f
Show file tree
Hide file tree
Showing 10 changed files with 997 additions and 2,110 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ package-lock.json
/tmp
/build/


4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ module.exports = function(grunt) {
main: {
options: {
mode: 'zip',
archive: './build/pm-v' + pkg.version + '.zip'
archive: './build/wedevs-project-manager-v' + pkg.version + '.zip'
},
expand: true,
cwd: 'build/',
src: ['**/*'],
dest: 'pm'
dest: 'wedevs-project-manager'
}
},

Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
= v2.0.4 - July 27, 2018 =

* **Fix** Download link for wedevs project manager php-5.6.

= v2.0.3 - July 27, 2018 =

* **New** List drag, drop and reorder.
Expand Down
Binary file removed composer.phar
Binary file not shown.
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
'name' => 'Project Manager',
'slug' => 'pm',
'version' => '2.0.3',
'version' => '2.0.4',
'api' => '2',
'db_version' => '2.0',
'text_domain' => 'pm'
Expand Down
146 changes: 1 addition & 145 deletions cpm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: WordPress Project Management plugin. Manage your projects and tasks, get things done.
* Author: weDevs
* Author URI: https://wedevs.com
* Version: 2.0.3
* Version: 2.0.4
* Text Domain: wedevs-project-manager
* Domain Path: /languages
* License: GPL2
Expand All @@ -26,157 +26,13 @@
}

if ( version_compare( phpversion(), '5.6.0', '>=' ) ) {
// is_plugin_active( 'erp/wp-erp.php' ) ||
if ( class_exists('WeDevs_ERP') ) {
add_action( 'admin_notices', 'pm_erp_compatibility_notices' );
add_action( 'wp_ajax_pm_install_wp_project_manager', 'pm_install_project_manager' );
return;
}
}

/**
* php version notices
* @return void
*/
function pm_php_version_notice() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$option = get_option('pm_hide_php_notice');
if ( $option['hide'] == '1' ) {
return ;
}
?>
<div class="error notice is-dismissible" id="pm-php-notice" style="padding: 1em; position: relative;">
<h2><?php _e( 'WP Project Manager moving PHP 5.6!', 'wedevs-project-manager' ); ?></h2>
<p><?php _e( 'WP Project Manager moving PHP 5.6 very soon. Please upgrader your php version.', 'wedevs-project-manager' ); ?></p>
</div>
<script type="text/javascript">
(function ($) {
var wrapper = $('#pm-php-notice');

wrapper.on('click', 'button.notice-dismiss', function (e) {
var self = $(this);

e.preventDefault();

var data = {
action: 'pm_hide_php_notice',
_wpnonce: '<?php echo wp_create_nonce('pm-php-nonce'); ?>'
};

$.post(ajaxurl, data);
});
})(jQuery);
</script>
<?php
}

function pm_hide_php_notice () {
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'pm-php-nonce' ) ) {
wp_send_json_error( __( 'Error: Nonce verification failed', 'wedevs-project-manager') );
}

update_option('pm_hide_php_notice', [ 'hide' => 1, 'date'=> format_date(current_time('mysql'))]);
wp_send_json_success();
}

/**
* Show message if plugin not capable with WPERP
*
* @since 2.0.2
*/
function pm_erp_compatibility_notices() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
?>
<div class="updated" id="pm-installer-notice" style="padding: 1em; position: relative;">
<h2><?php _e( 'Your installed version of Project Manager is not compatible with WP ERP', 'wedevs-project-manager' ); ?></h2>
<p><?php _e( 'Please Install the compatible version', 'wedevs-project-manager' ); ?></p>

<p>
<button id="pm-installer" class="button"><?php _e( 'Install', 'wedevs-project-manager' ); ?></button>
</p>

</div>

<script type="text/javascript">
(function ($) {
var wrapper = $('#pm-installer-notice');

wrapper.on('click', '#pm-installer', function (e) {
var self = $(this);

e.preventDefault();
self.addClass('install-now updating-message');
self.text('<?php echo esc_js( 'Installing...', 'wedevs-project-manager' ); ?>');

var data = {
action: 'pm_install_wp_project_manager',
_wpnonce: '<?php echo wp_create_nonce('pm-installer-nonce'); ?>'
};

$.post(ajaxurl, data, function (response) {
if (response.success) {
self.attr('disabled', 'disabled');
self.removeClass('install-now updating-message');
self.text('<?php echo esc_js( 'Installed', 'wedevs-project-manager' ); ?>');

window.location.reload();
}
});
});
})(jQuery);
</script>
<?php
}


/**
* Install the WP project Manager plugin via ajax
*
* @since 2.0.2
*
* @return json
*/
function pm_install_project_manager() {

if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'pm-installer-nonce' ) ) {
wp_send_json_error( __( 'Error: Nonce verification failed', 'wedevs-project-manager') );
}

include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';

$upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );

add_filter( 'upgrader_package_options', function ( $options ) {
$options['clear_destination'] = true;
$options['hook_extra'] = [
'type' => 'plugin',
'action' => 'install',
'plugin' => 'wedevs-project-manager/cpm.php',
];
return $options;
});

add_filter('upgrader_pre_install', array($upgrader, 'deactivate_plugin_before_upgrade'), 10, 2);
add_filter('upgrader_clear_destination', array($upgrader, 'delete_old_plugin'), 10, 4);

$result = $upgrader->install( 'https://github.com/weDevsOfficial/wp-project-manager/releases/download/v2.0.2/wedevs-project-manager-php5.6-v2.0.2.zip' );

if ( is_wp_error( $result ) ) {
wp_send_json_error( $result );
}

$result = activate_plugin( 'wedevs-project-manager/cpm.php' );

if ( is_wp_error( $result ) ) {
wp_send_json_error( $result );
}
wp_send_json_success();
}

define('PM_FILE', __FILE__);
define ('PM_BASENAME', plugin_basename(__FILE__));
Expand Down
Loading

0 comments on commit 90a6f0f

Please sign in to comment.