Skip to content

Commit

Permalink
WP Admin Microblog 3.0.4
Browse files Browse the repository at this point in the history
* Changed: Text domain switched to wp-admin-microblog
* Changed: Ajax requests now generated via WordPress API
  • Loading branch information
winkm89 committed Sep 16, 2016
1 parent 800947f commit c56b5c5
Show file tree
Hide file tree
Showing 24 changed files with 1,447 additions and 1,255 deletions.
27 changes: 0 additions & 27 deletions ajax.php

This file was deleted.

4 changes: 2 additions & 2 deletions core/class-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static function new_message_check($p_id) {
$p_id = intval($p_id);
$test = intval( $wpdb->get_var("SELECT COUNT(*) FROM " . WPAM_ADMIN_BLOG_POSTS . " WHERE `post_ID` > '$p_id'") );
if ( $test !== 0 ) {
echo __('New messages available','wp_admin_blog');
echo __('New messages available','wp-admin-microblog');
}
}

Expand Down Expand Up @@ -59,7 +59,7 @@ public static function show_likes ($message_id) {
echo '<html>';
echo '<head>';
echo '<meta charset="utf-8">';
echo '<title>teachPress - Assessment details</title>';
echo '<title>List of likes</title>';
echo '</head>';
echo '<body>';
echo '<div id="content">';
Expand Down
22 changes: 11 additions & 11 deletions core/class-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function message ($message, $tags, $user_info, $options, $level =
$r = '<div id="wp_admin_blog_message_' . $message->post_ID . '" class="wpam-blog-message">
<div class="wpam-message-info-row">
<div class="wpam-message-info-details">
' . self::date($message->date, $options) . ' | ' . __('by','wp_admin_blog') . ' ' . $user_info->display_name . self::replies_menu ($message, $count_rep) . '
' . self::date($message->date, $options) . ' | ' . __('by','wp-admin-microblog') . ' ' . $user_info->display_name . self::replies_menu ($message, $count_rep) . '
</div>
<div class="wpam-message-info-likes">
' . self::like_menu($message) . '
Expand All @@ -49,7 +49,7 @@ public static function like_menu ($message) {
if ( $number > 0 ) {
$hidden = '';
}
$like_menu = '<a class="wpam-like-star dashicons-before dashicons-star-filled ' . $hidden . '" id="wpam_like_' . $message->post_ID . '" message_id="' . $message->post_ID . '" href="' . plugins_url() . '/wp-admin-microblog/ajax.php?like_id=' . $message->post_ID . '" title="' . __('Show Likes','wp_admin_blog') . '">' . $number . '</a>';
$like_menu = '<a class="wpam-like-star dashicons-before dashicons-star-filled ' . $hidden . '" id="wpam_like_' . $message->post_ID . '" message_id="' . $message->post_ID . '" href="' . admin_url( 'admin-ajax.php' ) . '?action=wp_admin_blog&like_id=' . $message->post_ID . '" title="' . __('Show Likes','wp-admin-microblog') . '">' . $number . '</a>';
return $like_menu;
}

Expand All @@ -62,7 +62,7 @@ public static function like_menu ($message) {
*/
public static function replies_menu ($message, $count_rep) {
if ($count_rep != 0) {
return ' | <a href="admin.php?page=wp-admin-microblog/wp-admin-microblog.php&amp;rpl=' . $message->post_parent . '" title="' . _n( 'One Reply', $count_rep . ' Replies', $count_rep, 'wp_admin_blog' ) . '">' . $count_rep . ' ' . __( 'Replies', 'wp_admin_blog' ) . '</a>';
return ' | <a href="admin.php?page=wp-admin-microblog/wp-admin-microblog.php&amp;rpl=' . $message->post_parent . '" title="' . _n( 'One Reply', $count_rep . ' Replies', $count_rep, 'wp-admin-microblog' ) . '">' . $count_rep . ' ' . __( 'Replies', 'wp-admin-microblog' ) . '</a>';
}
return '';
}
Expand Down Expand Up @@ -100,32 +100,32 @@ public static function action_menu ($message, $user_info, $options, $level = 1)
$sticky_option = '';
if ( current_user_can( 'use_wp_admin_microblog_sticky' ) && $options['sticky_for_dash'] === true && $level == 1 ) {
if ( $message->is_sticky == 0 ) {
$sticky_option = '<a class="wpam-sticky-button dashicons-before dashicons-admin-post" href="' . $link_sticky . '" title="' . __('Sticky this message','wp_admin_blog') . '" >' . __('Sticky','wp_admin_blog') . '</a> | ';
$sticky_option = '<a class="wpam-sticky-button dashicons-before dashicons-admin-post" href="' . $link_sticky . '" title="' . __('Sticky this message','wp-admin-microblog') . '" >' . __('Sticky','wp-admin-microblog') . '</a> | ';
}
else {
$sticky_option = '<a class="wpam-sticky-button dashicons-before dashicons-admin-post" href="' . $link_unsticky . '" title="' . __('Unsticky this message','wp_admin_blog') . '">' . __('Unsticky','wp_admin_blog') . '</a> | ';
$sticky_option = '<a class="wpam-sticky-button dashicons-before dashicons-admin-post" href="' . $link_unsticky . '" title="' . __('Unsticky this message','wp-admin-microblog') . '">' . __('Unsticky','wp-admin-microblog') . '</a> | ';
}
}

// Show message edit options if the user is the author of the message or the blog admin
if ( $message->user == $options['user'] || current_user_can('manage_options') ) {

// Edit button
$edit_button .= '<a class="wpam_message_edit dashicons-before dashicons-welcome-write-blog" id="wpam_message_edit_' . $message->post_ID . '" message_id="' . $message->post_ID . '" style="cursor:pointer;" title="' . __('Edit this message','wp_admin_blog') . '">' . __('Edit','wp_admin_blog') . '</a> | ';
$edit_button .= '<a class="wpam_message_edit dashicons-before dashicons-welcome-write-blog" id="wpam_message_edit_' . $message->post_ID . '" message_id="' . $message->post_ID . '" style="cursor:pointer;" title="' . __('Edit this message','wp-admin-microblog') . '">' . __('Edit','wp-admin-microblog') . '</a> | ';

// Sticky button
$edit_button .= $sticky_option;

// Delete button
$edit_button .= '<a class="wpam-delete-button dashicons-before dashicons-dismiss" href="' . $link_delete . '" title="' . __('Click to delete this message','wp_admin_blog') . '" style="color:#FF0000">' . __('Delete','wp_admin_blog') . '</a> | ';
$edit_button .= '<a class="wpam-delete-button dashicons-before dashicons-dismiss" href="' . $link_delete . '" title="' . __('Click to delete this message','wp-admin-microblog') . '" style="color:#FF0000">' . __('Delete','wp-admin-microblog') . '</a> | ';
}

// Reply button
$edit_button .= '<a class="wpam-reply-button dashicons-before dashicons-format-chat" onclick="javascript:wpam_replyMessage(' . $message->post_ID . ',' . $message->post_parent . ',' . "'" . $options['auto_reply'] . "'" . ',' . "'" . $user_info->user_login . "'" . ')" style="cursor:pointer; color:#009900;" title="' . __('Write a reply','wp_admin_blog') . '"> ' . __('Reply','wp_admin_blog') . '</a>';
$edit_button .= '<a class="wpam-reply-button dashicons-before dashicons-format-chat" onclick="javascript:wpam_replyMessage(' . $message->post_ID . ',' . $message->post_parent . ',' . "'" . $options['auto_reply'] . "'" . ',' . "'" . $user_info->user_login . "'" . ')" style="cursor:pointer; color:#009900;" title="' . __('Write a reply','wp-admin-microblog') . '"> ' . __('Reply','wp-admin-microblog') . '</a>';

// Like button
$check = wpam_likes::check_like($message->post_ID, $current_user->ID);
$title = ( $check === false ) ? __('Like','wp_admin_blog') : __('Unlike','wp_admin_blog');
$title = ( $check === false ) ? __('Like','wp-admin-microblog') : __('Unlike','wp-admin-microblog');
$class = ( $check === false ) ? 'dashicons-star-filled' : 'dashicons-star-empty';
$edit_button .= ' | <a class="dashicons-before ' . $class . ' wpam_message_like" id="wpam_like_button_' . $message->post_ID . '" message_id="' . $message->post_ID . '" style="cursor:pointer;" title="' . $title . '">' . $title . '</a>';

Expand All @@ -143,7 +143,7 @@ public static function date ($post_time, $options) {
$timestamp = mktime($time[0][3], $time[0][4], $time[0][5], $time[0][1], $time[0][2], $time[0][0] );

// get human time difference
$time_difference = human_time_diff( $timestamp, current_time('timestamp') ) . ' ' . __( 'ago', 'wp_admin_blog' );
$time_difference = human_time_diff( $timestamp, current_time('timestamp') ) . ' ' . __( 'ago', 'wp-admin-microblog' );

// get time
$message_time = date($options['wp_time_format'], $timestamp);
Expand All @@ -153,7 +153,7 @@ public static function date ($post_time, $options) {

// handle date formats
if ( date($options['wp_date_format']) == $message_date ) {
$message_date = __('Today','wp_admin_blog');
$message_date = __('Today','wp-admin-microblog');
}

// end result
Expand Down
10 changes: 5 additions & 5 deletions core/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ private static function send_notifications($text, $user) {
$text = wpam_message::replace_bbcode($text, 'delete');
$text = str_replace("<br />","",$text);
$text = str_replace('(file://)', 'http://', $text);
$text = __('Author:','wp_admin_blog') . ' ' . $user->display_name . chr(13) . chr(10) . chr(13) . chr(10) . $text;
$text = $text . chr(13) . chr(10) . '________________________' . chr(13) . chr(10) . __('Login under the following address to create a reply:','wp_admin_blog') . ' ' . wp_login_url();
$text = __('Author:','wp-admin-microblog') . ' ' . $user->display_name . chr(13) . chr(10) . chr(13) . chr(10) . $text;
$text = $text . chr(13) . chr(10) . '________________________' . chr(13) . chr(10) . __('Login under the following address to create a reply:','wp-admin-microblog') . ' ' . wp_login_url();

$headers = 'From: ' . get_bloginfo() . ' <' . get_bloginfo('admin_email') . '>' . "\r\n\\";
$subject = get_bloginfo() . ': ' .__('New message in wp admin micoblog','wp_admin_blog');
$subject = get_bloginfo() . ': ' .__('New message in wp admin micoblog','wp-admin-microblog');

$sql = "SELECT DISTINCT user FROM " . WPAM_ADMIN_BLOG_POSTS ."";
$users = $wpdb->get_results($sql);
Expand Down Expand Up @@ -280,7 +280,7 @@ static function update_sticky($message_ID, $is_sticky) {
*/
static function add_as_wp_post ($content, $title, $author_id) {
if ($title == '') {
$title = __('Short message','wp_admin_blog');
$title = __('Short message','wp-admin-microblog');
}
$content = str_replace('(file://)', 'http://', $content);
$message = array(
Expand Down Expand Up @@ -398,7 +398,7 @@ private static function replace_tags ($text, $tags) {
$name = trim($name);
foreach ($tags as $tag) {
if ($tag['name'] == $name) {
$text = str_replace($match[0][$x], ' <a href="admin.php?page=wp-admin-microblog/wp-admin-microblog.php&amp;tag=' . $tag['tag_ID'] . '" title="' . __('Show related messages','wp_admin_blog') . '">#' . $tag['name'] . '</a> ', $text);
$text = str_replace($match[0][$x], ' <a href="admin.php?page=wp-admin-microblog/wp-admin-microblog.php&amp;tag=' . $tag['tag_ID'] . '" title="' . __('Show related messages','wp-admin-microblog') . '">#' . $tag['name'] . '</a> ', $text);
}
}
}
Expand Down
Loading

0 comments on commit c56b5c5

Please sign in to comment.