b6df4dbb92
MLS plugin fixes from this session: - Fix silent insert failures: location column NOT NULL was rejecting wpdb->insert calls, causing ~18k new properties since Dec 2025 to be lost. Inserts now build raw SQL with ST_PointFromText so the spatial column is populated atomically. - Auto-refresh expired media URLs in MLS_Media_Handler::fetch_and_cache(), guarded by a property-level GET_LOCK so concurrent fetches share one API refresh. - Normalize WP_Error to null in mls_get_property_image() so callers can rely on the documented string|null contract. - Support comma-separated property_type filters in MLS_Query and MLS_Cluster so the homepage "View All Commercial" link (?property_type=Commercial+Sale,Land,Farm) actually filters correctly. - Incremental sync now looks back 10 minutes past the latest modification timestamp as a safety margin against missed records. - Smart sync exits silently (info-level, not warning) when a full sync is in progress. Operational: - New cron: weekly full sync Sundays at 3 AM (/usr/local/bin/mls-full-sync). - New cron: hourly 2GB cap on mls-thumbnails/ and cache/transformed-images/ (/usr/local/bin/mls-image-cache-cap). - Logrotate config for wp-content/debug.log (2-day retention, daily rotation, delaycompress). Repo policy: - CLAUDE.md updated with explicit "commit everything except build artifacts" policy. - .gitignore: untrack runtime image caches and debug.log rotations. Other modifications in this snapshot are pre-existing in-flight theme/plugin/db_content_updates work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
97 lines
2.9 KiB
PHP
Executable File
97 lines
2.9 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Helpers functions for the Education pages.
|
|
*
|
|
* @since 1.8.2.2
|
|
*/
|
|
|
|
/**
|
|
* Get the button.
|
|
*
|
|
* @since 1.8.2.2
|
|
* @since 1.9.6.1 Add $license_level parameter.
|
|
*
|
|
* @param string $action Action to perform.
|
|
* @param bool $plugin_allow Is plugin allowed.
|
|
* @param string $path Plugin file.
|
|
* @param string $url URL for download plugin.
|
|
* @param array $utm UTM parameters.
|
|
* @param string $license_level License level.
|
|
*/
|
|
function wpforms_edu_get_button( $action, $plugin_allow, $path, $url, $utm, $license_level = '' ) {
|
|
|
|
// If the user is not allowed to use the plugin, show the upgrade button.
|
|
if ( ! $plugin_allow ) {
|
|
wpforms_edu_get_upgrade_button( $utm, [], $license_level );
|
|
|
|
return;
|
|
}
|
|
|
|
$status = 'inactive';
|
|
$data_plugin = $path;
|
|
$title = esc_html__( 'Activate', 'wpforms-lite' );
|
|
$can_install = wpforms_can_install( 'addon' );
|
|
|
|
if ( $action === 'install' ) {
|
|
$status = 'download';
|
|
$data_plugin = $url;
|
|
$title = esc_html__( 'Install & Activate', 'wpforms-lite' );
|
|
}
|
|
|
|
?>
|
|
|
|
<?php if ( $action === 'install' && ! $can_install ) : ?>
|
|
<div class="wpforms-notice wpforms-error">
|
|
<p><?php esc_html_e( 'Plugin installation is disabled for this site.', 'wpforms-lite' ); ?></p>
|
|
</div>
|
|
<?php else : ?>
|
|
<button
|
|
class="status-<?php echo esc_attr( $status ); ?> wpforms-btn wpforms-btn-lg wpforms-btn-blue wpforms-education-toggle-plugin-btn"
|
|
data-type="addon"
|
|
data-action="<?php echo esc_attr( $action ); ?>"
|
|
data-plugin="<?php echo esc_attr( $data_plugin ); ?>">
|
|
<i></i><?php echo esc_html( $title ); ?>
|
|
<?php endif; ?>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* Get the upgrade button.
|
|
*
|
|
* @since 1.8.2.2
|
|
* @since 1.9.6.1 Add $license_level parameter.
|
|
*
|
|
* @param array $utm UTM parameters.
|
|
* @param array $classes Classes.
|
|
* @param string $license_level License level.
|
|
*/
|
|
function wpforms_edu_get_upgrade_button( $utm, $classes = [], $license_level = '' ) {
|
|
|
|
$utm_medium = isset( $utm['medium'] ) ? $utm['medium'] : '';
|
|
$utm_content = isset( $utm['content'] ) ? $utm['content'] : '';
|
|
|
|
$default_classes = [ 'wpforms-btn', 'wpforms-btn-lg', 'wpforms-btn-orange' ];
|
|
$default_classes[] = ! wpforms()->is_pro() ? 'wpforms-upgrade-modal' : '';
|
|
|
|
$btn_classes = array_merge( $default_classes, (array) $classes );
|
|
|
|
$upgrade_button_label = esc_html__( 'Upgrade to WPForms Pro', 'wpforms-lite' );
|
|
|
|
if ( ! empty( $license_level ) && is_string( $license_level ) ) {
|
|
$upgrade_button_label = sprintf(
|
|
/* translators: %s: License name. */
|
|
esc_html__( 'Upgrade to WPForms %s', 'wpforms-lite' ),
|
|
esc_html( ucfirst( $license_level ) )
|
|
);
|
|
}
|
|
?>
|
|
<a
|
|
href="<?php echo esc_url( wpforms_admin_upgrade_link( $utm_medium, $utm_content ) ); ?>"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="<?php echo esc_attr( implode( ' ', array_filter( $btn_classes ) ) ); ?>">
|
|
<?php echo esc_html( $upgrade_button_label ); ?>
|
|
</a>
|
|
<?php
|
|
}
|