}
- /**
- * Parse the name of a plugin to check if 'search=' exists, and check search transient for the key
- *
- * @param string name
- * @return string
- */
- public function _parse_search_key( $name, $data_type = 'plugin' ) {
-
- // Sanitize to 1 of 2 types
- $data_type = 'plugin' === $data_type ? 'plugin' : 'theme';
-
- if ( false !== strpos( $name, 'search=' ) ) {
- $search_key = (int) str_replace( 'search=', '', $name );
- if ( ( $trans = get_site_transient( 'wpcli-$data_type-search-data' ) ) && isset( $trans[$search_key] ) )
- $name = $trans[$search_key]->slug;
- else
- \WP_CLI::error( 'There is no recent search with that key.' );
- }
- return $name;
- }
-
}
}
protected function status_single( $args ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
$details = $this->get_details( $file );
* @synopsis <plugin> [--network]
*/
function activate( $args, $assoc_args = array() ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
$network_wide = isset( $assoc_args['network'] );
* @synopsis <plugin> [--network]
*/
function deactivate( $args, $assoc_args = array() ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
$network_wide = isset( $assoc_args['network'] );
* @synopsis <plugin> [--network]
*/
function toggle( $args, $assoc_args = array() ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
$network_wide = isset( $assoc_args['network'] );
* @synopsis <plugin> [--version=<version>]
*/
function update( $args, $assoc_args ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$basename = $this->parse_name( $name );
if ( isset( $assoc_args['version'] ) && 'dev' == $assoc_args['version'] ) {
* @synopsis <plugin|zip|url> [--version=<version>] [--force] [--activate]
*/
function install( $args, $assoc_args ) {
- $args[0] = $this->parse_search_key( $args[0] );
parent::install( $args, $assoc_args );
}
* @synopsis <plugin> [--no-delete]
*/
function uninstall( $args, $assoc_args = array() ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
if ( is_plugin_active( $file ) ) {
* @synopsis <plugin>
*/
function delete( $args, $assoc_args = array() ) {
- $name = $this->parse_search_key( $args[0] );
+ $name = $args[0];
$file = $this->parse_name( $name );
if ( $this->_delete( $file ) ) {
}
/**
- * Parse the name of a plugin to check if 'search=' exists, and check search transient for the key
- *
- * @param string name
- * @return string
- */
- public function parse_search_key( $name ) {
- return parent::_parse_search_key( $name, 'plugin' );
- }
-
- /**
* Converts a plugin basename back into a friendly slug.
*/
private function get_name( $file ) {
* @synopsis <theme|zip|url> [--version=<version>] [--force] [--activate]
*/
function install( $args, $assoc_args ) {
- $args[0] = $this->parse_search_key( $args[0] );
parent::install( $args, $assoc_args );
}
* @return object
*/
private function parse_name( $name ) {
- $theme = wp_get_theme( $this->parse_search_key( $name ) );
+ $theme = wp_get_theme( $name );
if ( !$theme->exists() ) {
WP_CLI::error( "The theme '$name' could not be found." );
return $theme;
}
- /**
- * Parse the name of a theme to check if 'search=' exists, and check search transient for the key
- *
- * @param string name
- * @return string
- */
- public function parse_search_key( $name ) {
- return parent::_parse_search_key( $name, 'theme' );
- }
}
WP_CLI::add_command( 'theme', 'Theme_Command' );