Files
homeproz/wp-content/plugins/wpforms-lite/templates/integrations/wpcode/code-snippets.php
T
root b6df4dbb92 Snapshot: MLS sync fixes, image refresh, plugin/theme updates
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>
2026-04-29 15:32:23 +00:00

108 lines
4.5 KiB
PHP
Executable File

<?php
/**
* WPCode integration code snippets page.
*
* @since 1.8.5
*
* @var array $snippets WPCode snippets list.
* @var bool $action_required Indicate that user should install or activate WPCode.
* @var string $action Popup button action.
* @var string $plugin WPCode Lite download URL | WPCode Lite plugin slug.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php
$container_class = $action_required ? 'wpforms-wpcode-blur' : '';
$popup_title = esc_html__( 'Please Install WPCode to Use the WPForms Snippet Library', 'wpforms-lite' );
$popup_button_text = esc_html__( 'Install + Activate WPCode', 'wpforms-lite' );
if ( $action === 'update' ) {
$popup_title = esc_html__( 'Please Update WPCode to Use the WPForms Snippet Library', 'wpforms-lite' );
$popup_button_text = esc_html__( 'Update + Activate WPCode', 'wpforms-lite' );
}
if ( $action === 'activate' ) {
$popup_title = esc_html__( 'Please Activate WPCode to Use the WPForms Snippet Library', 'wpforms-lite' );
$popup_button_text = esc_html__( 'Activate WPCode', 'wpforms-lite' );
}
?>
<div class="wpforms-wpcode">
<?php if ( $action_required ) : ?>
<div class="wpforms-wpcode-popup">
<div class="wpforms-wpcode-popup-title"><?php echo esc_html( $popup_title ); ?></div>
<div class="wpforms-wpcode-popup-description">
<?php esc_html_e( 'Using WPCode, you can install WPForms code snippets with 1 click right from this page or the WPCode Library in the WordPress admin.', 'wpforms-lite' ); ?>
</div>
<div data-action="<?php echo esc_attr( $action ); ?>" data-plugin="<?php echo esc_attr( $plugin ); ?>" class="wpforms-wpcode-popup-button wpforms-btn wpforms-btn-lg wpforms-btn-orange"><?php echo esc_html( $popup_button_text ); ?></div>
<a
href="https://wordpress.org/plugins/insert-headers-and-footers/?utm_source=wpformsplugin&utm_medium=WPCode+WordPress+Repo&utm_campaign=plugin&utm_content=WPCode"
class="wpforms-wpcode-popup-link">
<?php esc_html_e( 'Learn more about WPCode', 'wpforms-lite' ); ?>
</a>
</div>
<?php endif; ?>
<div class="wpforms-wpcode-container <?php echo sanitize_html_class( $container_class ); ?>">
<div class="wpforms-setting-row tools wpforms-wpcode-header">
<div class="wpforms-wpcode-header-meta">
<h4><?php esc_html_e( 'Code Snippets', 'wpforms-lite' ); ?></h4>
<p>
<?php
printf(
wp_kses( /* translators: %s - WPCode library website URL. */
__( 'Using WPCode, you can install WPForms code snippets with 1 click directly from this page or the <a href="%s" target="_blank" rel="noopener noreferrer">WPCode library</a>.', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
esc_url( admin_url( 'admin.php?page=wpcode-library' ) )
);
?>
</p>
</div>
<div class="wpforms-wpcode-header-search">
<label for="wpforms-wpcode-snippet-search"></label>
<input
type="search" placeholder="<?php esc_attr_e( 'Search Snippets', 'wpforms-lite' ); ?>"
id="wpforms-wpcode-snippet-search">
</div>
</div>
<div id="wpforms-wpcode-snippets-list">
<div class="list">
<?php
foreach ( $snippets as $snippet ) :
$button_text = $snippet['installed'] ? __( 'Edit Snippet', 'wpforms-lite' ) : __( 'Install Snippet', 'wpforms-lite' );
$button_type_class = $snippet['installed'] ? 'button-primary' : 'button-secondary';
$button_action = $snippet['installed'] ? 'edit' : 'install';
$badge_text = $snippet['installed'] ? __( 'Installed', 'wpforms-lite' ) : '';
?>
<div class="wpforms-wpcode-snippet">
<div class="wpforms-wpcode-snippet-header">
<h3 class="wpforms-wpcode-snippet-title"><?php echo esc_html( $snippet['title'] ); ?></h3>
<div class="wpforms-wpcode-snippet-note"><?php echo esc_html( $snippet['note'] ); ?></div>
</div>
<div class="wpforms-wpcode-snippet-footer">
<div class="wpforms-wpcode-snippet-badge"><?php echo esc_html( $badge_text ); ?></div>
<a
href="<?php echo esc_url( $snippet['install'] ); ?>"
class="button wpforms-wpcode-snippet-button <?php echo sanitize_html_class( $button_type_class ); ?>"
data-action="<?php echo esc_attr( $button_action ); ?>"><?php echo esc_html( $button_text ); ?> </a>
</div>
</div>
<?php endforeach; ?>
</div>
<div id="wpforms-wpcode-no-results"><?php esc_html_e( "Sorry, we didn't find any snippets that match your criteria.", 'wpforms-lite' ); ?></div>
</div>
</div>
</div>