PluginProbe
Auto Update Post Date / 1.1.2
Auto Update Post Date v1.1.2
1.1.2 1.1.1 trunk 1.0.0 1.0.1 1.0.2 1.1.0
auto-update-post-date / auto-update-post-date.php

auto-update-post-date.php in Auto Update Post Date 1.1.2, at auto-update-post-date.php

78 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Auto Update Post Date
4 Description: Keep your WordPress content evergreen with Auto Update Post Date – a simple WP plugin designed to effortlessly update your posts and boost SEO. Bid farewell to outdated information as this plugin takes care of the heavy lifting for you!
5 Version: 1.1.2
6 Author: Temak
7 Author URI: https://temak.dev
8 Plugin URI: https://github.com/git-temak/auto-update-post-date
9 License: GPL3 or later
10 License URI: https://www.gnu.org/licenses/gpl-3.0.html
11 Text Domain: auto-update-post-date
12 Domain Path: /languages
13
14 */
15
16 // Exit if accessed directly
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 require __DIR__ . '/inc/auto-update-post-date-runner.php';
22
23 // Add menu page
24 if( !function_exists('tmaupd_menu_page') ){
25 function tmaupd_menu_page() {
26 add_submenu_page(
27 'tools.php',
28 'Auto Update Post Date Settings',
29 'Auto Update Post Date',
30 'manage_options',
31 'tmaupd-settings',
32 'tmaupd_render_page'
33 );
34 }
35 }
36
37 add_action('admin_menu', 'tmaupd_menu_page');
38
39 // log events to file
40 function tmaupd_log_updates($log, $date = true){
41 $filename = plugin_dir_path(__FILE__). 'aupd_log.txt';
42 if ($date){
43 file_put_contents($filename, $log . ' - ' . date('Y-m-d H:i:s') . "\n\n", FILE_APPEND);
44 } else {
45 file_put_contents($filename, $log . "\n\n", FILE_APPEND);
46 }
47 }
48
49 // Load script and styles
50 function tmaupd_load_scripts_styles($hook)
51 {
52 // only load on the plugin settings page
53 if ('tools_page_tmaupd-settings' !== $hook) {
54 return;
55 }
56
57 wp_enqueue_script('cs-jsDatetimePicker', plugin_dir_url(__FILE__) . 'inc/jquery.datetimepicker.full.min.js', array('jquery'), '1.0.0', true);
58 wp_enqueue_style('cs-jsDatetimePickerStyle', plugin_dir_url(__FILE__) . 'inc/jquery.datetimepicker.min.css', array(), '1.0.0', 'all');
59 wp_enqueue_script('tmaupdscript', plugin_dir_url(__FILE__) . 'inc/aupd.js', array('jquery'), '1.0.1', true);
60 wp_enqueue_style('tmaupdstyles', plugin_dir_url(__FILE__) . 'inc/aupd.css', array(), '1.0.1', 'all');
61 }
62
63 add_action('admin_enqueue_scripts', 'tmaupd_load_scripts_styles');
64
65 // plugin uninstallation
66 register_uninstall_hook( __FILE__, 'tmaupd_plugin_uninstall' );
67 function tmaupd_plugin_uninstall() {
68 $aupd_plugin_settings = get_option('tmaupd_settings_all_options');
69
70 // delete all saved plugin options on uninstall
71 foreach ($aupd_plugin_settings as $aupd_setting){
72 delete_option( $aupd_setting );
73 }
74
75 delete_option('tmaupd_settings_all_options');
76 }
77
78 ?>