| 1 |
<?php |
| 2 |
/** |
| 3 |
* Metabox view |
| 4 |
* |
| 5 |
* @package ConvertKit |
| 6 |
* @author ConvertKit |
| 7 |
*/ |
| 8 |
|
| 9 |
?> |
| 10 |
<table class="form-table"> |
| 11 |
<tbody> |
| 12 |
<!-- Form --> |
| 13 |
<tr valign="top"> |
| 14 |
<th scope="row"> |
| 15 |
<label for="wp-convertkit-form"><?php esc_html_e( 'Form', 'convertkit' ); ?></label> |
| 16 |
</th> |
| 17 |
<td> |
| 18 |
<div class="convertkit-select2-container convertkit-select2-container-grid"> |
| 19 |
<?php |
| 20 |
echo $convertkit_forms->get_select_field_all( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 21 |
'wp-convertkit[form]', |
| 22 |
'wp-convertkit-form', |
| 23 |
array( |
| 24 |
'convertkit-select2', |
| 25 |
'widefat', |
| 26 |
), |
| 27 |
esc_attr( $convertkit_post->get_form() ), |
| 28 |
array( |
| 29 |
'-1' => esc_html__( 'Default', 'convertkit' ), |
| 30 |
'0' => esc_html__( 'None', 'convertkit' ), |
| 31 |
) |
| 32 |
); |
| 33 |
?> |
| 34 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Forms from Kit account', 'convertkit' ); ?>" data-resource="forms" data-field="#wp-convertkit-form"> |
| 35 |
<span class="dashicons dashicons-update"></span> |
| 36 |
</button> |
| 37 |
<p class="description"> |
| 38 |
<code><?php esc_html_e( 'Default', 'convertkit' ); ?></code> |
| 39 |
<?php esc_html_e( ': Uses the form specified on the', 'convertkit' ); ?> |
| 40 |
<a href="<?php echo esc_url( $settings_link ); ?>"><?php esc_html_e( 'settings page', 'convertkit' ); ?></a> |
| 41 |
<br /> |
| 42 |
<code><?php esc_html_e( 'None', 'convertkit' ); ?></code> |
| 43 |
<?php esc_html_e( ': do not display a form.', 'convertkit' ); ?> |
| 44 |
<br /> |
| 45 |
<?php esc_html_e( 'Any other option will display that form after the main content.', 'convertkit' ); ?> |
| 46 |
<br /> |
| 47 |
<?php |
| 48 |
printf( |
| 49 |
/* translators: Link to sign in to ConvertKit */ |
| 50 |
esc_html__( 'To make changes to your forms, %s', 'convertkit' ), |
| 51 |
'<a href="' . esc_url( convertkit_get_sign_in_url() ) . '" target="_blank">' . esc_html__( 'sign in to Kit', 'convertkit' ) . '</a>' |
| 52 |
); |
| 53 |
?> |
| 54 |
</p> |
| 55 |
</div> |
| 56 |
</td> |
| 57 |
</tr> |
| 58 |
|
| 59 |
<!-- Landing Page --> |
| 60 |
<?php |
| 61 |
if ( 'page' === $post->post_type ) { |
| 62 |
?> |
| 63 |
<tr valign="top"> |
| 64 |
<th scope="row"> |
| 65 |
<label for="wp-convertkit-landing_page"><?php esc_html_e( 'Landing Page', 'convertkit' ); ?></label> |
| 66 |
</th> |
| 67 |
<td> |
| 68 |
<div class="convertkit-select2-container convertkit-select2-container-grid"> |
| 69 |
<select name="wp-convertkit[landing_page]" id="wp-convertkit-landing_page" class="convertkit-select2"> |
| 70 |
<option <?php selected( '', $convertkit_post->get_landing_page() ); ?> value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option> |
| 71 |
<?php |
| 72 |
if ( $convertkit_landing_pages->exist() ) { |
| 73 |
foreach ( $convertkit_landing_pages->get() as $landing_page ) { |
| 74 |
if ( isset( $convertkit_landing_page['url'] ) ) { |
| 75 |
?> |
| 76 |
<option value="<?php echo esc_attr( $landing_page['url'] ); ?>"<?php selected( $landing_page['url'], $convertkit_post->get_landing_page() ); ?>><?php echo esc_attr( $landing_page['name'] ); ?></option> |
| 77 |
<?php |
| 78 |
} else { |
| 79 |
?> |
| 80 |
<option value="<?php echo esc_attr( $landing_page['id'] ); ?>"<?php selected( $landing_page['id'], $convertkit_post->get_landing_page() ); ?>><?php echo esc_attr( $landing_page['name'] ); ?></option> |
| 81 |
<?php |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
?> |
| 86 |
</select> |
| 87 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Landing Pages from Kit account', 'convertkit' ); ?>" data-resource="landing_pages" data-field="#wp-convertkit-landing_page"> |
| 88 |
<span class="dashicons dashicons-update"></span> |
| 89 |
</button> |
| 90 |
<p class="description"> |
| 91 |
<?php esc_html_e( 'Select a landing page to make it appear in place of this page.', 'convertkit' ); ?> |
| 92 |
<br /> |
| 93 |
<?php |
| 94 |
printf( |
| 95 |
/* translators: Link to sign in to ConvertKit */ |
| 96 |
esc_html__( 'To make changes to your landing pages, %s', 'convertkit' ), |
| 97 |
'<a href="' . esc_url( convertkit_get_sign_in_url() ) . '" target="_blank">' . esc_html__( 'sign in to Kit', 'convertkit' ) . '</a>' |
| 98 |
); |
| 99 |
?> |
| 100 |
</p> |
| 101 |
</div> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
<?php |
| 105 |
} |
| 106 |
?> |
| 107 |
|
| 108 |
<!-- Tag --> |
| 109 |
<tr valign="top"> |
| 110 |
<th scope="row"> |
| 111 |
<label for="wp-convertkit-tag"><?php esc_html_e( 'Add a Tag', 'convertkit' ); ?></label> |
| 112 |
</th> |
| 113 |
<td> |
| 114 |
<div class="convertkit-select2-container convertkit-select2-container-grid"> |
| 115 |
<select name="wp-convertkit[tag]" id="wp-convertkit-tag" class="convertkit-select2"> |
| 116 |
<option value="0"<?php selected( '', $convertkit_post->get_tag() ); ?> data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option> |
| 117 |
<?php |
| 118 |
if ( $convertkit_tags->exist() ) { |
| 119 |
foreach ( $convertkit_tags->get() as $convertkit_tag ) { |
| 120 |
?> |
| 121 |
<option value="<?php echo esc_attr( $convertkit_tag['id'] ); ?>"<?php selected( $convertkit_tag['id'], $convertkit_post->get_tag() ); ?>><?php echo esc_attr( $convertkit_tag['name'] ); ?></option> |
| 122 |
<?php |
| 123 |
} |
| 124 |
} |
| 125 |
?> |
| 126 |
</select> |
| 127 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Tags from Kit account', 'convertkit' ); ?>" data-resource="tags" data-field="#wp-convertkit-tag"> |
| 128 |
<span class="dashicons dashicons-update"></span> |
| 129 |
</button> |
| 130 |
<p class="description"> |
| 131 |
<?php esc_html_e( 'Select a tag to apply to visitors of this page who are subscribed.', 'convertkit' ); ?> |
| 132 |
<br /> |
| 133 |
<?php esc_html_e( 'A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a Kit Form on this site.', 'convertkit' ); ?> |
| 134 |
</p> |
| 135 |
</div> |
| 136 |
</td> |
| 137 |
</tr> |
| 138 |
|
| 139 |
<tr valign="top"> |
| 140 |
<th scope="row"> |
| 141 |
<label for="wp-convertkit-restrict_content"><?php esc_html_e( 'Member Content', 'convertkit' ); ?></label> |
| 142 |
</th> |
| 143 |
<td> |
| 144 |
<div class="convertkit-select2-container convertkit-select2-container-grid"> |
| 145 |
<select name="wp-convertkit[restrict_content]" id="wp-convertkit-restrict_content" class="convertkit-select2"> |
| 146 |
<option value="0"<?php selected( '', $convertkit_post->get_restrict_content() ); ?> data-preserve-on-refresh="1"><?php esc_html_e( 'Don\'t restrict content to members only.', 'convertkit' ); ?></option> |
| 147 |
|
| 148 |
<optgroup label="<?php esc_attr_e( 'Forms', 'convertkit' ); ?>" data-resource="forms"> |
| 149 |
<?php |
| 150 |
// Forms. |
| 151 |
if ( $convertkit_forms->inline_exist() ) { |
| 152 |
foreach ( $convertkit_forms->get_inline() as $convertkit_form ) { |
| 153 |
printf( |
| 154 |
'<option value="form_%s"%s>%s [%s]</option>', |
| 155 |
esc_attr( $convertkit_form['id'] ), |
| 156 |
selected( $convertkit_post->get_restrict_content(), 'form_' . $convertkit_form['id'], false ), |
| 157 |
esc_attr( $convertkit_form['name'] ), |
| 158 |
( ! empty( $convertkit_form['format'] ) ? esc_attr( $convertkit_form['format'] ) : 'inline' ) |
| 159 |
); |
| 160 |
} |
| 161 |
} |
| 162 |
?> |
| 163 |
</optgroup> |
| 164 |
|
| 165 |
<optgroup label="<?php esc_attr_e( 'Tags', 'convertkit' ); ?>" data-resource="tags"> |
| 166 |
<?php |
| 167 |
// Tags. |
| 168 |
if ( $convertkit_tags->exist() ) { |
| 169 |
foreach ( $convertkit_tags->get() as $convertkit_tag ) { |
| 170 |
?> |
| 171 |
<option value="tag_<?php echo esc_attr( $convertkit_tag['id'] ); ?>"<?php selected( 'tag_' . $convertkit_tag['id'], $convertkit_post->get_restrict_content() ); ?>><?php echo esc_attr( $convertkit_tag['name'] ); ?></option> |
| 172 |
<?php |
| 173 |
} |
| 174 |
} |
| 175 |
?> |
| 176 |
</optgroup> |
| 177 |
|
| 178 |
<optgroup label="<?php esc_attr_e( 'Products', 'convertkit' ); ?>" data-resource="products"> |
| 179 |
<?php |
| 180 |
// Products. |
| 181 |
if ( $convertkit_products->exist() ) { |
| 182 |
foreach ( $convertkit_products->get() as $product ) { |
| 183 |
?> |
| 184 |
<option value="product_<?php echo esc_attr( $product['id'] ); ?>"<?php selected( 'product_' . $product['id'], $convertkit_post->get_restrict_content() ); ?>><?php echo esc_attr( $product['name'] ); ?></option> |
| 185 |
<?php |
| 186 |
} |
| 187 |
} |
| 188 |
?> |
| 189 |
</optgroup> |
| 190 |
</select> |
| 191 |
<button class="wp-convertkit-refresh-resources" class="button button-secondary hide-if-no-js" title="<?php esc_attr_e( 'Refresh Products and Tags from Kit account', 'convertkit' ); ?>" data-resource="restrict_content" data-field="#wp-convertkit-restrict_content"> |
| 192 |
<span class="dashicons dashicons-update"></span> |
| 193 |
</button> |
| 194 |
<p class="description"> |
| 195 |
<?php esc_html_e( 'Select the Kit form, tag or product that the visitor must be subscribed to, permitting them access to view this members only content.', 'convertkit' ); ?> |
| 196 |
<br /> |
| 197 |
<code><?php esc_html_e( 'Form', 'convertkit' ); ?></code> |
| 198 |
<?php esc_html_e( ': Displays the Kit form. On submission, the email address will be subscribed to the selected form, granting access to the members only content. Useful to gate free content in return for an email address.', 'convertkit' ); ?> |
| 199 |
<br /> |
| 200 |
<code><?php esc_html_e( 'Tag', 'convertkit' ); ?></code> |
| 201 |
<?php esc_html_e( ': Displays a WordPress styled subscription form. On submission, the email address will be subscribed to the selected tag, granting access to the members only content. Useful to gate free content in return for an email address.', 'convertkit' ); ?> |
| 202 |
<br /> |
| 203 |
<code><?php esc_html_e( 'Product', 'convertkit' ); ?></code> |
| 204 |
<?php esc_html_e( ': Displays a link to the Kit product, and a login form. Useful to gate content that can only be accessed by purchasing the Kit product.', 'convertkit' ); ?> |
| 205 |
</p> |
| 206 |
</div> |
| 207 |
</td> |
| 208 |
</tr> |
| 209 |
</tbody> |
| 210 |
</table> |
| 211 |
|
| 212 |
<?php |
| 213 |
wp_nonce_field( 'wp-convertkit-save-meta', 'wp-convertkit-save-meta-nonce' ); |
| 214 |
|