diff --git a/wp-content/plugins/gitium/functions.php b/wp-content/plugins/gitium/functions.php index 3df288c3..96f83864 100644 --- a/wp-content/plugins/gitium/functions.php +++ b/wp-content/plugins/gitium/functions.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @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 + ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/gitium/gitium-webhook.php b/wp-content/plugins/gitium/gitium-webhook.php index 6640d040..47b82b06 100644 --- a/wp-content/plugins/gitium/gitium-webhook.php +++ b/wp-content/plugins/gitium/gitium-webhook.php @@ -1,26 +1,58 @@ - - 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 + * + * 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 . + * + * @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'; diff --git a/wp-content/plugins/gitium/gitium.php b/wp-content/plugins/gitium/gitium.php index 7aaf49bb..e253488f 100644 --- a/wp-content/plugins/gitium/gitium.php +++ b/wp-content/plugins/gitium/gitium.php @@ -1,29 +1,35 @@ + * + * 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 . + * + * @package Gitium */ -/* Copyright 2014-2024 Presslabs - - 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' ); diff --git a/wp-content/plugins/gitium/inc/class-git-wrapper.php b/wp-content/plugins/gitium/inc/class-git-wrapper.php index 0c8a6d7c..de78d79e 100644 --- a/wp-content/plugins/gitium/inc/class-git-wrapper.php +++ b/wp-content/plugins/gitium/inc/class-git-wrapper.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ if (!defined('GITIGNORE')) define('GITIGNORE', << - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Admin { public function __construct() { diff --git a/wp-content/plugins/gitium/inc/class-gitium-help.php b/wp-content/plugins/gitium/inc/class-gitium-help.php index b41dae78..57416798 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-help.php +++ b/wp-content/plugins/gitium/inc/class-gitium-help.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Help { diff --git a/wp-content/plugins/gitium/inc/class-gitium-menu-bubble.php b/wp-content/plugins/gitium/inc/class-gitium-menu-bubble.php index 81f3e2dd..c1a8a838 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-menu-bubble.php +++ b/wp-content/plugins/gitium/inc/class-gitium-menu-bubble.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Menu_Bubble extends Gitium_Menu { diff --git a/wp-content/plugins/gitium/inc/class-gitium-menu.php b/wp-content/plugins/gitium/inc/class-gitium-menu.php index 6556a991..9adac247 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-menu.php +++ b/wp-content/plugins/gitium/inc/class-gitium-menu.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Menu { diff --git a/wp-content/plugins/gitium/inc/class-gitium-requirements.php b/wp-content/plugins/gitium/inc/class-gitium-requirements.php index 7180479c..211b8a62 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-requirements.php +++ b/wp-content/plugins/gitium/inc/class-gitium-requirements.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Requirements { diff --git a/wp-content/plugins/gitium/inc/class-gitium-submenu-commits.php b/wp-content/plugins/gitium/inc/class-gitium-submenu-commits.php index d7811294..e204c487 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-submenu-commits.php +++ b/wp-content/plugins/gitium/inc/class-gitium-submenu-commits.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Submenu_Commits extends Gitium_Menu { diff --git a/wp-content/plugins/gitium/inc/class-gitium-submenu-configure.php b/wp-content/plugins/gitium/inc/class-gitium-submenu-configure.php index 6bafdc9d..48fd4be0 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-submenu-configure.php +++ b/wp-content/plugins/gitium/inc/class-gitium-submenu-configure.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Submenu_Configure extends Gitium_Menu { @@ -152,8 +158,13 @@ class Gitium_Submenu_Configure extends Gitium_Menu {

- - + + +

+

+

+ +


github or bitbucket.', 'gitium' ); ?> diff --git a/wp-content/plugins/gitium/inc/class-gitium-submenu-settings.php b/wp-content/plugins/gitium/inc/class-gitium-submenu-settings.php index f4c61bad..7b292471 100644 --- a/wp-content/plugins/gitium/inc/class-gitium-submenu-settings.php +++ b/wp-content/plugins/gitium/inc/class-gitium-submenu-settings.php @@ -1,19 +1,25 @@ - - 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 + * + * 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 . + * + * @package Gitium + */ class Gitium_Submenu_Settings extends Gitium_Menu { @@ -63,11 +69,16 @@ class Gitium_Submenu_Settings extends Gitium_Menu {

- - - Merge changes

- -

+ + + Merge changes

+ +

+

+ +
+

+

- - 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 + * + * 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 . + * + * @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 { git->local_status(); + $behind_commits = count( $this->git->get_behind_commits() ); - private function show_git_changes_table_submit_buttons( $changes ) { - if ( ! empty( $changes ) ) : ?> -

- - -

-

- />  -

- 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 ) ) : ?> +

+ + +

+

+ />  +

+ changes_page(); } -} +} \ No newline at end of file diff --git a/wp-content/plugins/gitium/js/copy-to-clipboard.js b/wp-content/plugins/gitium/js/copy-to-clipboard.js new file mode 100644 index 00000000..af934807 --- /dev/null +++ b/wp-content/plugins/gitium/js/copy-to-clipboard.js @@ -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); + } + }); +}); \ No newline at end of file diff --git a/wp-content/plugins/gitium/readme.txt b/wp-content/plugins/gitium/readme.txt index 5f2e085a..27fa5c00 100644 --- a/wp-content/plugins/gitium/readme.txt +++ b/wp-content/plugins/gitium/readme.txt @@ -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;