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 */ class Gitium_Help { public function __construct( $hook, $help = 'gitium' ) { add_action( "load-{$hook}", array( $this, $help ), 20 ); } private function general() { $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'gitium', 'title' => __( 'Gitium', 'gitium' ), 'callback' => array( $this, 'gitium' ) ) ); $screen->add_help_tab( array( 'id' => 'faq', 'title' => __( 'F.A.Q.', 'gitium' ), 'callback' => array( $this, 'faq' ) ) ); $screen->add_help_tab( array( 'id' => 'requirements', 'title' => __( 'Requirements', 'gitium' ), 'callback' => array( $this, 'requirements_callback' ) ) ); $screen->set_help_sidebar( '
' ); } public function gitium() { echo '

' . __( 'Gitium enables continuous deployment for WordPress integrating with tools such as Github, Bitbucket or Travis-CI. Plugin and theme updates, installs and removals are automatically versioned.', 'gitium' ) . '

'; echo '

' . __( 'Ninja code edits from the WordPress editor are also tracked into version control. Gitium is designed for sane development environments.', 'gitium' ) . '

'; echo '

' . __( 'Staging and production can follow different branches of the same repository. You can deploy code simply trough git push.', 'gitium' ) . '

'; echo '

' . __( 'Gitium requires git command line tool minimum version 1.7 installed on the server and proc_open PHP function enabled.', 'gitium' ) . '

'; } public function faq() { echo '

' . __( 'Could not connect to remote repository?', 'gitium' ) . '
'. __( 'If you encounter this kind of error you can try to fix it by setting the proper username of the .git directory.', 'gitium' ) . '
' . __( 'Example', 'gitium' ) .': chown -R www-data:www-data .git

'; echo '

' . __( 'Is this plugin considered stable?', 'gitium' ) . '
'. __( 'Right now this plugin is considered alpha quality and should be used in production environments only by adventurous kinds.', 'gitium' ) . '

'; echo '

' . __( 'What happens in case of conflicts?', 'gitium' ) . '
'. __( 'The behavior in case of conflicts is to overwrite the changes on the origin repository with the local changes (ie. local modifications take precedence over remote ones).', 'gitium' ) . '

'; echo '

' . __( 'How to deploy automatically after a push?', 'gitium' ) . '
'. __( 'You can ping the webhook url after a push to automatically deploy the new code. The webhook url can be found under Code menu. This url plays well with Github or Bitbucket webhooks.', 'gitium' ) . '

'; echo '

' . __( 'Does it works on multi site setups?', 'gitium' ) . '
'. __( 'Gitium is not supporting multisite setups at the moment.', 'gitium' ) . '

'; echo '

' . __( 'How does gitium handle submodules?', 'gitium' ) . '
'. __( 'Currently submodules are not supported.', 'gitium' ) . '

'; } public function requirements_callback() { echo '

' . __( 'Gitium requires:', 'gitium' ) . '

'; echo '

' . __( 'the function proc_open available', 'gitium' ) . '

'; echo '

' . __( 'can exec the file inc/ssh-git', 'gitium' ) . '

'; printf( '

' . __( 'git version >= %s', 'gitium' ) . '

', GITIUM_MIN_GIT_VER ); printf( '

' . __( 'PHP version >= %s', 'gitium' ) . '

', GITIUM_MIN_PHP_VER ); } public function configuration() { $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'configuration', 'title' => __( 'Configuration', 'gitium' ), 'callback' => array( $this, 'configuration_callback' ) ) ); $this->general(); } public function configuration_callback() { echo '

' . __( 'Configuration step 1', 'gitium' ) . '
' . __( 'In this step you must specify the Remote URL. This URL represents the link between the git sistem and your site.', 'gitium' ) . '

'; echo '

' . __( 'You can get this URL from your Git repository and it looks like this:', 'gitium' ) . '

'; echo '

' . __( 'github.com -> git@github.com:user/example.git', 'gitium' ) . '

'; echo '

' . __( 'bitbucket.org -> git@bitbucket.org:user/glowing-happiness.git', 'gitium' ) . '

'; echo '

' . __( 'To go to the next step, fill the Remote URL and then press the Fetch button.', 'gitium' ) . '

'; echo '

' . __( 'Configuration step 2', 'gitium' ) . '
' . __( 'In this step you must select the branch you want to follow.', 'gitium' ) . '

'; echo '

' . __( 'Only this branch will have all of your code modifications.', 'gitium' ) . '

'; echo '

' . __( 'When you push the button Merge & Push, all code(plugins & themes) will be pushed on the git repository.', 'gitium' ) . '

'; } public function status() { $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'status', 'title' => __( 'Status', 'gitium' ), 'callback' => array( $this, 'status_callback' ) ) ); $this->general(); } public function status_callback() { echo '

' . __( 'On status page you can see what files are modified, and you can commit the changes to git.', 'gitium' ) . '

'; } public function commits() { $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'commits', 'title' => __( 'Commits', 'gitium' ), 'callback' => array( $this, 'commits_callback' ) ) ); $this->general(); } public function commits_callback() { echo '

' . __( 'You may be wondering what is the difference between author and committer.', 'gitium' ) . '

'; echo '

' . __( 'The author is the person who originally wrote the patch, whereas the committer is the person who last applied the patch.', 'gitium' ) . '

'; echo '

' . __( 'So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit — you as the author and the core member as the committer.', 'gitium' ) . '

'; } public function settings() { $screen = get_current_screen(); $screen->add_help_tab( array( 'id' => 'settings', 'title' => __( 'Settings', 'gitium' ), 'callback' => array( $this, 'settings_callback' ) ) ); $this->general(); } public function settings_callback() { echo '

' . __( 'Each line from the gitignore file specifies a pattern.', 'gitium' ) . '

'; echo '

' . __( 'When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome)', 'gitium' ) . '

'; echo '

' . sprintf( __( 'Read more on %s', 'gitium' ), 'git documentation' ) . '

'; } }