Skip to content

Commit 8c4f086

Browse files
authored
Merge pull request #19 from circuscode/develop
Develop
2 parents 78ee963 + 01c18ad commit 8c4f086

File tree

11 files changed

+213
-103
lines changed

11 files changed

+213
-103
lines changed

.github/workflows/deploy-env-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
username: ${{ secrets.FTP_USER_GITHUBDEPLOY }}
1818
password: ${{ secrets.FTP_PASSWORD_GITHUBDEPLOY }}
1919
protocol: ftp
20-
server-dir: unmus/dev/wordpress/wp-content/plugins/mathilda/
20+
server-dir: ${{ vars.FTP_PATH_DEV }}
2121
exclude: |
2222
**/.git*
2323
**/.git*/**

.github/workflows/deploy-env-public.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
username: ${{ secrets.FTP_USER_GITHUBDEPLOY }}
1818
password: ${{ secrets.FTP_PASSWORD_GITHUBDEPLOY }}
1919
protocol: ftp
20-
server-dir: unmus/public/wordpress/wp-content/plugins/mathilda/
20+
server-dir: ${{ vars.FTP_PATH_PUBLIC }}
2121
exclude: |
2222
**/.git*
2323
**/.git*/**

mathilda.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Mathilda
55
Plugin URI: https://www.unmus.de/wordpress-plugin-mathilda/
66
Description: Mathilda copies your tweets from Twitter to WordPress.
7-
Version: 0.11
7+
Version: 0.12
88
Author: Marco Hitschler
99
Author URI: https://www.unmus.de/
1010
License: GPL3
@@ -74,7 +74,7 @@ function mathilda_activate () {
7474
add_option('mathilda_tweets_count', "0");
7575
add_option('mathilda_activated', "1");
7676
add_option('mathilda_database_version', "1");
77-
add_option('mathilda_plugin_version', "13");
77+
add_option('mathilda_plugin_version', "15");
7878
add_option('mathilda_import', "0");
7979
add_option('mathilda_slug_is_changed', "0");
8080
add_option('mathilda_cron_period', "900");
@@ -95,6 +95,7 @@ function mathilda_activate () {
9595
add_option('mathilda_import_subprocess_running', "0");
9696
add_option('mathilda_load_process_running',"0");
9797
add_option('mathilda_import_filesize_max',"409600");
98+
add_option('mathilda_cron_status',"0");
9899

99100
/* Create Mathilda Tables */
100101

@@ -208,6 +209,7 @@ function mathilda_delete () {
208209
delete_option('mathilda_import_subprocess_running');
209210
delete_option('mathilda_load_process_running');
210211
delete_option('mathilda_import_filesize_max');
212+
delete_option('mathilda_cron_status');
211213

212214
/* Delete Tables */
213215

mathilda_cron.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,10 @@ function mathilda_cron_script() {
503503
Update Meta
504504
*/
505505

506-
if($initial_load == 0) { update_option('mathilda_initial_load', 1); }
506+
if($initial_load == 0) {
507+
update_option('mathilda_initial_load', 1);
508+
update_option('mathilda_cron_status', 1);
509+
}
507510
$latest_tweet=mathilda_latest_tweet();
508511
$number_of_tweets=mathilda_tweets_count();
509512
$number_of_select=mathilda_select_count();

mathilda_database.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ function mathilda_reset_data() {
462462
update_option('mathilda_import_subprocess_running',0);
463463
update_option('mathilda_load_process_running',0);
464464
update_option('mathilda_import_interval', "86400");
465+
update_option('mathilda_cron_status',"0");
465466

466467
global $wpdb;
467468
$table_name=$wpdb->prefix . 'mathilda_tweets';

mathilda_schedule.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ function mathilda_import_interval( $schedules ) {
4848
function mathilda_cron_execute_tweetload() {
4949

5050
$initial_load = get_option('mathilda_initial_load');
51-
if($initial_load==1) {
51+
$cron_status=get_option('mathilda_cron_status');
52+
53+
if($initial_load==1 && $cron_status==1) {
5254
mathilda_cron_script();
5355
}
5456
}

mathilda_tools.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function mathilda_tools_controller() {
3434
$handbook_show=false;
3535
$mathilda_reset=false;
3636
$import_break=false;
37+
$cron_status=false;
3738

3839
// Load Tweets
3940
if(isset($_GET['cron'])) {
@@ -42,6 +43,13 @@ function mathilda_tools_controller() {
4243
$run_cron=true;
4344
}
4445
}
46+
// Cron Status
47+
if(isset($_GET['cronstatus'])) {
48+
if($_GET['cronstatus']=='true')
49+
{
50+
$cron_status=true;
51+
}
52+
}
4553
// Scripting
4654
if(isset($_GET['scripting'])) {
4755
if($_GET['scripting']=='true')
@@ -148,6 +156,8 @@ function mathilda_tools_controller() {
148156
function mathilda_tools() {
149157

150158
/* Dynamic Labels */
159+
160+
/* Import Status */
151161
$label_import_botton="";
152162
$label_import_status=get_option('mathilda_import_running');
153163
if($label_import_status==0) {
@@ -156,6 +166,15 @@ function mathilda_tools() {
156166
$label_import_botton="Status!";
157167
}
158168

169+
/* cron Status */
170+
$label_cronstatus_button="";
171+
$label_cronstatus_status=get_option('mathilda_cron_status');
172+
if($label_cronstatus_status==0) {
173+
$label_cronstatus_button="Activate!";
174+
} else {
175+
$label_cronstatus_button="Deactivate!";
176+
}
177+
159178
/* Headline */
160179
echo '<h1 class="mathilda_tools_headline">Tweets</h1>
161180
<p class="mathilda_tools_description">Mathilda Tools</p>';
@@ -193,6 +212,36 @@ function mathilda_tools() {
193212
}
194213
}
195214

215+
// Auto Load
216+
if(isset($_GET['cronstatus'])) {
217+
if($_GET['cronstatus']=='true')
218+
{
219+
$autoload_status=get_option('mathilda_cron_status');
220+
if($autoload_status) {
221+
update_option('mathilda_cron_status','0');
222+
$label_cronstatus_button="Activate!";
223+
echo '<div class="updated fade">
224+
<p><strong>Auto Load has been deactivated.</strong></p>
225+
</div>';
226+
} else {
227+
228+
$initial_load = get_option('mathilda_initial_load');
229+
if($initial_load==1) {
230+
update_option('mathilda_cron_status','1');
231+
$label_cronstatus_button="Deactivate!";
232+
echo '<div class="updated fade">
233+
<p><strong>Auto Load has been activated.</strong></p>
234+
</div>';
235+
} else {
236+
echo '<div class="notice notice-warning is-dismissible">
237+
<p><strong>Auto Load can still not be activated. You have to run an initial load manually first (Load Tweets).</strong></p>
238+
</div>';
239+
}
240+
241+
}
242+
}
243+
}
244+
196245
// Embed Reset
197246
if(isset($_GET['resetisconfirmed'])) {
198247
if($_GET['resetisconfirmed']=='true')
@@ -226,6 +275,16 @@ function mathilda_tools() {
226275
<a class="button" href="'.admin_url().'tools.php?page=mathilda-tools-menu&cron=true" >Run!</a>
227276
</td>
228277
</tr>
278+
279+
<!-- Status Cron -->
280+
<tr valign="top">
281+
<th scope="row">
282+
<label for="cron">Auto Load</label>
283+
</th>
284+
<td>
285+
<a class="button" href="'.admin_url().'tools.php?page=mathilda-tools-menu&cronstatus=true">'.$label_cronstatus_button.'</a>
286+
</td>
287+
</tr>
229288
230289
<!-- Load Twitter Export -->
231290
<tr valign="top">

mathilda_update.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,19 @@ function mathilda_update () {
194194
add_option('mathilda_import_filesize_max',"409600");
195195
}
196196

197+
/* Update Process Version 0.12 */
198+
if($mathilda_previous_version==14) {
199+
update_option('mathilda_plugin_version', "15");
200+
$cron_status='';
201+
$initial_load = get_option('mathilda_initial_load');
202+
if($initial_load==1) {
203+
$cron_status=1;
204+
} else {
205+
$cron_status=0;
206+
}
207+
add_option('mathilda_cron_status',$cron_status);
208+
}
209+
197210
}
198211
add_action( 'plugins_loaded', 'mathilda_update' );
199212

mathilda_utilities.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,18 @@ function mathilda_healthy_check() {
291291

292292
$output.='<br/>';
293293

294-
// 4. Info
294+
// 4. Info
295+
$cron_status=get_option('mathilda_cron_status');
296+
if($cron_status==0) {
297+
$output.='Auto Load is deactive.';
298+
}
299+
else {
300+
$output.='Auto Load is active.';
301+
}
302+
303+
$output.='<br/>';
304+
305+
// 5. Info
295306
$tweets_loaded=mathilda_tweets_count();
296307
if($tweets_loaded==0) {
297308
$output.='No Tweets are loaded.';

readme.md

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Mathilda copies your tweets from Twitter to WordPress continuously.
66

77
Mathilda is trying to give you back some control of your tweets. The plugin copies your tweets from Twitter continuously and saves them into the WordPress database. The tweets can be displayed on the blog chronologically (but do not have to). Indeed, Twitter is also blogging, micro-blogging so to speak.
88

9-
## Functions
9+
## Features
1010

1111
* Copy your tweets back
1212
* Copy your tweeted images back
@@ -16,6 +16,10 @@ Mathilda is trying to give you back some control of your tweets. The plugin copi
1616
* Export your tweets as CSV file
1717
* Languague: English, German (only FrontEnd)
1818

19+
## Future of this Plugin
20+
21+
As Twitter has decided to discontinue free access to the Twitter API, I have stopped using Twitter. This will also impact the future of this plugin. In the medium term the api request function to copy tweets will be removed from the plugin. Displaying of already received tweet data and the import of DSGVO Data Export will be further supported and maintained. The plugin features will be reduced to minimum. At the present time, the plugin is still be able to execute API Calls as the plugin is using the Twitter API Standard v1.1, which still is usable without payment. But that can change at any time.
22+
1923
## Installation
2024

2125
1. Download the plugin from the WordPress Plugin Repository
@@ -30,23 +34,6 @@ Mathilda is trying to give you back some control of your tweets. The plugin copi
3034
4. Run the initial load (Tools/Tweets)
3135
5. Create a WordPress page (page slug must match mathilda slug)
3236

33-
## CSS classes
34-
35-
All mathilda UI elements can be addressed with individual CSS selectors. Please use your debugger to find the right classes.
36-
37-
## Mathilda API
38-
39-
WordPress Action: mathilda_tweets_updated (fired on tweet update)
40-
41-
## Data & Files
42-
43-
Mathilda creates 4 folders within wp-content/uploads.
44-
45-
* mathilda-twitterapi = Archive of the Twitter API data
46-
* mathilda-images = Tweet Image Folder
47-
* mathilda-export = Export Directory
48-
* mathilda-import = Import Directory
49-
5037
## Supported Tweet Types
5138

5239
Following tweet types are supported.
@@ -66,12 +53,33 @@ Following tweet objects are supported.
6653
* Mentions
6754
* Galleries
6855

69-
## Mathilda Cron Jobs @ WordPress
56+
## Architecture
57+
58+
Data storage and process logic is separated from the WordPress Framework. The tweets are not saved in the table wp_posts. And Mathilda is not registering a custom post type for the tweets as well.
59+
60+
## CSS classes
61+
62+
All mathilda UI elements can be addressed with individual CSS selectors. Please use your debugger to find the right classes.
63+
64+
## Data & Files
65+
66+
Mathilda creates 4 folders within wp-content/uploads.
67+
68+
* mathilda-twitterapi = Archive of the Twitter API data
69+
* mathilda-images = Tweet Image Folder
70+
* mathilda-export = Export Directory
71+
* mathilda-import = Import Directory
72+
73+
## wpCrons
7074

7175
* Autoload Tweets (every 15 minutes, customizable)
7276
* Get Embedding Code from External Source (every 15 minutes, customizable)
7377
* Import Tweets (every Minute, if Import is running)
7478

79+
## Mathilda API
80+
81+
WordPress Action: mathilda_tweets_updated (fired on tweet update)
82+
7583
## Frequently Asked Questions
7684

7785
### Which Tweets are displayed in the blog?
@@ -137,10 +145,6 @@ Backlinks to Twitter will be declared as nofollow. This affects Hashtags, Mentio
137145
## How to split large JSON files?
138146
[JSON Splitter](https://www.unmus.de/wp-content/uploads/Mathilda-JSON-File-Split-EN.pdf)
139147

140-
## Live Demo
141-
142-
[Here!](https://www.unmus.de/tweets/)
143-
144148
## Branches
145149

146150
This repository follows the git-flow workflow to a large extent.
@@ -152,10 +156,9 @@ This repository follows the git-flow workflow to a large extent.
152156

153157
Hotfix and release branches will not be applied.
154158

155-
## Unterstanding the Deployment
159+
## Live Demo
156160

157-
Releases in the WordPress Plugin Directory will be processed via SVN.
158-
The Version-to-Ship will be created manually on GitHub. See Release Section.
161+
[Here!](https://www.unmus.de/tweets/)
159162

160163
## Built With
161164

@@ -172,6 +175,11 @@ This project is licensed under the GPL3 License.
172175

173176
## Changelog
174177

178+
### 0.12 "Alfred"
179+
180+
* April 2023
181+
* Feature: Deactivate regular API Request
182+
175183
### 0.11 "Alice"
176184

177185
* October 2020

0 commit comments

Comments
 (0)