| @@ -11,10 +11,8 @@ | ||
| 11 | 11 | protected $plugin_url; |
| 12 | 12 | protected $plugin_path; |
| 13 | 13 | protected $version; |
| 14 | 14 | |
| 15 | - protected $url; // pageURL | |
| 16 | - | |
| 17 | 15 | protected $networks; |
| 18 | 16 | protected $admin; |
| 19 | 17 | |
| 20 | 18 | public function __construct() |
| @@ -35,44 +33,28 @@ | ||
| 35 | 33 | |
| 36 | 34 | if (! is_admin()) |
| 37 | 35 | $hook_bool = collections::setupHooks(); |
| 38 | 36 | |
| 39 | - //add_action('admin_menu', array($this, 'admin_menu') ); | |
| 37 | + add_action('admin_menu', array($this, 'admin_menu') ); | |
| 40 | 38 | add_action('admin_enqueue_scripts', array($this, 'admin_styles') ); |
| 41 | 39 | |
| 42 | - // load admin pages, after MB. | |
| 43 | - add_filter('maxbuttons/plugin/admin_pages', array($this, 'admin_menu')); | |
| 44 | - | |
| 45 | 40 | add_action('add_meta_boxes', array($this, 'meta_boxes'), 10, 2 ); |
| 46 | 41 | add_action('save_post', array($this, 'save_meta_boxes'), 10, 3 ); |
| 47 | 42 | |
| 48 | 43 | add_action('wp_enqueue_scripts', array($this, 'front_scripts') ); |
| 49 | 44 | |
| 45 | + add_action('wp_enqueue_scripts', array($this, 'front_scripts') ); | |
| 46 | + | |
| 50 | 47 | add_shortcode('maxsocial', array($this->admin()->namespaceit('collections'), 'shortcode') ); |
| 51 | - | |
| 52 | 48 | add_action('maxbuttons/ajax/save_collection', array( $this->admin()->namespaceit('collections'), 'ajax_save') ); |
| 53 | - add_action('maxbuttons/ajax/remove-collection', array( $this->admin()->namespaceit('collections'), 'ajax_remove_collection') ); | |
| 54 | - | |
| 55 | 49 | add_action('maxbuttons/ajax/refreshblock', array($this->admin()->namespaceit('collections'), 'ajax_refreshblock') ); |
| 56 | 50 | add_action('maxbuttons/ajax/get_presets', array($this->admin()->namespaceit('collections'), 'ajax_getpresets') ); |
| 57 | 51 | add_action('maxbuttons/ajax/set_preset', array($this->admin()->namespaceit('collections'), 'ajax_setpreset') ); |
| 58 | 52 | |
| 59 | - add_action('maxbuttons/ajax/network-settings', array($this->networks(), 'ajax_networksettings') ); | |
| 60 | - add_action('maxbuttons/ajax/save-network', array($this->networks(), 'ajax_savenetwork') ); | |
| 61 | - add_action('maxbuttons/ajax/remove-networksettings', array($this->networks(), 'ajax_removesettings')); | |
| 62 | - add_action('maxbuttons/ajax/show-customnetworks', array($this->networks(), 'ajax_showcustomnetworks')); | |
| 63 | - add_action('maxbuttons/ajax/import-customnetworks', array($this->networks(), 'ajax_importcustomnetworks')); | |
| 64 | - | |
| 65 | 53 | // FRONT AJAX |
| 66 | 54 | add_action('wp_ajax_mbsocial_get_count', array($this->admin()->namespaceit("collections"), "ajax_action_front")); // front end for all users |
| 67 | 55 | add_action('wp_ajax_nopriv_mbsocial_get_count', array($this->admin()->namespaceit("collections"), "ajax_action_front")); |
| 68 | 56 | |
| 69 | - remove_action('admin_init', array(maxUtils::namespaceit('maxAdmin'), 'do_review_notice')); | |
| 70 | - add_action('admin_init', array($this->admin(), 'do_review_notice')); | |
| 71 | - add_action('maxbuttons/ajax/mbsocial_review_notice_status', array($this->admin(), 'save_review_notice')); | |
| 72 | - | |
| 73 | - add_action('wp_ajax_maxbuttons_social_css', array($this->admin()->namespaceit('collections'), 'outputFileCSS')); | |
| 74 | - add_action('wp_ajax_nopriv_maxbuttons_social_css', array($this->admin()->namespaceit('collections'), 'outputFileCSS')); | |
| 75 | 57 | //add_filter('mb-block-paths', array($this, 'block_templates')); |
| 76 | 58 | |
| 77 | 59 | } |
| 78 | 60 | |
| @@ -179,9 +161,9 @@ | ||
| 179 | 161 | |
| 180 | 162 | return $this->admin; |
| 181 | 163 | } |
| 182 | 164 | |
| 183 | - public function admin_menu ($admin_pages) | |
| 165 | + public function admin_menu () | |
| 184 | 166 | { |
| 185 | 167 | |
| 186 | 168 | $page_title = __('WordPress Share Buttons', 'mb-social'); |
| 187 | 169 | $menu_title = __('WordPress Share Buttons', 'mb-social'); |
| @@ -191,26 +173,23 @@ | ||
| 191 | 173 | $function = array($this, 'load_admin_page'); |
| 192 | 174 | $icon_url = $this->plugin_url . 'images/mb-social-icon.png'; |
| 193 | 175 | $submenu_function = array($this, 'load_admin_page'); |
| 194 | 176 | |
| 195 | - $admin_pages[] = add_menu_page($page_title, $menu_title, $admin_capability, $menu_slug, $function, $icon_url, 82); | |
| 177 | + add_menu_page($page_title, $menu_title, $admin_capability, $menu_slug, $function, $icon_url, 82); | |
| 196 | 178 | |
| 197 | - if (Install::isPro()) | |
| 179 | + /*if (Install::isPro()) | |
| 198 | 180 | { |
| 199 | 181 | $page_title = __('Settings', 'mb-social'); |
| 200 | 182 | $submenu_slug = 'maxbuttons-social-settings'; |
| 201 | 183 | $function = array($this, 'load_settings_page'); |
| 202 | - $admin_pages[] = add_submenu_page($menu_slug, $page_title, $page_title, $admin_capability, $submenu_slug, $function); | |
| 203 | - } | |
| 204 | - | |
| 205 | - return $admin_pages; | |
| 184 | + add_submenu_page($menu_slug, $page_title, $page_title, $admin_capability, $submenu_slug, $function); | |
| 185 | + } */ | |
| 206 | 186 | } |
| 207 | 187 | |
| 208 | 188 | public function admin_styles($hook) |
| 209 | 189 | { |
| 190 | + wp_register_style('mbsocial-global', $this->plugin_url . 'css/global-admin.css', array(), $this->version); | |
| 210 | 191 | |
| 211 | - wp_register_style('mbsocial-global', $this->plugin_url . 'css/global-admin.css', array(), $this->version); | |
| 212 | - | |
| 213 | 192 | if ( strpos($hook,'maxbuttons-social') === false ) |
| 214 | 193 | return; |
| 215 | 194 | |
| 216 | 195 | wp_enqueue_style('mbsocial-admin', $this->plugin_url . 'css/admin.css', array(), $this->version); |
| @@ -215,29 +194,17 @@ | ||
| 215 | 194 | |
| 216 | 195 | wp_enqueue_style('mbsocial-admin', $this->plugin_url . 'css/admin.css', array(), $this->version); |
| 217 | 196 | |
| 218 | 197 | if (Install::isPro()) |
| 219 | - { | |
| 220 | 198 | $deps = array('maxbuttons-pro-init','maxbuttons-ajax', 'mb-media-button', 'jquery-ui-sortable'); // pro init |
| 221 | - wp_register_script('maxbuttons-mbcustom', $this->plugin_url . 'js/maxbuttons-custom.js', $deps, $this->version, true); | |
| 222 | - wp_enqueue_script('maxbuttons-mbcustom'); | |
| 223 | - | |
| 224 | - wp_register_script('mbsocial-icons', $this->plugin_url . 'js/images.js', $deps, $this->version, true); | |
| 225 | - wp_enqueue_script('mbsocial-icons'); | |
| 226 | - | |
| 227 | - $deps[] = 'mbsocial-icons'; | |
| 228 | - } | |
| 229 | 199 | else |
| 230 | - { | |
| 231 | 200 | $deps = array('maxbutton-js-init', 'maxbuttons-ajax', 'mb-media-button', 'jquery-ui-sortable'); // free init |
| 232 | - } | |
| 201 | + | |
| 233 | 202 | wp_register_script('maxbuttons-social', $this->plugin_url . 'js/maxbuttons-social.js', $deps , $this->version, true); |
| 234 | 203 | wp_enqueue_script('maxbuttons-social'); |
| 235 | 204 | |
| 236 | - | |
| 237 | - wp_register_script('mbsocial-editor', $this->plugin_url . 'js/network-editor.js', $deps, $this->version, true); | |
| 238 | - wp_enqueue_script('mbsocial-editor'); | |
| 239 | - | |
| 205 | + //wp_register_style('mbsocial-buttons', $this->plugin_url . 'css/buttons.css', array(), $this->version); | |
| 206 | + //wp_enqueue_style('mbsocial-buttons'); | |
| 240 | 207 | MB()->load_media_script(); |
| 241 | 208 | |
| 242 | 209 | wp_register_style('nucleo_icons', $this->plugin_url . 'libraries/nucleo_icons/nucleo_icons.css', array(), $this->version); |
| 243 | 210 | wp_enqueue_style('nucleo_icons'); |
| @@ -247,14 +214,12 @@ | ||
| 247 | 214 | { |
| 248 | 215 | wp_register_script('mbsocial_front', $this->plugin_url . 'js/social-front.js', array('jquery'), |
| 249 | 216 | $this->version, true); |
| 250 | 217 | |
| 251 | - wp_localize_script('mbsocial_front','mbsocial', array('ajaxurl' => admin_url( 'admin-ajax.php' ))); | |
| 252 | - | |
| 253 | 218 | wp_register_style('mbsocial-buttons', $this->plugin_url . 'css/buttons.css'); |
| 254 | 219 | |
| 255 | - //wp_register_style('nucleo_icons', $this->plugin_url . 'libraries/nucleo_icons/nucleo_icons.css', array(), $this->version); | |
| 256 | - //wp_enqueue_style('nucleo_icons'); | |
| 220 | + wp_register_style('nucleo_icons', $this->plugin_url . 'libraries/nucleo_icons/nucleo_icons.css', array(), $this->version); | |
| 221 | + wp_enqueue_style('nucleo_icons'); | |
| 257 | 222 | } |
| 258 | 223 | |
| 259 | 224 | public function meta_boxes($post_type, $post) |
| 260 | 225 | { |
| @@ -287,13 +252,8 @@ | ||
| 287 | 252 | { |
| 288 | 253 | return trailingslashit(plugin_dir_url(MBSOCIAL_ROOT_FILE)); |
| 289 | 254 | } |
| 290 | 255 | |
| 291 | - public function get_page_url() | |
| 292 | - { | |
| 293 | - return $this->url; | |
| 294 | - } | |
| 295 | - | |
| 296 | 256 | public function get_version() |
| 297 | 257 | { |
| 298 | 258 | return MBSOCIAL_VERSION_NUM; |
| 299 | 259 | } |
| @@ -302,12 +262,9 @@ | ||
| 302 | 262 | { |
| 303 | 263 | if (Install::getIssue() == 'mb-wrong-version') |
| 304 | 264 | include_once($this->plugin_path . 'admin/update_mb.php'); |
| 305 | 265 | else |
| 306 | - { | |
| 307 | - $this->url = admin_url('?page=maxbuttons-social'); | |
| 308 | 266 | include_once($this->plugin_path . 'admin/page_editor.php'); |
| 309 | - } | |
| 310 | 267 | } |
| 311 | 268 | |
| 312 | 269 | public function load_settings_page() |
| 313 | 270 | { |
| @@ -313,11 +270,8 @@ | ||
| 313 | 270 | { |
| 314 | 271 | if (Install::getIssue() == 'mb-wrong-version') |
| 315 | 272 | include_once($this->plugin_path . 'admin/update_mb.php'); |
| 316 | 273 | else |
| 317 | - { | |
| 318 | - $this->url = admin_url('?page=maxbuttons-social-settings'); | |
| 319 | 274 | include_once($this->plugin_path . 'admin/page_settings.php'); |
| 320 | - } | |
| 321 | 275 | } |
| 322 | 276 | |
| 323 | 277 | } |