| @@ -11,31 +11,29 @@ | ||
| 11 | 11 | <!-- Form --> |
| 12 | 12 | <div> |
| 13 | 13 | <label for="wp-convertkit-bulk-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-bulk-edit-form" size="1"> | |
| 16 | - <?php | |
| 17 | - // For Bulk Edit, the 'No Change' value is -1. However, because this Plugin has historically used -1 | |
| 18 | - // to mean that the Default form for the Post Type should be displayed, using -1 as 'No Change' in Bulk Edit | |
| 19 | - // would result in Posts/Pages having (or not having) the Form setting updated, when the user may/may not | |
| 20 | - // have selected the 'Default' option. | |
| 21 | - // Therefore, we use -2 to denote 'No Change'. | |
| 22 | - ?> | |
| 23 | - <option value="-2" data-preserve-on-refresh="1"><?php esc_html_e( '— No Change —', 'convertkit' ); ?></option> | |
| 24 | - <option value="-1" data-preserve-on-refresh="1"><?php esc_html_e( 'Default', 'convertkit' ); ?></option> | |
| 25 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option> | |
| 26 | - <?php | |
| 27 | - if ( $convertkit_forms->exist() ) { | |
| 28 | - foreach ( $convertkit_forms->get() as $form ) { | |
| 29 | - ?> | |
| 30 | - <option value="<?php echo esc_attr( $form['id'] ); ?>"><?php echo esc_attr( $form['name'] ); ?></option> | |
| 31 | - <?php | |
| 32 | - } | |
| 33 | - } | |
| 34 | - ?> | |
| 35 | - </select> | |
| 15 | + | |
| 16 | + <?php | |
| 17 | + // For Bulk Edit, the 'No Change' value is -1. However, because this Plugin has historically used -1 | |
| 18 | + // to mean that the Default form for the Post Type should be displayed, using -1 as 'No Change' in Bulk Edit | |
| 19 | + // would result in Posts/Pages having (or not having) the Form setting updated, when the user may/may not | |
| 20 | + // have selected the 'Default' option. | |
| 21 | + // Therefore, we use -2 to denote 'No Change'. | |
| 22 | + $convertkit_forms->output_select_field_all( | |
| 23 | + 'wp-convertkit[form]', | |
| 24 | + 'wp-convertkit-bulk-edit-form', | |
| 25 | + false, | |
| 26 | + false, | |
| 27 | + array( | |
| 28 | + '-2' => esc_html__( '— No Change —', 'convertkit' ), | |
| 29 | + '-1' => esc_html__( 'Default', 'convertkit' ), | |
| 30 | + '0' => esc_html__( 'None', 'convertkit' ), | |
| 31 | + ) | |
| 32 | + ); | |
| 33 | + ?> | |
| 36 | 34 | </label> |
| 37 | - <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-bulk-edit-form"> | |
| 35 | + <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-bulk-edit-form"> | |
| 38 | 36 | <span class="dashicons dashicons-update"></span> |
| 39 | 37 | </button> |
| 40 | 38 | </div> |
| 41 | 39 | |
| @@ -63,55 +61,75 @@ | ||
| 63 | 61 | } |
| 64 | 62 | ?> |
| 65 | 63 | </select> |
| 66 | 64 | </label> |
| 67 | - <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-bulk-edit-tag"> | |
| 65 | + <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-bulk-edit-tag"> | |
| 68 | 66 | <span class="dashicons dashicons-update"></span> |
| 69 | 67 | </button> |
| 70 | 68 | </div> |
| 71 | 69 | |
| 72 | - <?php | |
| 73 | - if ( $restrict_content_settings->enabled() ) { | |
| 74 | - ?> | |
| 75 | - <!-- Restrict Content --> | |
| 76 | - <div> | |
| 77 | - <label for="wp-convertkit-bulk-edit-restrict_content"> | |
| 78 | - <span class="title convertkit-icon-restrict-content"><?php esc_html_e( 'Member', 'convertkit' ); ?></span> | |
| 79 | - <select name="wp-convertkit[restrict_content]" id="wp-convertkit-bulk-edit-restrict_content" size="1"> | |
| 70 | + <!-- Restrict Content --> | |
| 71 | + <div> | |
| 72 | + <label for="wp-convertkit-bulk-edit-restrict_content"> | |
| 73 | + <span class="title convertkit-icon-restrict-content"><?php esc_html_e( 'Member', 'convertkit' ); ?></span> | |
| 74 | + <select name="wp-convertkit[restrict_content]" id="wp-convertkit-bulk-edit-restrict_content" size="1"> | |
| 75 | + <?php | |
| 76 | + // For Bulk Edit, the 'No Change' value is -1. However, because this Plugin has historically used -1 | |
| 77 | + // to mean that the Default form for the Post Type should be displayed, using -1 as 'No Change' in Bulk Edit | |
| 78 | + // would result in Posts/Pages having (or not having) the Form setting updated, when the user may/may not | |
| 79 | + // have selected the 'Default' option. | |
| 80 | + // Therefore, we use -2 to denote 'No Change', even though this setting is for the Tag, so we're at least consistent. | |
| 81 | + ?> | |
| 82 | + <option value="-2" data-preserve-on-refresh="1"><?php esc_html_e( '— No Change —', 'convertkit' ); ?></option> | |
| 83 | + <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to member-only.', 'convertkit' ); ?></option> | |
| 84 | + | |
| 85 | + <optgroup label="<?php esc_attr_e( 'Forms', 'convertkit' ); ?>" data-resource="forms"> | |
| 80 | 86 | <?php |
| 81 | - // For Bulk Edit, the 'No Change' value is -1. However, because this Plugin has historically used -1 | |
| 82 | - // to mean that the Default form for the Post Type should be displayed, using -1 as 'No Change' in Bulk Edit | |
| 83 | - // would result in Posts/Pages having (or not having) the Form setting updated, when the user may/may not | |
| 84 | - // have selected the 'Default' option. | |
| 85 | - // Therefore, we use -2 to denote 'No Change', even though this setting is for the Tag, so we're at least consistent. | |
| 87 | + // Forms. | |
| 88 | + if ( $convertkit_forms->inline_exist() ) { | |
| 89 | + foreach ( $convertkit_forms->get_inline() as $convertkit_form ) { | |
| 90 | + printf( | |
| 91 | + '<option value="form_%s">%s [%s]</option>', | |
| 92 | + esc_attr( $convertkit_form['id'] ), | |
| 93 | + esc_attr( $convertkit_form['name'] ), | |
| 94 | + ( ! empty( $convertkit_form['format'] ) ? esc_attr( $convertkit_form['format'] ) : 'inline' ) | |
| 95 | + ); | |
| 96 | + } | |
| 97 | + } | |
| 86 | 98 | ?> |
| 87 | - <option value="-2" data-preserve-on-refresh="1"><?php esc_html_e( '— No Change —', 'convertkit' ); ?></option> | |
| 88 | - <option value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to members only.', 'convertkit' ); ?></option> | |
| 99 | + </optgroup> | |
| 89 | 100 | |
| 101 | + <optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>" data-resource="tags"> | |
| 90 | 102 | <?php |
| 103 | + // Tags. | |
| 104 | + if ( $convertkit_tags->exist() ) { | |
| 105 | + foreach ( $convertkit_tags->get() as $convertkit_tag ) { | |
| 106 | + ?> | |
| 107 | + <option value="tag_<?php echo esc_attr( $convertkit_tag['id'] ); ?>"><?php echo esc_attr( $convertkit_tag['name'] ); ?></option> | |
| 108 | + <?php | |
| 109 | + } | |
| 110 | + } | |
| 111 | + ?> | |
| 112 | + </optgroup> | |
| 113 | + | |
| 114 | + <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>" data-resource="products"> | |
| 115 | + <?php | |
| 91 | 116 | // Products. |
| 92 | 117 | if ( $convertkit_products->exist() ) { |
| 93 | - ?> | |
| 94 | - <optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>"> | |
| 118 | + foreach ( $convertkit_products->get() as $product ) { | |
| 119 | + ?> | |
| 120 | + <option value="product_<?php echo esc_attr( $product['id'] ); ?>"><?php echo esc_attr( $product['name'] ); ?></option> | |
| 95 | 121 | <?php |
| 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> | |
| 99 | - <?php | |
| 100 | - } | |
| 101 | - ?> | |
| 102 | - </optgroup> | |
| 103 | - <?php | |
| 122 | + } | |
| 104 | 123 | } |
| 105 | 124 | ?> |
| 106 | - </select> | |
| 107 | - </label> | |
| 108 | - <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-bulk-edit-restrict_content"> | |
| 109 | - <span class="dashicons dashicons-update"></span> | |
| 110 | - </button> | |
| 111 | - </div> | |
| 112 | - <?php | |
| 113 | - } | |
| 114 | - | |
| 125 | + </optgroup> | |
| 126 | + </select> | |
| 127 | + </label> | |
| 128 | + <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-bulk-edit-restrict_content"> | |
| 129 | + <span class="dashicons dashicons-update"></span> | |
| 130 | + </button> | |
| 131 | + </div> | |
| 132 | + <?php | |
| 115 | 133 | wp_nonce_field( 'wp-convertkit-save-meta', 'wp-convertkit-save-meta-nonce' ); |
| 116 | 134 | ?> |
| 117 | 135 | </div> |