active_gateway(); if ( $gateway instanceof GatewayInterface ) { return $gateway->send( $to, $message ); } return false; } /** * Get the active gateway * * @return Gateways\GatewayInterface|false */ public function active_gateway() { $gateways = $this->all(); $gateway = texty()->settings()->gateway(); if ( $gateway && array_key_exists( $gateway, $gateways ) ) { return new $gateways[ $gateway ](); } return false; } /** * Get all the available gateways * * @return array */ public function all() { $gateways = [ 'twilio' => __NAMESPACE__ . '\Gateways\Twilio', 'vonage' => __NAMESPACE__ . '\Gateways\Vonage', 'clickatell' => __NAMESPACE__ . '\Gateways\Clickatell', 'plivo' => __NAMESPACE__ . '\Gateways\Plivo', ]; if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { $gateways['fake'] = __NAMESPACE__ . '\Gateways\Fake'; } return apply_filters( 'texty_available_gateways', $gateways ); } }