|null $arr A sequential object array whose unique items are needed * @return object[] An array of unique objects * @since 1.11.0 */ public static function arrayUniqueObject(?array $arr): array { if ($arr === null || !$arr) return []; $idArray = []; foreach($arr as $item) { if (!is_object($item)) continue; // spl_object_id is a unique ID given to each object. So, the ID array can only have unique objects since // unique IDs are used as keys. If an object has the same ID as an object existing in the ID array, then // it will just be reassigned. So, ID array is unique. $idArray[spl_object_id($item)] = $item; } // Just return the values of the ID array as the final unique array. return array_values($idArray); } /** * Check if a plugin is currently active. This method is created by examining {@link is_plugin_active()} and * {@link is_plugin_active_for_network()}. These functions are available in "admin_init" event, while this method * is available any time. * * @param string|null $plugin Path of the plugin's entrypoint file relative to the "plugins" directory. For * example, for WooCommerce, this is "woocommerce/woocommerce.php". * @return bool * @since 1.11.0 */ public static function isPluginActive(?string $plugin): bool { if (!$plugin) return false; // If this is not a multi site if (!is_multisite()) { return in_array($plugin, apply_filters('active_plugins', get_option('active_plugins'))); } // This is a multi site installation. Get site-wide active plugins. $activePlugins = get_site_option('active_sitewide_plugins'); // Make sure it is an array, since the return type does not guarantee that. return !is_array($activePlugins) ? false : in_array($plugin, array_keys($activePlugins)); } /** * @return array|string[] Decimal separator options that can be shown in a select form item * @since 1.11.0 */ public static function getDecimalSeparatorOptionsForSelect(): array { return [ 'dot' => _wpcc('Dot') . ' (.)', 'comma' => _wpcc('Comma') . ' (,)', ]; } /** * Check if an array has non-empty values. This does not check inner arrays. * * @param array $arr An array * @return bool True if the array has values that are non-empty * @since 1.11.0 */ public static function hasNonEmptyValues(array $arr): bool { return !empty(array_filter($arr, function($v) { if (is_array($v) || is_object($v)) { return !empty($v); } return $v !== ''; })); } /** * Shifts the first key from a dot key. The dot key will be set to the remaining key after this operation. The first * key will be returned. The remaining key, i.e. the value of $dotKey, will be an empty string if the given $dotKey * has only one part. * * @param string|null $dotKey A dot notation key * @param string $separator The separator used in the dot key. This is typically '.' * @return string|null First key. If the dotKey is null or an empty string, returns null. If the dot key could not * be separated by using the given separator, returns null. * @since 1.11.1 */ public static function shiftFirstKey(?string &$dotKey, string $separator = '.'): ?string { if ($dotKey === null || $dotKey === '') { return null; } // Explode the dot key from the separators. Set the limit as 2 since we need the first key and the rest of the // dot key. $exploded = explode($separator, $dotKey, 2); if ($exploded) { // Get the first key $firstKey = $exploded[0]; // The remaining dot key should be in the index 1. $dotKey = $exploded[1] ?? ''; return $firstKey; } return null; } /** * Get the details of attachments with their IDs * * @param string[]|int[]|null $attachmentIds IDs of the attachments whose information is needed * @return array|null An array whose keys are attachment IDs and whose values are the information about * the attachments retrieved via {@link wp_prepare_attachment_for_js()}. * @since 1.12.0 */ public static function getAttachmentInfo(?array $attachmentIds): ?array { if (!$attachmentIds) return null; $preparedIds = array_filter(array_map(function($value) { return is_numeric($value) ? (int) $value : null; }, $attachmentIds)); // Get the attachments $attachments = get_posts([ 'numberposts' => -1, 'orderby' => 'post__in', 'include' => $preparedIds, 'post_status' => 'any', 'post_type' => 'attachment', ]); // Prepare the attachment details $result = []; foreach($attachments as $attachment) { if (!($attachment instanceof WP_Post)) continue; $info = wp_prepare_attachment_for_js($attachment) ?: null; if (!is_array($info)) continue; $result[$attachment->ID] = $info; } return $result; } }
Fatal error: Uncaught Error: Class 'WPCCrawler\Utils' not found in /home/healths/public_html/wp-content/plugins/wp-content-crawler/app/RequirementValidator.php:58 Stack trace: #0 /home/healths/public_html/wp-content/plugins/wp-content-crawler/app/WPCCrawler.php(58): WPCCrawler\RequirementValidator->validateAll() #1 /home/healths/public_html/wp-content/plugins/wp-content-crawler/app/WPCCrawler.php(44): WPCCrawler\WPCCrawler->__construct() #2 /home/healths/public_html/wp-content/plugins/wp-content-crawler/wp-content-crawler.php(28): WPCCrawler\WPCCrawler::getInstance() #3 /home/healths/public_html/wp-settings.php(473): include_once('/home/healths/p...') #4 /home/healths/public_html/wp-config.php(99): require_once('/home/healths/p...') #5 /home/healths/public_html/wp-load.php(50): require_once('/home/healths/p...') #6 /home/healths/public_html/wp-blog-header.php(13): require_once('/home/healths/p...') #7 /home/healths/public_html/index.php(17): require('/home/healths/p...') #8 {main} thrown in /home/healths/public_html/wp-content/plugins/wp-content-crawler/app/RequirementValidator.php on line 58