Easy_Peasy_MailChimp

Easy Google Analytics class.

Defined (1)

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

/easy-peasy-mailchimp.php  
  1. class Easy_Peasy_MailChimp { 
  2.  
  3. /** 
  4. * Constructor - get the plugin hooked in and ready 
  5. * @since 1.0.0 
  6. */ 
  7. public function __construct() { 
  8.  
  9. // Define constants 
  10. define( 'EPM_VERSION', '1.0.0' ); 
  11. define( 'EPM_SLUG', plugin_basename(__FILE__)); 
  12. define( 'EPM_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); 
  13. define( 'EPM_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); 
  14.  
  15. //Filters 
  16. add_filter( "plugin_action_links_".EPM_SLUG , array( $this, 'epm_add_settings_link') ); 
  17. add_filter( 'plugin_row_meta', array( $this, 'epm_plugin_row_meta'), 10, 2 ); 
  18.  
  19. //Actions 
  20. add_action('plugins_loaded', array($this, 'epm_load_plugin_textdomain')); 
  21. add_action('admin_menu', array($this, 'epm_add_options_link'), 10); 
  22. add_action('epm_settings_sidebar', array($this, 'epm_add_settings_box'), 10); 
  23. add_action('epm_settings_sidebar', array($this, 'epm_add_settings_box_advert'), 10); 
  24. add_action('epm_next_to_settings_title', array($this, 'epm_add_links_to_title')); 
  25.  
  26. // Load required files 
  27. $this->epm_includes(); 
  28.  
  29.  
  30. /** 
  31. * Add Settings Link To WP-Plugin Page 
  32. * @since 1.0.0 
  33. */ 
  34. public function epm_add_settings_link( $links ) { 
  35. $settings_link = '<a href="options-general.php?page=epm-settings">'.__('Settings', 'easy-peasy-mailchimp').'</a>'; 
  36. array_push( $links, $settings_link ); 
  37. return $links; 
  38.  
  39. /** 
  40. * Plugin row meta links 
  41. * @since 1.8 
  42. */ 
  43. function epm_plugin_row_meta( $input, $file ) { 
  44. if ( $file != 'easy-peasy-mailchimp/easy-peasy-mailchimp.php' ) 
  45. return $input; 
  46.  
  47. $links = array( 
  48. '<a href="http://themeforest.net/user/ThemesDepot/portfolio" target="_blank">' . esc_html__( 'Get Premium WordPress Themes', 'easy-peasy-mailchimp' ) . '</a>',  
  49. '<a href="http://profiles.wordpress.org/alessandrotesoro/" target="_blank">' . esc_html__( 'Get More Free Plugins', 'easy-peasy-mailchimp' ) . '</a>',  
  50. ); 
  51.  
  52. $input = array_merge( $input, $links ); 
  53.  
  54. return $input; 
  55.  
  56. /** 
  57. * Localization 
  58. * @since 1.0.0 
  59. */ 
  60. public function epm_load_plugin_textdomain() { 
  61. load_plugin_textdomain( 'easy-peasy-mailchimp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 
  62.  
  63. /** 
  64. * Include required files 
  65. * @since 1.0.0 
  66. */ 
  67. private function epm_includes() { 
  68.  
  69. // Plugin options handler 
  70. global $epm_options; 
  71. require_once EPM_PLUGIN_DIR . '/includes/admin/settings/register-settings.php'; 
  72. $epm_options = epm_get_settings(); 
  73.  
  74. if(is_admin()) { 
  75. require_once EPM_PLUGIN_DIR . '/includes/admin/settings/display-settings.php'; 
  76.  
  77. // Load MailChimp API Class 
  78. require_once EPM_PLUGIN_DIR . '/includes/MailChimp.php'; 
  79.  
  80. // Easy Peasy MailChimp Template Manager 
  81. require_once EPM_PLUGIN_DIR . '/includes/template.php'; 
  82.  
  83. // Easy Peasy MailChimp Shortcode 
  84. require_once EPM_PLUGIN_DIR . '/includes/shortcode.php'; 
  85.  
  86. // Easy Peasy Ajax Handler 
  87. require_once EPM_PLUGIN_DIR . '/includes/ajax.php';  
  88.  
  89.  
  90. /** 
  91. * Add Plugin Menu Page 
  92. * @since 1.0.0 
  93. */ 
  94. public function epm_add_options_link() { 
  95. global $epm_settings_page; 
  96. $epm_settings_page = add_submenu_page( 'options-general.php', __( 'Easy Peasy MailChimp Settings', 'easy-peasy-mailchimp' ), __( 'MailChimp Settings', 'easy-peasy-mailchimp' ), 'manage_options', 'epm-settings', 'epm_options_page' ); 
  97.  
  98. /** 
  99. * Add box into the sidebar of the settings page. 
  100. * @since 1.0.0 
  101. */ 
  102. public function epm_add_settings_box() { 
  103.  
  104. echo '<div class="postbox"> 
  105. <h3 class="hndle">'.__('MailChimp Form Usage', 'easy-peasy-mailchimp').'</h3> 
  106. <div class="inside"> 
  107. '.__('To display a mailchimp signup form use the shortcode below here.', 'easy-peasy-mailchimp').' 
  108. <br/><br/> 
  109. <code>[epm_mailchimp]</code> 
  110. </div> 
  111.  
  112. <div id="major-publishing-actions"> 
  113. <a href="http://kb.mailchimp.com/article/where-can-i-find-my-api-key" target="_blank" class="button">'.__('Get Your API Key', 'easy-peasy-mailchimp').'</a> 
  114. <a href="http://kb.mailchimp.com/article/how-can-i-find-my-list-id" target="_blank" class="button">'.__('Get Your List ID', 'easy-peasy-mailchimp').'</a>  
  115. </div> 
  116. </div>'; 
  117.  
  118. /** 
  119. * Add box into the sidebar of the settings page. 
  120. * @since 1.0.0 
  121. */ 
  122. public function epm_add_settings_box_advert() { 
  123.  
  124. echo '<div class="postbox"> 
  125. <h3 class="hndle">'.__('Premium WordPress Themes', 'easy-peasy-mailchimp').'</h3> 
  126. <div class="inside"> 
  127. '.__('Are you looking for Premium WordPress Themes? <a href="http://themesdepot.org" target="_blank">ThemesDepot</a> provides premium and affordable WordPress themes for any kind of website.', 'easy-peasy-mailchimp').' 
  128. </div> 
  129.  
  130. <div id="major-publishing-actions"> 
  131. <a href="http://themeforest.net/user/ThemesDepot/portfolio?ref=ThemesDepot" target="_blank" class="button-primary">'.__('Browse Premium Themes', 'easy-peasy-mailchimp').'</a> 
  132. </div> 
  133. </div>'; 
  134.  
  135. /** 
  136. * Add links next to title in settings page 
  137. * @since 1.0.0 
  138. */ 
  139. public function epm_add_links_to_title() { 
  140.  
  141. echo '<a href="http://profiles.wordpress.org/alessandrotesoro/" class="add-new-h2" target="_blank">'.__('Get More Free Plugins', 'easy-peasy-mailchimp').'</a>'; 
  142. echo '<a href="http://themeforest.net/user/ThemesDepot/portfolio?ref=ThemesDepot" class="add-new-h2" target="_blank">'.__('Browse Premium WordPress Themes', 'easy-peasy-mailchimp').'</a>'; 
  143.