CWS_Google_Picasa_Pro

The core plugin class.

Defined (1)

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

/includes/class-cws-google-picasa-pro.php  
  1. class CWS_Google_Picasa_Pro { 
  2.  
  3. /** 
  4. * The loader that's responsible for maintaining and registering all hooks that power 
  5. * the plugin. 
  6. * @since 2.0.0 
  7. * @access protected 
  8. * @var CWS_Google_Picasa_Pro_Loader $loader Maintains and registers all hooks for the plugin. 
  9. */ 
  10. protected $loader; 
  11.  
  12. /** 
  13. * The unique identifier of this plugin. 
  14. * @since 2.0.0 
  15. * @access protected 
  16. * @var string $plugin_name The string used to uniquely identify this plugin. 
  17. */ 
  18. protected $plugin_name; 
  19.  
  20. /** 
  21. * The current version of the plugin. 
  22. * @since 2.0.0 
  23. * @access protected 
  24. * @var string $version The current version of the plugin. 
  25. */ 
  26. protected $version; 
  27.  
  28. /** 
  29. * Define the core functionality of the plugin. 
  30. * Set the plugin name and the plugin version that can be used throughout the plugin. 
  31. * Load the dependencies, define the locale, and set the hooks for the admin area and 
  32. * the public-facing side of the site. 
  33. * @since 2.0.0 
  34. */ 
  35. public function __construct() { 
  36.  
  37. $this->plugin_name = 'cws-google-picasa-pro'; 
  38. $this->version = '2.2.3'; 
  39. $this->isPro = 0; 
  40. $this->load_dependencies(); 
  41. $this->set_locale(); 
  42. $this->define_admin_hooks(); 
  43. $this->define_public_hooks(); 
  44.  
  45. // set installed flag so can determine whether or not to show upgrade message 
  46. update_option( 'cws_gpp_installed', 1 ); 
  47.  
  48. /** 
  49. * Load the required dependencies for this plugin. 
  50. * Include the following files that make up the plugin: 
  51. * - CWS_Google_Picasa_Pro_Loader. Orchestrates the hooks of the plugin. 
  52. * - CWS_Google_Picasa_Pro_i18n. Defines internationalization functionality. 
  53. * - CWS_Google_Picasa_Pro_Admin. Defines all hooks for the admin area. 
  54. * - CWS_Google_Picasa_Pro_Public. Defines all hooks for the public side of the site. 
  55. * Create an instance of the loader which will be used to register the hooks 
  56. * with WordPress. 
  57. * @since 2.0.0 
  58. * @access private 
  59. */ 
  60. private function load_dependencies() { 
  61.  
  62. /** 
  63. * The class responsible for orchestrating the actions and filters of the 
  64. * core plugin. 
  65. */ 
  66. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-cws-google-picasa-pro-loader.php'; 
  67.  
  68. /** 
  69. * The class responsible for defining internationalization functionality 
  70. * of the plugin. 
  71. */ 
  72. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-cws-google-picasa-pro-i18n.php'; 
  73.  
  74. /** 
  75. * The class responsible for defining all actions that occur in the admin area. 
  76. */ 
  77. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-cws-google-picasa-pro-admin.php'; 
  78.  
  79. /** 
  80. * The class responsible for defining all actions that occur in the public-facing 
  81. * side of the site. 
  82. */ 
  83. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-cws-google-picasa-pro-public.php'; 
  84.  
  85. /** 
  86. * The class responsible for defining Google Oauth2 functionality. 
  87. */ 
  88. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/api-libs/Google/Client.php';  
  89. require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/api-libs/Google/Service/Analytics.php';  
  90.  
  91. $this->loader = new CWS_Google_Picasa_Pro_Loader(); 
  92.  
  93. /** 
  94. * Define the locale for this plugin for internationalization. 
  95. * Uses the Plugin_Name_i18n class in order to set the domain and to register the hook 
  96. * with WordPress. 
  97. * @since 2.0.0 
  98. * @access private 
  99. */ 
  100. private function set_locale() { 
  101.  
  102. $plugin_i18n = new CWS_Google_Picasa_Pro_i18n(); 
  103. $plugin_i18n->set_domain( $this->get_plugin_name() ); 
  104.  
  105. $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); 
  106.  
  107. /** 
  108. * Register all of the hooks related to the admin area functionality 
  109. * of the plugin. 
  110. * @since 2.0.0 
  111. * @access private 
  112. */ 
  113. private function define_admin_hooks() { 
  114.  
  115. $plugin_admin = new CWS_Google_Picasa_Pro_Admin( $this->get_plugin_name(), $this->get_version(), $this->get_isPro() ); 
  116.  
  117. $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 
  118. $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 
  119.  
  120. // Add the options page - Just stores Google AccessCode in prep to return it for AccessToken 
  121. $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_options_page' ); 
  122.  
  123. // Register and define the settings 
  124. $this->loader->add_action( 'admin_init', $plugin_admin, 'register_plugin_settings' );  
  125.  
  126. // test ik 
  127. $this->loader->add_action( 'admin_init', $plugin_admin, 'cws_gpp_ignore_upgrade' );  
  128. $this->loader->add_action( 'admin_init', $plugin_admin, 'cws_gpp_admin_notices_styles' );  
  129. //$this->loader->add_action( 'admin_init', $plugin_admin, 'myFunction' );  
  130.  
  131. $this->loader->add_action( 'wp_loaded', $plugin_admin, 'getCurrentUser' ); 
  132.  
  133.  
  134. /** 
  135. * Register all of the hooks related to the public-facing functionality 
  136. * of the plugin. 
  137. * @since 2.0.0 
  138. * @access private 
  139. */ 
  140. private function define_public_hooks() { 
  141.  
  142. $plugin_public = new CWS_Google_Picasa_Pro_Public( $this->get_plugin_name(), $this->get_version(), $this->get_isPro() ); 
  143.  
  144. $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); 
  145. $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); 
  146.  
  147. /** 
  148. * Run the loader to execute all of the hooks with WordPress. 
  149. * @since 2.0.0 
  150. */ 
  151. public function run() { 
  152. $this->loader->run(); 
  153.  
  154. /** 
  155. * The name of the plugin used to uniquely identify it within the context of 
  156. * WordPress and to define internationalization functionality. 
  157. * @since 2.0.0 
  158. * @return string The name of the plugin. 
  159. */ 
  160. public function get_plugin_name() { 
  161. return $this->plugin_name; 
  162.  
  163. /** 
  164. * The reference to the class that orchestrates the hooks with the plugin. 
  165. * @since 2.0.0 
  166. * @return CWS_Google_Picasa_Pro_Loader Orchestrates the hooks of the plugin. 
  167. */ 
  168. public function get_loader() { 
  169. return $this->loader; 
  170.  
  171. /** 
  172. * Retrieve the version number of the plugin. 
  173. * @since 2.0.0 
  174. * @return string The version number of the plugin. 
  175. */ 
  176. public function get_version() { 
  177. return $this->version; 
  178.  
  179. /** 
  180. * Chesk if this is Pro version of plugin. 
  181. * @since 2.0.0 
  182. * @return bool The Pro flag for the plugin. 
  183. */ 
  184. public function get_isPro() { 
  185. return $this->isPro; 
  186. }  
  187.