| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
/* |
| 4 |
Plugin Name: Admin Page Spider |
| 5 |
Plugin URI: https://j7digital.com/admin-page-spider |
| 6 |
Description: Adds menus to the admin bar which gives you quick access to view or edit any page available on the website. |
| 7 |
Author: J7Digital |
| 8 |
Version: 1.04 |
| 9 |
Author URI: https://j7digital.com/admin-page-spider |
| 10 |
Text Domain: admin-page-spider |
| 11 |
Domain Path: /languages |
| 12 |
License: GPLv2 or later |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or |
| 15 |
modify it under the terms of the GNU General Public License |
| 16 |
as published by the Free Software Foundation; either version 2 |
| 17 |
of the License, or (at your option) any later version. |
| 18 |
|
| 19 |
This program is distributed in the hope that it will be useful, |
| 20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
GNU General Public License for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public License |
| 25 |
along with this program; if not, write to the Free Software |
| 26 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 27 |
*/ |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
// Load settings page |
| 32 |
include_once 'apspider-adminsettings.php'; |
| 33 |
|
| 34 |
// Loads functions & menus |
| 35 |
include_once 'apspider-functions.php'; |
| 36 |
|
| 37 |
add_action ( 'plugins_loaded' , 'page_spider_textdomain' ); |
| 38 |
|
| 39 |
function page_spider_textdomain () { |
| 40 |
load_plugin_textdomain( 'admin-page-spider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
| 41 |
} |
| 42 |
|
| 43 |
// Defines activation & deactivation functions |
| 44 |
register_deactivation_hook( __FILE__, 'apspider_plugin_deactivate' ); |
| 45 |
register_activation_hook( __FILE__, 'apspider_plugin_activate' ); |
| 46 |
|
| 47 |
// Deletes all settings upon plugin deactivation |
| 48 |
function apspider_plugin_deactivate(){ |
| 49 |
if ( ! current_user_can( 'activate_plugins' ) ) |
| 50 |
return; |
| 51 |
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : ''; |
| 52 |
check_admin_referer( "deactivate-plugin_{$plugin}" ); |
| 53 |
|
| 54 |
// Include the array of settings |
| 55 |
include('apspider-adminfieldsarray.php'); |
| 56 |
// Cycle through the array & delete all options |
| 57 |
foreach( $fields as $field ){ |
| 58 |
delete_option($field['uid'] ); |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
// Adds all options upon plugin activation |
| 63 |
function apspider_plugin_activate(){ |
| 64 |
if ( ! current_user_can( 'activate_plugins' ) ) |
| 65 |
return; |
| 66 |
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : ''; |
| 67 |
check_admin_referer( "activate-plugin_{$plugin}" ); |
| 68 |
|
| 69 |
// Include the array of settings |
| 70 |
include('apspider-adminfieldsarray.php'); |
| 71 |
// Cycle through the array and add all options |
| 72 |
foreach( $fields as $field ){ |
| 73 |
add_option( $field['uid'], $field['default']); |
| 74 |
} |
| 75 |
} |
| 76 |
|