....................................../////.===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/t/h/i/thillelirn/www/wp-content/plugins/burst-statistics/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/t/h/i/thillelirn/www/wp-content/plugins/burst-statistics/class-admin.php
<?php
defined( 'ABSPATH' ) or die( 'you do not have access to this page!' );
if ( ! class_exists( 'burst_admin' ) ) {
	class burst_admin {
		private static $_this;

		function __construct() {
			if ( isset( self::$_this ) ) {
				wp_die();
			}

			self::$_this = $this;
			add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );

			$plugin = burst_plugin;
			add_filter( "plugin_action_links_$plugin", array( $this, 'plugin_settings_link' ) );

			// multisite
			add_filter( "network_admin_plugin_action_links_$plugin", [ $this, 'plugin_settings_link' ] );

			// column
			add_action( 'admin_init', array( $this, 'add_burst_admin_columns' ), 1 );
			add_action( 'pre_get_posts', array( $this, 'posts_orderby_total_pageviews' ), 1 );
			// deactivating
			add_action( 'admin_footer', array( $this, 'deactivate_popup' ), 40 );
			add_action( 'admin_init', array( $this, 'listen_for_deactivation' ), 40 );
			add_action( 'admin_init', array( $this, 'add_privacy_info' ), 10 );

			// remove tables on multisite uninstall
			add_filter( 'wpmu_drop_tables', [ $this, 'ms_remove_tables' ], 10, 2 );

			add_filter( 'burst_do_action', array( $this, 'maybe_delete_all_data' ), 10, 3 );

			add_filter( 'burst_after_saved_fields', [ $this, 'create_js_file' ], 10, 1 );
			add_action( 'upgrader_process_complete', [ $this, 'create_js_file' ], 10, 1 );
			add_action( 'wp_initialize_site', [ $this, 'create_js_file' ], 10, 1 );
			add_action( 'admin_init', [ $this, 'activation' ] );

			add_action( 'admin_bar_menu', array( $this, 'add_to_admin_bar_menu' ), 35 );
			add_action( 'admin_bar_menu', array( $this, 'add_top_bar_menu' ), 400 );

            add_action( 'burst_activation', array( $this, 'setup_defaults' ) );
            add_action( 'burst_activation', [ $this, 'run_table_init_hook' ], 10, 1 );
			add_action( 'after_reset_stats', [ $this, 'run_table_init_hook' ], 10, 1 );
			add_action( 'upgrader_process_complete', [ $this, 'run_table_init_hook' ], 10, 1 );
			add_action( 'wp_initialize_site', [ $this, 'run_table_init_hook' ], 10, 1 );
			add_action( 'burst_upgrade', [ $this, 'run_table_init_hook' ], 10, 1 );

            if ( defined('BURST_BLUEPRINT') ) {
                add_action( 'init', [ $this, 'install_demo_data' ] );
            }
		}

		public static function this() {
			return self::$_this;
		}

        private function insert_row($table, $rows){
            global $wpdb;
            $table = "{$wpdb->prefix}burst_$table";
            foreach ( $rows as $row ) {
	            $wpdb->insert(
		            $table,
		            $row
	            );
            }
        }

        private function get_random_referrer(){
            $referrers = [
                    'https://www.google.com',
                    'https://duckduckgo.com',
                    'https://bing.com',
                    'https://burst-statistics.com',
            ];
	        return $referrers[array_rand($referrers)];
        }

		/**
         * Install demo data in Burst if blueprint.json is active
         *
		 * @return void
		 */
        public function install_demo_data(){
            //check if database installed
            if ( !get_option( 'burst_stats_db_version' ) ) {
                return;
            }
            
            if ( !get_option( 'burst_demo_data_installed' ) ){
                global $wpdb;

	            $data = [
		            [
			            'name' => 'Chrome',
		            ],
		            [
			            'name' => 'Safari',
		            ],
		            [
			            'name' => 'Firefox',
		            ],
	            ];
	            $this->insert_row('browsers', $data);

	            $data = [
		            [
			            'name' => 'desktop',
		            ],
		            [
			            'name' => 'mobile',
		            ],
		            [
			            'name' => 'tablet',
		            ],
	            ];
	            $this->insert_row('platforms', $data);

	            $data = [
		            [
			            'name' => 'Windows',
		            ],
		            [
			            'name' => 'MacOS',
		            ],
		            [
			            'name' => 'Linux',
		            ],
	            ];
                $this->insert_row('platforms', $data);
                //get all demo pages
                $posts = get_posts( array(
                    'post_type' => ['page', 'post'],
                    'post_status' => 'publish',
                    'posts_per_page' => -1,
                ) );
	            $start_date_unix = time();
	            $total_days = 30;
                //we're walking back in time, so to get an increasing nr of pageviews, we decrease the max views each day.
                $max_views = 200;
	            for ( $i = 0; $i < $total_days; $i++ ) {
		            $stats_date_unix = $start_date_unix - ( $i * DAY_IN_SECONDS );
		            $stats_date = BURST()->statistics->convert_unix_to_date( $stats_date_unix ); // 2022-02-07
                    $total_entry_added = false;
		            $max_views -= $i * 5;
                    $min_views = 5;
                    if ( $max_views <= $min_views ) {
                        $max_views = $min_views+5;
                    }
                    foreach ( $posts as $post ) {
                        $post_id = $post->ID;

                        $page_url = str_replace(home_url(), '', get_permalink( $post_id ) );
                        $visitors = random_int( $min_views, $max_views );
                        $page_views = 2 * $visitors;
                        $sessions = Round(0.5 * $visitors, 0 );
                        $first_time_visitors = Round(0.1 * $visitors, 0 );
                        $bounces = Round(0.03 * $visitors, 0 );
                        $wpdb->insert(
                            "{$wpdb->prefix}burst_summary",
                            [
                                'date' => $stats_date,
                                'page_url' => $page_url,
                                'sessions' => $sessions,
                                'pageviews' => $page_views,
                                'visitors' => $first_time_visitors,
                                'first_time_visitors' => $first_time_visitors,
                                'bounces' => $bounces,
                                'avg_time_on_page' => rand(20, 3 * MINUTE_IN_SECONDS ),
                                'completed' => 1,
                            ]
                        );

	                    $wpdb->insert(
		                    "{$wpdb->prefix}burst_statistics",
		                    [
			                    'time' => $stats_date_unix,
			                    'page_url' => $page_url,
			                    'uid' => random_int( 1, 1000 ),
			                    'first_time_visit' => 1,
			                    'bounce' => random_int(0,1),
			                    'browser_id' => random_int( 1, 3 ),
			                    'device_id' => random_int( 1, 3 ),
			                    'platform_id' => random_int( 1, 3 ),
			                    'time_on_page' => rand(20, 3 * MINUTE_IN_SECONDS ),
                                'referrer'  => $this->get_random_referrer(),
		                    ]
	                    );

                        $post_hit_count = get_post_meta( $post_id, 'burst_total_pageviews_count', true );
	                    $post_hit_count = $post_hit_count ?: 0;
	                    $post_hit_count += $page_views;
                        update_post_meta( $post_id, 'burst_total_pageviews_count', $post_hit_count );
                        if ( !$total_entry_added ) {
                            $wpdb->insert(
                                "{$wpdb->prefix}burst_summary",
                                [
                                    'date' => $stats_date,
                                    'page_url' => 'burst_day_total',
                                    'sessions' => $sessions,
                                    'pageviews' => $page_views,
                                    'visitors' => $first_time_visitors,
                                    'first_time_visitors' => $first_time_visitors,
                                    'bounces' => $bounces,
                                    'avg_time_on_page' => rand(20, 3 * MINUTE_IN_SECONDS ),
                                    'completed' => 1,
                                ]
                            );
                            $total_entry_added = true;
                        }
                    }
                }

                update_option( 'burst_demo_data_installed', true );
            }
        }

		public function add_to_admin_bar_menu( $wp_admin_bar ) {
			if ( ! burst_user_can_view() || is_admin() ) {
				return;
			}

			// don't show on subsites if networkwide activated, and this is not the main site.
			if ( burst_is_networkwide_active() && ! is_main_site() ) {
				return;
			}

			$wp_admin_bar->add_node(
				[
					'parent' => 'site-name',
					'id'     => 'burst-statistics',
					'title'  => __( 'Statistics', 'burst-statistics' ),
					'href'   => burst_dashboard_url,
				]
			);
		}

		/**
		 * Add top bar menu for page views
		 *
		 * @param $wp_admin_bar
		 *
		 * @return void
		 */
		public function add_top_bar_menu( $wp_admin_bar ) {
			global $wp_admin_bar;
			global $wpdb;
			if ( is_admin() ) {
				return;
			}

			if ( ! burst_user_can_view() ) {
				return;
			}

			global $post;
			if ( $post && is_object( $post ) ) {
				$count = (int) get_post_meta( $post->ID, 'burst_total_pageviews_count', true );
			} else {
				$count = 0;
			}
			$wp_admin_bar->add_menu(
				[
					'id'    => 'burst-front-end',
					'title' => $count . ' ' . __( 'Pageviews', 'burst-statistics' ),
				]
			);
			$wp_admin_bar->add_menu(
				[
					'parent' => 'burst-front-end',
					'id'     => 'burst-statistics-link',
					'title'  => __( 'Go to dashboard', 'burst-statistics' ),
					'href'   => burst_dashboard_url,
				]
			);
		}

		public function activation() {
			if ( ! burst_admin_logged_in() ) {
				return;
			}

			if ( get_option( 'burst_run_activation' ) ) {
                do_action('burst_activation');
                delete_option( 'burst_run_activation' );

            }
		}

		/**
         * Compile js file from settings and javascript so we can prevent inline variables
         *
		 * @return void
		 */
		public function create_js_file() {
			if ( ! burst_user_can_manage() ) {
				return;
			}

			$cookieless      = burst_get_option( 'enable_cookieless_tracking' );
			$cookieless_text = $cookieless == '1' ? '-cookieless' : '';
			$localize_args = apply_filters(
				'burst_tracking_options',
				burst_get_tracking_options()
			);

			$js = '';
			$js .= 'let burst = ' . json_encode( $localize_args ) . ';';
			$js .= file_get_contents( burst_path . "assets/js/build/burst$cookieless_text.min.js" );

			$upload_dir = burst_upload_dir( 'js' );
			$file       = $upload_dir . 'burst.min.js';
			if ( file_exists( $upload_dir ) && is_writable( $upload_dir ) ) {
				$handle = fopen( $file, 'wb' );
				fwrite( $handle, $js );
				fclose( $handle );
			}
		}

		/**
		 * On Multisite site creation, run table init hook as well.
		 *
		 * @return void
		 */
		public function run_table_init_hook() {
			// if already running, exit
			if ( defined( 'BURST_INSTALL_TABLES_RUNNING' ) ) {
				return;
			}

			define( 'BURST_INSTALL_TABLES_RUNNING', true );

			if ( get_transient( 'burst_running_upgrade' ) ) {
				return;
			}

			//don't run on uninstall
            if (defined('BURST_UNINSTALLING')) {
                return;
            }

			set_transient( 'burst_running_upgrade', true, 30 );
			do_action( 'burst_install_tables' );
			// we need to run table creation across subsites as well.
			if ( is_multisite() ) {
				$sites = get_sites();
				if ( count( $sites ) > 0 ) {
					foreach ( $sites as $site ) {
						switch_to_blog( $site->blog_id );
						do_action( 'burst_install_tables' );
						restore_current_blog();
					}
				}
			}
		}

		/**
		 * Add some privacy info
		 */
		public function add_privacy_info() {
			if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
				return;
			}

			$content = sprintf(
				__( 'This website uses Burst Statistics, a Privacy-Friendly Statistics Tool to analyze visitor behavior. For this functionality we (this website) collect anonymized data, stored locally without sharing it with other parties. For more information, please read the %s Privacy Statement %s from Burst.', 'burst-statistics' ),
				'<a href="https://burst-statistics.com/legal/privacy-statement/" target="_blank">',
				'</a>'
			);
			wp_add_privacy_policy_content(
				'Burst Statistics',
				wp_kses_post( wpautop( $content, false ) )
			);
		}

		/**
		 * enqueue some assets
		 *
		 * @param $hook
		 */
		public function enqueue_assets( $hook ) {
			if ( $hook === 'toplevel_page_burst' ) {
				$min  = ! is_rtl() && ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
				$rtl  = is_rtl() ? 'rtl/' : '';
				$url  = trailingslashit( burst_url ) . "assets/css/{$rtl}admin{$min}.css";
				$path = trailingslashit( burst_path ) . "assets/css/{$rtl}admin{$min}.css";
				wp_enqueue_style( 'burst-admin', $url, [ 'wp-components' ], filemtime( $path ) );
			}
		}

		/**
		 * Setup default settings used for tracking
		 *
		 * @return void
		 */
		public function setup_defaults(): void {
			if ( get_option( 'burst_set_defaults' ) ) {
				update_option( 'burst_activation_time', time(), false );
				update_option( 'burst_last_cron_hit', time(), false );
				$this->run_table_init_hook();
				// tables installed, now set defaults
				$exclude_roles = burst_get_option( 'user_role_blocklist' );
				if ( ! $exclude_roles ) {
					$defaults = array( 'administrator' );
					burst_update_option( 'user_role_blocklist', $defaults );
				}

				$mailinglist = burst_get_option( 'email_reports_mailinglist' );
				if ( ! $mailinglist ) {
					$defaults = array( array( 'email' => get_option( 'admin_email' ), 'frequency' => 'monthly' ) );
					burst_update_option( 'email_reports_mailinglist', $defaults );
				}

				if ( get_option( 'burst_goals_db_version' ) === false ) {
					// if there is no goals db version, then we can assume there are no goals database.
					// rerun so this code is not executed
					return;
				}
				// set default goal
				// if there is no default goal, then insert one
				$goals = BURST()->goals->get_goals();
				$count = count( $goals );
				if ( $count === 0 ) {
					require_once burst_path . 'goals/class-goal.php';
					$goal        = new burst_goal();
					$goal->title = __( 'Default goal', 'burst-statistics' );
					$goal->save();
				}
				delete_option( 'burst_set_defaults' );
			}
		}

		/**
		 * Add custom link to plugins overview page
		 *
		 * @hooked plugin_action_links_$plugin
		 *
		 * @param array $links
		 *
		 * @return array $links
		 */
		public function plugin_settings_link( $links ) {
			$settings_link = '<a href="'
			                 . admin_url( 'admin.php?page=burst#settings' )
			                 . '" class="burst-settings-link">'
			                 . __( 'Settings', 'burst-statistics' ) . '</a>';
			array_unshift( $links, $settings_link );

			$support_link = defined( 'burst_free' )
				? 'https://wordpress.org/support/plugin/burst-statistics'
				: burst_get_website_url( 'support', [
					'burst_source'  => 'plugin-overview',
					'burst_content' => 'support-link',
				] );
			$faq_link     = '<a target="_blank" href="' . $support_link . '">'
			                . __( 'Support', 'burst-statistics' ) . '</a>';
			array_unshift( $links, $faq_link );

			if ( ! defined( 'burst_pro' ) ) {
				$upgrade_link
					= '<a style="color:#2e8a37;font-weight:bold" target="_blank" href="' . burst_get_website_url( 'pricing', [ 'burst_source' => 'plugin-overview' ] ) . '">'
					  . __( 'Upgrade to Pro', 'burst-statistics' ) . '</a>';
				array_unshift( $links, $upgrade_link );
			}

			return $links;
		}

		/**
		 * Add counts column
		 *
		 * @param $column_title
		 * @param $post_type
		 * @param $cb
		 *
		 * @return void
		 * @since 1.1
		 */
		public function add_admin_column( $column_name, $column_title, $post_type, $sortable, $cb ) {
			// Add column
			add_filter(
				'manage_' . $post_type . '_posts_columns',
				function( $columns ) use ( $column_name, $column_title ) {
					$columns[ $column_name ] = $column_title;

					return $columns;
				}
			);

			// Add column content
			add_action(
				'manage_' . $post_type . '_posts_custom_column',
				function( $column, $post_id ) use ( $column_name, $column_title, $cb ) {
					if ( $column_name === $column ) {
						$cb( $post_id );
					}
				},
				10,
				2
			);

			// Add sortable column
			if ( $sortable ) {
				add_filter(
					'manage_edit-' . $post_type . '_sortable_columns',
					function( $columns ) use ( $column_name, $column_title ) {
						$columns[ $column_name ] = $column_name;

						return $columns;
					}
				);
			}
		}

		/**
		 * Function to add pageviews column to post table
		 *
		 * @return void
		 * @since 1.1
		 */
		public function add_burst_admin_columns() {
			if ( ! burst_user_can_view() ) {
				return;
			}
			$burst_column_post_types = apply_filters(
				'burst_column_post_types',
				[ 'post', 'page' ]
			);
			foreach ( $burst_column_post_types as $post_type ) {
				$this->add_admin_column(
					'pageviews',
					__( 'Pageviews', 'burst-statistics' ),
					$post_type,
					true,
					function( $post_id ) {
						echo (int) get_post_meta( $post_id, 'burst_total_pageviews_count', true );
					}
				);
			}
		}

		public function posts_orderby_total_pageviews( $query ) {
			if ( ! is_admin() || ! $query->is_main_query() || ! burst_user_can_view() ) {
				return;
			}

			if ( 'pageviews' === $query->get( 'orderby' ) ) {
				$query->set( 'orderby', 'meta_value_num title ' );
				$query->set( 'meta_key', 'burst_total_pageviews_count' );
			}
		}

		/**
		 * Check if the current day falls within the required date range (November 25, 00:00 to December 2, 23:59) based on GMT.
		 *
		 * @return bool
		 */
		public function is_bf() {
            // Get current date and time in GMT as timestamp
			$current_date = strtotime(gmdate('Y-m-d H:i:s'));

			// Define the start and end dates for the range in GMT (including specific times)
			$start_date = strtotime('November 25 2024 00:00:00 GMT');
			$end_date   = strtotime('November 29 2024 23:59:59 GMT');

			// Check if the current date and time falls within the date range
			if ( $current_date >= $start_date && $current_date <= $end_date ) {
				return true;
			}

			return false;
		}


        public function is_cm() {
	        // Get current date and time in GMT as timestamp
	        $current_date = strtotime(gmdate('Y-m-d H:i:s'));

	        // Define the start and end dates for the range in GMT (including specific times)
	        $start_date = strtotime('November 30 00:00:00 GMT');
	        $end_date   = strtotime('December 2 23:59:59 GMT');

	        // Check if the current date and time falls within the date range
	        if ( $current_date >= $start_date && $current_date <= $end_date ) {
		        return true;
	        }

	        return false;
        }


		/**
		 *
		 * Add a button and thickbox to deactivate the plugin
		 *
		 * @since  1.0
		 *
		 * @access public
		 */
		public function deactivate_popup() {
			// only on plugins page
			$screen = get_current_screen();
			if ( ! $screen || ($screen->base !== 'plugins' && $screen->base !== 'plugins-network') ) {
				return;
			}
			$networkwide = $screen->base === 'plugins-network';
			$slug = sanitize_title( burst_plugin_name );

			?>
			<?php add_thickbox(); ?>
            <style>

                #TB_ajaxContent.burst-deactivation-popup {
                    text-align: center !important;
                }

                #TB_window.burst-deactivation-popup {
                    height: min-content !important;
                    margin-top: initial !important;
                    margin-left: initial !important;
                    display: flex;
                    flex-direction: column;
                    top: 50% !important;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    width: 500px !important;
                    border-radius: 12px !important;
                    min-width: min-content;
                }

                .burst-deactivation-popup #TB_title {
                    padding-bottom: 20px;
                    border-radius: 12px;
                    border-bottom: none !important;
                    background: #fff !important;
                }

                .burst-deactivation-popup #TB_ajaxWindowTitle {
                    font-weight: bold;
                    font-size: 20px;
                    padding: 20px;
                    background: #fff !important;
                    border-radius: 12px 12px 0 0;
                    width: calc(100% - 40px);
                }

                .burst-deactivation-popup .tb-close-icon {
                    color: #333;
                    width: 25px;
                    height: 25px;
                    top: 12px;
                    right: 20px;
                }

                .burst-deactivation-popup .tb-close-icon:before {
                    font: normal 25px/25px dashicons;
                }

                .burst-deactivation-popup #TB_closeWindowButton:focus .tb-close-icon {
                    outline: 0;
                    color: #666;
                }

                .burst-deactivation-popup #TB_closeWindowButton .tb-close-icon:hover {
                    color: #666;
                }

                .burst-deactivation-popup #TB_closeWindowButton:focus {
                    outline: 0;
                }

                .burst-deactivation-popup #TB_ajaxContent {
                    width: 90% !important;
                    height: initial !important;
                    padding-left: 20px !important;
                }

                .burst-deactivation-popup .button-burst-tertiary.button {
                    background-color: #D7263D !important;
                    color: white !important;
                    border-color: #D7263D;
                }

                .burst-deactivation-popup .button-burst-tertiary.button:hover {
                    background-color: #f1f1f1 !important;
                    color: #d7263d !important;
                }

                .burst-deactivate-notice-content h3, .burst-deactivate-notice-content ul {
                }

                .burst-deactivate-notice-footer {
                    display: flex;
                    gap: 10px;
                    padding: 15px 10px 0 10px;
                }

                .burst-deactivation-popup ul {
                    list-style: disc;
                    padding-left: 20px;
                }

                .burst-deactivate-notice-footer .button {
                    min-width: fit-content;
                    white-space: nowrap;
                    cursor: pointer;
                    text-decoration: none;
                    text-align: center;
                }
            </style>
            <script>
              jQuery(document).ready(function($) {
                $('#burst_close_tb_window').click(tb_remove);

                $(document).on('click', '#deactivate-<?php echo $slug; ?>', function(e) {
                  e.preventDefault();
                  tb_show('', '#TB_inline?height=420&inlineId=deactivate_and_delete_data', 'null');
                  $('#TB_window').addClass('burst-deactivation-popup');

                });
                if ($('#deactivate-<?php echo $slug; ?>').length) {
                  $('.burst-button-deactivate').attr('href', $('#deactivate-<?php echo $slug; ?>').attr('href'));
                }

              });
            </script>

            <div id="deactivate_and_delete_data" style="display: none;">
                <div class="burst-deactivate-notice-content">
                    <h4 style="margin:0 0 20px 0; text-align: left; font-size: 1.1em;">
						<?php _e( 'To deactivate the plugin correctly, please select if you want to:', 'burst-statistics' ); ?></h4>
                    <ul style="text-align: left;">

                        <li><?php _e( 'Deactivate', 'burst-statistics' ); ?></li>
                        <li>
							<?php _e( 'Deactivate, and remove all statistics, experiments and settings.', 'burst-statistics' ); ?>
							<?php _e( 'The data will be gone forever.', 'burst-statistics' ); ?>
                            <?php if ($networkwide) {
                                _e( 'As you are deactivating networkwide, this will also remove all data from all subsites.', 'burst-statistics' );
                            }?>
                        </li>
                    </ul>
                </div>

				<?php
				$token                              = wp_create_nonce( 'burst_deactivate_plugin' );
				$deactivate_and_remove_all_data_url = add_query_arg(
					array(
						'action' => 'uninstall_delete_all_data',
						'networkwide' => $networkwide ? '1' : '0',
						'token'  => $token,
					),
					admin_url( 'plugins.php' )
				);
				?>
                <div class="burst-deactivate-notice-footer">
                    <a class="button button-default" href="#"
                       id="burst_close_tb_window"><?php _e( 'Cancel', 'burst-statistics' ); ?></a>
                    <a class="button button-primary burst-button-deactivate"
                       href="#"><?php _e( 'Deactivate', 'burst-statistics' ); ?></a>
                    <a class="button button-burst-tertiary"
                       href="<?php echo esc_url( $deactivate_and_remove_all_data_url ); ?>"><?php _e( 'Deactivate and delete all data', 'burst-statistics' ); ?></a>
                </div>
            </div>
			<?php
		}

		/**
		 * Deactivate the plugin, based on made choice regarding data
		 */
		public function listen_for_deactivation(): void {
			// check user role
			if ( ! current_user_can( 'activate_plugins' ) ) {
				return;
			}

			// check nonce
			if ( ! isset( $_GET['token'] ) || ( ! wp_verify_nonce( $_GET['token'], 'burst_deactivate_plugin' ) ) ) {
				return;
			}

			// check for action
			if ( isset( $_GET['action'] ) && $_GET['action'] === 'uninstall_delete_all_data' ) {
				define( 'BURST_NO_UPGRADE', true );
                define( 'BURST_UNINSTALLING', true );
				burst_clear_scheduled_hooks();

				$networkwide = isset( $_GET['networkwide'] ) && $_GET['networkwide'] === '1';
				if ( $networkwide && is_multisite() ) {
					$sites = get_sites();
					if ( count( $sites ) > 0 ) {
						foreach ( $sites as $site ) {
							switch_to_blog( $site->blog_id );
							$this->delete_all_burst_data();
							$this->delete_all_burst_configuration();
							restore_current_blog();
						}
					}
				}
				$this->delete_all_burst_data();
				$this->delete_all_burst_configuration();
				burst_clear_scheduled_hooks();
				deactivate_plugins( burst_plugin, false, $networkwide );
				$redirect_slug = $networkwide ? 'network/plugins.php' : 'plugins.php';

				wp_redirect( admin_url($redirect_slug ) );
				exit;
			}
		}

		/**
		 * Clear all data from the reset button in the settings
		 *
		 * @param array  $output
		 * @param string $action
		 * @param        $data
		 *
		 * @return array
		 */
		public function maybe_delete_all_data( array $output, string $action, $data ) {
			if ( ! burst_user_can_manage() ) {
				return $output;
			}
			if ( $action === 'reset' ) {
				// delete everything
				$this->delete_all_burst_data();

				// reset to defaults
				burst_set_defaults( false );

				// immediately run setup defaults, so db tables get made
				$this->setup_defaults();

                $this->run_table_init_hook();

                $output = [
					'success' => true,
					'message' => __( 'Successfully cleared data.', 'burst-statistics' ),
				];
			}

			return $output;
		}

		/**
		 * Clear plugin data
		 */
		public function delete_all_burst_data() {
			if ( ! current_user_can( 'activate_plugins' ) ) {
				return;
			}

			global $wpdb;

			// post meta to delete
			$post_meta = array(
				'burst_total_pageviews_count',
			);

			if ( ! function_exists( 'delete_post_meta_by_key' ) ) {
				require_once ABSPATH . WPINC . '/post.php';
			}
			foreach ( $post_meta as $post_meta_key ) {
				delete_post_meta_by_key( $post_meta_key );
			}

			// tables to delete
			$table_names = apply_filters(
				'burst_all_tables',
				[
					'burst_statistics',
					'burst_campaigns',
					'burst_sessions',
					'burst_goals',
					'burst_goal_statistics',
					'burst_summary',
					'burst_archived_months',
					'burst_parameters',
					'burst_browsers',
					'burst_browser_versions',
					'burst_platforms',
					'burst_devices',
					'burst_summary',
				],
			);

			// delete tables
			foreach ( $table_names as $table_name ) {
				$sql = "DROP TABLE IF EXISTS $wpdb->prefix$table_name";
				$wpdb->query( $sql );
			}

			// options to delete
			$options = apply_filters(
				'burst_table_db_options',
				[
					'burst_stats_db_version',
					'burst_sessions_db_version',
					'burst_goals_db_version',
					'burst_goal_stats_db_version',
					'burst_archive_db_version',
				],
			);

			// delete options
			foreach ( $options as $option_name ) {
				delete_option( $option_name );
				delete_site_option( $option_name );
			}

		}

		public function delete_all_burst_configuration() {
			if ( ! current_user_can( 'activate_plugins' ) ) {
				return;
			}

			global $wp_roles;
			global $wpdb;

			// capabilities to delete
			$roles        = $wp_roles->roles;
			$capabilities = [
				'manage_burst_statistics',
				'view_burst_statistics',
			];

			// delete user capabilities from all user roles
			foreach ( $roles as $role_name => $role_info ) {
				foreach ( $capabilities as $capability ) {
					$wp_roles->remove_cap( $role_name, $capability );
				}
			}


			// options to delete
			$options = [
				'burst_activation_time',
				'burst_set_defaults',
				'burst_review_notice_shown',
				'burst_run_premium_upgrade',
				'burst_tracking_status',
				'burst_table_size',
				'burst_import_geo_ip_on_activation',
				'burst_geo_ip_import_error',
				'burst_archive_dir',
				'burst_geo_ip_file',
				'burst_last_update_geo_ip',
				'burst_license_attempts',
				'burst_ajax_fallback_active',
				'burst_tour_shown_once',
				'burst_options_settings',
				'burst-current-version',
			];
			// delete options
			foreach ( $options as $option_name ) {
				delete_option( $option_name );
				delete_site_option( $option_name );
			}

			// get all burst transients
			$results = $wpdb->get_results(
				"SELECT `option_name` AS `name`, `option_value` AS `value`
                                FROM  $wpdb->options
                                WHERE `option_name` LIKE '%transient_burst%'
                                ORDER BY `option_name`",
				'ARRAY_A'
			);
			// loop through all burst transients and delete
			foreach ( $results as $key => $value ) {
				$transient_name = substr( $value['name'], 11 );
				delete_transient( $transient_name );
			}

		}

		/**
		 * Drop tables during the site deletion
		 *
		 * @param array $tables  The tables to drop.
		 * @param int   $blog_id The site ID.
		 *
		 * @return array
		 */
		public
		function ms_remove_tables(
			$tables, $blog_id
		) {
			global $wpdb;

			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_sessions';
			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_statistics';
			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_goals';
			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_archived_months';
			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_goal_statistics';
			$tables[] = $wpdb->get_blog_prefix( $blog_id ) . 'burst_summary';

			return $tables;
		}
	}
} //class closure

Youez - 2016 - github.com/yon3zu
LinuXploit