Skip to content

Commit 891def4

Browse files
committed
v1.8 changes 2
1 parent 4a24e60 commit 891def4

6 files changed

Lines changed: 46 additions & 38 deletions

File tree

admin/admin.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ public static function edit_repo( $action = 'edit' ){
198198
echo '<tbody>';
199199

200200
echo '<tr>';
201-
echo '<td style="width: 300px">Github username/owner</td>';
201+
echo '<td style="width: 300px">GitHub username/owner</td>';
202202
echo '<td><input type="text" name="giw_username" value="' . esc_attr( $values[ 'username' ] ) . '" required="required" />';
203-
echo '<p class="description">The username of the Github repository</p>';
203+
echo '<p class="description">The username of the GitHub repository</p>';
204204
echo '</td>';
205205
echo '</tr>';
206206

207207
echo '<tr>';
208208
echo '<td>Repository name</td>';
209209
echo '<td><input type="text" name="giw_repository" value="' . esc_attr( $values[ 'repository' ] ) . '" required="required" />';
210-
echo '<p class="description">The name of the Github repository to pull and publish posts from</p>';
210+
echo '<p class="description">The name of the GitHub repository to pull and publish posts from</p>';
211211
echo '</td>';
212212
echo '</tr>';
213213

@@ -247,7 +247,7 @@ public static function edit_repo( $action = 'edit' ){
247247
'teeny' => true,
248248
'textarea_rows' => 4
249249
));
250-
echo '<p class="description">The template of the post content. Use any text, HTML, shortcode you would like to be added to all the posts when they are published. Supported placeholder <code>%%content%%</code> (The HTML of the pulled post). Use shortcode <code>[giw_edit_link]</code> to insert a link of the source Github file to edit and collaborate. You might need to "Pull all the files" to update the post if the template is changed.</p>';
250+
echo '<p class="description">The template of the post content. Use any text, HTML, shortcode you would like to be added to all the posts when they are published. Supported placeholder <code>%%content%%</code> (The HTML of the pulled post). Use shortcode <code>[giw_edit_link]</code> to insert a link of the source GitHub file to edit and collaborate. You might need to "Pull all the files" to update the post if the template is changed.</p>';
251251
echo '</td>';
252252
echo '</tr>';
253253

@@ -302,7 +302,7 @@ public static function pull_posts(){
302302

303303
$id = $g[ 'id' ];
304304

305-
echo '<h2>Pull posts from Github for [' . esc_html( $id ) . ']</h2>';
305+
echo '<h2>Pull posts from GitHub for [' . esc_html( $id ) . ']</h2>';
306306

307307
echo '<table class="widefat striped">';
308308
echo '<tbody>
@@ -375,22 +375,22 @@ public static function general_settings(){
375375
echo '<tr>';
376376
echo '<td style="width: 200px">Webhook secret</td>';
377377
echo '<td><input type="password" class="webhook_secret" name="giw_webhook_secret" value="' . esc_attr( $values[ 'webhook_secret' ] ) . '" autocomplete="new-password" /> &nbsp;<button class="button">Toggle view</button>';
378-
echo '<p class="description">Go to Github repository settings --> Webhook and add a webhook for the payload URL <code>' . esc_html( rest_url( '/giw/v1/publish' ) ) . '</code> if you would like to automatically publish the changes whenever repository is updated.</p>';
378+
echo '<p class="description">Go to GitHub repository settings --> Webhook and add a webhook for the payload URL <code>' . esc_html( rest_url( '/giw/v1/publish' ) ) . '</code> if you would like to automatically publish the changes whenever repository is updated.</p>';
379379
echo '<p class="description">Select content-type as <code>application/json</code> and enter a secret text. Provide the same secret text in the above field. Select "Just the push event" for the webhook trigger. Make sure all the repositories you would like to automatically update have the same payload URL and the secret.</p>';
380380
echo '</td>';
381381
echo '</tr>';
382382

383383
echo '<tr><td colspan="2"><h4>Authentication</h4></td></tr>';
384384

385385
echo '<tr>';
386-
echo '<td>Github Username</td>';
386+
echo '<td>GitHub Username</td>';
387387
echo '<td><input type="text" name="giw_github_username" value="' . esc_attr( $values[ 'github_username' ] ) . '" />';
388-
echo '<p class="description">Your Github username for authenticating API calls.</p></td>';
388+
echo '<p class="description">Your GitHub username for authenticating API calls.</p></td>';
389389
echo '</tr>';
390390

391391
echo '<tr>';
392-
echo '<td>Github Access token</td>';
393-
echo '<td><input type="text" name="giw_github_access_token" value="' . esc_attr( $values[ 'github_access_token' ] ) . '" />';
392+
echo '<td>GitHub Access token</td>';
393+
echo '<td><input type="password" name="giw_github_access_token" value="' . esc_attr( $values[ 'github_access_token' ] ) . '" /> &nbsp;<button class="button">Toggle view</button>';
394394
echo '<p class="description">Create an access token by following <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token" target="_blank">the instructions here.</a> Select <code>repo -> public_repo</code> under scopes and generate a token.
395395
</p></td>';
396396
echo '</tr>';
@@ -499,9 +499,9 @@ public static function sidebar(){
499499
echo '<a class="cta_link" href="https://www.aakashweb.com/docs/git-it-write/" target="_blank">See plugin documentation <span class="dashicons dashicons-arrow-right-alt"></span></a>';
500500
echo '</div>';
501501

502-
echo '<p><a href="https://github.com/vaakash/git-it-write" class="button side_btn" target="_blank"><span class="dashicons dashicons-editor-code"></span> Contribute on Github</a></p>';
502+
echo '<p><a href="https://github.com/vaakash/git-it-write" class="button side_btn" target="_blank"><span class="dashicons dashicons-editor-code"></span> Contribute on GitHub</a></p>';
503503

504-
echo '<p><a href="https://twitter.com/intent/tweet?hashtags=wordpress,markdown,github&related=aakashweb&text=Check%20it%20out%20-%20%22Git%20it%20Write%22%20a%20new%20WordPress%20plugin%20to%20publish%20posts%20from%20Github%20using%20markdown%20files%20and%20allow%20people%20to%20collaborate%20%E2%9C%8D%20https://wordpress.org/plugins/git-it-write/" class="button side_btn" target="_blank"><span class="dashicons dashicons-share"></span> Share with friends</a></p>';
504+
echo '<p><a href="https://twitter.com/intent/tweet?hashtags=wordpress,markdown,github&related=aakashweb&text=Check%20it%20out%20-%20%22Git%20it%20Write%22%20a%20new%20WordPress%20plugin%20to%20publish%20posts%20from%20GitHub%20using%20markdown%20files%20and%20allow%20people%20to%20collaborate%20%E2%9C%8D%20https://wordpress.org/plugins/git-it-write/" class="button side_btn" target="_blank"><span class="dashicons dashicons-share"></span> Share with friends</a></p>';
505505

506506
}
507507

admin/css/style.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ table.widefat td {
7272
margin-bottom: 15px;
7373
background-size: 95px;
7474
background-color: #fff;
75-
border: 1px solid #dfdfdf;
75+
border: 1px solid #c3c4c7;
7676
}
7777
.side_card h2 {
7878
margin: -20px -20px 20px -20px;
7979
padding: 12.5px 15px;
80-
border-bottom: 1px solid #dfdfdf;
80+
border-bottom: 1px solid #c3c4c7;
8181
font-size: 1.2em;
8282
}
8383
.side_card h2 .dashicons {
@@ -147,12 +147,12 @@ table.widefat td {
147147
margin-bottom: 0;
148148
}
149149
.twitter_btn.button{
150-
background: #1b95e0;
150+
background: #000;
151151
color: #fff;
152152
border-color: transparent;
153153
}
154154
.facebook_btn.button{
155-
background: #4080ff;
155+
background: #0866ff;
156156
color: #fff;
157157
border-color: transparent;
158158
}

admin/js/script.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
(function($){
22
$(document).ready(function(){
3-
var $wh_secret = $(".webhook_secret");
4-
$wh_secret.next().click(function(e){
3+
var $secret_input = $('input[type="password"]');
4+
$secret_input.next().click(function(e){
55
e.preventDefault();
6-
if($wh_secret.attr("type") == "text"){
7-
$wh_secret.attr("type", "password");
6+
var $the_input = $(this).prev();
7+
if($the_input.attr('type') == 'text'){
8+
$the_input.attr('type', 'password');
89
}else{
9-
$wh_secret.attr("type", "text");
10+
$the_input.attr('type', 'text');
1011
}
1112
});
1213
});

git-it-write.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
Description: Publish markdown files present in a Github repository as posts to WordPress automatically
66
Author: Aakash Chakravarthy
77
Author URI: https://www.aakashweb.com/
8-
Version: 1.7
8+
Version: 1.8
99
*/
1010

11-
define( 'GIW_VERSION', '1.7' );
11+
define( 'GIW_VERSION', '1.8' );
1212
define( 'GIW_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
1313
define( 'GIW_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
1414

includes/repository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function get( $url ){
3939
$response = wp_remote_get( $url, $args );
4040

4141
if( is_wp_error( $response ) ) {
42+
GIW_Utils::log( 'Error: ' . $response->get_error_message() );
4243
return false;
4344
}
4445

readme.txt

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Git it Write - Write posts from Github
1+
# Git it Write - Write posts from GitHub
22
Contributors: vaakash
33
Author URI: https://www.aakashweb.com/
44
Plugin URI: https://www.aakashweb.com/wordpress-plugins/git-it-write/
@@ -10,21 +10,21 @@ Requires at least: 4.4
1010
Tested up to: 6.4.1
1111
Stable tag: 1.8
1212

13-
Publish markdown files present in a Github repository as posts to WordPress automatically
13+
Publish markdown files present in a GitHub repository as posts to WordPress automatically
1414

1515

1616

1717
## Description
1818

19-
Git it Write allows to publish the markdown files present in a Github repository to your WordPress site. So with this plugin, whenever the files are added, updated in the repository the WordPress post will be added, updated accordingly.
19+
Git it Write allows to publish the markdown files present in a GitHub repository to your WordPress site. So with this plugin, whenever the files are added, updated in the repository the WordPress post will be added, updated accordingly.
2020

21-
This plugin is inspired from static site generators like `Jekyll`, `Next.js`, `Gatsby.js` on how content is written is markdown. This is a similar idea for WordPress where markdown files are parsed from Github and published as posts.
21+
This plugin is inspired from static site generators like `Jekyll`, `Next.js`, `Gatsby.js` on how content is written is markdown. This is a similar idea for WordPress where markdown files are parsed from GitHub and published as posts.
2222

2323
👓 **Live example:** [Source github repository](https://github.com/vaakash/aakash-web) (`/docs/` folder) to [Posts published](https://www.aakashweb.com/docs/)
2424

2525
⚡ **Getting started:** [Get started](https://www.aakashweb.com/docs/git-it-write/getting-started/) with Git it write. Learn how to write `.md` files and publish posts on WordPress.
2626

27-
This allows people to collaborate with the post, share edits and suggestions in Github which when pulled the WordPress post will be updated automatically.
27+
This allows people to collaborate with the post, share edits and suggestions in GitHub which when pulled the WordPress post will be updated automatically.
2828

2929
If a repository has files in the below structure,
3030

@@ -43,10 +43,10 @@ Then below posts will be created like below (if permalinks are configured and th
4343

4444
### 🎲 What is the use of this plugin ?
4545

46-
* Publish posts using the files in your Github repository.
46+
* Publish posts using the files in your GitHub repository.
4747
* Write your posts in Markdown format.
4848
* Write your posts on your desktop application (Notepad++, Sublime Text, Visual studio code).
49-
* Collaborate, involve communities on the files in Github and publish them on WordPress.
49+
* Collaborate, involve communities on the files in GitHub and publish them on WordPress.
5050
* All the advantages of Git and it's version management system.
5151

5252
### 🚀 Some use cases
@@ -70,7 +70,7 @@ Then below posts will be created like below (if permalinks are configured and th
7070
### ℹ Note
7171

7272
* Only Markdown files will be pulled and published right now
73-
* Posts won't be deleted when it's source file is deleted on Github.
73+
* Posts won't be deleted when it's source file is deleted on GitHub.
7474
* It is preferred to have a permalink structure.
7575
* It is preferred to select a post type which supports hierarchy.
7676
* Images have to present only in `_images` folder in the repository root. Markdown files have to relatively use them in the file.
@@ -81,7 +81,7 @@ It is recommended that a permalink structure is enabled in the WordPress site so
8181

8282
### 🏃‍♂️ Using the plugin
8383

84-
1. Have a Github repository where all the source files (markdown files) are maintained (organized in folders if needed the exact structure)
84+
1. Have a GitHub repository where all the source files (markdown files) are maintained (organized in folders if needed the exact structure)
8585
1. In the plugin settings page, click add a new repository.
8686
1. Enter the details of the repository to pull the posts from and under what post type to publish them.
8787
1. Save the settings
@@ -93,7 +93,7 @@ It is recommended that a permalink structure is enabled in the WordPress site so
9393
* [Documentation](https://www.aakashweb.com/docs/git-it-write/)
9494
* [Support forum/Report bugs](https://www.aakashweb.com/forum/)
9595
* [Donate](https://www.paypal.me/vaakash/)
96-
* [Contribute on Github](https://github.com/vaakash/git-it-write)
96+
* [Contribute on GitHub](https://github.com/vaakash/git-it-write)
9797

9898

9999
## Installation
@@ -108,9 +108,9 @@ It is recommended that a permalink structure is enabled in the WordPress site so
108108

109109
Please visit the [plugin documentation page](https://www.aakashweb.com/docs/git-it-write/) for complete list of FAQs.
110110

111-
### When a post is edited in WordPress will that update the file in the Github repository ?
111+
### When a post is edited in WordPress will that update the file in the GitHub repository ?
112112

113-
No. This plugin won't sync post content. It is a one way update. Only changes made to the Github repository will update the posts and not otherwise.
113+
No. This plugin won't sync post content. It is a one way update. Only changes made to the GitHub repository will update the posts and not otherwise.
114114

115115
### What all files in the repository will be published ?
116116

@@ -131,8 +131,8 @@ Yes, if you want to pull posts from a folder in a repository then you can specif
131131

132132
## Screenshots
133133

134-
1. Your files in a Github repository
135-
2. Posts pulled and published from Github.
134+
1. Your files in a GitHub repository
135+
2. Posts pulled and published from GitHub.
136136
3. Content of the published post.
137137
4. Published post.
138138
5. Plugin admin page.
@@ -142,6 +142,12 @@ Yes, if you want to pull posts from a folder in a repository then you can specif
142142

143143
## Changelog
144144

145+
### 1.8
146+
* New: Error message during HTTP get/post is now logged.
147+
* Fix: Double quotes in WordPress shortcodes are escaped.
148+
* Fix: GitHub access token field in admin form is converted to a password field.
149+
* Fix: Typos in readme and admin page.
150+
145151
### 1.7
146152
* New: Images (`_images`) can be now organized in folders.
147153
* New: Featured image can now be set to posts.
@@ -159,7 +165,7 @@ Yes, if you want to pull posts from a folder in a repository then you can specif
159165
* Fix: Enhancements to data escaping in the admin page.
160166

161167
### 1.4
162-
* Fix: Repository not found issue by adding Github authentication.
168+
* Fix: Repository not found issue by adding GitHub authentication.
163169
* Fix: Duplicate posts when filename has special characters.
164170
* Fix: PHP warning when directory has no index.md file.
165171

0 commit comments

Comments
 (0)