Sindbad~EG File Manager

Current Path : /home/xiedrke/entrepot/wp-content/plugins/realpress/app/Controllers/
Upload File :
Current File : /home/xiedrke/entrepot/wp-content/plugins/realpress/app/Controllers/WPDropDownController.php

<?php

namespace RealPress\Controllers;

class WPDropDownController {

	public function __construct() {
		add_action( 'wp_dropdown_cats', array( $this, 'wp_dropdown_cats_multiple' ), 10, 2 );
	}

	public function wp_dropdown_cats_multiple( $output, $args ) {
		if ( isset( $args['multiple'] ) && $args['multiple'] ) {
			$output = preg_replace( '/^<select/i', '<select multiple', $output );

			$output = str_replace( "name='{$args['name']}'", "name='{$args['name']}[]'", $output );

			foreach ( array_map( 'trim', explode( ',', $args['selected'] ) ) as $value ) {
				$output = str_replace( "value=\"{$value}\"", "value=\"{$value}\" selected", $output );
			}
		}

		return $output;
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists