This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genesis-featured-page-advanced.php
executable file
·79 lines (63 loc) · 3.09 KB
/
genesis-featured-page-advanced.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
75
76
77
<?php
/*
Plugin Name: Genesis Featured Page Advanced
Plugin URI: http://www.outermostdesign.com/
Description: Adds an enhanced version of the Genesis - Featured Page widget. The Genesis Framework 2.0+ is required.
Version: 1.8.0
Author: Outermost Design
Author URI: http://www.outermostdesign.com/
Text Domain: genesis-featured-page-advanced
License: GPLv2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
defined( 'WPINC' ) or die;
register_activation_hook( __FILE__, 'fpa_activation_check' );
/**
* This function runs on plugin activation. It checks to make sure the required
* minimum Genesis version is installed. If not, it deactivates itself.
*
* Author: Nathan Rice
* Author URI: http://www.nathanrice.net/
*/
function fpa_activation_check() {
$latest = '2.0';
$theme_info = wp_get_theme( 'genesis' );
if ( 'genesis' != basename( TEMPLATEPATH ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
wp_die( sprintf( __( 'Sorry, you can\'t activate %1$sGenesis - Featured Page Advanced%2$s unless you have installed the %3$sGenesis Framework%4$s. Go back to the %5$sPlugins Page%4$s.', 'genesis-featured-page-advanced' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', '</a>', '<a href="javascript:history.back()">' ) );
}
if ( version_compare( $theme_info['Version'], $latest, '<' ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
wp_die( sprintf( __( 'Sorry, you can\'t activate %1$sGenesis - Featured Page Advanced%2$s unless you have installed the %3$sGenesis %4$s%5$s. Go back to the %6$sPlugins Page%5$s.', 'genesis-featured-page-advanced' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', $latest, '</a>', '<a href="javascript:history.back()">' ) );
}
}
add_action('admin_init', 'fpa_deactivate_check');
/**
* This function runs on admin_init and checks to make sure Genesis is active, if not, it
* deactivates the plugin. This is useful for when users switch to a non-Genesis themes.
*/
function fpa_deactivate_check() {
if ( ! function_exists('genesis_pre') ) {
deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin
}
}
/**
* Include out Widget Class file
*/
include_once dirname( __FILE__ ) . '/inc/fpa-widget-class.php';
add_action( 'widgets_init', 'fpa_register_widget' );
/**
* Registers our Genesis Featured Page Advanced widget
*/
function fpa_register_widget() {
register_widget( 'Genesis_Featured_Page_Advanced' );
}