Example #1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // start ajax actions
     $this->wp_ajax = new FA_Ajax_Actions();
     // check for iframe plugin variables and set the according variables needed by WordPress
     add_action('init', array($this, 'is_iframe'), -9999);
     // check for previews
     add_action('init', array($this, 'is_preview'), -9999);
     // admin menu
     add_action('admin_menu', array($this, 'admin_menu'), 1);
     // add scripts
     add_action('load-post.php', array($this, 'post_edit_assets'));
     add_action('load-post-new.php', array($this, 'post_edit_assets'));
     // remove autosave script from slider editing screen
     add_action('admin_enqueue_scripts', array($this, 'dequeue_slider_autosave'));
     // save slide data
     add_action('save_post', array($this, 'save_slide'), 1, 3);
     // save slider data
     add_action('save_post_' . parent::get_type_slider(), array($this, 'save_slider'), 10, 3);
     // save slider revisions (for preview purposes)
     add_action('save_post_revision', array($this, 'save_slider_revisions'), 10, 3);
     // detect images in post contents when saving post
     add_action('save_post', array($this, 'detect_image'), 10, 3);
     // add extra columns on sliders table
     add_filter('manage_' . parent::get_type_slider() . '_posts_columns', array($this, 'extra_slider_columns'), 9999);
     add_action('manage_' . parent::get_type_slider() . '_posts_custom_column', array($this, 'output_extra_slider_columns'), 10, 2);
     // add meta boxes for slider post type
     add_action('fa_meta_box_cb_' . parent::get_type_slider(), array($this, 'register_slider_meta_boxes'));
     // remove all metaboxes except the ones implemented by the plugin and the default allowed ones
     add_action('screen_options_show_screen', array($this, 'remove_meta_boxes'));
     // add slide edit meta box on post and page editing
     add_action('add_meta_boxes', array($this, 'register_meta_boxes'), 10, 2);
     // tinymce
     add_action('admin_head', array($this, 'tinymce'));
     add_filter('mce_external_languages', array($this, 'tinymce_languages'));
     // for WP version prior to WP 4, use alternative for slider shortcode tinyMCE button
     if (version_compare(get_bloginfo('version'), '4', '<')) {
         // register shortcode meta box if version smaller than 4
         add_action('add_meta_boxes', array($this, 'register_slider_shortcode_meta_box'), 10, 2);
     }
     add_filter('enter_title_here', array($this, 'post_title_label'), 999, 2);
     add_filter('preview_post_link', array($this, 'slider_preview_link'), 999, 1);
     // add a filter to detect if FA PRO is installed and remove activation link and add a message
     add_filter('plugin_row_meta', array($this, 'plugin_meta'), 10, 2);
     add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
     add_filter('admin_footer_text', array($this, 'admin_footer_message'));
 }
Example #2
0
 /**
  * Init callback. This should be the first to start within the plugin.
  */
 public function on_init()
 {
     // load when not in admin area
     if (!is_admin()) {
         // start custom post type class
         parent::__construct();
         // add the shortcodes
         require_once fa_get_path('includes/libs/class-fa-shortcodes.php');
         new FA_Shortcodes();
     }
     // only for admin area
     if (is_admin() || fa_is_preview()) {
         // localization - needed only for admin area
         load_plugin_textdomain('fapro', false, dirname(plugin_basename(__FILE__)) . '/languages/');
         // allow admins to manage all areas of the plugin
         add_action('set_current_user', array($this, 'allow_admins'));
         // add admin specific functions
         require_once fa_get_path('includes/admin/functions.php');
         // add administration management
         require_once fa_get_path('includes/admin/libs/class-fa-admin.php');
         // start the administration area
         new FA_Admin();
     }
 }