File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ class WP_JSON_Authentication_OAuth1_CLI extends WP_CLI_Command {
4
+
5
+ /**
6
+ * ## OPTIONS
7
+ *
8
+ * [--name=<name>]
9
+ * : Consumer name
10
+ *
11
+ * [--description=<description>]
12
+ * : Consumer description
13
+ */
14
+ public function add ( $ _ , $ args ) {
15
+ $ authenticator = new WP_JSON_Authentication_OAuth1 ();
16
+ $ consumer = $ authenticator ->add_consumer ( $ args );
17
+ WP_CLI ::line ( sprintf ( 'ID: %d ' , $ consumer ->ID ) );
18
+ WP_CLI ::line ( sprintf ( 'Key: %s ' , $ consumer ->key ) );
19
+ WP_CLI ::line ( sprintf ( 'Secret: %s ' , $ consumer ->secret ) );
20
+ }
21
+ }
Original file line number Diff line number Diff line change 8
8
include_once ( dirname ( __FILE__ ) . '/lib/class-wp-json-authentication-oauth1.php ' );
9
9
include_once ( dirname ( __FILE__ ) . '/lib/class-wp-json-authentication-oauth1-authorize.php ' );
10
10
11
+ if ( defined ( 'WP_CLI ' ) && WP_CLI ) {
12
+ include_once ( dirname ( __FILE__ ) . '/lib/class-wp-json-authentication-oauth1-cli.php ' );
13
+
14
+ WP_CLI ::add_command ( 'oauth1 ' , 'WP_JSON_Authentication_OAuth1_CLI ' );
15
+ }
16
+
11
17
/**
12
18
* Register our rewrite rules for the API
13
19
*/
You can’t perform that action at this time.
0 commit comments