pmpro_init

The Paid Memberships Pro pmpro init function.

Description

pmpro_init(); 

Usage

  1. if ( !function_exists( 'pmpro_init' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/init.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_init(); 
  7.  

Defined (1)

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

/includes/init.php  
  1. function pmpro_init() 
  2. require_once(PMPRO_DIR . "/includes/countries.php"); 
  3. require_once(PMPRO_DIR . "/includes/states.php"); 
  4. require_once(PMPRO_DIR . "/includes/currencies.php"); 
  5.  
  6.  
  7. if(is_admin()) 
  8. wp_enqueue_script('ssmemberships_js', plugins_url('js/paid-memberships-pro.js', dirname(__FILE__) ), array('jquery')); 
  9.  
  10. $admin_css_rtl = false; 
  11. if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/css/admin.css")) { 
  12. $admin_css = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/admin.css"; 
  13. if( is_rtl() && file_exists(get_stylesheet_directory() . "/paid-memberships-pro/css/admin-rtl.css") ) { 
  14. $admin_css_rtl = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/admin-rtl.css"; 
  15. } elseif(file_exists(get_template_directory() . "/paid-memberships-pro/admin.css")) { 
  16. $admin_css = get_template_directory_uri() . "/paid-memberships-pro/admin.css"; 
  17. if( is_rtl() && file_exists(get_template_directory() . "/paid-memberships-pro/css/admin-rtl.css") ) { 
  18. $admin_css_rtl = get_template_directory_uri() . "/paid-memberships-pro/css/admin-rtl.css"; 
  19. } else { 
  20. $admin_css = plugins_url('css/admin.css', dirname(__FILE__) ); 
  21. if( is_rtl() ) { 
  22. $admin_css_rtl = plugins_url('css/admin-rtl.css', dirname(__FILE__) ); 
  23. wp_enqueue_style('pmpro_admin', $admin_css, array(), PMPRO_VERSION, "screen"); 
  24. if( $admin_css_rtl ) { 
  25. wp_enqueue_style('pmpro_admin_rtl', $admin_css_rtl, array(), PMPRO_VERSION, "screen"); 
  26.  
  27. wp_enqueue_script('jquery-ui-sortable'); 
  28. else 
  29. {  
  30. $frontend_css_rtl = false; 
  31. if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/css/frontend.css")) { 
  32. $frontend_css = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/frontend.css"; 
  33. if( is_rtl() && file_exists(get_stylesheet_directory() . "/paid-memberships-pro/css/frontend-rtl.css") ) { 
  34. $frontend_css_rtl = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/frontend-rtl.css"; 
  35. } elseif(file_exists(get_template_directory() . "/paid-memberships-pro/frontend.css")) { 
  36. $frontend_css = get_template_directory_uri() . "/paid-memberships-pro/frontend.css"; 
  37. if( is_rtl() && file_exists(get_template_directory() . "/paid-memberships-pro/css/frontend-rtl.css") ) { 
  38. $frontend_css_rtl = get_template_directory_uri() . "/paid-memberships-pro/css/frontend-rtl.css"; 
  39. } else { 
  40. $frontend_css = plugins_url('css/frontend.css', dirname(__FILE__) );  
  41. if( is_rtl() ) { 
  42. $frontend_css_rtl = plugins_url('css/frontend-rtl.css', dirname(__FILE__) ); 
  43. wp_enqueue_style('pmpro_frontend', $frontend_css, array(), PMPRO_VERSION, "screen"); 
  44. if( $frontend_css_rtl ) { 
  45. wp_enqueue_style('pmpro_frontend_rtl', $frontend_css_rtl, array(), PMPRO_VERSION, "screen"); 
  46.  
  47. if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/css/print.css")) 
  48. $print_css = get_stylesheet_directory_uri() . "/paid-memberships-pro/css/print.css"; 
  49. elseif(file_exists(get_template_directory() . "/paid-memberships-pro/print.css")) 
  50. $print_css = get_template_directory_uri() . "/paid-memberships-pro/print.css"; 
  51. else 
  52. $print_css = plugins_url('css/print.css', dirname(__FILE__) ); 
  53. wp_enqueue_style('pmpro_print', $print_css, array(), PMPRO_VERSION, "print"); 
  54.  
  55. global $pmpro_pages, $pmpro_core_pages, $pmpro_ready, $pmpro_currencies, $pmpro_currency, $pmpro_currency_symbol; 
  56. $pmpro_pages = array(); 
  57. $pmpro_pages["account"] = pmpro_getOption("account_page_id"); 
  58. $pmpro_pages["billing"] = pmpro_getOption("billing_page_id"); 
  59. $pmpro_pages["cancel"] = pmpro_getOption("cancel_page_id"); 
  60. $pmpro_pages["checkout"] = pmpro_getOption("checkout_page_id"); 
  61. $pmpro_pages["confirmation"] = pmpro_getOption("confirmation_page_id"); 
  62. $pmpro_pages["invoice"] = pmpro_getOption("invoice_page_id"); 
  63. $pmpro_pages["levels"] = pmpro_getOption("levels_page_id"); 
  64.  
  65. //save this in case we want a cleanversionof the array with just the core pages 
  66. $pmpro_core_pages = $pmpro_pages; 
  67.  
  68. $pmpro_ready = pmpro_is_ready(); 
  69.  
  70. /** 
  71. * This action is documented in /adminpages/pagesettings.php 
  72. */ 
  73. $extra_pages = apply_filters('pmpro_extra_page_settings', array()); 
  74. foreach($extra_pages as $name => $page)  
  75. $pmpro_pages[$name] = pmpro_getOption($name . '_page_id'); 
  76.  
  77.  
  78. //set currency 
  79. $pmpro_currency = pmpro_getOption("currency"); 
  80. if(!$pmpro_currency) 
  81. global $pmpro_default_currency; 
  82. $pmpro_currency = $pmpro_default_currency; 
  83.  
  84. //figure out what symbol to show for currency 
  85. if(!empty($pmpro_currencies[$pmpro_currency]) && is_array($pmpro_currencies[$pmpro_currency])) 
  86. $pmpro_currency_symbol = $pmpro_currencies[$pmpro_currency]['symbol']; 
  87. elseif(!empty($pmpro_currencies[$pmpro_currency]) && strpos($pmpro_currencies[$pmpro_currency], "(") !== false) 
  88. $pmpro_currency_symbol = pmpro_getMatches("/\((.*)\)/", $pmpro_currencies[$pmpro_currency], true);  
  89. else 
  90. $pmpro_currency_symbol = $pmpro_currency . " "; //just use the code