| @@ -33,14 +33,11 @@ | ||
| 33 | 33 | |
| 34 | 34 | if (! is_admin()) |
| 35 | 35 | $hook_bool = collections::setupHooks(); |
| 36 | 36 | |
| 37 | - //add_action('admin_menu', array($this, 'admin_menu') ); | |
| 37 | + add_action('admin_menu', array($this, 'admin_menu') ); | |
| 38 | 38 | add_action('admin_enqueue_scripts', array($this, 'admin_styles') ); |
| 39 | 39 | |
| 40 | - // load admin pages, after MB. | |
| 41 | - add_filter('maxbuttons/plugin/admin_pages', array($this, 'admin_menu')); | |
| 42 | - | |
| 43 | 40 | add_action('add_meta_boxes', array($this, 'meta_boxes'), 10, 2 ); |
| 44 | 41 | add_action('save_post', array($this, 'save_meta_boxes'), 10, 3 ); |
| 45 | 42 | |
| 46 | 43 | add_action('wp_enqueue_scripts', array($this, 'front_scripts') ); |
| @@ -47,10 +44,8 @@ | ||
| 47 | 44 | |
| 48 | 45 | add_shortcode('maxsocial', array($this->admin()->namespaceit('collections'), 'shortcode') ); |
| 49 | 46 | |
| 50 | 47 | add_action('maxbuttons/ajax/save_collection', array( $this->admin()->namespaceit('collections'), 'ajax_save') ); |
| 51 | - add_action('maxbuttons/ajax/remove-collection', array( $this->admin()->namespaceit('collections'), 'ajax_remove_collection') ); | |
| 52 | - | |
| 53 | 48 | add_action('maxbuttons/ajax/refreshblock', array($this->admin()->namespaceit('collections'), 'ajax_refreshblock') ); |
| 54 | 49 | add_action('maxbuttons/ajax/get_presets', array($this->admin()->namespaceit('collections'), 'ajax_getpresets') ); |
| 55 | 50 | add_action('maxbuttons/ajax/set_preset', array($this->admin()->namespaceit('collections'), 'ajax_setpreset') ); |
| 56 | 51 | |
| @@ -59,8 +54,10 @@ | ||
| 59 | 54 | add_action('maxbuttons/ajax/remove-networksettings', array($this->networks(), 'ajax_removesettings')); |
| 60 | 55 | add_action('maxbuttons/ajax/show-customnetworks', array($this->networks(), 'ajax_showcustomnetworks')); |
| 61 | 56 | add_action('maxbuttons/ajax/import-customnetworks', array($this->networks(), 'ajax_importcustomnetworks')); |
| 62 | 57 | |
| 58 | + | |
| 59 | + | |
| 63 | 60 | // FRONT AJAX |
| 64 | 61 | add_action('wp_ajax_mbsocial_get_count', array($this->admin()->namespaceit("collections"), "ajax_action_front")); // front end for all users |
| 65 | 62 | add_action('wp_ajax_nopriv_mbsocial_get_count', array($this->admin()->namespaceit("collections"), "ajax_action_front")); |
| 66 | 63 | |
| @@ -67,10 +64,8 @@ | ||
| 67 | 64 | remove_action('admin_init', array(maxUtils::namespaceit('maxAdmin'), 'do_review_notice')); |
| 68 | 65 | add_action('admin_init', array($this->admin(), 'do_review_notice')); |
| 69 | 66 | add_action('maxbuttons/ajax/mbsocial_review_notice_status', array($this->admin(), 'save_review_notice')); |
| 70 | 67 | |
| 71 | - add_action('wp_ajax_maxbuttons_social_css', array($this->admin()->namespaceit('collections'), 'outputFileCSS')); | |
| 72 | - add_action('wp_ajax_nopriv_maxbuttons_social_css', array($this->admin()->namespaceit('collections'), 'outputFileCSS')); | |
| 73 | 68 | //add_filter('mb-block-paths', array($this, 'block_templates')); |
| 74 | 69 | |
| 75 | 70 | } |
| 76 | 71 | |
| @@ -177,9 +172,9 @@ | ||
| 177 | 172 | |
| 178 | 173 | return $this->admin; |
| 179 | 174 | } |
| 180 | 175 | |
| 181 | - public function admin_menu ($admin_pages) | |
| 176 | + public function admin_menu () | |
| 182 | 177 | { |
| 183 | 178 | |
| 184 | 179 | $page_title = __('WordPress Share Buttons', 'mb-social'); |
| 185 | 180 | $menu_title = __('WordPress Share Buttons', 'mb-social'); |
| @@ -189,9 +184,9 @@ | ||
| 189 | 184 | $function = array($this, 'load_admin_page'); |
| 190 | 185 | $icon_url = $this->plugin_url . 'images/mb-social-icon.png'; |
| 191 | 186 | $submenu_function = array($this, 'load_admin_page'); |
| 192 | 187 | |
| 193 | - $admin_pages[] = add_menu_page($page_title, $menu_title, $admin_capability, $menu_slug, $function, $icon_url, 82); | |
| 188 | + add_menu_page($page_title, $menu_title, $admin_capability, $menu_slug, $function, $icon_url, 82); | |
| 194 | 189 | |
| 195 | 190 | if (Install::isPro()) |
| 196 | 191 | { |
| 197 | 192 | $page_title = __('Settings', 'mb-social'); |
| @@ -196,19 +191,16 @@ | ||
| 196 | 191 | { |
| 197 | 192 | $page_title = __('Settings', 'mb-social'); |
| 198 | 193 | $submenu_slug = 'maxbuttons-social-settings'; |
| 199 | 194 | $function = array($this, 'load_settings_page'); |
| 200 | - $admin_pages[] = add_submenu_page($menu_slug, $page_title, $page_title, $admin_capability, $submenu_slug, $function); | |
| 195 | + add_submenu_page($menu_slug, $page_title, $page_title, $admin_capability, $submenu_slug, $function); | |
| 201 | 196 | } |
| 202 | - | |
| 203 | - return $admin_pages; | |
| 204 | 197 | } |
| 205 | 198 | |
| 206 | 199 | public function admin_styles($hook) |
| 207 | 200 | { |
| 201 | + wp_register_style('mbsocial-global', $this->plugin_url . 'css/global-admin.css', array(), $this->version); | |
| 208 | 202 | |
| 209 | - wp_register_style('mbsocial-global', $this->plugin_url . 'css/global-admin.css', array(), $this->version); | |
| 210 | - | |
| 211 | 203 | if ( strpos($hook,'maxbuttons-social') === false ) |
| 212 | 204 | return; |
| 213 | 205 | |
| 214 | 206 | wp_enqueue_style('mbsocial-admin', $this->plugin_url . 'css/admin.css', array(), $this->version); |
| @@ -213,26 +205,15 @@ | ||
| 213 | 205 | |
| 214 | 206 | wp_enqueue_style('mbsocial-admin', $this->plugin_url . 'css/admin.css', array(), $this->version); |
| 215 | 207 | |
| 216 | 208 | if (Install::isPro()) |
| 217 | - { | |
| 218 | 209 | $deps = array('maxbuttons-pro-init','maxbuttons-ajax', 'mb-media-button', 'jquery-ui-sortable'); // pro init |
| 219 | - wp_register_script('maxbuttons-mbcustom', $this->plugin_url . 'js/maxbuttons-custom.js', $deps, $this->version, true); | |
| 220 | - wp_enqueue_script('maxbuttons-mbcustom'); | |
| 221 | - | |
| 222 | - wp_register_script('mbsocial-icons', $this->plugin_url . 'js/images.js', $deps, $this->version, true); | |
| 223 | - wp_enqueue_script('mbsocial-icons'); | |
| 224 | - | |
| 225 | - $deps[] = 'mbsocial-icons'; | |
| 226 | - } | |
| 227 | 210 | else |
| 228 | - { | |
| 229 | 211 | $deps = array('maxbutton-js-init', 'maxbuttons-ajax', 'mb-media-button', 'jquery-ui-sortable'); // free init |
| 230 | - } | |
| 212 | + | |
| 231 | 213 | wp_register_script('maxbuttons-social', $this->plugin_url . 'js/maxbuttons-social.js', $deps , $this->version, true); |
| 232 | 214 | wp_enqueue_script('maxbuttons-social'); |
| 233 | 215 | |
| 234 | - | |
| 235 | 216 | wp_register_script('mbsocial-editor', $this->plugin_url . 'js/network-editor.js', $deps, $this->version, true); |
| 236 | 217 | wp_enqueue_script('mbsocial-editor'); |
| 237 | 218 | |
| 238 | 219 | MB()->load_media_script(); |
| @@ -245,14 +226,12 @@ | ||
| 245 | 226 | { |
| 246 | 227 | wp_register_script('mbsocial_front', $this->plugin_url . 'js/social-front.js', array('jquery'), |
| 247 | 228 | $this->version, true); |
| 248 | 229 | |
| 249 | - wp_localize_script('mbsocial_front','mbsocial', array('ajaxurl' => admin_url( 'admin-ajax.php' ))); | |
| 250 | - | |
| 251 | 230 | wp_register_style('mbsocial-buttons', $this->plugin_url . 'css/buttons.css'); |
| 252 | 231 | |
| 253 | - //wp_register_style('nucleo_icons', $this->plugin_url . 'libraries/nucleo_icons/nucleo_icons.css', array(), $this->version); | |
| 254 | - //wp_enqueue_style('nucleo_icons'); | |
| 232 | + wp_register_style('nucleo_icons', $this->plugin_url . 'libraries/nucleo_icons/nucleo_icons.css', array(), $this->version); | |
| 233 | + wp_enqueue_style('nucleo_icons'); | |
| 255 | 234 | } |
| 256 | 235 | |
| 257 | 236 | public function meta_boxes($post_type, $post) |
| 258 | 237 | { |