+ function wp_getPageTemplates( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if( !$this->login_pass_ok( $username, $password ) ) {
+ return $this->error;
+ }
+
+ set_current_user( 0, $username );
+ if( !current_user_can( 'edit_pages' ) ) {
+ return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
+ }
+
+ $templates = get_page_templates( );
+ $templates['Default'] = 'default';
+
+ return $templates;
+ }
+
+ function wp_getOptions( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $options = (array) $args[3];
+
+ if( !$this->login_pass_ok( $username, $password ) )
+ return $this->error;
+
+ $user = set_current_user( 0, $username );
+
+ // If no specific options where asked for, return all of them
+ if (count( $options ) == 0 ) {
+ $options = array_keys($this->blog_options);
+ }
+
+ return $this->_getOptions($options);
+ }
+
+ function _getOptions($options)
+ {
+ $data = array( );
+ foreach( $options as $option ) {
+ if( array_key_exists( $option, $this->blog_options ) )
+ {
+ $data[$option] = $this->blog_options[$option];
+ //Is the value static or dynamic?
+ if( isset( $data[$option]['option'] ) ) {
+ $data[$option]['value'] = get_option( $data[$option]['option'] );
+ unset($data[$option]['option']);
+ }
+ }
+ }
+
+ return $data;
+ }
+
+ function wp_setOptions( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $options = (array) $args[3];
+
+ if( !$this->login_pass_ok( $username, $password ) )
+ return $this->error;
+
+ $user = set_current_user( 0, $username );
+ if( !current_user_can( 'manage_options' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
+
+ foreach( $options as $o_name => $o_value ) {
+ $option_names[] = $o_name;
+ if( empty( $o_value ) )
+ continue;
+
+ if( !array_key_exists( $o_name, $this->blog_options ) )
+ continue;
+
+ if( $this->blog_options[$o_name]['readonly'] == true )
+ continue;
+
+ update_option( $this->blog_options[$o_name]['option'], $o_value );
+ }
+
+ //Now return the updated values
+ return $this->_getOptions($option_names);
+ }