updated plugin Gitium
version 1.2.1
This commit is contained in:
parent
d652fac5a4
commit
c53f9e0e50
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
function gitium_error_log( $message ) {
|
||||
if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { return; }
|
||||
@ -418,3 +424,18 @@ function gitium_admin_init() {
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'gitium_admin_init' );
|
||||
|
||||
add_action('admin_enqueue_scripts', 'enqueue_script_for_gitium_page');
|
||||
function enqueue_script_for_gitium_page($hook) {
|
||||
// Check if the current page is your plugin's settings page
|
||||
if ((isset($_GET['page']) && $_GET['page'] === 'gitium/gitium.php') || (isset($_GET['page']) && $_GET['page'] === 'gitium/gitium-settings.php')) {
|
||||
// Enqueue your JavaScript file
|
||||
wp_enqueue_script(
|
||||
'my-plugin-script', // Handle for the script
|
||||
plugin_dir_url(__FILE__) . 'js/copy-to-clipboard.js', // URL to the script
|
||||
array('jquery'), // Dependencies
|
||||
'1.1', // Version number
|
||||
true // Load in footer
|
||||
);
|
||||
}
|
||||
}
|
@ -1,26 +1,58 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
header( 'Content-Type: text/html' );
|
||||
define( 'SHORTINIT', true );
|
||||
//$wordpress_loader = $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';
|
||||
$wordpress_loader = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT', FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '/wp-load.php';
|
||||
|
||||
require_once $wordpress_loader;
|
||||
$current_dir = __DIR__;
|
||||
|
||||
// Define an array of possible WordPress root locations
|
||||
$try_wp_roots = [
|
||||
getenv('DOCUMENT_ROOT'),
|
||||
filter_input(INPUT_SERVER, 'DOCUMENT_ROOT', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
|
||||
realpath($current_dir . '/../../../../../'),
|
||||
realpath($current_dir . '/../../../../'),
|
||||
realpath($current_dir . '/../../../'), // Typical WordPress structure
|
||||
realpath($current_dir . '/../../'), // Alternative structure
|
||||
realpath($current_dir . '/../'), // Closer parent directory
|
||||
$current_dir, // Fallback to current directory
|
||||
];
|
||||
|
||||
$wordpress_loader = null;
|
||||
|
||||
foreach ($try_wp_roots as $root) {
|
||||
if ($root && file_exists($root . '/wp-load.php')) {
|
||||
$wordpress_loader = $root . '/wp-load.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($wordpress_loader) {
|
||||
require_once $wordpress_loader;
|
||||
} else {
|
||||
die('Error: Unable to locate wp-load.php. Please verify your WordPress installation.');
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/functions.php';
|
||||
require_once __DIR__ . '/inc/class-git-wrapper.php';
|
||||
|
||||
|
@ -1,29 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Gitium
|
||||
* Version: 1.0.7
|
||||
* Author: Presslabs
|
||||
* Author URI: https://www.presslabs.com
|
||||
* License: GPL2
|
||||
* Description: Keep all your code on git version control system.
|
||||
* Text Domain: gitium
|
||||
* Domain Path: /languages/
|
||||
* Plugin Name: Gitium
|
||||
* Plugin URI: https://www.presslabs.com/gitium/
|
||||
* Description: Keep all your code on git version control system.
|
||||
* Author: PRESSINFRA SRL
|
||||
* Author URI: https://www.presslabs.com
|
||||
* Text Domain: gitium
|
||||
* Domain Path: /languages
|
||||
* Version: 1.2.1
|
||||
* License: GPL3
|
||||
*
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
/* Copyright 2014-2024 Presslabs <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
define( 'GITIUM_LAST_COMMITS', 20 );
|
||||
define( 'GITIUM_MIN_GIT_VER', '1.7' );
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
if (!defined('GITIGNORE'))
|
||||
define('GITIGNORE', <<<EOF
|
||||
|
@ -1,20 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
class Gitium_Admin {
|
||||
|
||||
public function __construct() {
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Help {
|
||||
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Menu_Bubble extends Gitium_Menu {
|
||||
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Menu {
|
||||
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Requirements {
|
||||
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Submenu_Commits extends Gitium_Menu {
|
||||
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Submenu_Configure extends Gitium_Menu {
|
||||
|
||||
@ -152,8 +158,13 @@ class Gitium_Submenu_Configure extends Gitium_Menu {
|
||||
<th scope="row"><label for="key_pair"><?php _e( 'Key pair', 'gitium' ); ?></label></th>
|
||||
<td>
|
||||
<p>
|
||||
<input type="text" class="regular-text" name="key_pair" id="key_pair" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">
|
||||
<input type="submit" name="GitiumSubmitRegenerateKeypair" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" />
|
||||
<input type="text" class="regular-text" name="key_pair" id="key_pair" value="<?php echo esc_attr( $git_public_key ); ?>" readonly="readonly">
|
||||
<input type="submit" name="GitiumSubmitRegenerateKeypair" class="button" value="<?php _e( 'Regenerate Key', 'gitium' ); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<div>
|
||||
<button id="copyButton" class="button" data-copy-text="<?php echo esc_attr($git_public_key); ?>">Copy Key Pair</button>
|
||||
</div>
|
||||
</p>
|
||||
<p class="description"><?php _e( 'If your code use ssh keybased authentication for git you need to allow write access to your repository using this key.', 'gitium' ); ?><br />
|
||||
<?php _e( 'Checkout instructions for <a href="https://help.github.com/articles/generating-ssh-keys#step-3-add-your-ssh-key-to-github" target="_blank">github</a> or <a href="https://confluence.atlassian.com/display/BITBUCKET/Add+an+SSH+key+to+an+account#AddanSSHkeytoanaccount-HowtoaddakeyusingSSHforOSXorLinux" target="_blank">bitbucket</a>.', 'gitium' ); ?>
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Submenu_Settings extends Gitium_Menu {
|
||||
|
||||
@ -63,11 +69,16 @@ class Gitium_Submenu_Settings extends Gitium_Menu {
|
||||
<th><label for="webhook-url"><?php _e( 'Webhook URL', 'gitium' ); ?>:</label></th>
|
||||
<td>
|
||||
<p><code id="webhook-url"><?php echo esc_url( gitium_get_webhook() ); ?></code>
|
||||
<?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>
|
||||
<input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />
|
||||
<a class="button" href="<?php echo esc_url( gitium_get_webhook() ); ?>" target="_blank">Merge changes</a></p>
|
||||
<?php endif; ?>
|
||||
<p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>
|
||||
<?php if ( ! defined( 'GIT_WEBHOOK_URL' ) || GIT_WEBHOOK_URL == '' ) : ?>
|
||||
<input type="submit" name="GitiumSubmitRegenerateWebhook" class="button" value="<?php _e( 'Regenerate Webhook', 'gitium' ); ?>" />
|
||||
<a class="button" href="<?php echo esc_url( gitium_get_webhook() ); ?>" target="_blank">Merge changes</a></p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<div>
|
||||
<button id="copyButton" class="button" data-copy-text="<?php echo esc_url( gitium_get_webhook() ) ?>">Copy Webhook URL</button>
|
||||
</div>
|
||||
</p>
|
||||
<p class="description"><?php _e( 'Pinging this URL triggers an update from remote repository.', 'gitium' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -1,19 +1,25 @@
|
||||
<?php
|
||||
/* Copyright 2014-2016 Presslabs SRL <ping@presslabs.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/**
|
||||
* Gitium provides automatic git version control and deployment for
|
||||
* your plugins and themes integrated into wp-admin.
|
||||
*
|
||||
* Copyright (C) 2014-2025 PRESSINFRA SRL <ping@presslabs.com>
|
||||
*
|
||||
* Gitium is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Gitium is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Gitium. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package Gitium
|
||||
*/
|
||||
|
||||
class Gitium_Submenu_Status extends Gitium_Menu {
|
||||
|
||||
@ -94,30 +100,54 @@ class Gitium_Submenu_Status extends Gitium_Menu {
|
||||
}
|
||||
|
||||
public function save_changes() {
|
||||
$gitium_save_changes = filter_input(INPUT_POST, 'GitiumSubmitSaveChanges', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$gitium_save_changes = filter_input(INPUT_POST, 'GitiumSubmitSaveChanges', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$gitium_commit_msg = filter_input(INPUT_POST, 'commitmsg', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
if ( ! isset( $gitium_save_changes ) ) {
|
||||
|
||||
if ( ! isset( $gitium_save_changes ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
check_admin_referer( 'gitium-admin' );
|
||||
|
||||
|
||||
gitium_enable_maintenance_mode() or wp_die( __( 'Could not enable the maintenance mode!', 'gitium' ) );
|
||||
$this->git->add();
|
||||
|
||||
$commitmsg = sprintf( __( 'Merged changes from %s on %s', 'gitium' ), get_site_url(), date( 'm.d.Y' ) );
|
||||
|
||||
if ( isset( $gitium_commit_msg ) && ! empty( $gitium_commit_msg ) ) {
|
||||
$commitmsg = $gitium_commit_msg;
|
||||
}
|
||||
|
||||
$commits = array();
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
$commit = $this->git->commit( $commitmsg, $current_user->display_name, $current_user->user_email );
|
||||
if ( ! $commit ) {
|
||||
$this->redirect( __( 'Could not commit!', 'gitium' ) );
|
||||
|
||||
// Get local status and behind commits
|
||||
$local_status = $this->git->local_status();
|
||||
$behind_commits = count( $this->git->get_behind_commits() );
|
||||
|
||||
if ( $this->git->is_dirty() && $this->git->add() > 0 ) {
|
||||
$commit = $this->git->commit( $commitmsg, $current_user->display_name, $current_user->user_email );
|
||||
if ( ! $commit ) {
|
||||
gitium_disable_maintenance_mode();
|
||||
$this->redirect( __( 'Could not commit!', 'gitium' ) );
|
||||
}
|
||||
$commits[] = $commit;
|
||||
}
|
||||
$merge_success = gitium_merge_and_push( $commit );
|
||||
|
||||
$merge_success = gitium_merge_and_push( $commits );
|
||||
|
||||
gitium_disable_maintenance_mode();
|
||||
|
||||
if ( ! $merge_success ) {
|
||||
$this->redirect( __( 'Merge failed: ', 'gitium' ) . $this->git->get_last_error() );
|
||||
}
|
||||
$this->success_redirect( sprintf( __( 'Pushed commit: `%s`', 'gitium' ), $commitmsg ) );
|
||||
|
||||
// Determine message based on previous conditions
|
||||
if ( $behind_commits > 0 && empty( $local_status[1] ) ) {
|
||||
$this->success_redirect( sprintf( __( 'Pull done!', 'gitium' ) ) );
|
||||
} else{
|
||||
$this->success_redirect( sprintf( __( 'Pushed commit: `%s`', 'gitium' ), $commitmsg ) );
|
||||
}
|
||||
}
|
||||
|
||||
private function show_ahead_and_behind_info( $changes = '' ) {
|
||||
@ -193,18 +223,32 @@ class Gitium_Submenu_Status extends Gitium_Menu {
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function show_git_changes_table_submit_buttons( $changes ) {
|
||||
// Get local status and behind commits
|
||||
$local_status = $this->git->local_status();
|
||||
$behind_commits = count( $this->git->get_behind_commits() );
|
||||
|
||||
private function show_git_changes_table_submit_buttons( $changes ) {
|
||||
if ( ! empty( $changes ) ) : ?>
|
||||
<p>
|
||||
<label for="save-changes"><?php _e( 'Commit message', 'gitium' ); ?>:</label>
|
||||
<input type="text" name="commitmsg" id="save-changes" class="widefat" value="" placeholder="<?php printf( __( 'Merged changes from %s on %s', 'gitium' ), get_site_url(), date( 'm.d.Y' ) ); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="GitiumSubmitSaveChanges" class="button-primary button" value="<?php _e( 'Save changes', 'gitium' ); ?>" <?php if ( get_transient( 'gitium_remote_disconnected' ) ) { echo 'disabled="disabled" '; } ?>/>
|
||||
</p>
|
||||
<?php endif;
|
||||
}
|
||||
// Determine button value based on conditions
|
||||
if ( $behind_commits > 0 && !empty( $local_status[1] ) ) {
|
||||
$button_value = __( 'Pull & Push changes', 'gitium' );
|
||||
} else if ( $behind_commits > 0 ) {
|
||||
$button_value = __( 'Pull changes', 'gitium' );
|
||||
} else if ( !empty( $local_status[1] ) ) {
|
||||
$button_value = __( 'Push changes', 'gitium' );
|
||||
}
|
||||
|
||||
// Check if there are any changes to display the form
|
||||
if ( !empty( $changes ) ) : ?>
|
||||
<p>
|
||||
<label for="save-changes"><?php _e( 'Commit message', 'gitium' ); ?>:</label>
|
||||
<input type="text" name="commitmsg" id="save-changes" class="widefat" value="" placeholder="<?php printf( __( 'Merged changes from %s on %s', 'gitium' ), get_site_url(), date( 'm.d.Y' ) ); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="GitiumSubmitSaveChanges" class="button-primary button" value="<?php echo esc_html( $button_value ); ?>" <?php if ( get_transient( 'gitium_remote_disconnected' ) ) { echo 'disabled="disabled" '; } ?>/>
|
||||
</p>
|
||||
<?php endif;
|
||||
}
|
||||
|
||||
private function changes_page() {
|
||||
list( , $changes ) = _gitium_status();
|
||||
@ -233,4 +277,4 @@ class Gitium_Submenu_Status extends Gitium_Menu {
|
||||
_gitium_status( true );
|
||||
$this->changes_page();
|
||||
}
|
||||
}
|
||||
}
|
38
wp-content/plugins/gitium/js/copy-to-clipboard.js
Normal file
38
wp-content/plugins/gitium/js/copy-to-clipboard.js
Normal file
@ -0,0 +1,38 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const copyButton = document.getElementById('copyButton');
|
||||
|
||||
copyButton.addEventListener('click', function() {
|
||||
// Get the text to copy from the button's data attribute
|
||||
const textToCopy = copyButton.getAttribute('data-copy-text');
|
||||
|
||||
// Check if navigator.clipboard is supported
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(textToCopy)
|
||||
.then(() => {
|
||||
alert('Copied to clipboard using navigator: ' + textToCopy);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Could not copy text with navigator: ', err);
|
||||
});
|
||||
} else {
|
||||
// Deprecated fallback for older browsers
|
||||
console.warn('Using deprecated document.execCommand("copy") as a fallback. Update your browser for better clipboard support.');
|
||||
|
||||
// Fallback using document.execCommand
|
||||
const tempTextarea = document.createElement('textarea');
|
||||
tempTextarea.value = textToCopy;
|
||||
document.body.appendChild(tempTextarea);
|
||||
tempTextarea.select();
|
||||
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
alert('Copied to clipboard (using fallback): ' + textToCopy);
|
||||
} catch (err) {
|
||||
console.error('Fallback copy failed: ', err);
|
||||
}
|
||||
|
||||
// Remove the temporary textarea
|
||||
document.body.removeChild(tempTextarea);
|
||||
}
|
||||
});
|
||||
});
|
@ -2,13 +2,13 @@
|
||||
|
||||
Contributors: PressLabs
|
||||
Donate link: https://www.presslabs.com/gitium/
|
||||
Tags: git, version, versioning, deployment, version-control, github, bitbucket, travis, code, revision, testing, development, branch, production, staging, debug, plugin, gitium, presslabs, simple
|
||||
Tags: git, version control, revision, gitium, presslabs
|
||||
Requires at least: 4.7
|
||||
Tested up to: 6.6
|
||||
Requires PHP: 5.6
|
||||
License: GPLv2
|
||||
Stable tag: 1.0.7
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
Tested up to: 6.8
|
||||
Requires PHP: 7.4
|
||||
License: GPLv3
|
||||
Stable tag: 1.2.1
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
Automatic git version control and deployment for your plugins and themes integrated into wp-admin.
|
||||
|
||||
@ -122,11 +122,22 @@ Submodules are currently not supported.
|
||||
Please report security bugs found in the source code of the Gitium plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/gitium). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.
|
||||
|
||||
== Upgrade Notice ==
|
||||
= 1.0.7 =
|
||||
PHP8.1 compatibility, check if gitignore is already defined and add HOME env
|
||||
= 1.2.1 =
|
||||
Tested up to WP 6.8
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.2.1 =
|
||||
* Tested the compatibility of the plugin with WP 6.8
|
||||
|
||||
= 1.2.0 =
|
||||
* Changed the license for all files to GPLv3
|
||||
* Fix: In some cases, the WP is configured in another folder. We've made some changes on how we check for the wp-load.php file
|
||||
|
||||
= 1.1.0 =
|
||||
* Fix: In some cases, the website was stuck in maintenance when it was pulling the changes from remote
|
||||
* Added: A copy-to-clipboard button was introduced for copying ssh key-pair and webhook url
|
||||
|
||||
= 1.0.7 =
|
||||
* Fix: HOME env definition;
|
||||
* Fix: deprecation warnings in PHP 8.1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user