array(), 'visible_button' => true, ); private static $firstLoad = true; /** * Constructor * * @since 1.4 */ function __construct( $settings, $owner ) { parent::__construct( $settings, $owner ); add_action( 'admin_head', array( __CLASS__, 'createSortableScript' ) ); mm_add_action_once( 'admin_enqueue_scripts', array( $this, 'enqueueSortable' ) ); mm_add_action_once( 'customize_controls_enqueue_scripts', array( $this, 'enqueueSortable' ) ); } /** * Enqueues the jQuery UI scripts * * @return void * @since 1.4 */ public function enqueueSortable() { wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-sortable' ); } /** * Creates the javascript needed for sortable to run * * @return void * @since 1.4 */ public static function createSortableScript() { if ( ! self::$firstLoad ) { return; } self::$firstLoad = false; ?> settings['options'] ) ) { return; } if ( ! count( $this->settings['options'] ) ) { return; } $this->echoOptionHeader( true ); $values = $this->getValue(); if ( $values == '' ) { $values = array_keys( $this->settings['options'] ); } if ( count( $values ) != count( $this->settings['options'] ) ) { $this->settings['visible_button'] = true; } $visibleButton = ''; $orientation = ''; if ( $this->settings['visible_button'] == true ) { $visibleButton = ""; } if ( isset( $this->settings['orientation'] ) ) { $orientation = $this->settings['orientation']; } ?>
", $this->getID(), $this->getID(), esc_attr( $values ) ); $this->echoOptionFooter( false ); } /** * Cleans up the serialized value before saving * * @param string $value The serialized value * @return string The cleaned value * @since 1.4 */ public function cleanValueForSaving( $value ) { if ( is_array( $value ) ) { return serialize( $value ); } return stripslashes( $value ); } /** * Cleans the raw value for getting * * @param string $value The raw value * @return string The cleaned value * @since 1.4 */ public function cleanValueForGetting( $value ) { if ( is_array( $value ) ) { return $value; } if ( is_serialized( stripslashes( $value ) ) ) { return unserialize( $value ); } return $value; } }