PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
admin-site-enhancements
/
classes
<?php namespace ASENHA\Classes; /** * Class for Auto-Publishing of Posts with Missed Schedules module * * @since 6.9.5 */ class Auto_Publish_Posts_With_Missed_Schedule { /** * Publish posts of any type with missed schedule. * We use the Transients API to reduce straining the site with DB queries on busy sites. * So, this function will only query the DB once every 15 minutes at most. * * @since 3.1.0 */ public function publish_missed_schedule_posts() { if ( is_front_page() || is_home() || is_page() || is_single() || is_singular() || is_archive() || is_admin() || is_blog_admin() || is_robots() || is_ssl() ) { // Get missed schedule posts data from cache $missed_schedule_posts = get_transient( 'asenha_missed_schedule_posts' ); // Nothing found in cache if ( false === $missed_schedule_posts ) { global $wpdb; $current_gmt_datetime = gmdate( 'Y-m-d H:i:00' ); $args = array( 'public' => true, '_builtin' => false, // not post, page, attachment, revision or nav_menu_item ); $custom_post_types = get_post_types( $args, 'names' ); // array, e.g. array( 'project', 'book', 'staff' ) if ( count( $custom_post_types ) > 0 ) { $custom_post_types = "'" . implode( "','", $custom_post_types ) . "'"; // string, e.g. 'project','book','staff' $post_types = "'page','post'," . $custom_post_types; // 'page','post','project','book','staff' } else { $post_types = "'page','post'"; } $sql = "SELECT ID FROM $wpdb->posts WHERE post_type IN ($post_types) AND post_status='future' AND post_date_gmt<'$current_gmt_datetime'"; // The following does not work as backslashes are inserted before single quotes in $post_types // $sql = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type IN (%s) AND post_status='future' AND post_date_gmt<'%s'", array( $post_types, $current_gmt_datetime ) ); $missed_schedule_posts = $wpdb->get_results( $sql, ARRAY_A ); // Save query results as a transient with expiry of 15 minutes set_transient( 'asenha_missed_schedule_posts', $missed_schedule_posts, 15 * MINUTE_IN_SECONDS ); } if ( empty( $missed_schedule_posts ) || ! is_array( $missed_schedule_posts ) ) { return; } foreach( $missed_schedule_posts as $post ) { wp_publish_post( $post['ID'] ); } } } }
[-] class-hide-admin-bar.php
[edit]
[-] class-svg-upload.php
[edit]
[-] class-disable-gutenberg.php
[edit]
[-] class-cleanup-admin-bar.php
[edit]
[-] class-disable-rest-api.php
[edit]
[-] class-multiple-user-roles.php
[edit]
[-] class-disable-updates.php
[edit]
[-] class-image-upload-control.php
[edit]
[-] class-hide-admin-notices.php
[edit]
[-] class-content-duplication.php
[edit]
[-] class-insert-head-body-footer-code.php
[edit]
[-] class-media-replacement.php
[edit]
[-] class-password-protection.php
[edit]
[-] class-heartbeat-control.php
[edit]
[-] class-email-address-obfuscator.php
[edit]
[-] class-settings-sanitization.php
[edit]
[-] class-wp-config-transformer.php
[edit]
[-] class-content-order.php
[edit]
[-] class-custom-css.php
[edit]
[-] class-enhance-list-tables.php
[edit]
[-] class-login-logout-menu.php
[edit]
[-] class-search-engines-visibility.php
[edit]
[-] class-limit-login-attempts.php
[edit]
[-] class-disable-xml-rpc.php
[edit]
[-] class-common-methods.php
[edit]
[-] class-email-delivery.php
[edit]
[-] class-obfuscate-author-slugs.php
[edit]
[-] class-external-permalinks.php
[edit]
[-] class-wider-admin-menu.php
[edit]
[-] class-display-system-summary.php
[edit]
[-] class-admin-menu-organizer.php
[edit]
[-] class-redirect-fourofour.php
[edit]
[-] class-manage-robots-txt.php
[edit]
[-] class-site-identity-on-login-page.php
[edit]
[-] class-avif-upload.php
[edit]
[-] class-disable-comments.php
[edit]
[-] class-manage-ads-appads-txt.php
[edit]
[-] class-various-admin-ui-enhancements.php
[edit]
[-] class-admin-menu-svg-icon-mask.php
[edit]
[-] class-deactivation.php
[edit]
[-] class-activation.php
[edit]
[-] class-view-admin-as-role.php
[edit]
[-] class-maintenance-mode.php
[edit]
[-] class-custom-body-class.php
[edit]
[-] class-disable-dashboard-widgets.php
[edit]
[-] class-login-id-type.php
[edit]
[-] class-image-sizes-panel.php
[edit]
[-] class-redirect-after-login.php
[edit]
[-] class-settings-sections-fields.php
[edit]
[-] class-auto-publish-posts-with-missed-schedule.php
[edit]
[-] class-revisions-control.php
[edit]
[+]
..
[-] class-registration-date-column.php
[edit]
[-] class-disable-embeds.php
[edit]
[-] class-show-custom-taxonomy-filters.php
[edit]
[-] class-custom-nav-menu-items-in-new-tab.php
[edit]
[-] class-disable-feeds.php
[edit]
[-] class-captcha-protection.php
[edit]
[-] class-custom-admin-footer-text.php
[edit]
[-] class-change-login-url.php
[edit]
[-] class-last-login-column.php
[edit]
[-] class-settings-fields-render.php
[edit]
[-] class-disable-smaller-components.php
[edit]
[-] class-disable-author-archives.php
[edit]
[-] class-redirect-after-logout.php
[edit]
[-] class-open-external-links-in-new-tab.php
[edit]