Changeset 3380693
- Timestamp:
- 10/19/2025 06:36:17 AM (5 months ago)
- Location:
- convertkit
- Files:
-
- 6 edited
- 1 copied
-
tags/3.0.5 (copied) (copied from convertkit/trunk)
-
tags/3.0.5/includes/class-convertkit-ajax.php (modified) (2 diffs)
-
tags/3.0.5/includes/class-convertkit-output-restrict-content.php (modified) (8 diffs)
-
tags/3.0.5/views/frontend/restrict-content/login-email.php (modified) (1 diff)
-
trunk/includes/class-convertkit-ajax.php (modified) (2 diffs)
-
trunk/includes/class-convertkit-output-restrict-content.php (modified) (8 diffs)
-
trunk/views/frontend/restrict-content/login-email.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
convertkit/tags/3.0.5/includes/class-convertkit-ajax.php
r3337204 r3380693 176 176 $output_restrict_content->maybe_run_subscriber_authentication(); 177 177 178 // Fetch Post ID, Resource Type and Resource ID for the view. 179 $post_id = $output_restrict_content->post_id; 180 $resource_type = $output_restrict_content->resource_type; 181 $resource_id = $output_restrict_content->resource_id; 182 178 183 // If an error occured, build the email form view with the error message. 179 184 if ( is_wp_error( $output_restrict_content->error ) ) { … … 207 212 $output_restrict_content->maybe_run_subscriber_verification(); 208 213 214 // Fetch Post ID, Resource Type and Resource ID for the view. 215 $post_id = $output_restrict_content->post_id; 216 $resource_type = $output_restrict_content->resource_type; 217 $resource_id = $output_restrict_content->resource_id; 218 209 219 // If an error occured, build the code form view with the error message. 210 220 if ( is_wp_error( $output_restrict_content->error ) ) { -
convertkit/tags/3.0.5/includes/class-convertkit-output-restrict-content.php
r3357832 r3380693 375 375 // and Page Builders. 376 376 add_filter( 'the_content', array( $this, 'maybe_restrict_content' ) ); 377 378 // Fetch some information about the current Page.379 $id = get_the_ID();380 377 381 378 /** … … 1233 1230 } 1234 1231 1232 // Get resource type and id. 1233 $resource_type = $this->resource_type; 1234 $resource_id = $this->resource_id; 1235 1235 1236 // This is deliberately a switch statement, because we will likely add in support 1236 1237 // for restrict by tag and form later. 1237 switch ( $ this->resource_type ) {1238 switch ( $resource_type ) { 1238 1239 case 'product': 1239 1240 // Get header and text from settings for Products. … … 1244 1245 // Get Product. 1245 1246 $products = new ConvertKit_Resource_Products( 'restrict_content' ); 1246 $product = $products->get_by_id( $ this->resource_id );1247 $product = $products->get_by_id( $resource_id ); 1247 1248 1248 1249 // Get commerce.js URL and enqueue. … … 1257 1258 add_action( 1258 1259 'wp_footer', 1259 function () {1260 function () use ( $post_id, $resource_id, $resource_type ) { 1260 1261 1261 1262 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; … … 1268 1269 ob_start(); 1269 1270 $button = $products->get_html( 1270 $ this->resource_id,1271 $resource_id, 1271 1272 $this->restrict_content_settings->get_by_key( 'subscribe_button_label' ), 1272 1273 array( … … 1280 1281 // Display the Form. 1281 1282 $forms = new ConvertKit_Resource_Forms( 'restrict_content' ); 1282 $form = $forms->get_html( $ this->resource_id, $post_id );1283 $form = $forms->get_html( $resource_id, $post_id ); 1283 1284 1284 1285 // If scripts are enabled, output the email login form in a modal, which will be displayed … … 1287 1288 add_action( 1288 1289 'wp_footer', 1289 function () {1290 function () use ( $post_id, $resource_id, $resource_type ) { 1290 1291 1291 1292 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; … … 1310 1311 add_action( 1311 1312 'wp_footer', 1312 function () {1313 function () use ( $post_id, $resource_id, $resource_type ) { 1313 1314 1314 1315 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; -
convertkit/tags/3.0.5/views/frontend/restrict-content/login-email.php
r3242327 r3380693 10 10 11 11 ?> 12 <form id="convertkit-restrict-content-form" class="convertkit-restrict-content-form" action="<?php echo esc_attr( add_query_arg( array( 'convertkit_login' => 1 ), get_permalink( WP_ConvertKit()->get_class( 'output_restrict_content' )->post_id ) ) ); ?>#convertkit-restrict-content" method="post">12 <form id="convertkit-restrict-content-form" class="convertkit-restrict-content-form" action="<?php echo esc_attr( add_query_arg( array( 'convertkit_login' => 1 ), get_permalink( $post_id ) ) ); ?>#convertkit-restrict-content" method="post"> 13 13 <div id="convertkit-restrict-content-email-field" class="<?php echo sanitize_html_class( ( is_wp_error( WP_ConvertKit()->get_class( 'output_restrict_content' )->error ) ? 'convertkit-restrict-content-error' : '' ) ); ?>"> 14 14 <input type="email" name="convertkit_email" id="convertkit_email" value="" placeholder="<?php esc_attr_e( 'Email Address', 'convertkit' ); ?>" required /> 15 15 <input type="submit" class="wp-block-button__link wp-block-button__link" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_button_label' ) ); ?>" /> 16 <input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->resource_type ); ?>" />17 <input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->resource_id ); ?>" />18 <input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->post_id ); ?>" />16 <input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( $resource_type ); ?>" /> 17 <input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( $resource_id ); ?>" /> 18 <input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( $post_id ); ?>" /> 19 19 <?php wp_nonce_field( 'convertkit_restrict_content_login' ); ?> 20 20 </div> -
convertkit/trunk/includes/class-convertkit-ajax.php
r3337204 r3380693 176 176 $output_restrict_content->maybe_run_subscriber_authentication(); 177 177 178 // Fetch Post ID, Resource Type and Resource ID for the view. 179 $post_id = $output_restrict_content->post_id; 180 $resource_type = $output_restrict_content->resource_type; 181 $resource_id = $output_restrict_content->resource_id; 182 178 183 // If an error occured, build the email form view with the error message. 179 184 if ( is_wp_error( $output_restrict_content->error ) ) { … … 207 212 $output_restrict_content->maybe_run_subscriber_verification(); 208 213 214 // Fetch Post ID, Resource Type and Resource ID for the view. 215 $post_id = $output_restrict_content->post_id; 216 $resource_type = $output_restrict_content->resource_type; 217 $resource_id = $output_restrict_content->resource_id; 218 209 219 // If an error occured, build the code form view with the error message. 210 220 if ( is_wp_error( $output_restrict_content->error ) ) { -
convertkit/trunk/includes/class-convertkit-output-restrict-content.php
r3357832 r3380693 375 375 // and Page Builders. 376 376 add_filter( 'the_content', array( $this, 'maybe_restrict_content' ) ); 377 378 // Fetch some information about the current Page.379 $id = get_the_ID();380 377 381 378 /** … … 1233 1230 } 1234 1231 1232 // Get resource type and id. 1233 $resource_type = $this->resource_type; 1234 $resource_id = $this->resource_id; 1235 1235 1236 // This is deliberately a switch statement, because we will likely add in support 1236 1237 // for restrict by tag and form later. 1237 switch ( $ this->resource_type ) {1238 switch ( $resource_type ) { 1238 1239 case 'product': 1239 1240 // Get header and text from settings for Products. … … 1244 1245 // Get Product. 1245 1246 $products = new ConvertKit_Resource_Products( 'restrict_content' ); 1246 $product = $products->get_by_id( $ this->resource_id );1247 $product = $products->get_by_id( $resource_id ); 1247 1248 1248 1249 // Get commerce.js URL and enqueue. … … 1257 1258 add_action( 1258 1259 'wp_footer', 1259 function () {1260 function () use ( $post_id, $resource_id, $resource_type ) { 1260 1261 1261 1262 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; … … 1268 1269 ob_start(); 1269 1270 $button = $products->get_html( 1270 $ this->resource_id,1271 $resource_id, 1271 1272 $this->restrict_content_settings->get_by_key( 'subscribe_button_label' ), 1272 1273 array( … … 1280 1281 // Display the Form. 1281 1282 $forms = new ConvertKit_Resource_Forms( 'restrict_content' ); 1282 $form = $forms->get_html( $ this->resource_id, $post_id );1283 $form = $forms->get_html( $resource_id, $post_id ); 1283 1284 1284 1285 // If scripts are enabled, output the email login form in a modal, which will be displayed … … 1287 1288 add_action( 1288 1289 'wp_footer', 1289 function () {1290 function () use ( $post_id, $resource_id, $resource_type ) { 1290 1291 1291 1292 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; … … 1310 1311 add_action( 1311 1312 'wp_footer', 1312 function () {1313 function () use ( $post_id, $resource_id, $resource_type ) { 1313 1314 1314 1315 include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; -
convertkit/trunk/views/frontend/restrict-content/login-email.php
r3242327 r3380693 10 10 11 11 ?> 12 <form id="convertkit-restrict-content-form" class="convertkit-restrict-content-form" action="<?php echo esc_attr( add_query_arg( array( 'convertkit_login' => 1 ), get_permalink( WP_ConvertKit()->get_class( 'output_restrict_content' )->post_id ) ) ); ?>#convertkit-restrict-content" method="post">12 <form id="convertkit-restrict-content-form" class="convertkit-restrict-content-form" action="<?php echo esc_attr( add_query_arg( array( 'convertkit_login' => 1 ), get_permalink( $post_id ) ) ); ?>#convertkit-restrict-content" method="post"> 13 13 <div id="convertkit-restrict-content-email-field" class="<?php echo sanitize_html_class( ( is_wp_error( WP_ConvertKit()->get_class( 'output_restrict_content' )->error ) ? 'convertkit-restrict-content-error' : '' ) ); ?>"> 14 14 <input type="email" name="convertkit_email" id="convertkit_email" value="" placeholder="<?php esc_attr_e( 'Email Address', 'convertkit' ); ?>" required /> 15 15 <input type="submit" class="wp-block-button__link wp-block-button__link" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_button_label' ) ); ?>" /> 16 <input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->resource_type ); ?>" />17 <input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->resource_id ); ?>" />18 <input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( WP_ConvertKit()->get_class( 'output_restrict_content' )->post_id ); ?>" />16 <input type="hidden" name="convertkit_resource_type" value="<?php echo esc_attr( $resource_type ); ?>" /> 17 <input type="hidden" name="convertkit_resource_id" value="<?php echo esc_attr( $resource_id ); ?>" /> 18 <input type="hidden" name="convertkit_post_id" value="<?php echo esc_attr( $post_id ); ?>" /> 19 19 <?php wp_nonce_field( 'convertkit_restrict_content_login' ); ?> 20 20 </div>
Note: See TracChangeset
for help on using the changeset viewer.