| @@ -11,23 +11,23 @@ | ||
| 11 | 11 | <!-- Form --> |
| 12 | 12 | <div> |
| 13 | 13 | <label for="wp-convertkit-quick-edit-form"> |
| 14 | 14 | <span class="title convertkit-icon-form"><?php esc_html_e( 'Form', 'convertkit' ); ?></span> |
| 15 | - <select name="wp-convertkit[form]" id="wp-convertkit-quick-edit-form" size="1"> | |
| 16 | - <option value="-1" data-preserve-on-refresh="1"><?php esc_html_e( 'Default', 'convertkit' ); ?></option> | |
| 17 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option> | |
| 18 | - <?php | |
| 19 | - if ( $convertkit_forms->exist() ) { | |
| 20 | - foreach ( $convertkit_forms->get() as $form ) { | |
| 21 | - ?> | |
| 22 | - <option value="<?php echo esc_attr( $form['id'] ); ?>"><?php echo esc_attr( $form['name'] ); ?></option> | |
| 23 | - <?php | |
| 24 | - } | |
| 25 | - } | |
| 26 | - ?> | |
| 27 | - </select> | |
| 15 | + | |
| 16 | + <?php | |
| 17 | + $convertkit_forms->output_select_field_all( | |
| 18 | + 'wp-convertkit[form]', | |
| 19 | + 'wp-convertkit-quick-edit-form', | |
| 20 | + false, | |
| 21 | + false, | |
| 22 | + array( | |
| 23 | + '-1' => esc_html__( 'Default', 'convertkit' ), | |
| 24 | + '0' => esc_html__( 'None', 'convertkit' ), | |
| 25 | + ) | |
| 26 | + ); | |
| 27 | + ?> | |
| 28 | 28 | </label> |
| 29 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Forms from ConvertKit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-quick-edit-form"> | |
| 29 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Forms from Kit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-quick-edit-form"> | |
| 30 | 30 | <span class="dashicons dashicons-update"></span> |
| 31 | 31 | </button> |
| 32 | 32 | </div> |
| 33 | 33 | |
| @@ -47,47 +47,67 @@ | ||
| 47 | 47 | } |
| 48 | 48 | ?> |
| 49 | 49 | </select> |
| 50 | 50 | </label> |
| 51 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Tags from ConvertKit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-quick-edit-tag"> | |
| 51 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Tags from Kit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-quick-edit-tag"> | |
| 52 | 52 | <span class="dashicons dashicons-update"></span> |
| 53 | 53 | </button> |
| 54 | 54 | </div> |
| 55 | 55 | |
| 56 | - <?php | |
| 57 | - if ( $restrict_content_settings->enabled() ) { | |
| 58 | - ?> | |
| 59 | - <!-- Restrict Content --> | |
| 60 | - <div> | |
| 61 | - <label for="wp-convertkit-quick-edit-restrict_content"> | |
| 62 | - <span class="title convertkit-icon-restrict-content"><?php esc_html_e( 'Member', 'convertkit' ); ?></span> | |
| 63 | - <select name="wp-convertkit[restrict_content]" id="wp-convertkit-quick-edit-restrict_content" size="1"> | |
| 64 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to members only.', 'convertkit' ); ?></option> | |
| 56 | + <!-- Restrict Content --> | |
| 57 | + <div> | |
| 58 | + <label for="wp-convertkit-quick-edit-restrict_content"> | |
| 59 | + <span class="title convertkit-icon-restrict-content"><?php esc_html_e( 'Member', 'convertkit' ); ?></span> | |
| 60 | + <select name="wp-convertkit[restrict_content]" id="wp-convertkit-quick-edit-restrict_content" size="1"> | |
| 61 | + <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to member-only.', 'convertkit' ); ?></option> | |
| 65 | 62 | |
| 63 | + <optgroup label="<?php esc_attr_e( 'Forms', 'convertkit' ); ?>" data-resource="forms"> | |
| 66 | 64 | <?php |
| 65 | + // Forms. | |
| 66 | + if ( $convertkit_forms->inline_exist() ) { | |
| 67 | + foreach ( $convertkit_forms->get_inline() as $convertkit_form ) { | |
| 68 | + printf( | |
| 69 | + '<option value="form_%s">%s [%s]</option>', | |
| 70 | + esc_attr( $convertkit_form['id'] ), | |
| 71 | + esc_attr( $convertkit_form['name'] ), | |
| 72 | + ( ! empty( $convertkit_form['format'] ) ? esc_attr( $convertkit_form['format'] ) : 'inline' ) | |
| 73 | + ); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + ?> | |
| 77 | + </optgroup> | |
| 78 | + | |
| 79 | + <optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>" data-resource="tags"> | |
| 80 | + <?php | |
| 81 | + // Tags. | |
| 82 | + if ( $convertkit_tags->exist() ) { | |
| 83 | + foreach ( $convertkit_tags->get() as $convertkit_tag ) { | |
| 84 | + ?> | |
| 85 | + <option value="tag_<?php echo esc_attr( $convertkit_tag['id'] ); ?>"><?php echo esc_attr( $convertkit_tag['name'] ); ?></option> | |
| 86 | + <?php | |
| 87 | + } | |
| 88 | + } | |
| 89 | + ?> | |
| 90 | + </optgroup> | |
| 91 | + | |
| 92 | + <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>" data-resource="products"> | |
| 93 | + <?php | |
| 67 | 94 | // Products. |
| 68 | 95 | if ( $convertkit_products->exist() ) { |
| 69 | - ?> | |
| 70 | - <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>"> | |
| 96 | + foreach ( $convertkit_products->get() as $product ) { | |
| 97 | + ?> | |
| 98 | + <option value="product_<?php echo esc_attr( $product['id'] ); ?>"><?php echo esc_attr( $product['name'] ); ?></option> | |
| 71 | 99 | <?php |
| 72 | - foreach ( $convertkit_products->get() as $product ) { | |
| 73 | - ?> | |
| 74 | - <option value="product_<?php echo esc_attr( $product['id'] ); ?>"><?php echo esc_attr( $product['name'] ); ?></option> | |
| 75 | - <?php | |
| 76 | - } | |
| 77 | - ?> | |
| 78 | - </optgroup> | |
| 79 | - <?php | |
| 100 | + } | |
| 80 | 101 | } |
| 81 | 102 | ?> |
| 82 | - </select> | |
| 83 | - </label> | |
| 84 | - <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Products from ConvertKit account', 'convertkit' ); ?>" data-resource="products" data-field="#wp-convertkit-quick-edit-restrict_content"> | |
| 85 | - <span class="dashicons dashicons-update"></span> | |
| 86 | - </button> | |
| 87 | - </div> | |
| 88 | - <?php | |
| 89 | - } | |
| 90 | - | |
| 103 | + </optgroup> | |
| 104 | + </select> | |
| 105 | + </label> | |
| 106 | + <button class="wp-convertkit-refresh-resources" class="button button-secondary" title="<?php esc_attr_e( 'Refresh Products and Tags from Kit account', 'convertkit' ); ?>" data-resource="restrict_content" data-field="#wp-convertkit-quick-edit-restrict_content"> | |
| 107 | + <span class="dashicons dashicons-update"></span> | |
| 108 | + </button> | |
| 109 | + </div> | |
| 110 | + <?php | |
| 91 | 111 | wp_nonce_field( 'wp-convertkit-save-meta', 'wp-convertkit-save-meta-nonce' ); |
| 92 | 112 | ?> |
| 93 | 113 | </div> |