-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass-facebook-scrape-admin.php
More file actions
116 lines (102 loc) · 2.59 KB
/
class-facebook-scrape-admin.php
File metadata and controls
116 lines (102 loc) · 2.59 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* Facebook Scrape.
*
* @package Facebook_Scrape
* @author Pulpmedia <simon@pulpmedia.at>
* @license GPL-2.0+
* @link http://pulpmedia.at
* @copyright 2015 Pulpmedia
*/
/**
* PM_Facebook_Scrape_Admin class.
*
* Main Admin Class
*
* @package PM_Facebook_Scrape_Admin
* @author Pulpmedia <simon@pulpmedia.at>
*/
class PM_Facebook_Scrape_Admin {
/**
* Instance of this class.
*
* @since 1.0.0
*
* @var object
*/
protected static $instance = null;
/**
* Slug of the plugin screen.
*
* @since 1.0.0
*
* @var string
*/
protected $plugin_screen_hook_suffix = null;
/**
* Initialize the plugin by loading admin scripts & styles and adding a
* settings page and menu.
*
* @since 1.0.0
*/
private function __construct() {
// Add the options page and menu item.
add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
// Add an action link pointing to the options page.
$plugin_basename = plugin_basename( plugin_dir_path( __FILE__ ) . PM_Facebook_Scrape::SLUG . '.php' );
add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
}
/**
* Return an instance of this class.
*
* @since 1.0.0
*
* @return object A single instance of this class.
*/
public static function get_instance() {
// If the single instance hasn't been set, set it now.
if ( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 1.0.0
*/
public function add_plugin_admin_menu() {
/*
* Add a settings page for this plugin to the Settings menu.
*
*/
$this->plugin_screen_hook_suffix = add_options_page(
__( 'Facebook Scrape', PM_Facebook_Scrape::SLUG ),
__( 'Facebook Scrape', PM_Facebook_Scrape::SLUG ),
'manage_options',
PM_Facebook_Scrape::SLUG,
array( $this, 'display_plugin_admin_page' )
);
}
/**
* Render the settings page.
*
* @since 1.0.0
*/
public function display_plugin_admin_page() {
include_once( 'views/admin.php' );
}
/**
* Add settings action link to the plugins page.
*
* @since 1.0.0
*/
public function add_action_links( $links ) {
return array_merge(
array(
'settings' => '<a href="' . admin_url( 'options-general.php?page=' . PM_Facebook_Scrape::SLUG ) . '">' . __( 'Settings', PM_Facebook_Scrape::SLUG ) . '</a>'
),
$links
);
}
}