WYSIJA_help_conflicts

The MailPoet Newsletters WYSIJA help conflicts class.

Defined (1)

The class is defined in the following location(s).

/helpers/conflicts.php  
  1. class WYSIJA_help_conflicts extends WYSIJA_object{ 
  2. var $cleanHooks=array(); 
  3.  
  4. function __construct() { 
  5. parent::__construct(); 
  6.  
  7. /** 
  8. * try to remove hook from plugins inviting themselves onto our interfaces 
  9. * @param type $conflictingPlugins 
  10. */ 
  11. function resolve($conflictingPlugins) { 
  12.  
  13. $this->whatToClean=array(); 
  14. foreach($conflictingPlugins as $keyPlg =>$plugin) { 
  15. foreach($plugin['clean'] as $action => $details) { 
  16. foreach($details as $priority =>$info) { 
  17. $this->cleanHooks[$action][$priority][]=$info; 
  18. foreach($this->cleanHooks as $hookToclean => $info) { 
  19.  
  20. switch($hookToclean) { 
  21. case 'admin_head': 
  22. add_action('init', array($this, 'remove_admin_head'), 999); 
  23. break; 
  24. case 'admin_print_scripts': 
  25. add_action('admin_menu', array($this, 'remove_admin_print_scripts'), 999); 
  26. break; 
  27. case 'wp_enqueue_scripts': 
  28. add_action('admin_menu', array($this, 'remove_wp_enqueue_scripts'), 999); 
  29. break; 
  30. case 'admin_enqueue_scripts': 
  31. add_action('admin_menu', array($this, 'remove_admin_enqueue_scripts'), 999); 
  32. break; 
  33. case 'init': 
  34. add_action('after_setup_theme', array($this, 'remove_init'), 999); 
  35. break; 
  36. default: 
  37. add_action('admin_footer', array($this, 'remove_default'), 999); 
  38. function remove_init() { 
  39. global $wp_filter; 
  40. $this->remove_actions('init'); 
  41.  
  42. function remove_default() { 
  43. $this->remove_actions('admin_init'); 
  44.  
  45. function remove_admin_head() { 
  46. $this->remove_actions('admin_head'); 
  47. function remove_admin_print_scripts() { 
  48. $this->remove_actions('admin_print_scripts'); 
  49.  
  50. function remove_wp_enqueue_scripts() { 
  51. $this->remove_actions('wp_enqueue_scripts'); 
  52.  
  53. function remove_admin_enqueue_scripts() { 
  54. $this->remove_actions('admin_enqueue_scripts'); 
  55.  
  56.  
  57.  
  58. function remove_actions($actionsToClear) { 
  59. global $wp_filter; 
  60.  
  61. if (!isset($wp_filter[$actionsToClear])) return; 
  62.  
  63. foreach($wp_filter[$actionsToClear] as $priority => $callbacks) { 
  64. if(!isset($this->cleanHooks[$actionsToClear][$priority])) continue; 
  65.  
  66. foreach($callbacks as $identifier => $arrayInfo) { 
  67. if(is_array($arrayInfo['function'])) { 
  68. foreach($arrayInfo['function'] as $id => $myobject) { 
  69. foreach($this->cleanHooks[$actionsToClear][$priority] as $infoClear) { 
  70. if(isset($infoClear['objects']) && is_object($myobject) && in_array(get_class($myobject), $infoClear['objects'])) { 
  71. remove_action( $actionsToClear, $infoClear['function'], $priority, $arrayInfo['accepted_args'] ); 
  72. } else { 
  73. foreach($this->cleanHooks[$actionsToClear][$priority] as $infoClear) { 
  74. // if there is more than one function specified (key: functions, type: array) 
  75. if(isset($infoClear["functions"]) && function_exists($arrayInfo['function']) && in_array($arrayInfo['function'], $infoClear["functions"])) { 
  76. foreach($infoClear['functions'] as $function) { 
  77. remove_action( $actionsToClear, $function, $priority, $arrayInfo['accepted_args'] ); 
  78. // if there is only one function to remove (key: function, type: string) 
  79. } else if(array_key_exists('function', $infoClear) && $infoClear['function'] === $arrayInfo['function']) { 
  80. remove_action( $actionsToClear, $infoClear['function'], $priority, $arrayInfo['accepted_args'] ); 
  81.