-
Notifications
You must be signed in to change notification settings - Fork 0
/
log-favorite-posts.php
74 lines (62 loc) · 2.29 KB
/
log-favorite-posts.php
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
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation function and defines a function that starts the plugin.
*
* @since 1.0.0
* @package LOG_FAVORITE_POSTS
*
* @wordpress-plugin
* Plugin Name: Log Favorite Posts
* Plugin URI: https://github.com/jairoprez
* Description: Allows users to add favorite posts
* Version: 1.0.0
* Author: Jairo Pérez
* Author URI: https://github.com/jairoprez
* Text Domain: log-favorite-posts
* License: GPL-3.0+
*/
namespace LogFavoritePosts;
use LogFavoritePosts\Includes\Log_Favorite_Posts_Button_Display;
use LogFavoritePosts\Includes\My_REST_Favorite_Posts_Controller;
use LogFavoritePosts\Includes\Log_Favorite_Posts_Widget;
use LogFavoritePosts\Includes\Log_Favorite_Posts_Shortcode;
// Prevent this file from being called directly.
defined('WPINC') || die;
/**
* Define constants
*/
define( 'LOG_FAVORITE_POSTS_VERSION', '1.0.0' );
define( 'LOG_FAVORITE_POSTS_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'LOG_FAVORITE_POSTS_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
// Include the autoloader so we can dynamically include the rest of the classes.
require_once LOG_FAVORITE_POSTS_PLUGIN_DIR . '/lib/autoloader.php';
/**
* Instantiates the main class and initializes the plugin.
*/
function log_favorite_posts_start() {
load_log_favorite_posts_textdomain();
$log_favorite_posts = new Log_Favorite_Posts_Button_Display();
$log_favorite_posts->initialize();
$controller = new My_REST_Favorite_Posts_Controller();
$controller->initialize();
$log_favorite_posts_shortcode = new Log_Favorite_Posts_Shortcode();
$log_favorite_posts_shortcode->initialize();
}
log_favorite_posts_start();
add_action( 'widgets_init', function() {
register_widget( 'LogFavoritePosts\Includes\Log_Favorite_Posts_Widget' );
});
/**
* Load plugin textdomain.
*/
function load_log_favorite_posts_textdomain() {
load_plugin_textdomain(
'log-favorite-posts',
false,
plugin_basename( LOG_FAVORITE_POSTS_PLUGIN_DIR ) . '/languages'
);
}