....................................../////.===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.19.154.92  /  Your IP : 216.73.216.47
Web Server : Apache
System : Linux lon12.onrocket.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC 2023 x86_64
User : gd5hzp4 ( 1069)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gd5hzp4/public_html/wp-content/themes/flatsome/inc/functions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gd5hzp4/public_html/wp-content/themes/flatsome/inc/functions/function-update.php
<?php

/**
 * Normalizes the theme directory name.
 *
 * @return string
 */
function flatsome_theme_key( $slug = null ) {
  if ( empty( $slug ) ) {
    $slug = basename( get_template_directory() );
  }

  $slug = trim( $slug );
  $slug = preg_replace( '/[,.\s]+/', '-', $slug );
  $slug = strtolower( $slug );

  return $slug;
}

/* Check if support is expired */
function flatsome_is_support_expired() {
  $slug = flatsome_theme_key();
  $date = date('m/d/Y h:i:s a', time());

  $purchase_code   = sanitize_text_field( get_option( $slug . '_wup_purchase_code', '' ) );
  $supported_until = get_option( $slug . '_wup_supported_until', '' );

  if ( ! empty( $purchase_code ) && strtotime( $date ) > strtotime( $supported_until ) ) {
    return true;
  }
}

/**
 * Check if support time is invalid.
 *
 * @param string $support_ends Support end timestamp.
 *
 * @return bool True if invalid false otherwise.
 */
function flatsome_is_invalid_support_time( $support_ends ) {
	$array = array_map( 'trim', explode( ',', $support_ends ) );

	return isset( $array[1] ) && $array[1] == 1970 ? true : false;
}

/* Check if theme is enabled */
function flatsome_is_theme_enabled(){
  if ( flatsome_envato()->is_registered() ) {
    return true;
  }
  $slug = flatsome_theme_key();
  $purchase_code = sanitize_text_field( get_option( $slug . '_wup_purchase_code', '' ) );
  if($purchase_code){
    return true;
  }
  return false;
}

/* Automagical updates */
function wupdates_check_JQ9eJ( $transient ) {
  // Nothing to do here if the checked transient entry is empty
  if ( empty( $transient->checked ) ) {
    return $transient;
  }

  // Let's start gathering data about the theme
  // First get the theme directory name (the theme slug - unique)
  $slug = basename( get_template_directory() );
  // Then WordPress version
  include( ABSPATH . WPINC . '/version.php' );
  $http_args = array (
    'body' => array(
      'slug' => $slug,
      'url' => home_url(), //the site's home URL
      'version' => 0,
      'locale' => get_locale(),
      'phpv' => phpversion(),
      'child_theme' => is_child_theme(),
      'data' => null, //no optional data is sent by default
    ),
    'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url()
  );

  // If the theme has been checked for updates before, get the checked version
  if ( isset( $transient->checked[ $slug ] ) && $transient->checked[ $slug ] ) {
    $http_args['body']['version'] = $transient->checked[ $slug ];
  }

  // Use this filter to add optional data to send
  // Make sure you return an associative array - do not encode it in any way
  $theme_key     = flatsome_theme_key();
  $optional_data = apply_filters( 'wupdates_call_data_request', $http_args['body']['data'], $theme_key, $http_args['body']['version'] );

  // Encrypting optional data with private key, just to keep your data a little safer
  // You should not edit the code bellow
  $optional_data = json_encode( $optional_data );
  $w=array();$re="";$s=array();$sa=md5('9bbe8289465e1493f734035eb68388eff8573724');
  $l=strlen($sa);$d=$optional_data;$ii=-1;
  while(++$ii<256){$w[$ii]=ord(substr($sa,(($ii%$l)+1),1));$s[$ii]=$ii;} $ii=-1;$j=0;
  while(++$ii<256){$j=($j+$w[$ii]+$s[$ii])%255;$t=$s[$j];$s[$ii]=$s[$j];$s[$j]=$t;}
  $l=strlen($d);$ii=-1;$j=0;$k=0;
  while(++$ii<$l){$j=($j+1)%256;$k=($k+$s[$j])%255;$t=$w[$j];$s[$j]=$s[$k];$s[$k]=$t;
  $x=$s[(($s[$j]+$s[$k])%255)];$re.=chr(ord($d[$ii])^$x);}
  $optional_data=bin2hex($re);

  // Save the encrypted optional data so it can be sent to the updates server
  $http_args['body']['data'] = $optional_data;

  // Check for an available update
  $url = $http_url = set_url_scheme( 'https://wupdates.com/wp-json/wup/v1/themes/check_version/JQ9eJ', 'http' );
  if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
    $url = set_url_scheme( $url, 'https' );
  }

  $raw_response = wp_remote_post( $url, $http_args );
  if ( $ssl && is_wp_error( $raw_response ) ) {
    $raw_response = wp_remote_post( $http_url, $http_args );
  }
  // We stop in case we haven't received a proper response
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
    return $transient;
  }

  $response = (array) json_decode($raw_response['body']);
  if ( ! empty( $response ) ) {
    // You can use this action to show notifications or take other action
    do_action( 'wupdates_before_response', $response, $transient );
    if ( isset( $response['allow_update'] ) && $response['allow_update'] && isset( $response['transient'] ) ) {
      $transient->response[ $slug ] = (array) $response['transient'];
    }
    do_action( 'wupdates_after_response', $response, $transient );
  }

  return $transient;
}
add_filter( 'pre_set_site_transient_update_themes', 'wupdates_check_JQ9eJ' );

/* Only allow theme updates with a valid Envato purchase code */
function wupdates_add_purchase_code_field_JQ9eJ( $themes ) {
  $output = '';
  // First get the theme directory name (the theme slug - unique)
  $template = get_template();
  $slug     = flatsome_theme_key();

  if ( ! isset( $themes[ $template ]['tags'] ) ) {
    $themes[ $template ]['tags'] = '';
  }

  if ( ! is_multisite() && isset( $themes[ $template ] ) ) {
    $output .= "<br/><br/>"; //put a little space above


    //get errors so we can show them
    $errors = get_option( $slug . '_wup_errors', array() );
    delete_option( $slug . '_wup_errors' ); //delete existing errors as we will handle them next

    //check if we have a purchase code saved already
    $purchase_code = sanitize_text_field( get_option( $slug . '_wup_purchase_code', '' ) );

    if ( ! empty( $purchase_code ) ) {
      $output .= flatsome_envato()->admin()->render_message_form();
    } else {
      $output .= flatsome_envato()->admin()->render_registration_form();
      $themes[ $template ]['tags'] .= $output;
      return $themes;
    }

    //in case there is an update available, tell the user that it needs a valid purchase code
    if ( empty( $purchase_code ) && ! empty( $themes[ $template ]['hasUpdate'] ) ) {
      $output .= '<div class="notice notice-error notice-alt notice-large">' . __( 'A <strong>valid purchase code</strong> is required for automatic updates.', 'wupdates' ) . '</div>';
    }
    //output errors and notifications
    if ( ! empty( $errors ) ) {
      foreach ( $errors as $key => $error ) {
        $output .= '<div class="error"><p>' . wp_kses_post( $error ) . '</p></div>';
      }
    }
    if ( ! empty( $purchase_code ) ) {
      if ( ! empty( $errors ) ) {
        //since there is already a purchase code present - notify the user
        $output .= '<div class="notice notice-warning notice-alt"><p>' . esc_html__( 'Purchase code not updated. We will keep the existing one.', 'wupdates' ) . '</p></div>';
      } else {
        //this means a valid purchase code is present and no errors were found
        $output .= '<div class="notice notice-success notice-alt notice-large">' . __( 'Your <strong>purchase code is valid</strong>. Thank you! Enjoy one-click automatic updates.', 'wupdates' ) . '</div>';
      }
    }
    $purchase_code_key = esc_attr( strtolower( str_replace( array(' ', '.'), '_', $slug ) ) ) . '_wup_purchase_code';
    $output .= '<form class="wupdates_purchase_code" action="" method="post">' .
      '<input type="hidden" name="wupdates_pc_theme" value="' . esc_attr( $slug ) . '" />' .
      '<input type="text" id="' . $purchase_code_key . '" name="' . $purchase_code_key . '"
              value="' . esc_attr( $purchase_code ) . '" placeholder="' . esc_html__( 'Purchase code ( e.g. 9g2b13fa-10aa-2267-883a-9201a94cf9b5 )', 'wupdates' ) . '" style="width:100%"/>' .
      '<p>' . __( 'Enter your purchase code.', 'wupdates' ) . '</p>' .
      '<p class="theme-description">' .
        __( 'Find out how to <a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-" target="_blank">get your purchase code</a>.', 'wupdates' ) .
        '</p>
      </form>';
  }

  $themes[ $template ]['tags'] .= $output;

  return $themes;
}
add_filter( 'wp_prepare_themes_for_js' ,'wupdates_add_purchase_code_field_JQ9eJ' );

/* Handle the purchase code input for multisite installations */
function wupdates_ms_theme_list_purchase_code_field_JQ9eJ( $theme, $r ) {
  $output = '<br/>';
  $slug = flatsome_theme_key( $theme->get_template() );
  //get errors so we can show them
  $errors = get_option( $slug . '_wup_errors', array() );
  delete_option( $slug . '_wup_errors' ); //delete existing errors as we will handle them next

  //check if we have a purchase code saved already
  $purchase_code = sanitize_text_field( get_option( $slug . '_wup_purchase_code', '' ) );
  //in case there is an update available, tell the user that it needs a valid purchase code
  if ( empty( $purchase_code ) ) {
    $output .=  '<p>' . __( 'A <strong>valid purchase code</strong> is required for automatic updates.', 'wupdates' ) . '</p>';
  }
  //output errors and notifications
  if ( ! empty( $errors ) ) {
    foreach ( $errors as $key => $error ) {
      $output .= '<div class="error"><p>' . wp_kses_post( $error ) . '</p></div>';
    }
  }
  if ( ! empty( $purchase_code ) ) {
    if ( ! empty( $errors ) ) {
      //since there is already a purchase code present - notify the user
      $output .= '<p>' . esc_html__( 'Purchase code not updated. We will keep the existing one.', 'wupdates' ) . '</p>';
    } else {
      //this means a valid purchase code is present and no errors were found
      $output .= '<p><span class="notice notice-success notice-alt">' . __( 'Your <strong>purchase code is valid</strong>. Thank you! Enjoy one-click automatic updates.', 'wupdates' ) . '</span></p>';
    }
  }
  $purchase_code_key = esc_attr( strtolower( str_replace( array(' ', '.'), '_', $slug ) ) ) . '_wup_purchase_code';
  $output .= '<form class="wupdates_purchase_code" action="" method="post">' .
    '<input type="hidden" name="wupdates_pc_theme" value="' . esc_attr( $slug ) . '" />' .
    '<input type="text" id="' . $purchase_code_key . '" name="' . $purchase_code_key . '"
            value="' . esc_attr( $purchase_code ) . '" placeholder="' . esc_html__( 'Purchase code ( e.g. 9g2b13fa-10aa-2267-883a-9201a94cf9b5 )', 'wupdates' ) . '"/>' . ' ' .
    __( 'Enter your purchase code.', 'wupdates' ) . ' ' .
    __( 'Find out how to <a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-" target="_blank">get your purchase code</a>.', 'wupdates' ) .
    '</form>';

  echo $output;
}
add_action( 'in_theme_update_message-' . basename( get_template_directory() ), 'wupdates_ms_theme_list_purchase_code_field_JQ9eJ', 10, 2 );

function wupdates_purchase_code_needed_notice_JQ9eJ() {
  global $current_screen;

  $output = '';

  //if the purchase code doesn't pass the prevalidation, show notice
  if ( in_array( $current_screen->id, array( 'update-core', 'update-core-network') ) && ! flatsome_envato()->is_registered() ) {
    $output .= '<div class="updated"><p>' . sprintf( __( '<a href="%s">Please enter your Envato token</a> to activate Flatsome and get one-click updates.', 'flatsome' ), network_admin_url( 'admin.php?page=flatsome-panel' ) ) . '</p></div>';
  }

  echo $output;
}
add_action( 'admin_notices', 'wupdates_purchase_code_needed_notice_JQ9eJ' );
add_action( 'network_admin_notices', 'wupdates_purchase_code_needed_notice_JQ9eJ' );

function wupdates_process_purchase_code_JQ9eJ() {
  $slug = isset( $_POST['wupdates_pc_theme'] )
    ? sanitize_text_field( $_POST['wupdates_pc_theme'] )
    : '';

  if ( ! empty( $_POST['flatsome_wizard_envato_token'] ) ) {

    $token     = wp_unslash( $_POST['flatsome_wizard_envato_token'] );
    $confirmed = (bool) wp_unslash( $_POST['flatsome_wizard_envato_terms'] );
    flatsome_envato()->admin()->update_token( $token, $confirmed );
    delete_option( strtolower( $slug ) . '_wup_errors' );

    // Redirect back to the themes page and open popup.
    wp_redirect( esc_url_raw( add_query_arg( 'theme', $slug ) ) );
    exit;

  } else if ( ! empty( $_POST['wupdates_pc_theme'] ) ) {

    $errors = array();
    $slug = sanitize_text_field( $_POST['wupdates_pc_theme'] ); // get the theme's slug
    //PHP doesn't allow dots or spaces in $_POST keys - it converts them into underscore; so we do also
    $purchase_code_key = esc_attr( strtolower( str_replace( array(' ', '.'), '_', $slug ) ) ) . '_wup_purchase_code';
    $purchase_code = false;
    if ( ! empty( $_POST[ $purchase_code_key ] ) ) {
      //get the submitted purchase code and sanitize it
      $purchase_code = sanitize_text_field( $_POST[ $purchase_code_key ] );
      //do a prevalidation; no need to make the API call if the format is not right
      if ( true !== wupdates_prevalidate_purchase_code_JQ9eJ( $purchase_code ) ) {
        $purchase_code = false;
      }
    }
    if ( ! empty( $purchase_code ) ) {
      //check if this purchase code represents a sale of the theme
      $http_args = array (
        'body' => array(
          'slug' => $slug, //the theme's slug
          'url' => home_url(), //the site's home URL
          'purchase_code' => $purchase_code,
        )
      );

      //make sure that we use a protocol that this hosting is capable of
      $url = $http_url = set_url_scheme( 'https://wupdates.com/wp-json/wup/v1/front/check_envato_purchase_code/JQ9eJ', 'http' );
      if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
        $url = set_url_scheme( $url, 'https' );
      }
      //make the call to the purchase code check API
      $raw_response = wp_remote_post( $url, $http_args );
      if ( $ssl && is_wp_error( $raw_response ) ) {
        $raw_response = wp_remote_post( $http_url, $http_args );
      }
      // In case the server hasn't responded properly, show error
      if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
        $errors[] = __( 'We are sorry but we couldn\'t connect to the verification server. Please try again later.', 'wupdates' ) . '<span class="hidden">' . print_r( $raw_response, true ) . '</span>';
      } else {
        $response = json_decode( $raw_response['body'], true );
        if ( ! empty( $response ) ) {
          //we will only update the purchase code if it's valid
          //this way we keep existing valid purchase codes
          if ( isset( $response['purchase_code'] ) && 'valid' == $response['purchase_code'] ) {


            //all is good, update the purchase code option
            update_option( strtolower( $slug ) . '_wup_purchase_code', $purchase_code );

            // Sold at
            update_option( strtolower( $slug ) . '_wup_sold_at', $response['raw_response']['sold_at'] );

            // Supported until
	        if ( ! isset( $response['raw_response']['supported_until'] ) ) {
		        $dateTime = new DateTime( $response['raw_response']['sold_at'] );
		        $dateTime->modify( '+6 months' );
		        $response['raw_response']['supported_until'] = $dateTime->format( 'Y-m-d\TH:i:sP' );
	        }
            update_option( strtolower( $slug ) . '_wup_supported_until', $response['raw_response']['supported_until'] );

            // Buyer
            update_option( strtolower( $slug ) . '_wup_buyer', $response['raw_response']['buyer'] );

            //delete the update_themes transient so we force a recheck
            set_site_transient('update_themes', null);
          } else {
            if ( isset( $response['reason'] ) && ! empty( $response['reason'] ) && 'out_of_support' == $response['reason'] ) {
              $errors[] = esc_html__( 'Your purchase\'s support period has ended. Please extend it to receive automatic updates.', 'wupdates' );
            } else {
              $errors[] = esc_html__( 'Could not find a sale with this purchase code. Please double check.', 'wupdates' );
            }
          }
        }
      }
    } else {
      //in case the user hasn't entered a valid purchase code
      $errors[] = esc_html__( 'Please enter a valid purchase code. Make sure to get all the characters.', 'wupdates' );
    }

    if ( count( $errors ) > 0 ) {
      //if we do have errors, save them in the database so we can display them to the user
      update_option( strtolower( $slug ) . '_wup_errors', $errors );
    } else {
      //since there are no errors, delete the option
      delete_option( strtolower( $slug ) . '_wup_errors' );
    }

    //redirect back to the themes page and open popup
    wp_redirect( esc_url_raw( add_query_arg( 'theme', $slug ) ) );
    exit;
  }
}
add_action( 'admin_init', 'wupdates_process_purchase_code_JQ9eJ' );

function wupdates_send_purchase_code_JQ9eJ( $optional_data, $slug ) {
  //get the saved purchase code
  $purchase_code = sanitize_text_field( get_option( strtolower( $slug ) . '_wup_purchase_code', '' ) );

  if ( null === $optional_data ) { //if there is no optional data, initialize it
    $optional_data = array();
  }
  //add the purchase code to the optional_data so we can check it upon update check
  //if a theme has an Envato item selected, this is mandatory
  $optional_data['envato_purchase_code'] = $purchase_code;

  return $optional_data;
}
add_filter( 'wupdates_call_data_request', 'wupdates_send_purchase_code_JQ9eJ', 10, 2 );

function wupdates_prevalidate_purchase_code_JQ9eJ( $purchase_code ) {
  $purchase_code = preg_replace( '#([a-z0-9]{8})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{4})-?([a-z0-9]{12})#', '$1-$2-$3-$4-$5', strtolower( $purchase_code ) );
  if ( 36 == strlen( $purchase_code ) ) {
    return true;
  }
  return false;
}

/* End of Envato checkup code */

Youez - 2016 - github.com/yon3zu
LinuXploit