delete_hook() public method

Adds a hook to delete_attachment tag called when a media is deleted externally out of rtMedia context
public delete_hook ( )
示例#1
0
 /**
  * Hooks the plugin into BuddyPress via 'bp_include' action.
  * Initialises the plugin's functionalities, options,
  * loads media for Profiles and Groups.
  * Creates Admin panels
  * Loads accessory functions
  *
  * @global BPMediaAdmin $bp_media_admin
  */
 function init()
 {
     // set metatable in $wpdb
     $this->set_rtmedia_meta_wpdbfix();
     // rtMedia db upgrade
     add_action('rt_db_upgrade', array($this, 'fix_parent_id'));
     add_action('rt_db_upgrade', array($this, 'fix_privacy'));
     add_action('rt_db_upgrade', array($this, 'fix_group_media_privacy'));
     add_action('rt_db_upgrade', array($this, 'fix_db_collation'));
     $this->update_db();
     remove_action('rt_db_upgrade', array($this, 'fix_parent_id'));
     remove_action('rt_db_upgrade', array($this, 'fix_privacy'));
     remove_action('rt_db_upgrade', array($this, 'fix_group_media_privacy'));
     remove_action('rt_db_upgrade', array($this, 'fix_db_collation'));
     $this->set_allowed_types();
     // Define allowed types
     $this->constants();
     // Define constants
     $this->redirect_on_change_slug();
     $this->set_default_sizes();
     // set default sizes
     $this->set_privacy();
     // set privacy
     /**
      * Load options/settings
      */
     $this->set_site_options();
     /**
      * BuddyPress - Media Navigation Tab Inject
      *
      */
     /**
      * Load accessory functions
      */
     $class_construct = array('deprecated' => true, 'interaction' => true, 'upload_shortcode' => false, 'gallery_shortcode' => false, 'upload_endpoint' => false, 'privacy' => false, 'nav' => true, 'like' => false, 'featured' => false, 'GroupFeatured' => false, 'ViewCount' => false, 'GalleryItemAction' => false, 'LoginPopup' => false, 'CommentNotification' => false, 'LikeNotification' => false);
     global $rtmedia_nav;
     /** Legacy code for Add-ons * */
     $bp_class_construct = apply_filters('bpmedia_class_construct', array());
     foreach ($bp_class_construct as $classname => $global_scope) {
         $class = 'BPMedia' . ucfirst($classname);
         if (class_exists($class)) {
             if (true === $global_scope) {
                 global ${'bp_media_' . $classname};
                 ${'bp_media_' . $classname} = new $class();
             } else {
                 new $class();
             }
         }
     }
     /** ------------------- * */
     $class_construct = apply_filters('rtmedia_class_construct', $class_construct);
     $class_construct['Group'] = false;
     // will be constructed after rtmedia pro class.
     foreach ($class_construct as $key => $global_scope) {
         $classname = '';
         $ck = explode('_', $key);
         foreach ($ck as $cn) {
             $classname .= ucfirst($cn);
         }
         $class = 'RTMedia' . $classname;
         if (class_exists($class)) {
             if (true === $global_scope) {
                 global ${'rtmedia_' . $key};
                 ${'rtmedia_' . $key} = new $class();
             } else {
                 new $class();
             }
         }
     }
     $this->set_allowed_types();
     // Define allowed types
     global $rtmedia_buddypress_activity;
     $rtmedia_buddypress_activity = new RTMediaBuddyPressActivity();
     $media = new RTMediaMedia();
     $media->delete_hook();
     global $rtmedia_ajax;
     $rtmedia_ajax = new RTMediaAJAX();
     //API Classes
     global $rtmediajsonapi;
     $rtmediajsonapi = new RTMediaJsonApi();
     do_action('bp_media_init');
     // legacy For plugin using this actions
     do_action('rtmedia_init');
 }
示例#2
0
 /**
  * Hooks the plugin into BuddyPress via 'bp_include' action.
  * Initialises the plugin's functionalities, options,
  * loads media for Profiles and Groups.
  * Creates Admin panels
  * Loads accessory functions
  *
  * @global BPMediaAdmin $bp_media_admin
  */
 function init()
 {
     $this->set_allowed_types();
     // Define allowed types
     $this->constants();
     // Define constants
     $this->redirect_on_change_slug();
     $this->set_default_sizes();
     // set default sizes
     $this->set_privacy();
     // set privacy
     /**
      * Load options/settings
      */
     $this->set_site_options();
     /**
      * Add a settings link to the Plugin list screen
      */
     //            add_filter('plugin_action_links', array($this, 'settings_link'), 10, 2);
     /**
      * BuddyPress - Media Navigation Tab Inject
      *
      */
     /**
      * Load accessory functions
      */
     //			new BPMediaActivity();
     $class_construct = array('deprecated' => true, 'interaction' => true, 'upload_shortcode' => false, 'gallery_shortcode' => false, 'upload_endpoint' => false, 'privacy' => false, 'nav' => true, 'like' => false, 'featured' => false, 'ViewCount' => false);
     global $rtmedia_nav;
     /** Legacy code for Add-ons * */
     $bp_class_construct = apply_filters('bpmedia_class_construct', array());
     foreach ($bp_class_construct as $classname => $global_scope) {
         $class = 'BPMedia' . ucfirst($classname);
         if (class_exists($class)) {
             if ($global_scope == true) {
                 global ${'bp_media_' . $classname};
                 ${'bp_media_' . $classname} = new $class();
             } else {
                 new $class();
             }
         }
     }
     /** ------------------- * */
     $class_construct = apply_filters('rtmedia_class_construct', $class_construct);
     $class_construct['Group'] = false;
     // will be constructed after rtmedia pro class.
     foreach ($class_construct as $key => $global_scope) {
         $classname = '';
         $ck = explode('_', $key);
         foreach ($ck as $cn) {
             $classname .= ucfirst($cn);
         }
         $class = 'RTMedia' . $classname;
         if (class_exists($class)) {
             if ($global_scope == true) {
                 global ${'rtmedia_' . $key};
                 ${'rtmedia_' . $key} = new $class();
             } else {
                 new $class();
             }
         }
     }
     $this->set_allowed_types();
     // Define allowed types
     global $rtmedia_buddypress_activity;
     $rtmedia_buddypress_activity = new RTMediaBuddyPressActivity();
     $media = new RTMediaMedia();
     $media->delete_hook();
     global $rtmedia_ajax;
     $rtmedia_ajax = new RTMediaAJAX();
     //API Classes
     global $rtmediajsonapi;
     $rtmediajsonapi = new RTMediaJsonApi();
     do_action('bp_media_init');
     // legacy For plugin using this actions
     do_action('rtmedia_init');
 }