text_domain(); self::$instance->updater(); self::$instance->includes(); self::$routes = new RCP_REST_API_Routes; } return self::$instance; } /** * Throw error on object clone. * * The whole idea of the singleton design pattern is that there is a single * object therefore, we don't want the object to be cloned. * * @since 1.0 * @access public * @return void */ public function __clone() { // Cloning instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'rcp-rest' ), '1.0' ); } /** * Disable unserializing of the class. * * @since 1.0 * @access public * @return void */ public function __wakeup() { // Unserializing instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'rcp-rest' ), '1.0' ); } /** * Load our textdomain * * @since 1.0 * @access public * @return void */ public function text_domain() { // Set filter for plugin's languages directory $lang_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; $lang_dir = apply_filters( 'rcp_rest_languages_directory', $lang_dir ); // Traditional WordPress plugin locale filter $locale = apply_filters( 'plugin_locale', get_locale(), 'rcp-rest' ); $mofile = sprintf( '%1$s-%2$s.mo', 'rcp-rest', $locale ); // Setup paths to current locale file $mofile_local = $lang_dir . $mofile; $mofile_global = WP_LANG_DIR . '/rcp/' . $mofile; if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/rcp folder load_textdomain( 'rcp-rest', $mofile_global ); } elseif ( file_exists( $mofile_local ) ) { // Look in local /wp-content/plugins/restrict-content-pro/languages/ folder load_textdomain( 'rcp-rest', $mofile_local ); } else { // Load the default language files load_plugin_textdomain( 'rcp-rest', false, $lang_dir ); } } /** * Load our plugin updater * * @since 1.0 * @access public * @return void */ public function updater() { if( is_admin() && class_exists( 'RCP_Add_On_Updater' ) ) { $updater = new RCP_Add_On_Updater( 389, __FILE__, '1.2.2' ); } } /** * Load our files * * @since 1.0 * @access public * @return void */ public function includes() { require_once self::$path . 'includes/class-routes.php'; require_once self::$path . 'includes/class-level.php'; require_once self::$path . 'includes/class-member.php'; require_once self::$path . 'includes/class-payment.php'; } } /** * Load the REST API after other plugins are loaded * * @since 1.0 * @access public * @return RCP_REST_API */ function rcp_rest_api() { if( ! function_exists( 'rcp_is_active' ) ) { return false; } return RCP_REST_API::instance(); } add_action( 'plugins_loaded', 'rcp_rest_api' ); if ( ! function_exists( 'ithemes_repository_name_updater_register' ) ) { function ithemes_repository_name_updater_register( $updater ) { $updater->register( 'rcp-rest-api', __FILE__ ); } add_action( 'ithemes_updater_register', 'ithemes_repository_name_updater_register' ); require( __DIR__ . '/lib/updater/load.php' ); }