Skip to content

Commit

Permalink
Release 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
circuscode committed Feb 4, 2017
1 parent 4614c83 commit 7f91ef7
Show file tree
Hide file tree
Showing 18 changed files with 848 additions and 429 deletions.
245 changes: 88 additions & 157 deletions mathilda.php

Large diffs are not rendered by default.

32 changes: 29 additions & 3 deletions mathilda_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function mathilda_cron_script() {
*/

echo '
<h1 class="mathilda_tools_headline">Mathilda Cron</h1>
<h1 class="mathilda_tools_headline">Load Tweets</h1>
<p class="mathilda_tools_description">Output</p>';

/*
Expand Down Expand Up @@ -323,14 +323,38 @@ function mathilda_cron_script() {

/* Tweets */

$tweet_truncate="FALSE";
$tweet_reply="FALSE";
$tweet_retweet="FALSE";
$tweet_quote="FALSE";

if(isset($items['retweeted_status'])) {
$tweet_retweet="TRUE";
}
if($items['truncated']=='true') {
$tweet_truncate="TRUE";
}
if($items['in_reply_to_status_id']!=null) {
$tweet_reply="TRUE";
}
if(isset($items['quoted_status_id'])) {
$tweet_quote="TRUE";
}

// if(isset($items['entities']['media']))

$tweet_cache[]=array($num_tweets,
$items['id_str'],
$items['text'],
$items['created_at'],
$hashtags_yes_or_no,
$mentions_yes_or_no,
$media_yes_or_no,
$urls_yes_or_no
$urls_yes_or_no,
$tweet_truncate,
$tweet_reply,
$tweet_retweet,
$tweet_quote
);

/* Prepare Next Tweet Loop */
Expand Down Expand Up @@ -388,7 +412,7 @@ function mathilda_cron_script() {

/* Save Tweet @ MySQL */

mathilda_add_tweets($tweet_cache[$i][1],$tweet_cache[$i][2],$dateconverted,$tweet_cache[$i][4],$tweet_cache[$i][5], $tweet_cache[$i][6], $tweet_cache[$i][7]);
mathilda_add_tweets($tweet_cache[$i][1],$tweet_cache[$i][2],$dateconverted,$tweet_cache[$i][4],$tweet_cache[$i][5], $tweet_cache[$i][6], $tweet_cache[$i][7], $tweet_cache[$i][8], $tweet_cache[$i][9], $tweet_cache[$i][10], $tweet_cache[$i][11]);
if ($i==0) { echo '<h2>Tweet Import</h2>'; }
echo ($i+1) . ': Tweet ' . $tweet_cache[$i][1] . ' added.<br/>';
}
Expand Down Expand Up @@ -448,8 +472,10 @@ function mathilda_cron_script() {
if($initial_load == 0) { update_option('mathilda_initial_load', 1); }
$latest_tweet=mathilda_latest_tweet();
$number_of_tweets=mathilda_tweets_count();
$number_of_select=mathilda_select_count();
update_option('mathilda_latest_tweet', $latest_tweet);
update_option('mathilda_tweets_count', $number_of_tweets);
update_option('mathilda_select_amount', $number_of_select);

/*
Close
Expand Down
42 changes: 36 additions & 6 deletions mathilda_dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,42 @@ function register_mathilda_dashboard_widget_reporting() {

// Mathilda Dashboard User Interface
function mathilda_dashboard_widget_reporting_display() {
echo '<p>Hello, I am Mathilda and you have posted the following.</p>';
echo '<p>' . mathilda_tweets_count() . " Tweets<br/>";
echo mathilda_images_count() . " Images<br/>";
echo mathilda_mentions_count() . " Mentions<br/>";
echo mathilda_hashtags_count() . " Hashtags<br/>";
echo mathilda_urls_count() . " Links</p>";

if(mathilda_select_count()==0) {
echo '<p>Hello, I am Mathilda and I will show you some tweet statistics here, after you have loaded your tweets with me.</p>';
} else {
echo '<p>Hello, I am Mathilda and you have posted the following.</p>';
echo '<table>';
echo '<tr><td>' . mathilda_tweets_count() . '&nbsp;&nbsp;&nbsp;</td><td>Tweets</td></tr>';
echo '<tr><td>' . mathilda_retweets_count() . '</td><td>Retweets</td></tr>';
echo '<tr><td>' . mathilda_replies_count() . '</td><td>Replies</td></tr>';
echo '<tr><td>' . mathilda_quotes_count() . '</td><td>Quotes</td></tr>';
echo '<tr><td>' . mathilda_images_count() . '</td><td>Images</td></tr>';
echo '<tr><td>' . mathilda_mentions_count() . '&nbsp;&nbsp;&nbsp;</td><td>Mentions</td></tr>';
echo '<tr><td>' . mathilda_hashtags_count() . '&nbsp;&nbsp;&nbsp;</td><td>Hashtags</td></tr>';
echo '<tr><td>' . mathilda_urls_count() . '</td><td>Links</td></tr>';
echo '</table>';
}
}

// mathilda_update_notice
// The function brings a message, if activites are required
// Input: none
// Output: none

function mathilda_update_notice(){
global $pagenow;
if ( $pagenow == 'index.php' OR $pagenow == 'tools.php' OR $pagenow == 'options-general.php' OR $pagenow == 'plugins.php') {
if(get_option('mathilda_plugin_version')==7) {
if(mathilda_update_seven_aftercheck()==false) {
echo '<div class="notice notice-warning is-dismissible"><p>';
echo 'Mathilda Update Notice: Please reset Mathilda and reload your data from twitter! <a href="'.admin_url().'tools.php?page=mathilda-tools-menu">Yes, I do it now!</a>';
echo '</p></div>';
}
}
}
}

add_action('admin_notices', 'mathilda_update_notice');

?>
Loading

0 comments on commit 7f91ef7

Please sign in to comment.