-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch-jft-plugin.php
More file actions
82 lines (69 loc) · 2.29 KB
/
fetch-jft-plugin.php
File metadata and controls
82 lines (69 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Plugin Name: Fetch JFT
* Plugin URI: https://wordpress.org/plugins/fetch-jft/
* Description: This is a plugin that fetches the Just For Today from NAWS and puts it on your site Simply add [jft] shortcode to your page. Fetch JFT Widget can be added to your sidebar or footer as well.
* Install: Drop this directory into the "wp-content/plugins/" directory and activate it.
* Contributors: pjaudiomv, bmltenabled
* Authors: bmltenabled
* Version: 1.9.2
* Requires PHP: 7.3
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: fetch-jft
* Domain Path: /languages
*/
namespace Jft;
if (! defined('WPINC')) {
die;
}
spl_autoload_register(function (string $class) {
if (strpos($class, 'Jft\\') === 0) {
$class = str_replace('Jft\\', '', $class);
require __DIR__ . '/src/' . str_replace('\\', '/', $class) . '.php';
}
});
class FetchJFTPlugin
{
private static $instance = null;
public function __construct()
{
add_action('init', [$this, 'pluginSetup']);
}
public function pluginSetup()
{
load_plugin_textdomain('fetch-jft', false, dirname(plugin_basename(__FILE__)) . '/languages');
if (is_admin()) {
add_action('admin_menu', [$this, 'optionsMenu']);
} else {
add_action('wp_enqueue_scripts', [$this, 'assets']);
add_shortcode('jft', [$this, 'reading']);
add_action('widgets_init', function () {
register_widget(Widget::class);
});
}
}
public function optionsMenu()
{
$dashboard = new Dashboard();
$dashboard->createMenu(plugin_basename(__FILE__));
}
public function reading($atts)
{
$reading = new Reading();
return $reading->renderReading($atts);
}
public function assets()
{
wp_enqueue_style("jftcss", plugin_dir_url(__FILE__) . "css/jft.css", false, filemtime(plugin_dir_path(__FILE__) . "css/jft.css"), false);
}
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
}
FetchJFTPlugin::getInstance();
;