PageRenderTime 59ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/code/cake/app/webroot/cp/wp-content/plugins/commentpress-core/commentpress-multisite/class_commentpress_mu_loader.php

https://github.com/DigitalPaulScholtenProject/DPSP-Platform
PHP | 390 lines | 63 code | 182 blank | 145 comment | 9 complexity | 9989049d8733c0badd9556877ed6c2d9 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php /*
  2. ================================================================================
  3. Class CommentpressMultisiteLoader
  4. ================================================================================
  5. AUTHOR: Christian Wach <needle@haystack.co.uk>
  6. --------------------------------------------------------------------------------
  7. NOTES
  8. =====
  9. This class loads all Multisite compatibility
  10. --------------------------------------------------------------------------------
  11. */
  12. /*
  13. ================================================================================
  14. Class Name
  15. ================================================================================
  16. */
  17. class CommentpressMultisiteLoader {
  18. /*
  19. ============================================================================
  20. Properties
  21. ============================================================================
  22. */
  23. // parent object reference
  24. var $parent_obj;
  25. // admin object reference
  26. var $db;
  27. // multisite object reference
  28. var $mu;
  29. // buddypress object reference
  30. var $bp;
  31. /**
  32. * @description: initialises this object
  33. * @param object $parent_obj a reference to the parent object
  34. * @return object
  35. * @todo:
  36. *
  37. */
  38. function __construct( $parent_obj = null ) {
  39. // store reference to "parent" (calling obj, not OOP parent)
  40. $this->parent_obj = $parent_obj;
  41. // init
  42. $this->_init();
  43. // --<
  44. return $this;
  45. }
  46. /**
  47. * PHP 4 constructor
  48. */
  49. function CommentpressMultisiteLoader( $parent_obj = null ) {
  50. // is this php5?
  51. if ( version_compare( PHP_VERSION, "5.0.0", "<" ) ) {
  52. // call php5 constructor
  53. $this->__construct( $parent_obj );
  54. }
  55. // --<
  56. return $this;
  57. }
  58. /**
  59. * @description: set up all items associated with this object
  60. * @todo:
  61. *
  62. */
  63. function initialise() {
  64. }
  65. /**
  66. * @description: if needed, destroys all items associated with this object
  67. * @todo:
  68. *
  69. */
  70. function destroy() {
  71. }
  72. //##############################################################################
  73. /*
  74. ============================================================================
  75. PUBLIC METHODS
  76. ============================================================================
  77. */
  78. //##############################################################################
  79. /*
  80. ============================================================================
  81. PRIVATE METHODS
  82. ============================================================================
  83. */
  84. /**
  85. * @description: object initialisation
  86. * @todo:
  87. *
  88. */
  89. function _init() {
  90. // check for network activation
  91. //add_action( 'activated_plugin', array( $this, '_network_activated' ), 10, 2 );
  92. // check for network deactivation
  93. add_action( 'deactivated_plugin', array( $this, '_network_deactivated' ), 10, 2 );
  94. // ---------------------------------------------------------------------
  95. // load Database Wrapper object
  96. // ---------------------------------------------------------------------
  97. // define filename
  98. $class_file = 'commentpress-multisite/class_commentpress_mu_admin.php';
  99. // get path
  100. $class_file_path = commentpress_file_is_present( $class_file );
  101. // we're fine, include class definition
  102. require_once( $class_file_path );
  103. // init autoload database object
  104. $this->db = new CommentpressMultisiteAdmin( $this );
  105. // ---------------------------------------------------------------------
  106. // load standard Multisite object
  107. // ---------------------------------------------------------------------
  108. // define filename
  109. $class_file = 'commentpress-multisite/class_commentpress_mu_ms.php';
  110. // get path
  111. $class_file_path = commentpress_file_is_present( $class_file );
  112. // we're fine, include class definition
  113. require_once( $class_file_path );
  114. // init multisite object
  115. $this->mu = new CommentpressMultisite( $this );
  116. // ---------------------------------------------------------------------
  117. // load Post Revisions object (merge this into Core as an option)
  118. // ---------------------------------------------------------------------
  119. // define filename
  120. $_class_file = 'commentpress-multisite/class_commentpress_mu_revisions.php';
  121. // get path
  122. $_class_file_path = commentpress_file_is_present( $_class_file );
  123. // we're fine, include class definition
  124. require_once( $_class_file_path );
  125. // instantiate it
  126. $this->revisions = new CommentpressMultisiteRevisions( $this );
  127. // ---------------------------------------------------------------------
  128. // call initialise() on admin object
  129. // ---------------------------------------------------------------------
  130. // initialise db for multisite
  131. $this->db->initialise( 'multisite' );
  132. // ---------------------------------------------------------------------
  133. // optionally load BuddyPress object
  134. // ---------------------------------------------------------------------
  135. // load when buddypress is loaded
  136. add_action( 'bp_include', array( $this, '_load_buddypress_object' ) );
  137. }
  138. /**
  139. * @description: BuddyPress object initialisation
  140. * @todo:
  141. *
  142. */
  143. function _load_buddypress_object() {
  144. // ---------------------------------------------------------------------
  145. // load BuddyPress object
  146. // ---------------------------------------------------------------------
  147. // define filename
  148. $class_file = 'commentpress-multisite/class_commentpress_mu_bp.php';
  149. // get path
  150. $class_file_path = commentpress_file_is_present( $class_file );
  151. // we're fine, include class definition
  152. require_once( $class_file_path );
  153. // init buddypress object
  154. $this->bp = new CommentpressMultisiteBuddypress( $this );
  155. // ---------------------------------------------------------------------
  156. // load Groupblog Workshop renaming object
  157. // ---------------------------------------------------------------------
  158. // define filename
  159. $_class_file = 'commentpress-multisite/class_commentpress_mu_workshop.php';
  160. // get path
  161. $_class_file_path = commentpress_file_is_present( $_class_file );
  162. // we're fine, include class definition
  163. require_once( $_class_file_path );
  164. // instantiate it
  165. $this->workshop = new CommentpressGroupblogWorkshop( $this );
  166. // ---------------------------------------------------------------------
  167. // call initialise() on admin object again
  168. // ---------------------------------------------------------------------
  169. // initialise db for buddypress
  170. $this->db->initialise( 'buddypress' );
  171. }
  172. /**
  173. * @description: this plugin has been network-activated (does not fire!)!
  174. * @todo:
  175. *
  176. */
  177. function _network_activated( $plugin, $network_wide = null ) {
  178. //print_r( array( $plugin, $network_wide ) ); die();
  179. // if it's our plugin...
  180. if ( $plugin == plugin_basename( COMMENTPRESS_PLUGIN_FILE ) ) {
  181. // was it network deactivated?
  182. if ( $network_wide == true ) {
  183. // if upgrading, we need to migrate each existing instance into a CommentPress Core blog
  184. }
  185. }
  186. }
  187. /**
  188. * @description: this plugin has been network-deactivated
  189. * @todo:
  190. *
  191. */
  192. function _network_deactivated( $plugin, $network_wide = null ) {
  193. // if it's our plugin...
  194. if ( $plugin == plugin_basename( COMMENTPRESS_PLUGIN_FILE ) ) {
  195. // was it network deactivated?
  196. if ( $network_wide == true ) {
  197. //print_r( array( $plugin, $network_wide ) ); die();
  198. // do we want to trigger deactivation_hook for all sub-blogs?
  199. // or do we want to convert each instance into a self-contained
  200. // CommentPress Core blog?
  201. }
  202. }
  203. }
  204. //##############################################################################
  205. } // class ends
  206. ?>