PluginProbe
WP Responsive Menu / 3.2.1
WP Responsive Menu v3.2.1
3.2.3 3.2.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.7.1 3.1.7.2 3.1.7.3 3.1.7.4 3.1.8 3.1.9 3.1.9.1 3.1.9.2 3.2 3.2.1 trunk 1.0 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 35 releases
wp-responsive-menu / inc / includes / class-wprmenu-framework.php

class-wprmenu-framework.php in WP Responsive Menu 3.2.1, at inc/includes/class-wprmenu-framework.php

89 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPRMenu FrameWork
4 *
5 * @package WP Responsive Menu
6 * @author MagniGenie
7 * @copyright Copyright (c) 2019, WP Responsive Menu
8 * @link https://magnigenie.com/
9 * @since WP Responsive Menu 3.1.4
10 */
11
12 defined( 'ABSPATH' ) || exit;
13
14 class WPRMenu_Framework {
15
16 /**
17 * Initialize the plugin.
18 *
19 * @since 1.7.0
20 */
21 public function init() {
22
23 // Needs to run every time in case theme has been changed
24 add_action( 'admin_init', array( $this, 'set_theme_option' ) );
25
26 }
27
28 /**
29 * Sets option defaults
30 *
31 * @since 1.7.0
32 */
33 function set_theme_option() {
34
35 // Load settings
36 $wpr_optionsframework_settings = get_option( 'wpr_optionsframework' );
37
38 // Updates the unique option id in the database if it has changed
39 if ( function_exists( 'wpr_optionsframework_option_name' ) ) {
40 wpr_optionsframework_option_name();
41 }
42 elseif ( has_action( 'wpr_optionsframework_option_name' ) ) {
43 do_action( 'wpr_optionsframework_option_name' );
44 }
45 // If the developer hasn't explicitly set an option id, we'll use a default
46 else {
47 $default_themename = get_option( 'stylesheet' );
48 $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
49 $default_themename = 'wpr_optionsframework_' . $default_themename;
50
51 if ( isset( $wpr_optionsframework_settings['id'] ) ) {
52 if ( $wpr_optionsframework_settings['id'] == $default_themename ) {
53 // All good, using default theme id
54 } else {
55 $wpr_optionsframework_settings['id'] = $default_themename;
56 update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
57 }
58 }
59 else {
60 $wpr_optionsframework_settings['id'] = $default_themename;
61 update_option( 'wpr_optionsframework', $wpr_optionsframework_settings );
62 }
63 }
64
65 }
66
67 static function &_wpr_optionsframework_options() {
68 static $options = null;
69
70 if ( !$options ) {
71 // Load options from options.php file (if it exists)
72
73 $maybe_options = require_once WPRMENU_OPTIONS_FRAMEWORK_PATH . 'wprmenu-options.php';;
74
75 if ( is_array( $maybe_options ) ) {
76 $options = $maybe_options;
77 }
78 else if ( function_exists( 'wpr_optionsframework_options' ) ) {
79 $options = wpr_optionsframework_options();
80 }
81
82 // Allow setting/manipulating options via filters
83 $options = apply_filters( 'wpr_of_options', $options );
84 }
85
86 return $options;
87 }
88
89 }