callouts
4 months ago
upgrade
4 months ago
widgets
4 months ago
components-admin.php
1 month ago
help-addons-row.php
4 months ago
help-addons.php
4 months ago
help.php
4 months ago
postbox-header.php
4 months ago
settings-reset.php
4 months ago
settings-settings.php
4 months ago
settings-tools.php
4 months ago
settings.php
4 months ago
setup-add.php
4 months ago
setup-edit.php
4 months ago
shortcode.php
4 months ago
view.php
4 months ago
components-admin.php
141 lines
| 1 | <?php |
| 2 | |
| 3 | // Don't load directly. |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | die( '-1' ); |
| 6 | } |
| 7 | |
| 8 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 9 | |
| 10 | // Prevent non-admins. |
| 11 | if ( ! pods_is_admin( 'pods_components' ) ) { |
| 12 | die( '-1' ); |
| 13 | } |
| 14 | ?> |
| 15 | <div class="wrap pods-admin"> |
| 16 | <div id="icon-pods" class="icon32"><br /></div> |
| 17 | <form action="" method="post" class="pods-submittable"> |
| 18 | <div class="pods-submittable-fields"> |
| 19 | <?php PodsForm::output_field( 'action', 'pods_admin_components', 'hidden' ); ?> |
| 20 | <?php PodsForm::output_field( 'component', $component, 'hidden' ); ?> |
| 21 | <?php PodsForm::output_field( 'method', 'settings', 'hidden' ); ?> |
| 22 | <?php PodsForm::output_field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-settings' ), 'hidden' ); ?> |
| 23 | |
| 24 | <h2><?php esc_html_e( 'Settings', 'pods' ); ?>: <?php echo esc_html( $component_label ); ?></h2> |
| 25 | |
| 26 | <?php |
| 27 | if ( isset( $_GET['do'] ) ) { |
| 28 | pods_message( esc_html__( 'Settings saved successfully.', 'pods' ) ); |
| 29 | } |
| 30 | ?> |
| 31 | |
| 32 | <table class="form-table pods-manage-field"> |
| 33 | <?php |
| 34 | $depends_on = false; |
| 35 | |
| 36 | foreach ( $options as $field_name => $field_option ) { |
| 37 | $field_option = PodsForm::field_setup( $field_option, null, $field_option['type'] ); |
| 38 | |
| 39 | $field_option['disable_dfv'] = true; |
| 40 | |
| 41 | $dep_options = PodsForm::dependencies( $field_option ); |
| 42 | $dep_classes = $dep_options['classes']; |
| 43 | $dep_data = $dep_options['data']; |
| 44 | |
| 45 | if ( ( ! empty( $depends_on ) || ! empty( $dep_classes ) ) && $depends_on != $dep_classes ) { |
| 46 | if ( ! empty( $depends_on ) ) { |
| 47 | ?> |
| 48 | </tbody> |
| 49 | <?php |
| 50 | } |
| 51 | |
| 52 | if ( ! empty( $dep_classes ) ) { |
| 53 | ?> |
| 54 | <tbody class="pods-field-option-container <?php echo esc_attr( $dep_classes ); ?>" <?php PodsForm::data( $dep_data ); ?>> |
| 55 | <?php |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if ( ! is_array( $field_option['group'] ) ) { |
| 60 | $value = pods_v( $field_name, $settings, $field_option['default'] ); |
| 61 | ?> |
| 62 | <tr valign="top" class="pods-field-option" id="pods-setting-<?php echo esc_attr( $field_name ); ?>"> |
| 63 | <th> |
| 64 | <?php PodsForm::output_label( 'pods_setting_' . $field_name, $field_option['label'], pods_v( 'help', $field_option ), $field_option ); ?> |
| 65 | </th> |
| 66 | <td> |
| 67 | <?php PodsForm::output_field( 'pods_setting_' . $field_name, $value, $field_option['type'], $field_option ); ?> |
| 68 | </td> |
| 69 | </tr> |
| 70 | <?php |
| 71 | } else { |
| 72 | ?> |
| 73 | <tr valign="top" class="pods-field-option-group" id="pods-setting-<?php echo esc_attr( $field_name ); ?>"> |
| 74 | <th class="pods-field-option-group-label"> |
| 75 | <?php echo esc_html( $field_option['label'] ); ?> |
| 76 | </th> |
| 77 | <td class="pods-pick-values pods-pick-checkbox"> |
| 78 | <ul> |
| 79 | <?php |
| 80 | foreach ( $field_option['group'] as $field_group_name => $field_group_option ) { |
| 81 | $field_group_option = PodsForm::field_setup( $field_group_option, null, $field_group_option['type'] ); |
| 82 | |
| 83 | if ( 'boolean' !== $field_group_option['type'] ) { |
| 84 | continue; |
| 85 | } |
| 86 | |
| 87 | $field_group_option['boolean_yes_label'] = $field_group_option['label']; |
| 88 | |
| 89 | $group_dep_options = PodsForm::dependencies( $field_group_option ); |
| 90 | $group_dep_classes = $group_dep_options['classes']; |
| 91 | $group_dep_data = $group_dep_options['data']; |
| 92 | |
| 93 | $value = pods_v( $field_group_name, $settings, $field_group_option['default'] ); |
| 94 | ?> |
| 95 | <li class="<?php echo esc_attr( $group_dep_classes ); ?>" <?php PodsForm::data( $group_dep_data ); ?>> |
| 96 | <?php PodsForm::output_field( 'pods_setting_' . $field_group_name, $value, $field_group_option['type'], $field_group_option ); ?> |
| 97 | </li> |
| 98 | <?php |
| 99 | } |
| 100 | ?> |
| 101 | </ul> |
| 102 | </td> |
| 103 | </tr> |
| 104 | <?php |
| 105 | }//end if |
| 106 | |
| 107 | if ( false !== $depends_on || ! empty( $dep_classes ) ) { |
| 108 | $depends_on = $dep_options; |
| 109 | } |
| 110 | }//end foreach |
| 111 | |
| 112 | if ( ! empty( $depends_on ) ) { |
| 113 | ?> |
| 114 | </tbody> |
| 115 | <?php |
| 116 | } |
| 117 | ?> |
| 118 | </table> |
| 119 | |
| 120 | <p class="submit"> |
| 121 | <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Save Changes', 'pods' ); ?>"> |
| 122 | <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> |
| 123 | </p> |
| 124 | </div> |
| 125 | </form> |
| 126 | </div> |
| 127 | |
| 128 | <script type="text/javascript"> |
| 129 | jQuery( function ( $ ) { |
| 130 | $( document ).Pods( 'validate' ); |
| 131 | $( document ).Pods( 'submit' ); |
| 132 | $( document ).Pods( 'dependency' ); |
| 133 | $( document ).Pods( 'confirm' ); |
| 134 | $( document ).Pods( 'exit_confirm' ); |
| 135 | } ); |
| 136 | |
| 137 | var pods_admin_submit_callback = function ( id ) { |
| 138 | document.location = <?php echo json_encode( esc_url_raw( pods_query_arg( array( 'do' => 'save' ) ) ) ); ?>; |
| 139 | } |
| 140 | </script> |
| 141 |