info-shortcodes.php
11 years ago
meta-appearance.php
11 years ago
meta-behavior.php
11 years ago
meta-content.php
11 years ago
meta-customcss.php
11 years ago
meta-rules.php
11 years ago
meta-submitdiv.php
11 years ago
network.php
11 years ago
settings.php
11 years ago
settings.php
237 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display the popup settings page. |
| 4 | */ |
| 5 | |
| 6 | $loading_methods = IncPopupDatabase::get_loading_methods(); |
| 7 | |
| 8 | |
| 9 | $settings = IncPopupDatabase::get_settings(); |
| 10 | $cur_method = $settings['loadingmethod']; |
| 11 | $form_url = esc_url_raw( |
| 12 | remove_query_arg( array( 'message', 'action', '_wpnonce' ) ) |
| 13 | ); |
| 14 | |
| 15 | |
| 16 | // Theme compatibility. |
| 17 | $theme_compat = IncPopupAddon_HeaderFooter::check(); |
| 18 | $theme_class = $theme_compat->okay ? 'msg-ok' : 'msg-err'; |
| 19 | |
| 20 | |
| 21 | $rules = IncPopup::get_rules(); |
| 22 | $rule_headers = array( |
| 23 | 'name' => 'Name', |
| 24 | 'desc' => 'Description', |
| 25 | 'rules' => 'Rules', |
| 26 | 'limit' => 'Limit', |
| 27 | ); |
| 28 | $ordered_rules = array(); |
| 29 | |
| 30 | ?> |
| 31 | <div class="wrap nosubsub"> |
| 32 | |
| 33 | <h2><?php _e( 'PopUp Settings', PO_LANG ); ?></h2> |
| 34 | |
| 35 | <div id="poststuff" class="metabox-holder m-settings"> |
| 36 | <form method="post" action="<?php echo esc_url( $form_url ); ?>"> |
| 37 | |
| 38 | <input type="hidden" name="action" value="updatesettings" /> |
| 39 | |
| 40 | <?php wp_nonce_field( 'update-popup-settings' ); ?> |
| 41 | |
| 42 | <div class="wpmui-box static"> |
| 43 | <h3> |
| 44 | <span><?php _e( 'PopUp Loading Method', PO_LANG ); ?></span> |
| 45 | </h3> |
| 46 | |
| 47 | <div class="inside"> |
| 48 | <p><?php |
| 49 | _e( |
| 50 | 'Select how you would like to load PopUp.', PO_LANG |
| 51 | ); |
| 52 | ?></p> |
| 53 | |
| 54 | <table class="form-table"> |
| 55 | <tbody> |
| 56 | |
| 57 | <?php /* === LOADING METHOD === */ ?> |
| 58 | <tr valign="top"> |
| 59 | <th scope="row"> |
| 60 | <?php _e( 'Load PopUp using', PO_LANG ); ?> |
| 61 | </th> |
| 62 | <td> |
| 63 | <select name="po_option[loadingmethod]" id="loadingmethod"> |
| 64 | <?php foreach ( $loading_methods as $item ) : ?> |
| 65 | <option |
| 66 | value="<?php echo esc_attr( $item->id ); ?>" |
| 67 | <?php if ( ! empty( $item->disabled ) ) { echo 'disabled="disabled"'; } ?> |
| 68 | <?php selected( $cur_method, $item->id ); ?>> |
| 69 | <?php _e( $item->label, PO_LANG ); ?> |
| 70 | </option> |
| 71 | <?php endforeach; ?> |
| 72 | </select> |
| 73 | |
| 74 | <ul> |
| 75 | <?php foreach ( $loading_methods as $item ) : ?> |
| 76 | <li> |
| 77 | <?php if ( $cur_method == $item->id ) : ?> |
| 78 | <strong><i class="dashicons dashicons-yes" |
| 79 | style="margin-left:-20px"> |
| 80 | </i><?php _e( $item->label, PO_LANG ); ?></strong>: |
| 81 | <?php else : ?> |
| 82 | <?php _e( $item->label, PO_LANG ); ?>: |
| 83 | <?php endif; ?> |
| 84 | <em><?php echo '' . $item->info; ?> |
| 85 | </em></li> |
| 86 | <?php endforeach; ?> |
| 87 | </ul> |
| 88 | </td> |
| 89 | </tr> |
| 90 | </tbody> |
| 91 | </table> |
| 92 | </div> |
| 93 | </div> |
| 94 | |
| 95 | <?php if ( 'footer' == $cur_method ) : ?> |
| 96 | <div class="wpmui-box <?php echo esc_attr( $theme_compat->okay ? 'closed' : '' ); ?>"> |
| 97 | <h3> |
| 98 | <a href="#" class="toggle" title="<?php _e( 'Click to toggle' ); ?>"><br></a> |
| 99 | <span><?php _e( 'Theme compatibility', PO_LANG ); ?></span> |
| 100 | </h3> |
| 101 | |
| 102 | <div class="inside"> |
| 103 | <?php |
| 104 | _e( |
| 105 | 'Here you can see if your theme is compatible with the ' . |
| 106 | '"Page Footer" loading method.', PO_LANG |
| 107 | ); |
| 108 | ?> |
| 109 | <div class="<?php echo esc_attr( $theme_class ); ?>"> |
| 110 | <?php foreach ( $theme_compat->msg as $row ) { |
| 111 | echo '<p>' . $row . '</p>'; |
| 112 | } ?> |
| 113 | </div> |
| 114 | </div> |
| 115 | </div> |
| 116 | <?php endif; ?> |
| 117 | |
| 118 | <div class="wpmui-box closed"> |
| 119 | <h3> |
| 120 | <a href="#" class="toggle" title="<?php _e( 'Click to toggle' ); ?>"><br></a> |
| 121 | <span><?php _e( 'Supported Shortcodes', PO_LANG ); ?></span> |
| 122 | </h3> |
| 123 | |
| 124 | <div class="inside"> |
| 125 | <?php include PO_VIEWS_DIR . 'info-shortcodes.php'; ?> |
| 126 | </div> |
| 127 | </div> |
| 128 | |
| 129 | <p class="submit"> |
| 130 | <button class="button-primary"> |
| 131 | <?php _e( 'Save All Changes', PO_LANG ) ?> |
| 132 | </button> |
| 133 | </p> |
| 134 | |
| 135 | <h2><?php _e( 'Available Conditions', PO_LANG ); ?></h2> |
| 136 | |
| 137 | <?php /* === ACTIVE RULES === */ ?> |
| 138 | <table class="widefat tbl-addons"> |
| 139 | <?php foreach ( array( 'thead', 'tfoot' ) as $tag ) : ?> |
| 140 | <<?php echo esc_attr( $tag ); ?>> |
| 141 | <tr> |
| 142 | <th class="manage-column column-cb check-column" id="cb" scope="col"> |
| 143 | <input type="checkbox" /> |
| 144 | </th> |
| 145 | <th class="manage-column column-name" scope="col"> |
| 146 | <?php _e( 'Name', PO_LANG ); ?> |
| 147 | </th> |
| 148 | <th class="manage-column column-items" scope="col"> |
| 149 | <?php _e( 'Activated Rules', PO_LANG ); ?> |
| 150 | </th> |
| 151 | </tr> |
| 152 | </<?php echo esc_attr( $tag ); ?>> |
| 153 | <?php endforeach; ?> |
| 154 | |
| 155 | <?php foreach ( $rules as $rule ) { |
| 156 | $data = get_file_data( |
| 157 | PO_INC_DIR . 'rules/' . $rule, |
| 158 | $rule_headers, |
| 159 | 'popup-rule' |
| 160 | ); |
| 161 | $is_active = ( in_array( $rule, $settings['rules'] ) ); |
| 162 | if ( empty( $data['name'] ) ) { continue; } |
| 163 | $data['limit'] = explode( ',', $data['limit'] ); |
| 164 | $data['limit'] = array_map( 'trim', $data['limit'] ); |
| 165 | |
| 166 | $name = __( trim( $data['name'] ), PO_LANG ); |
| 167 | |
| 168 | $ordered_rules[ $name ] = $data; |
| 169 | $ordered_rules[ $name ]['key'] = $rule; |
| 170 | $ordered_rules[ $name ]['name'] = $name; |
| 171 | $ordered_rules[ $name ]['active'] = $is_active; |
| 172 | $ordered_rules[ $name ]['desc'] = __( trim( $data['desc'] ), PO_LANG ); |
| 173 | |
| 174 | if ( 'pro' != PO_VERSION && in_array( 'pro', $data['limit'] ) ) { |
| 175 | $ordered_rules[ $name ]['disabled'] = sprintf( |
| 176 | __( 'Available in the <a href="%s" target="_blank">PRO version</a>', PO_LANG ), |
| 177 | 'http://premium.wpmudev.org/project/the-pop-over-plugin/' |
| 178 | ); |
| 179 | } else if ( IncPopup::use_global() && in_array( 'no global', $data['limit'] ) ) { |
| 180 | $ordered_rules[ $name ]['disabled'] = __( 'Not available for global PopUps', PO_LANG ); |
| 181 | } else if ( ! IncPopup::use_global() && in_array( 'global', $data['limit'] ) ) { |
| 182 | $ordered_rules[ $name ]['disabled'] = true; |
| 183 | } else { |
| 184 | $ordered_rules[ $name ]['disabled'] = false; |
| 185 | } |
| 186 | } ?> |
| 187 | <?php ksort( $ordered_rules ); ?> |
| 188 | |
| 189 | <?php foreach ( $ordered_rules as $data ) { |
| 190 | // Ignore Addons that have no name. |
| 191 | $data['rules'] = explode( ',', $data['rules'] ); |
| 192 | $rule_id = 'po-rule-' . sanitize_html_class( $data['key'] ); |
| 193 | if ( true === $data['disabled'] ) { continue; } |
| 194 | ?> |
| 195 | <tr valign="top" class="<?php echo esc_attr( $data['disabled'] ? 'locked' : '' ); ?>"> |
| 196 | <th class="check-column" scope="row"> |
| 197 | <?php if ( false == $data['disabled'] ) : ?> |
| 198 | <input type="checkbox" |
| 199 | id="<?php echo esc_attr( $rule_id ); ?>" |
| 200 | name="po_option[rules][<?php echo esc_attr( $data['key'] ); ?>]" |
| 201 | <?php checked( $data['active'] ); ?> |
| 202 | /> |
| 203 | <?php endif; ?> |
| 204 | </th> |
| 205 | <td class="column-name"> |
| 206 | <label for="<?php echo esc_attr( $rule_id ); ?>"> |
| 207 | <strong><?php echo esc_html( $data['name'] ); ?></strong> |
| 208 | </label> |
| 209 | <div><em><?php echo '' . $data['desc']; ?></em></div> |
| 210 | <?php if ( $data['disabled'] ) : ?> |
| 211 | <div class="locked-msg"> |
| 212 | <?php echo '' . $data['disabled']; ?> |
| 213 | </div> |
| 214 | <?php endif; ?> |
| 215 | </td> |
| 216 | <td class="column-items"> |
| 217 | <?php foreach ( $data['rules'] as $rule_name ) : ?> |
| 218 | <?php $rule_name = trim( $rule_name ); ?> |
| 219 | <?php if ( empty( $rule_name ) ) { continue; } ?> |
| 220 | <code><?php _e( trim( $rule_name ), PO_LANG ); ?></code><br /> |
| 221 | <?php endforeach; ?> |
| 222 | </td> |
| 223 | </tr> |
| 224 | <?php } ?> |
| 225 | </table> |
| 226 | |
| 227 | <p class="submit"> |
| 228 | <button class="button-primary"> |
| 229 | <?php _e( 'Save All Changes', PO_LANG ) ?> |
| 230 | </button> |
| 231 | </p> |
| 232 | |
| 233 | </form> |
| 234 | </div> |
| 235 | |
| 236 | </div> <!-- wrap --> |
| 237 |