WP_Installer_API

The WooCommerce Multilingual WP Installer API class.

Defined (1)

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

/vendor/otgs/installer/includes/installer-api.php  
  1. class WP_Installer_API{ 
  2.  
  3. public static function get_product_installer_link($repository_id, $package_id = false) { 
  4.  
  5. $menu_url = WP_Installer()->menu_url(); 
  6.  
  7. $url = $menu_url . '#' . $repository_id; 
  8. if($package_id) { 
  9. $url .= '/' . $package_id; 
  10.  
  11. return $url; 
  12.  
  13.  
  14. public static function get_product_price($repository_id, $package_id, $product_id, $incl_discount = false) { 
  15.  
  16. $price = WP_Installer()->get_product_price($repository_id, $package_id, $product_id, $incl_discount); 
  17.  
  18. return $price; 
  19.  
  20. /** 
  21. * Retrieve the preferred translation service. 
  22. * @since 1.6.5 
  23. * @param string The repository id (e.g. wpml) 
  24. * @return string The translation service id 
  25. */ 
  26. public static function get_preferred_ts($repository_id = 'wpml') { 
  27.  
  28. if(isset(WP_Installer()->settings['repositories'][$repository_id]['ts_info']['preferred'])) { 
  29. return WP_Installer()->settings['repositories'][$repository_id]['ts_info']['preferred']; 
  30.  
  31. return false; 
  32.  
  33.  
  34. /** 
  35. * Set the preferred translation service. 
  36. * @since 1.6.5 
  37. * @param string The translation service id 
  38. * @param string The repository id (e.g. wpml) 
  39. */ 
  40. public static function set_preferred_ts( $value, $repository_id = 'wpml' ) { 
  41.  
  42. if( isset( WP_Installer()->settings['repositories'][$repository_id]['ts_info']['preferred'] ) ) { 
  43.  
  44. WP_Installer()->settings['repositories'][$repository_id]['ts_info']['preferred'] = $value; 
  45.  
  46. WP_Installer()->save_settings(); 
  47.  
  48.  
  49.  
  50. /** 
  51. * Retrieve the referring translation service (if any) 
  52. * @since 1.6.5 
  53. * @param string The repository id (e.g. wpml) 
  54. * @return string The translation service id or false 
  55. */ 
  56. public static function get_ts_referal($repository_id = 'wpml') { 
  57.  
  58. if(isset(WP_Installer()->settings['repositories'][$repository_id]['ts_info']['referal'])) { 
  59. return WP_Installer()->settings['repositories'][$repository_id]['ts_info']['referal']; 
  60.  
  61. return false; 
  62.  
  63.  
  64. /** 
  65. * Retrieve the translation services client id for a specific repository (if any) 
  66. * @since 1.7.9 
  67. * @param string The repository id (e.g. wpml) 
  68. * @return string The client id or false 
  69. */ 
  70. public static function get_ts_client_id( $repository_id = 'wpml' ) { 
  71.  
  72. if(isset(WP_Installer()->settings['repositories'][$repository_id]['ts_info']['client_id'])) { 
  73. return WP_Installer()->settings['repositories'][$repository_id]['ts_info']['client_id']; 
  74.  
  75. return false; 
  76.  
  77.  
  78. /** 
  79. * Retrieve the site key corresponding to a repository. 
  80. * This is a wrapper of WP_Installer::get_site_key() 
  81. * @see WP_Installer::get_site_key() 
  82. * @since 1.7.9 
  83. * @param string The repository id (e.g. wpml) 
  84. * @return string The site key (or false) 
  85. */ 
  86. public static function get_site_key( $repository_id = 'wpml' ) { 
  87.  
  88. return WP_Installer()->get_site_key( $repository_id ); 
  89.  
  90.  
  91. /** 
  92. * Retrieve the ID of the last user who registered a repository. 
  93. * @since 1.7.16 
  94. * @param string The repository id (e.g. wpml) 
  95. * @return int The user id (or zero) 
  96. */ 
  97. public static function get_registering_user_id( $repository_id = 'wpml' ) { 
  98.  
  99. $user_id = 0; 
  100. if( isset( WP_Installer()->settings['repositories'][$repository_id]['subscription']['registered_by'] ) ) { 
  101. $user_id = WP_Installer()->settings['repositories'][$repository_id]['subscription']['registered_by']; 
  102.  
  103. return $user_id; 
  104.  
  105.