Skip to content

Commit

Permalink
Updated to v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayan Datta committed Aug 11, 2020
1 parent 26e0ece commit a33889e
Show file tree
Hide file tree
Showing 33 changed files with 413 additions and 243 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.7.0
Release Date: August 11, 2020

* Improvement: Rewrite the plugin from scratch.
* Added: Templateting system to customize the output as you want.
* Added: A method to replace post published date with post modified date. It will only work on Single Post Page.
* Added: Some validations to check if the custom modified date is a valid past date.
* Added: An option to hide last modified info on various archives from plugin settings.
* Added: Dedicated CSS editor to enable syntax highlighting.
* Added: Option to show Last Modified Author Avatar using Elementor.
* Added: Lots of filters and hooks to make the plugin customizable.
* Tweak: Traditional Date Format and Time Format field is merged into one field.
* Tweak: Better theme (Astra & GeneratePress) compatibility.
* Tweak: Notification Email will only add an only valid email and this field is now not mandatory.
* Tweak: Modified Date Update is disabled for Scheduled and Draft Posts.
* Tweak: Modified info will be shown only if the Published date is not equal to the modified date.
* Tweak: CTRL+S will save the plugin settings automatically.
* Fixed: A bug where WooCommerce Product Modified Date is changed automatically even the Disabled option is checked.
* Fixed: Some CSS and JS issues.
* Various improvements introduced.
* Compatibility with WordPress v5.5.
* Plugin now strictly requires PHP v5.6 or higher.

## 1.6.6
Release Date: April 2, 2020

* NEW: Added Shortcode `[lmt-site-modified-info]` to display website modified time. It will trigger when a post is saved.
* NEW: Added a method to directly replace the post published date with post modified date. This feature may not work with some themes.
* Added: `%post_link%` variable to PHP Output Buffer replace process.
* Added: Ablity to sort posts on frontend by post modified date.
* Tweak: Removed the required from Noti Post Types fields as sometime it prevents plugin from save the data.
* Tweak: Form now "Text before Last Modified Info" fields do not support and HTML tags. You can use `post-last-modified-text` CSS class for posts, `page-last-modified-text` CSS class for pages and `tt-last-modified-text` CSS class for template tags to apply styles.
* Fixed: Properly sanitizes input and escapes the output to prevent a XSS vulnerability. Thanks to @Jeroen Mulder.
* Fixed: Some CSS and JS issues.
* Compatibilty with WordPress v5.4.

## 1.6.5
Release Date: December 21, 2019

Expand Down
35 changes: 18 additions & 17 deletions inc/Api/Callbacks/ManagerCallbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function enable_plugin( $args )
{
?><label class="switch">
<input type="checkbox" id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_enable_last_modified_cb]" value="1" <?php checked( $this->get_data( 'lmt_enable_last_modified_cb' ), 1 ); ?> />
<span class="cb-slider round"></span></label>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Enable this if you want to auto republish old posts of your blog.', 'wp-auto-republish' ); ?>"><span title="" class="dashicons dashicons-editor-help"></span></span>
<span class="cb-slider round"></span></label>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Enable this if you want to auto republish old posts of your blog.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicons dashicons-editor-help"></span></span>
<?php
}

Expand All @@ -45,7 +45,7 @@ public function display_method( $args )
echo '<option value="' . $item . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select where you want to show last modified info on a single posts. If you select \'Before Content or After Content\', you can disable auto insert on particular posts from post edit screen > WP Last Modified Info meta box and apply shortcode on that particular post, if you want to. \'Show on Homepage\' option is applicable for posts only.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select where you want to show last modified info on a single posts. If you select Before Content or After Content or Replace Method, you can disable auto insert on particular posts from post edit screen > WP Last Modified Info meta box and apply shortcode on that particular post.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

Expand All @@ -61,14 +61,14 @@ public function date_type( $args )
echo '<option value="' . $item . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select last modified date time format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

public function date_format( $args )
{
?><input id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_date_time_format]" type="text" style="width:25%;" placeholder="<?php _e( 'Default:', 'wp-auto-republish' ); ?> <?php echo get_option( 'date_format' ); ?>" value="<?php echo $this->get_data( 'lmt_date_time_format', get_option( 'date_format' ) ); ?>" />&nbsp;
<a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span></a>
?><input id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_date_time_format]" type="text" style="width:25%;" placeholder="<?php _e( 'Default:', 'wp-last-modified-info' ); ?> <?php echo get_option( 'date_format' ); ?>" value="<?php echo $this->get_data( 'lmt_date_time_format', get_option( 'date_format' ) ); ?>" />&nbsp;
<a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><span class="tooltip" title="<?php _e( 'Set post last modified date time format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span></a>
<?php
}

Expand Down Expand Up @@ -120,7 +120,7 @@ public function author_list( $args )
echo '<option value="' . $user->ID . '"' . $selected . '>' . $user->display_name . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select how you want to display last modified author name on posts.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select the author name which you want to display for all posts.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

Expand All @@ -142,21 +142,21 @@ public function archives( $args )
echo '<option value="' . $item . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;</span><span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;</span><span class="tooltip" title="<?php _e( 'Select the archives where you don\'t want to show last modified info.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

public function selectors( $args )
{
?><input id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_css_selectors]" type="text" style="width:90%;" value="<?php echo wp_kses_post( $this->get_data( 'lmt_css_selectors', 'ul li.meta-date' ) ); ?>" />&nbsp;
<span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<p><small><?php printf(__( 'Do not add %s tag. This tag is not required, as it is already added.', 'wp-last-modified-info' ), '<code>&lt;style&gt; &lt;/style&gt;</code>'); ?></small></p>
<span class="tooltip" title="<?php _e( 'Add the CSS selector to replace the post meta. It may not work for all themes. Please check before using it. If you n eed any help, please open a support ticket with your website URL.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

public function display_info( $args )
{
?><textarea id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_last_modified_info_template]" rows="6" cols="100" style="width:90%;"><?php echo esc_html( $this->get_data( 'lmt_last_modified_info_template' ) ); ?></textarea>
$default = '<p id="last-modified-info">Last Updated on %post_modified% by <a href="%author_url%" target="_blank" class="last-modified-author">%author_name%</a></p>';
?><textarea id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_last_modified_info_template]" rows="6" cols="100" style="width:90%;"><?php echo esc_html( $this->get_data( 'lmt_last_modified_info_template', $default ) ); ?></textarea>
<p>
<small style="line-height: 2;"><span style="font-style: italic;"><?php _e( 'Use these tags', 'wp-last-modified-info' ); ?></span> -
<code>&#37;author_name&#37;</code> <code>&#37;author_url&#37;</code> <code>&#37;author_email&#37;</code> <code>&#37;author_archive&#37;</code> <code>&#37;post_published&#37;</code> <code>&#37;post_link&#37;</code> <code>&#37;post_modified&#37;</code>
Expand All @@ -173,7 +173,7 @@ public function post_types( $args )
echo '<option value="' . $post_type . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select post types of which you want to republish.', 'wp-auto-republish' ); ?>"><span title="" class="dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select post types on which you want to show last modified info.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicons dashicons-editor-help"></span></span>
<?php
}
/* ==============================================================================================
Expand Down Expand Up @@ -224,7 +224,7 @@ public function theme_template_type( $args )
echo '<option value="' . $item . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Enable the GeneratePress Theme Support form here. It will replace the post meta published date with post modified date.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Set the template type from here to diaplay on post meta.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

Expand All @@ -240,14 +240,14 @@ public function template_date_type( $args )
echo '<option value="' . $item . '"' . $selected . '>' . $label . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select last modified date time format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

public function template_date_format( $args )
{
?><input id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_tt_set_format_box]" type="text" style="width:25%;" placeholder="<?php _e( 'Default:', 'wp-auto-republish' ); ?> <?php echo get_option( 'date_format' ); ?>" value="<?php echo $this->get_data( 'lmt_tt_set_format_box', get_option( 'date_format' ) ); ?>" />&nbsp;
<a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><span class="tooltip" title="<?php _e( 'Select last modified info format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span></a>
?><input id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_tt_set_format_box]" type="text" style="width:25%;" placeholder="<?php _e( 'Default:', 'wp-last-modified-info' ); ?> <?php echo get_option( 'date_format' ); ?>" value="<?php echo $this->get_data( 'lmt_tt_set_format_box', get_option( 'date_format' ) ); ?>" />&nbsp;
<a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><span class="tooltip" title="<?php _e( 'Set post last modified date time format from here.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span></a>
<?php
}

Expand Down Expand Up @@ -276,13 +276,14 @@ public function template_author_list( $args )
echo '<option value="' . $user->ID . '"' . $selected . '>' . $user->display_name . '</option>';
}
echo '</select>';
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select how you want to display last modified author name on posts.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
?>&nbsp;&nbsp;<span class="tooltip" title="<?php _e( 'Select the author name which you want to display for all posts.', 'wp-last-modified-info' ); ?>"><span title="" class="dashicon dashicons dashicons-editor-help"></span></span>
<?php
}

public function template_display_info( $args )
{
?><textarea id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_last_modified_info_template_tt]" rows="6" cols="100" style="width:90%;"><?php echo esc_html( $this->get_data( 'lmt_last_modified_info_template_tt' ) ); ?></textarea>
$default = '<p id="last-modified-info">Last Updated on %post_modified% by <a href="%author_url%" target="_blank" class="last-modified-author">%author_name%</a></p>';
?><textarea id="<?php echo $args['label_for']; ?>" name="lmt_plugin_global_settings[lmt_last_modified_info_template_tt]" rows="6" cols="100" style="width:90%;"><?php echo esc_html( $this->get_data( 'lmt_last_modified_info_template_tt', $default ) ); ?></textarea>
<p>
<small style="line-height: 2;"><span style="font-style: italic;"><?php _e( 'Use these tags', 'wp-last-modified-info' ); ?></span> -
<code>&#37;author_name&#37;</code> <code>&#37;author_url&#37;</code> <code>&#37;author_email&#37;</code> <code>&#37;author_archive&#37;</code> <code>&#37;post_published&#37;</code> <code>&#37;post_link&#37;</code> <code>&#37;post_modified&#37;</code>
Expand Down
4 changes: 2 additions & 2 deletions inc/Base/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function __construct()
$this->plugin_path = plugin_dir_path( $this->dirname_r( __FILE__, 2 ) );
$this->plugin_url = plugin_dir_url( $this->dirname_r( __FILE__, 2 ) );
$this->plugin = plugin_basename( $this->dirname_r( __FILE__, 3 ) ) . '/wp-last-modified-info.php';
$this->version = '1.7.0 Beta 2';
$this->debug = true;
$this->version = '1.7.0';
$this->debug = false;
$this->name = 'WP Last Modified Info';
}

Expand Down
2 changes: 2 additions & 0 deletions inc/Base/DonateNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ public function dismiss_notice()
private function calculate_time()
{
$installed_time = get_option( 'wplmi_plugin_installed_time_donate' );

if ( ! $installed_time ) {
$installed_time = time();
update_option( 'wplmi_plugin_installed_time_donate', $installed_time );
}

return $installed_time;
}
}
2 changes: 1 addition & 1 deletion inc/Base/MiscActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function run_upgrade_action( $upgrader_object, $options )
// Iterate through the plugins being updated and check if ours is there
foreach( $options['plugins'] as $plugin ) {
if ( $plugin === $this->plugin ) {
$this->do_action( 'plugin_updated', $this->version, $options['translations']['version'] );
$this->do_action( 'plugin_updated', $this->version, $options );
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions inc/Base/RatingNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ public function dismiss_notice()
private function calculate_time()
{
$installed_time = get_option( 'wplmi_plugin_installed_time' );
if ( ! $installed_time ) {

if ( ! $installed_time ) {
$installed_time = time();
update_option( 'wplmi_plugin_installed_time', $installed_time );
}
}

return $installed_time;
}
}
20 changes: 12 additions & 8 deletions inc/Base/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class Uninstall
/**
* Run plugin uninstallation process.
*/
public static function uninstall() {
public static function uninstall()
{
$option_name = 'lmt_plugin_global_settings';

if ( ! is_multisite() ) {
$options = get_option( $option_name );
if ( isset( $options['lmt_del_plugin_data_cb'] ) && $options['lmt_del_plugin_data_cb'] == 1 ) {
Expand Down Expand Up @@ -57,12 +59,14 @@ public static function uninstaller()
];

$posts = get_posts( $args );
foreach( $posts as $post ) {
delete_post_meta( $post->ID, '_lmt_disable' );
delete_post_meta( $post->ID, '_lmt_disableupdate' );
delete_post_meta( $post->ID, '_wplmi_last_modified' );
delete_post_meta( $post->ID, 'wp_last_modified_info' );
delete_post_meta( $post->ID, 'wplmi_shortcode' );
}
if ( ! empty( $posts ) ) {
foreach ( $posts as $post ) {
delete_post_meta( $post->ID, '_lmt_disable' );
delete_post_meta( $post->ID, '_lmt_disableupdate' );
delete_post_meta( $post->ID, '_wplmi_last_modified' );
delete_post_meta( $post->ID, 'wp_last_modified_info' );
delete_post_meta( $post->ID, 'wplmi_shortcode' );
}
}
}
}
10 changes: 8 additions & 2 deletions inc/Core/AdminBar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Show Original Republish Data.
* Shows last modified info on admin bar.
*
* @since 1.7.0
* @package WP Last Modified Info
Expand All @@ -16,7 +16,7 @@
defined( 'ABSPATH' ) || exit;

/**
* Republish info class.
* Admin Bar class.
*/
class AdminBar
{
Expand Down Expand Up @@ -74,6 +74,9 @@ public function admin_bar( $wp_admin_bar )
$wp_admin_bar->add_node( $args );
}

/**
* Generate title to show on admin bar
*/
private function title()
{
// retrive date time formats
Expand All @@ -87,6 +90,9 @@ private function title()
return sprintf( __( 'Updated %s ago', 'wp-last-modified-info' ), human_time_diff( get_the_modified_time( 'U' ), $cur_time ) );
}

/**
* Generate revision url to show on admin bar
*/
private function revision()
{
global $post;
Expand Down
Loading

0 comments on commit a33889e

Please sign in to comment.