ta->license ) ) { return - 1; } /** * If we have an invalid license but the pro is installed. */ if ( $license_data->license !== 'valid' ) { if ( $pro_check ) { return 0; } return ( - 1 ); } if ( isset( $license_data->price_id ) ) { return intval( $license_data->price_id ); } $plan = get_option( $product_key . '_license_plan', - 1 ); $plan = intval( $plan ); /** * If the plan is not fetched but we have pro. */ if ( $plan < 1 ) { if ( $pro_check ) { return 0; } return - 1; } return $plan; } /** * Method to retrieve instance of post_format. * * @since 8.0.0 * @access public * * @param bool|string $service_name The name of the service. Default false. Returns all. * * @return array|mixed */ public function get_default_post_format( $service_name = false ) { if ( isset( $service_name ) && $service_name != false && isset( self::instance()->post_format[ $service_name ] ) ) { return self::instance()->post_format[ $service_name ]; } return self::instance()->post_format; } /** * Method to retrieve instance of settings. * * @since 8.0.0 * @access public * @return array */ public function get_default_settings() { return self::instance()->settings; } /** * Method to retrieve only the active services handle. * * @since 8.0.0 * @access public * @return array */ public function get_active_services_handle() { $active = array(); foreach ( $this->get_available_services() as $handle => $data ) { if ( $data['active'] == true ) { array_push( $active, $handle ); } } return $active; } /** * Method to retrieve instance of services. * * @since 8.0.0 * @access public * @return array */ public function get_available_services() { $available_services = apply_filters( 'rop_available_services', self::instance()->services_defaults ); /** * Don't show credentials popup if the service is already authenticated. */ $service_model = new Rop_Services_Model(); foreach ( $available_services as $key => $service ) { $registered = $service_model->get_authenticated_services( $key ); if ( empty( $registered ) ) { continue; } $registered = array_filter( $registered, function ( $value ) { return ! empty( $value['public_credentials'] ); } ); if ( empty( $registered ) ) { continue; } $service['credentials'] = array(); /** * These variables prevent Twitter service to register multiple accounts. * $service['two_step_sign_in'] = false; For Twitter, this prevent the modal to open up * Even if the modal displays, the variable $available_services[ $key ] will prevent the form to show up. */ if ( 'twitter' !== $key && 'tumblr' !== $key ) { $service['two_step_sign_in'] = false; $available_services[ $key ] = $service; } } return $available_services; } /** * Update the time. * * @return void */ public function update_start_time() { $settings_model = new Rop_Settings_Model(); $settings = $settings_model->get_settings(); $settings['start_time'] = time(); $settings_model->save_settings( $settings ); } /** * Update the time. * * @return int */ public function get_start_time() { $settings_model = new Rop_Settings_Model(); return $settings_model->get_start_time(); } /** * Update the time. * * @return void */ public function reset_start_time() { $settings_model = new Rop_Settings_Model(); $settings = $settings_model->get_settings(); $settings['start_time'] = false; $settings_model->save_settings( $settings ); } /** * Method to retrieve all the services handles. * * @since 8.0.0rc * @access public * @return array */ public function get_all_services_handle() { $all = array(); foreach ( $this->get_available_services() as $handle => $data ) { array_push( $all, $handle ); } return $all; } }