FacebookFanpageImport

The Facebook Fanpage Import FacebookFanpageImport class.

Defined (1)

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

/core.php  
  1. class FacebookFanpageImport { 
  2.  
  3. /** 
  4. * Initializes the plugin. 
  5. * @since 1.0.0 
  6. */ 
  7. function __construct() { 
  8. $this->constants(); 
  9. $this->includes(); 
  10. $this->framework(); 
  11.  
  12. add_action( 'init', array( $this, 'load_components' ) ); 
  13. add_action( 'init', array( $this, 'load_textdomain' ) ); 
  14.  
  15. // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. 
  16. register_activation_hook( __FILE__, array( $this, 'activate' ) ); 
  17. register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); 
  18. // register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) ); 
  19.  
  20. // Functions on Frontend 
  21. if( is_admin() ): 
  22. // Register admin styles and scripts 
  23. add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) ); 
  24. add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) ); 
  25. else: 
  26. // Register plugin styles and scripts 
  27. add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) ); 
  28. add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) ); 
  29. endif; 
  30. } // end constructor 
  31.  
  32. /** 
  33. * Fired when the plugin is activated. 
  34. * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog 
  35. * @since 1.0.0  
  36. */ 
  37. public function activate( $network_wide ) { 
  38. // TODO: Define activation functionality here 
  39. } // end activate 
  40.  
  41. /** 
  42. * Fired when the plugin is deactivated. 
  43. * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog  
  44. */ 
  45. public function deactivate( $network_wide ) { 
  46. // TODO: Define deactivation functionality here  
  47. } // end deactivate 
  48.  
  49. /** 
  50. * Fired when the plugin is uninstalled. 
  51. * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog 
  52. * @since 1.0.0  
  53. */ 
  54. public function uninstall( $network_wide ) { 
  55. // TODO: Define uninstall functionality here  
  56. } // end uninstall 
  57.  
  58. /** 
  59. * Loads the plugin text domain for translation. 
  60. * @since 1.0.0 
  61. */ 
  62. public function load_textdomain() { 
  63. // TODO: replace "plugin-name-locale" with a unique value for your plugin 
  64. load_plugin_textdomain( 'fbfpi', false, FBFPI_RELATIVE_FOLDER . '/languages' ); 
  65. } // end plugin_textdomain 
  66.  
  67. /** 
  68. * Registers and enqueues admin-specific styles. 
  69. * @since 1.0.0 
  70. */ 
  71. public function register_admin_styles() { 
  72. // TODO: Change 'plugin-name' to the name of your plugin 
  73. wp_enqueue_style( 'fbfpi-admin-styles', FBFPI_URLPATH . '/includes/css/admin.css' ); 
  74.  
  75. } // end register_admin_styles 
  76.  
  77. /** 
  78. * Registers and enqueues admin-specific JavaScript. 
  79. * @since 1.0.0 
  80. */  
  81. public function register_admin_scripts() { 
  82. wp_enqueue_script( 'fbfpi-admin-script', FBFPI_URLPATH . '/includes/js/admin.js' ); 
  83.  
  84. } // end register_admin_scripts 
  85.  
  86. /** 
  87. * Registers and enqueues plugin-specific styles. 
  88. * @since 1.0.0 
  89. */ 
  90. public function register_plugin_styles() { 
  91. if( '' == skip\value( 'fbfpi_settings', 'own_css' ) ) 
  92. wp_enqueue_style( 'fbfpi-plugin-styles', FBFPI_URLPATH . '/includes/css/display.css' ); 
  93.  
  94. } // end register_plugin_styles 
  95.  
  96. /** 
  97. * Registers and enqueues plugin-specific scripts. 
  98. * @since 1.0.0 
  99. */ 
  100. public function register_plugin_scripts() { 
  101. wp_enqueue_script( 'fbfpi-plugin-script', FBFPI_URLPATH . '/includes/js/display.js' ); 
  102.  
  103. } // end register_plugin_scripts 
  104.  
  105. /** 
  106. * Defining Constants for Use in Plugin 
  107. * @since 1.0.0 
  108. */ 
  109. public function constants() { 
  110. define( 'FBFPI_FOLDER', $this->get_folder() );  
  111. define( 'FBFPI_RELATIVE_FOLDER', substr( FBFPI_FOLDER, strlen( WP_PLUGIN_DIR ), strlen( FBFPI_FOLDER ) ) );  
  112. define( 'FBFPI_URLPATH', $this->get_url_path() ); 
  113. define( 'FBFPI_COMPONENTFOLDER', FBFPI_FOLDER . '/components' ); 
  114.  
  115. /** 
  116. * Defining Constants for Use in Plugin 
  117. * @since 1.0.0 
  118. */ 
  119. public function framework() { 
  120. // Loading Skip 
  121. include( FBFPI_FOLDER . '/includes/skip/loader.php' );  
  122. skip\start(); 
  123. }  
  124.  
  125. /** 
  126. * Getting include files 
  127. * @since 1.0.0 
  128. */ 
  129. public function includes() { 
  130. // Loading functions 
  131. include( FBFPI_FOLDER . '/functions.php' ); 
  132.  
  133. /** 
  134. * Loading components dynamical 
  135. * @since 1.0.0 
  136. */ 
  137. function load_components() { 
  138. // Loading Components 
  139. $handle = opendir( FBFPI_COMPONENTFOLDER ); // TODO: Rename Constant 
  140.  
  141. while ( FALSE !== ( $file = readdir( $handle) ) ): 
  142. $entry = FBFPI_COMPONENTFOLDER . '/' . $file; 
  143. if( is_dir( $entry ) && '.' != $file && '..' != $file ) 
  144. if( file_exists( $entry . '/component.php' ) ) 
  145. include( $entry . '/component.php' ); 
  146. endwhile; 
  147.  
  148. closedir($handle); 
  149.  
  150. /** 
  151. * Getting URL 
  152. * @since 1.0.0 
  153. */ 
  154. private function get_url_path() { 
  155. $sub_path = substr( FBFPI_FOLDER, strlen( ABSPATH ), ( strlen( FBFPI_FOLDER ) - 11 ) ); 
  156. $script_url = get_bloginfo( 'wpurl' ) . '/' . $sub_path; 
  157. return $script_url; 
  158.  
  159. /** 
  160. * Getting Folder 
  161. * @since 1.0.0 
  162. */ 
  163. private function get_folder() { 
  164. $sub_folder = substr( dirname(__FILE__), strlen( ABSPATH ), ( strlen( dirname(__FILE__) ) - strlen( ABSPATH ) ) ); 
  165. $script_folder = ABSPATH . $sub_folder; 
  166. return $script_folder; 
  167.  
  168. } // end class