PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.3
StreamCast – bring live radio to your site with a sleek player v2.2.3
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / admin / codestar-framework / fields / sorter / sorter.php

sorter.php in StreamCast – bring live radio to your site with a sleek player 2.2.3, at admin/codestar-framework/fields/sorter/sorter.php

77 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * Field: sorter
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'CSF_Field_sorter' ) ) {
11 class CSF_Field_sorter extends CSF_Fields {
12
13 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 parent::__construct( $field, $value, $unique, $where, $parent );
15 }
16
17 public function render() {
18
19 $args = wp_parse_args( $this->field, array(
20 'disabled' => true,
21 'enabled_title' => esc_html__( 'Enabled', 'csf' ),
22 'disabled_title' => esc_html__( 'Disabled', 'csf' ),
23 ) );
24
25 echo $this->field_before();
26
27 $this->value = ( ! empty( $this->value ) ) ? $this->value : $this->field['default'];
28 $enabled_options = ( ! empty( $this->value['enabled'] ) ) ? $this->value['enabled'] : array();
29 $disabled_options = ( ! empty( $this->value['disabled'] ) ) ? $this->value['disabled'] : array();
30
31 echo '<div class="csf-sorter" data-depend-id="'. esc_attr( $this->field['id'] ) .'"></div>';
32
33 echo ( $args['disabled'] ) ? '<div class="csf-modules">' : '';
34
35 echo ( ! empty( $args['enabled_title'] ) ) ? '<div class="csf-sorter-title">'. esc_attr( $args['enabled_title'] ) .'</div>' : '';
36 echo '<ul class="csf-enabled">';
37 if ( ! empty( $enabled_options ) ) {
38 foreach ( $enabled_options as $key => $value ) {
39 echo '<li><input type="hidden" name="'. esc_attr( $this->field_name( '[enabled]['. $key .']' ) ) .'" value="'. esc_attr( $value ) .'"/><label>'. esc_attr( $value ) .'</label></li>';
40 }
41 }
42 echo '</ul>';
43
44 // Check for hide/show disabled section
45 if ( $args['disabled'] ) {
46
47 echo '</div>';
48
49 echo '<div class="csf-modules">';
50 echo ( ! empty( $args['disabled_title'] ) ) ? '<div class="csf-sorter-title">'. esc_attr( $args['disabled_title'] ) .'</div>' : '';
51 echo '<ul class="csf-disabled">';
52 if ( ! empty( $disabled_options ) ) {
53 foreach ( $disabled_options as $key => $value ) {
54 echo '<li><input type="hidden" name="'. esc_attr( $this->field_name( '[disabled]['. $key .']' ) ) .'" value="'. esc_attr( $value ) .'"/><label>'. esc_attr( $value ) .'</label></li>';
55 }
56 }
57 echo '</ul>';
58 echo '</div>';
59
60 }
61
62
63 echo $this->field_after();
64
65 }
66
67 public function enqueue() {
68
69 if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
70 wp_enqueue_script( 'jquery-ui-sortable' );
71 }
72
73 }
74
75 }
76 }
77