| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPRMenu FrameWork |
| 4 |
* |
| 5 |
* @version 3.1.4 |
| 6 |
*/ |
| 7 |
|
| 8 |
defined( 'ABSPATH' ) || exit; |
| 9 |
|
| 10 |
// Don't load if wprmenu_framework_init is already defined |
| 11 |
if ( is_admin() && ! function_exists( 'wprmenu_framework_init' ) ) : |
| 12 |
|
| 13 |
function wprmenu_framework_init() { |
| 14 |
|
| 15 |
// If user can't edit theme options, exit |
| 16 |
if ( ! current_user_can( 'edit_theme_options' ) ) |
| 17 |
return; |
| 18 |
|
| 19 |
// Loads the required WPRMenu Framework classes. |
| 20 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wprmenu-framework.php'; |
| 21 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wprmenu-framework-admin.php'; |
| 22 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wprmenu-interface.php'; |
| 23 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wprmenu-media-uploader.php'; |
| 24 |
require plugin_dir_path( __FILE__ ) . 'includes/class-wprmenu-sanitization.php'; |
| 25 |
|
| 26 |
// Instantiate the main plugin class. |
| 27 |
$wprmenu_framework = new WPRMenu_Framework; |
| 28 |
$wprmenu_framework->init(); |
| 29 |
|
| 30 |
// Instantiate the WPRMenu options page. |
| 31 |
$wprmenu_framework_admin = new WPRMenu_Framework_Admin; |
| 32 |
$wprmenu_framework_admin->init(); |
| 33 |
|
| 34 |
// Instantiate the media uploader class |
| 35 |
$wprmenu_framework_media_uploader = new WPRMenu_Framework_Media_Uploader; |
| 36 |
$wprmenu_framework_media_uploader->init(); |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
add_action( 'init', 'wprmenu_framework_init', 20 ); |
| 41 |
|
| 42 |
endif; |
| 43 |
|
| 44 |
|
| 45 |
/** |
| 46 |
* Helper function to return the theme option value. |
| 47 |
* If no value has been saved, it returns $default. |
| 48 |
* Needed because options are saved as serialized strings. |
| 49 |
* |
| 50 |
* Not in a class to support backwards compatibility in themes. |
| 51 |
*/ |
| 52 |
|
| 53 |
if ( ! function_exists( 'wpr_of_get_option' ) ) : |
| 54 |
|
| 55 |
function wpr_of_get_option( $name, $default = false ) { |
| 56 |
$config = get_option( 'wpr_optionsframework' ); |
| 57 |
|
| 58 |
if ( ! isset( $config['id'] ) ) { |
| 59 |
return $default; |
| 60 |
} |
| 61 |
|
| 62 |
$options = get_option( $config['id'] ); |
| 63 |
|
| 64 |
if ( isset( $options[$name] ) ) { |
| 65 |
return $options[$name]; |
| 66 |
} |
| 67 |
|
| 68 |
return $default; |
| 69 |
} |
| 70 |
|
| 71 |
endif; |