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 4.8.6 4.8.7 4.8.8 4.8.9 4.9.0 4.9.1 4.9.10 4.9.11 4.9.12 4.9.13 4.9.14 4.9.15 4.9.16 4.9.17 4.9.18 4.9.19 4.9.2 4.9.20 4.9.21 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 4.9.8 4.9.9 trunk 1.1.5 1.2.1 1.2.3 1.2.4 1.2.5 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8
mailchimp-for-wp / includes / class-plugin.php
mailchimp-for-wp / includes Last commit date
views 12 years ago class-admin.php 12 years ago class-api.php 12 years ago class-checkbox.php 12 years ago class-form.php 12 years ago class-plugin.php 12 years ago class-widget.php 12 years ago functions.php 12 years ago index.php 12 years ago template-functions.php 12 years ago
class-plugin.php
132 lines
1 <?php
2
3 class MC4WP_Lite {
4 private static $instance;
5
6 public static function instance() {
7 return self::$instance;
8 }
9
10 public static function init() {
11 if(self::$instance) {
12 throw new Exception("ALready initialized.");
13 } else {
14 self::$instance = new self;
15 }
16 }
17
18 private function __construct() {
19 $this->backwards_compatibility();
20
21 // checkbox
22 require_once MC4WP_LITE_PLUGIN_DIR . 'includes/class-checkbox.php';
23 MC4WP_Lite_Checkbox::init();
24
25 // form
26 require_once MC4WP_LITE_PLUGIN_DIR . 'includes/class-form.php';
27 MC4WP_Lite_Form::init();
28
29 // widget
30 add_action( 'widgets_init', array($this, 'register_widget') );
31
32 if (!is_admin()) {
33 // frontend only
34 include_once MC4WP_LITE_PLUGIN_DIR . 'includes/template-functions.php';
35
36 // load css
37 add_action( 'wp_enqueue_scripts', array($this, 'load_stylesheets'), 90);
38 add_action( 'login_enqueue_scripts', array($this, 'load_stylesheets') );
39 }
40 }
41
42 private function backwards_compatibility() {
43 $options = get_option( 'mc4wp_lite' );
44
45 // transfer widget to new id?
46 if(get_option('mc4wp_transfered_old_widgets', false) == false) {
47 $sidebars_widgets = get_option('sidebars_widgets');
48
49 if($sidebars_widgets && is_array($sidebars_widgets)) {
50 foreach($sidebars_widgets as $key => $widgets)
51 {
52 if(!is_array($widgets)) { continue; }
53 foreach($widgets as $subkey => $widget_name) {
54
55 if(substr($widget_name, 0, 17) == 'mc4wp_lite_widget') {
56
57 $new_widget_name = str_replace('mc4wp_lite_widget', 'mc4wp_widget', $widget_name);
58 // active widget found, just change name?
59 $sidebars_widgets[$key][$subkey] = $new_widget_name;
60 update_option('sidebars_widgets', $sidebars_widgets);
61 update_option('widget_mc4wp_widget', get_option('widget_mc4wp_lite_widget') );
62 break;
63 }
64 }
65 }
66 }
67
68 update_option('mc4wp_transfered_old_widgets', true);
69 }
70
71
72
73
74 // transfer old options to new options format
75 if (isset( $options['mailchimp_api_key'] )) {
76
77 $new_options = array(
78 'general' => array(),
79 'checkbox' => array(),
80 'form' => array()
81 );
82
83 $new_options['general']['api_key'] = $options['mailchimp_api_key'];
84
85 foreach ( $options as $key => $value ) {
86 $_pos = strpos( $key, '_' );
87
88 $first_key = substr( $key, 0, $_pos );
89 $second_key = substr( $key, $_pos + 1 );
90
91 if ( isset( $new_options[$first_key] ) ) {
92
93 // change option name
94 if ( $second_key == 'show_at_bp_form' ) {
95 $second_key = 'show_at_buddypress_form';
96 }
97
98 // change option name
99 if ( $second_key == 'show_at_ms_form' ) {
100 $second_key = 'show_at_multisite_form';
101 }
102
103 // set value into new option name
104 $new_options[$first_key][$second_key] = $value;
105 }
106
107 }
108
109 update_option( 'mc4wp_lite', $new_options['general'] );
110 update_option( 'mc4wp_lite_checkbox', $new_options['checkbox'] );
111 update_option( 'mc4wp_lite_form', $new_options['form'] );
112 } // end transfer options
113 }
114
115 public function register_widget()
116 {
117 include_once MC4WP_LITE_PLUGIN_DIR . 'includes/class-widget.php';
118 register_widget( 'MC4WP_Lite_Widget' );
119 }
120
121 public function load_stylesheets()
122 {
123 $stylesheets = apply_filters('mc4wp_stylesheets', array());
124
125 if(!empty($stylesheets)) {
126 $stylesheet_url = add_query_arg($stylesheets, plugins_url('mailchimp-for-wp/assets/css/css.php'));
127 wp_enqueue_style( 'mailchimp-for-wp', $stylesheet_url, array(), MC4WP_LITE_VERSION);
128 }
129 }
130
131 }
132