Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: option.php
/**
[1000] Fix | Delete
* Fires after the value of an option has been successfully updated.
[1001] Fix | Delete
*
[1002] Fix | Delete
* @since 2.9.0
[1003] Fix | Delete
*
[1004] Fix | Delete
* @param string $option Name of the updated option.
[1005] Fix | Delete
* @param mixed $old_value The old option value.
[1006] Fix | Delete
* @param mixed $value The new option value.
[1007] Fix | Delete
*/
[1008] Fix | Delete
do_action( 'updated_option', $option, $old_value, $value );
[1009] Fix | Delete
[1010] Fix | Delete
return true;
[1011] Fix | Delete
}
[1012] Fix | Delete
[1013] Fix | Delete
/**
[1014] Fix | Delete
* Adds a new option.
[1015] Fix | Delete
*
[1016] Fix | Delete
* You do not need to serialize values. If the value needs to be serialized,
[1017] Fix | Delete
* then it will be serialized before it is inserted into the database.
[1018] Fix | Delete
* Remember, resources cannot be serialized or added as an option.
[1019] Fix | Delete
*
[1020] Fix | Delete
* You can create options without values and then update the values later.
[1021] Fix | Delete
* Existing options will not be updated and checks are performed to ensure that you
[1022] Fix | Delete
* aren't adding a protected WordPress option. Care should be taken to not name
[1023] Fix | Delete
* options the same as the ones which are protected.
[1024] Fix | Delete
*
[1025] Fix | Delete
* @since 1.0.0
[1026] Fix | Delete
* @since 6.6.0 The $autoload parameter's default value was changed to null.
[1027] Fix | Delete
*
[1028] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1029] Fix | Delete
*
[1030] Fix | Delete
* @param string $option Name of the option to add. Expected to not be SQL-escaped.
[1031] Fix | Delete
* @param mixed $value Optional. Option value. Must be serializable if non-scalar.
[1032] Fix | Delete
* Expected to not be SQL-escaped.
[1033] Fix | Delete
* @param string $deprecated Optional. Description. Not used anymore.
[1034] Fix | Delete
* @param bool|null $autoload Optional. Whether to load the option when WordPress starts up.
[1035] Fix | Delete
* Accepts a boolean, or `null` to leave the decision up to default heuristics in WordPress.
[1036] Fix | Delete
* For backward compatibility 'yes' and 'no' are also accepted.
[1037] Fix | Delete
* Autoloading too many options can lead to performance problems, especially if the
[1038] Fix | Delete
* options are not frequently used. For options which are accessed across several places
[1039] Fix | Delete
* in the frontend, it is recommended to autoload them, by using 'yes'|true.
[1040] Fix | Delete
* For options which are accessed only on few specific URLs, it is recommended
[1041] Fix | Delete
* to not autoload them, by using false.
[1042] Fix | Delete
* Default is null, which means WordPress will determine the autoload value.
[1043] Fix | Delete
* @return bool True if the option was added, false otherwise.
[1044] Fix | Delete
*/
[1045] Fix | Delete
function add_option( $option, $value = '', $deprecated = '', $autoload = null ) {
[1046] Fix | Delete
global $wpdb;
[1047] Fix | Delete
[1048] Fix | Delete
if ( ! empty( $deprecated ) ) {
[1049] Fix | Delete
_deprecated_argument( __FUNCTION__, '2.3.0' );
[1050] Fix | Delete
}
[1051] Fix | Delete
[1052] Fix | Delete
if ( is_scalar( $option ) ) {
[1053] Fix | Delete
$option = trim( $option );
[1054] Fix | Delete
}
[1055] Fix | Delete
[1056] Fix | Delete
if ( empty( $option ) ) {
[1057] Fix | Delete
return false;
[1058] Fix | Delete
}
[1059] Fix | Delete
[1060] Fix | Delete
/*
[1061] Fix | Delete
* Until a proper _deprecated_option() function can be introduced,
[1062] Fix | Delete
* redirect requests to deprecated keys to the new, correct ones.
[1063] Fix | Delete
*/
[1064] Fix | Delete
$deprecated_keys = array(
[1065] Fix | Delete
'blacklist_keys' => 'disallowed_keys',
[1066] Fix | Delete
'comment_whitelist' => 'comment_previously_approved',
[1067] Fix | Delete
);
[1068] Fix | Delete
[1069] Fix | Delete
if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
[1070] Fix | Delete
_deprecated_argument(
[1071] Fix | Delete
__FUNCTION__,
[1072] Fix | Delete
'5.5.0',
[1073] Fix | Delete
sprintf(
[1074] Fix | Delete
/* translators: 1: Deprecated option key, 2: New option key. */
[1075] Fix | Delete
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
[1076] Fix | Delete
$option,
[1077] Fix | Delete
$deprecated_keys[ $option ]
[1078] Fix | Delete
)
[1079] Fix | Delete
);
[1080] Fix | Delete
return add_option( $deprecated_keys[ $option ], $value, $deprecated, $autoload );
[1081] Fix | Delete
}
[1082] Fix | Delete
[1083] Fix | Delete
wp_protect_special_option( $option );
[1084] Fix | Delete
[1085] Fix | Delete
if ( is_object( $value ) ) {
[1086] Fix | Delete
$value = clone $value;
[1087] Fix | Delete
}
[1088] Fix | Delete
[1089] Fix | Delete
$value = sanitize_option( $option, $value );
[1090] Fix | Delete
[1091] Fix | Delete
/*
[1092] Fix | Delete
* Make sure the option doesn't already exist.
[1093] Fix | Delete
* We can check the 'notoptions' cache before we ask for a DB query.
[1094] Fix | Delete
*/
[1095] Fix | Delete
$notoptions = wp_cache_get( 'notoptions', 'options' );
[1096] Fix | Delete
[1097] Fix | Delete
if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) {
[1098] Fix | Delete
/** This filter is documented in wp-includes/option.php */
[1099] Fix | Delete
if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) ) {
[1100] Fix | Delete
return false;
[1101] Fix | Delete
}
[1102] Fix | Delete
}
[1103] Fix | Delete
[1104] Fix | Delete
$serialized_value = maybe_serialize( $value );
[1105] Fix | Delete
[1106] Fix | Delete
$autoload = wp_determine_option_autoload_value( $option, $value, $serialized_value, $autoload );
[1107] Fix | Delete
[1108] Fix | Delete
/**
[1109] Fix | Delete
* Fires before an option is added.
[1110] Fix | Delete
*
[1111] Fix | Delete
* @since 2.9.0
[1112] Fix | Delete
*
[1113] Fix | Delete
* @param string $option Name of the option to add.
[1114] Fix | Delete
* @param mixed $value Value of the option.
[1115] Fix | Delete
*/
[1116] Fix | Delete
do_action( 'add_option', $option, $value );
[1117] Fix | Delete
[1118] Fix | Delete
$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
[1119] Fix | Delete
if ( ! $result ) {
[1120] Fix | Delete
return false;
[1121] Fix | Delete
}
[1122] Fix | Delete
[1123] Fix | Delete
if ( ! wp_installing() ) {
[1124] Fix | Delete
if ( in_array( $autoload, wp_autoload_values_to_autoload(), true ) ) {
[1125] Fix | Delete
$alloptions = wp_load_alloptions( true );
[1126] Fix | Delete
$alloptions[ $option ] = $serialized_value;
[1127] Fix | Delete
wp_cache_set( 'alloptions', $alloptions, 'options' );
[1128] Fix | Delete
} else {
[1129] Fix | Delete
wp_cache_set( $option, $serialized_value, 'options' );
[1130] Fix | Delete
}
[1131] Fix | Delete
}
[1132] Fix | Delete
[1133] Fix | Delete
// This option exists now.
[1134] Fix | Delete
$notoptions = wp_cache_get( 'notoptions', 'options' ); // Yes, again... we need it to be fresh.
[1135] Fix | Delete
[1136] Fix | Delete
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
[1137] Fix | Delete
unset( $notoptions[ $option ] );
[1138] Fix | Delete
wp_cache_set( 'notoptions', $notoptions, 'options' );
[1139] Fix | Delete
}
[1140] Fix | Delete
[1141] Fix | Delete
/**
[1142] Fix | Delete
* Fires after a specific option has been added.
[1143] Fix | Delete
*
[1144] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[1145] Fix | Delete
*
[1146] Fix | Delete
* @since 2.5.0 As "add_option_{$name}"
[1147] Fix | Delete
* @since 3.0.0
[1148] Fix | Delete
*
[1149] Fix | Delete
* @param string $option Name of the option to add.
[1150] Fix | Delete
* @param mixed $value Value of the option.
[1151] Fix | Delete
*/
[1152] Fix | Delete
do_action( "add_option_{$option}", $option, $value );
[1153] Fix | Delete
[1154] Fix | Delete
/**
[1155] Fix | Delete
* Fires after an option has been added.
[1156] Fix | Delete
*
[1157] Fix | Delete
* @since 2.9.0
[1158] Fix | Delete
*
[1159] Fix | Delete
* @param string $option Name of the added option.
[1160] Fix | Delete
* @param mixed $value Value of the option.
[1161] Fix | Delete
*/
[1162] Fix | Delete
do_action( 'added_option', $option, $value );
[1163] Fix | Delete
[1164] Fix | Delete
return true;
[1165] Fix | Delete
}
[1166] Fix | Delete
[1167] Fix | Delete
/**
[1168] Fix | Delete
* Removes an option by name. Prevents removal of protected WordPress options.
[1169] Fix | Delete
*
[1170] Fix | Delete
* @since 1.2.0
[1171] Fix | Delete
*
[1172] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[1173] Fix | Delete
*
[1174] Fix | Delete
* @param string $option Name of the option to delete. Expected to not be SQL-escaped.
[1175] Fix | Delete
* @return bool True if the option was deleted, false otherwise.
[1176] Fix | Delete
*/
[1177] Fix | Delete
function delete_option( $option ) {
[1178] Fix | Delete
global $wpdb;
[1179] Fix | Delete
[1180] Fix | Delete
if ( is_scalar( $option ) ) {
[1181] Fix | Delete
$option = trim( $option );
[1182] Fix | Delete
}
[1183] Fix | Delete
[1184] Fix | Delete
if ( empty( $option ) ) {
[1185] Fix | Delete
return false;
[1186] Fix | Delete
}
[1187] Fix | Delete
[1188] Fix | Delete
wp_protect_special_option( $option );
[1189] Fix | Delete
[1190] Fix | Delete
// Get the ID, if no ID then return.
[1191] Fix | Delete
$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
[1192] Fix | Delete
if ( is_null( $row ) ) {
[1193] Fix | Delete
return false;
[1194] Fix | Delete
}
[1195] Fix | Delete
[1196] Fix | Delete
/**
[1197] Fix | Delete
* Fires immediately before an option is deleted.
[1198] Fix | Delete
*
[1199] Fix | Delete
* @since 2.9.0
[1200] Fix | Delete
*
[1201] Fix | Delete
* @param string $option Name of the option to delete.
[1202] Fix | Delete
*/
[1203] Fix | Delete
do_action( 'delete_option', $option );
[1204] Fix | Delete
[1205] Fix | Delete
$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
[1206] Fix | Delete
[1207] Fix | Delete
if ( ! wp_installing() ) {
[1208] Fix | Delete
if ( in_array( $row->autoload, wp_autoload_values_to_autoload(), true ) ) {
[1209] Fix | Delete
$alloptions = wp_load_alloptions( true );
[1210] Fix | Delete
[1211] Fix | Delete
if ( is_array( $alloptions ) && isset( $alloptions[ $option ] ) ) {
[1212] Fix | Delete
unset( $alloptions[ $option ] );
[1213] Fix | Delete
wp_cache_set( 'alloptions', $alloptions, 'options' );
[1214] Fix | Delete
}
[1215] Fix | Delete
} else {
[1216] Fix | Delete
wp_cache_delete( $option, 'options' );
[1217] Fix | Delete
}
[1218] Fix | Delete
}
[1219] Fix | Delete
[1220] Fix | Delete
if ( $result ) {
[1221] Fix | Delete
[1222] Fix | Delete
/**
[1223] Fix | Delete
* Fires after a specific option has been deleted.
[1224] Fix | Delete
*
[1225] Fix | Delete
* The dynamic portion of the hook name, `$option`, refers to the option name.
[1226] Fix | Delete
*
[1227] Fix | Delete
* @since 3.0.0
[1228] Fix | Delete
*
[1229] Fix | Delete
* @param string $option Name of the deleted option.
[1230] Fix | Delete
*/
[1231] Fix | Delete
do_action( "delete_option_{$option}", $option );
[1232] Fix | Delete
[1233] Fix | Delete
/**
[1234] Fix | Delete
* Fires after an option has been deleted.
[1235] Fix | Delete
*
[1236] Fix | Delete
* @since 2.9.0
[1237] Fix | Delete
*
[1238] Fix | Delete
* @param string $option Name of the deleted option.
[1239] Fix | Delete
*/
[1240] Fix | Delete
do_action( 'deleted_option', $option );
[1241] Fix | Delete
[1242] Fix | Delete
return true;
[1243] Fix | Delete
}
[1244] Fix | Delete
[1245] Fix | Delete
return false;
[1246] Fix | Delete
}
[1247] Fix | Delete
[1248] Fix | Delete
/**
[1249] Fix | Delete
* Determines the appropriate autoload value for an option based on input.
[1250] Fix | Delete
*
[1251] Fix | Delete
* This function checks the provided autoload value and returns a standardized value
[1252] Fix | Delete
* ('on', 'off', 'auto-on', 'auto-off', or 'auto') based on specific conditions.
[1253] Fix | Delete
*
[1254] Fix | Delete
* If no explicit autoload value is provided, the function will check for certain heuristics around the given option.
[1255] Fix | Delete
* It will return `auto-on` to indicate autoloading, `auto-off` to indicate not autoloading, or `auto` if no clear
[1256] Fix | Delete
* decision could be made.
[1257] Fix | Delete
*
[1258] Fix | Delete
* @since 6.6.0
[1259] Fix | Delete
* @access private
[1260] Fix | Delete
*
[1261] Fix | Delete
* @param string $option The name of the option.
[1262] Fix | Delete
* @param mixed $value The value of the option to check its autoload value.
[1263] Fix | Delete
* @param mixed $serialized_value The serialized value of the option to check its autoload value.
[1264] Fix | Delete
* @param bool|null $autoload The autoload value to check.
[1265] Fix | Delete
* Accepts 'on'|true to enable or 'off'|false to disable, or
[1266] Fix | Delete
* 'auto-on', 'auto-off', or 'auto' for internal purposes.
[1267] Fix | Delete
* Any other autoload value will be forced to either 'auto-on',
[1268] Fix | Delete
* 'auto-off', or 'auto'.
[1269] Fix | Delete
* 'yes' and 'no' are supported for backward compatibility.
[1270] Fix | Delete
* @return string Returns the original $autoload value if explicit, or 'auto-on', 'auto-off',
[1271] Fix | Delete
* or 'auto' depending on default heuristics.
[1272] Fix | Delete
*/
[1273] Fix | Delete
function wp_determine_option_autoload_value( $option, $value, $serialized_value, $autoload ) {
[1274] Fix | Delete
[1275] Fix | Delete
// Check if autoload is a boolean.
[1276] Fix | Delete
if ( is_bool( $autoload ) ) {
[1277] Fix | Delete
return $autoload ? 'on' : 'off';
[1278] Fix | Delete
}
[1279] Fix | Delete
[1280] Fix | Delete
switch ( $autoload ) {
[1281] Fix | Delete
case 'on':
[1282] Fix | Delete
case 'yes':
[1283] Fix | Delete
return 'on';
[1284] Fix | Delete
case 'off':
[1285] Fix | Delete
case 'no':
[1286] Fix | Delete
return 'off';
[1287] Fix | Delete
}
[1288] Fix | Delete
[1289] Fix | Delete
/**
[1290] Fix | Delete
* Allows to determine the default autoload value for an option where no explicit value is passed.
[1291] Fix | Delete
*
[1292] Fix | Delete
* @since 6.6.0
[1293] Fix | Delete
*
[1294] Fix | Delete
* @param bool|null $autoload The default autoload value to set. Returning true will be set as 'auto-on' in the
[1295] Fix | Delete
* database, false will be set as 'auto-off', and null will be set as 'auto'.
[1296] Fix | Delete
* @param string $option The passed option name.
[1297] Fix | Delete
* @param mixed $value The passed option value to be saved.
[1298] Fix | Delete
*/
[1299] Fix | Delete
$autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
[1300] Fix | Delete
if ( is_bool( $autoload ) ) {
[1301] Fix | Delete
return $autoload ? 'auto-on' : 'auto-off';
[1302] Fix | Delete
}
[1303] Fix | Delete
[1304] Fix | Delete
return 'auto';
[1305] Fix | Delete
}
[1306] Fix | Delete
[1307] Fix | Delete
/**
[1308] Fix | Delete
* Filters the default autoload value to disable autoloading if the option value is too large.
[1309] Fix | Delete
*
[1310] Fix | Delete
* @since 6.6.0
[1311] Fix | Delete
* @access private
[1312] Fix | Delete
*
[1313] Fix | Delete
* @param bool|null $autoload The default autoload value to set.
[1314] Fix | Delete
* @param string $option The passed option name.
[1315] Fix | Delete
* @param mixed $value The passed option value to be saved.
[1316] Fix | Delete
* @param mixed $serialized_value The passed option value to be saved, in serialized form.
[1317] Fix | Delete
* @return bool|null Potentially modified $default.
[1318] Fix | Delete
*/
[1319] Fix | Delete
function wp_filter_default_autoload_value_via_option_size( $autoload, $option, $value, $serialized_value ) {
[1320] Fix | Delete
/**
[1321] Fix | Delete
* Filters the maximum size of option value in bytes.
[1322] Fix | Delete
*
[1323] Fix | Delete
* @since 6.6.0
[1324] Fix | Delete
*
[1325] Fix | Delete
* @param int $max_option_size The option-size threshold, in bytes. Default 150000.
[1326] Fix | Delete
* @param string $option The name of the option.
[1327] Fix | Delete
*/
[1328] Fix | Delete
$max_option_size = (int) apply_filters( 'wp_max_autoloaded_option_size', 150000, $option );
[1329] Fix | Delete
$size = ! empty( $serialized_value ) ? strlen( $serialized_value ) : 0;
[1330] Fix | Delete
[1331] Fix | Delete
if ( $size > $max_option_size ) {
[1332] Fix | Delete
return false;
[1333] Fix | Delete
}
[1334] Fix | Delete
[1335] Fix | Delete
return $autoload;
[1336] Fix | Delete
}
[1337] Fix | Delete
[1338] Fix | Delete
/**
[1339] Fix | Delete
* Deletes a transient.
[1340] Fix | Delete
*
[1341] Fix | Delete
* @since 2.8.0
[1342] Fix | Delete
*
[1343] Fix | Delete
* @param string $transient Transient name. Expected to not be SQL-escaped.
[1344] Fix | Delete
* @return bool True if the transient was deleted, false otherwise.
[1345] Fix | Delete
*/
[1346] Fix | Delete
function delete_transient( $transient ) {
[1347] Fix | Delete
[1348] Fix | Delete
/**
[1349] Fix | Delete
* Fires immediately before a specific transient is deleted.
[1350] Fix | Delete
*
[1351] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[1352] Fix | Delete
*
[1353] Fix | Delete
* @since 3.0.0
[1354] Fix | Delete
*
[1355] Fix | Delete
* @param string $transient Transient name.
[1356] Fix | Delete
*/
[1357] Fix | Delete
do_action( "delete_transient_{$transient}", $transient );
[1358] Fix | Delete
[1359] Fix | Delete
if ( wp_using_ext_object_cache() || wp_installing() ) {
[1360] Fix | Delete
$result = wp_cache_delete( $transient, 'transient' );
[1361] Fix | Delete
} else {
[1362] Fix | Delete
$option_timeout = '_transient_timeout_' . $transient;
[1363] Fix | Delete
$option = '_transient_' . $transient;
[1364] Fix | Delete
$result = delete_option( $option );
[1365] Fix | Delete
[1366] Fix | Delete
if ( $result ) {
[1367] Fix | Delete
delete_option( $option_timeout );
[1368] Fix | Delete
}
[1369] Fix | Delete
}
[1370] Fix | Delete
[1371] Fix | Delete
if ( $result ) {
[1372] Fix | Delete
[1373] Fix | Delete
/**
[1374] Fix | Delete
* Fires after a transient is deleted.
[1375] Fix | Delete
*
[1376] Fix | Delete
* @since 3.0.0
[1377] Fix | Delete
*
[1378] Fix | Delete
* @param string $transient Deleted transient name.
[1379] Fix | Delete
*/
[1380] Fix | Delete
do_action( 'deleted_transient', $transient );
[1381] Fix | Delete
}
[1382] Fix | Delete
[1383] Fix | Delete
return $result;
[1384] Fix | Delete
}
[1385] Fix | Delete
[1386] Fix | Delete
/**
[1387] Fix | Delete
* Retrieves the value of a transient.
[1388] Fix | Delete
*
[1389] Fix | Delete
* If the transient does not exist, does not have a value, or has expired,
[1390] Fix | Delete
* then the return value will be false.
[1391] Fix | Delete
*
[1392] Fix | Delete
* @since 2.8.0
[1393] Fix | Delete
*
[1394] Fix | Delete
* @param string $transient Transient name. Expected to not be SQL-escaped.
[1395] Fix | Delete
* @return mixed Value of transient.
[1396] Fix | Delete
*/
[1397] Fix | Delete
function get_transient( $transient ) {
[1398] Fix | Delete
[1399] Fix | Delete
/**
[1400] Fix | Delete
* Filters the value of an existing transient before it is retrieved.
[1401] Fix | Delete
*
[1402] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[1403] Fix | Delete
*
[1404] Fix | Delete
* Returning a value other than false from the filter will short-circuit retrieval
[1405] Fix | Delete
* and return that value instead.
[1406] Fix | Delete
*
[1407] Fix | Delete
* @since 2.8.0
[1408] Fix | Delete
* @since 4.4.0 The `$transient` parameter was added
[1409] Fix | Delete
*
[1410] Fix | Delete
* @param mixed $pre_transient The default value to return if the transient does not exist.
[1411] Fix | Delete
* Any value other than false will short-circuit the retrieval
[1412] Fix | Delete
* of the transient, and return that value.
[1413] Fix | Delete
* @param string $transient Transient name.
[1414] Fix | Delete
*/
[1415] Fix | Delete
$pre = apply_filters( "pre_transient_{$transient}", false, $transient );
[1416] Fix | Delete
[1417] Fix | Delete
if ( false !== $pre ) {
[1418] Fix | Delete
return $pre;
[1419] Fix | Delete
}
[1420] Fix | Delete
[1421] Fix | Delete
if ( wp_using_ext_object_cache() || wp_installing() ) {
[1422] Fix | Delete
$value = wp_cache_get( $transient, 'transient' );
[1423] Fix | Delete
} else {
[1424] Fix | Delete
$transient_option = '_transient_' . $transient;
[1425] Fix | Delete
if ( ! wp_installing() ) {
[1426] Fix | Delete
// If option is not in alloptions, it is not autoloaded and thus has a timeout.
[1427] Fix | Delete
$alloptions = wp_load_alloptions();
[1428] Fix | Delete
[1429] Fix | Delete
if ( ! isset( $alloptions[ $transient_option ] ) ) {
[1430] Fix | Delete
$transient_timeout = '_transient_timeout_' . $transient;
[1431] Fix | Delete
wp_prime_option_caches( array( $transient_option, $transient_timeout ) );
[1432] Fix | Delete
$timeout = get_option( $transient_timeout );
[1433] Fix | Delete
if ( false !== $timeout && $timeout < time() ) {
[1434] Fix | Delete
delete_option( $transient_option );
[1435] Fix | Delete
delete_option( $transient_timeout );
[1436] Fix | Delete
$value = false;
[1437] Fix | Delete
}
[1438] Fix | Delete
}
[1439] Fix | Delete
}
[1440] Fix | Delete
[1441] Fix | Delete
if ( ! isset( $value ) ) {
[1442] Fix | Delete
$value = get_option( $transient_option );
[1443] Fix | Delete
}
[1444] Fix | Delete
}
[1445] Fix | Delete
[1446] Fix | Delete
/**
[1447] Fix | Delete
* Filters an existing transient's value.
[1448] Fix | Delete
*
[1449] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[1450] Fix | Delete
*
[1451] Fix | Delete
* @since 2.8.0
[1452] Fix | Delete
* @since 4.4.0 The `$transient` parameter was added
[1453] Fix | Delete
*
[1454] Fix | Delete
* @param mixed $value Value of transient.
[1455] Fix | Delete
* @param string $transient Transient name.
[1456] Fix | Delete
*/
[1457] Fix | Delete
return apply_filters( "transient_{$transient}", $value, $transient );
[1458] Fix | Delete
}
[1459] Fix | Delete
[1460] Fix | Delete
/**
[1461] Fix | Delete
* Sets/updates the value of a transient.
[1462] Fix | Delete
*
[1463] Fix | Delete
* You do not need to serialize values. If the value needs to be serialized,
[1464] Fix | Delete
* then it will be serialized before it is set.
[1465] Fix | Delete
*
[1466] Fix | Delete
* @since 2.8.0
[1467] Fix | Delete
*
[1468] Fix | Delete
* @param string $transient Transient name. Expected to not be SQL-escaped.
[1469] Fix | Delete
* Must be 172 characters or fewer in length.
[1470] Fix | Delete
* @param mixed $value Transient value. Must be serializable if non-scalar.
[1471] Fix | Delete
* Expected to not be SQL-escaped.
[1472] Fix | Delete
* @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
[1473] Fix | Delete
* @return bool True if the value was set, false otherwise.
[1474] Fix | Delete
*/
[1475] Fix | Delete
function set_transient( $transient, $value, $expiration = 0 ) {
[1476] Fix | Delete
[1477] Fix | Delete
$expiration = (int) $expiration;
[1478] Fix | Delete
[1479] Fix | Delete
/**
[1480] Fix | Delete
* Filters a specific transient before its value is set.
[1481] Fix | Delete
*
[1482] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[1483] Fix | Delete
*
[1484] Fix | Delete
* @since 3.0.0
[1485] Fix | Delete
* @since 4.2.0 The `$expiration` parameter was added.
[1486] Fix | Delete
* @since 4.4.0 The `$transient` parameter was added.
[1487] Fix | Delete
*
[1488] Fix | Delete
* @param mixed $value New value of transient.
[1489] Fix | Delete
* @param int $expiration Time until expiration in seconds.
[1490] Fix | Delete
* @param string $transient Transient name.
[1491] Fix | Delete
*/
[1492] Fix | Delete
$value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient );
[1493] Fix | Delete
[1494] Fix | Delete
/**
[1495] Fix | Delete
* Filters the expiration for a transient before its value is set.
[1496] Fix | Delete
*
[1497] Fix | Delete
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
[1498] Fix | Delete
*
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function