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/sodaltech/wp-content/plugins/elementor-pro/core/upgrade/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/web/dev.agtindia.co.in/sodaltech/wp-content/plugins/elementor-pro/core/upgrade/upgrades.php
<?php
namespace ElementorPro\Core\Upgrade;

use Elementor\Core\Base\Document;
use Elementor\Core\Upgrade\Updater;
use Elementor\Icons_Manager;
use Elementor\Core\Upgrade\Upgrades as Core_Upgrades;
use ElementorPro\License\API;
use ElementorPro\Plugin;
use Elementor\Modules\History\Revisions_Manager;

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

class Upgrades {

	public static $typography_control_names = [
		'typography', // The popover toggle ('starter_name').
		'font_family',
		'font_size',
		'font_weight',
		'text_transform',
		'font_style',
		'text_decoration',
		'line_height',
		'letter_spacing',
	];

	public static function _on_each_version( $updater ) {
		self::_remove_remote_info_api_data();
	}

	public static function _v_1_3_0() {
		global $wpdb;

		// Fix Button widget to new sizes options
		$post_ids = $wpdb->get_col(
			'SELECT `post_id` FROM `' . $wpdb->postmeta . '` WHERE `meta_key` = "_elementor_data" AND `meta_value` LIKE \'%"widgetType":"form"%\';'
		);

		if ( empty( $post_ids ) ) {
			return;
		}

		foreach ( $post_ids as $post_id ) {
			$document = Plugin::elementor()->documents->get( $post_id );

			if ( $document ) {
				$data = $document->get_elements_data();
			}

			if ( empty( $data ) ) {
				continue;
			}

			$data = Plugin::elementor()->db->iterate_data( $data, function( $element ) {
				if ( empty( $element['widgetType'] ) || 'form' !== $element['widgetType'] ) {
					return $element;
				}

				if ( ! isset( $element['settings']['submit_actions'] ) ) {
					$element['settings']['submit_actions'] = [ 'email' ];
				}

				if ( ! empty( $element['settings']['redirect_to'] ) ) {
					if ( ! in_array( 'redirect', $element['settings']['submit_actions'] ) ) {
						$element['settings']['submit_actions'][] = 'redirect';
					}
				}

				if ( ! empty( $element['settings']['webhooks'] ) ) {
					if ( ! in_array( 'webhook', $element['settings']['submit_actions'] ) ) {
						$element['settings']['submit_actions'][] = 'webhook';
					}
				}

				return $element;
			} );

			self::save_editor( $post_id, $data );
		}
	}

	public static function _v_1_4_0() {
		global $wpdb;

		// Move all posts columns to classic skin (Just add prefix)
		$post_ids = $wpdb->get_col(
			'SELECT `post_id` FROM `' . $wpdb->postmeta . '` WHERE `meta_key` = "_elementor_data" AND `meta_value` LIKE \'%"widgetType":"posts"%\';'
		);

		if ( empty( $post_ids ) ) {
			return;
		}

		foreach ( $post_ids as $post_id ) {
			$document = Plugin::elementor()->documents->get( $post_id );

			if ( $document ) {
				$data = $document->get_elements_data();
			}

			if ( empty( $data ) ) {
				continue;
			}

			$data = Plugin::elementor()->db->iterate_data( $data, function( $element ) {
				if ( empty( $element['widgetType'] ) || 'posts' !== $element['widgetType'] ) {
					return $element;
				}

				$fields_to_change = [
					'columns',
					'columns_mobile',
					'columns_tablet',
				];

				foreach ( $fields_to_change as $field ) {
					// TODO: Remove old value later
					$new_field_key = 'classic_' . $field;
					if ( isset( $element['settings'][ $field ] ) && ! isset( $element['settings'][ $new_field_key ] ) ) {
						$element['settings'][ $new_field_key ] = $element['settings'][ $field ];
					}
				}

				return $element;
			} );

			$document = Plugin::elementor()->documents->get( $post_id );

			$document->save( [
				'elements' => $data,
			] );
		}
	}

	public static function _v_1_12_0() {
		global $wpdb;

		// Set `mailchimp_api_key_source` to `custom`.
		$post_ids = $wpdb->get_col(
			'SELECT `post_id` FROM `' . $wpdb->postmeta . '` WHERE `meta_key` = "_elementor_data" AND `meta_value` LIKE \'%"widgetType":"form"%\';'
		);

		if ( empty( $post_ids ) ) {
			return;
		}

		foreach ( $post_ids as $post_id ) {
			$do_update = false;
			$document = Plugin::elementor()->documents->get( $post_id );

			if ( $document ) {
				$data = $document->get_elements_data();
			}

			if ( empty( $data ) ) {
				continue;
			}

			$data = Plugin::elementor()->db->iterate_data( $data, function( $element ) use ( &$do_update ) {
				if ( empty( $element['widgetType'] ) || 'form' !== $element['widgetType'] ) {
					return $element;
				}

				if ( ! empty( $element['settings']['mailchimp_api_key'] ) && ! isset( $element['settings']['mailchimp_api_key_source'] ) ) {
					$element['settings']['mailchimp_api_key_source'] = 'custom';
					$do_update = true;
				}

				return $element;
			} );

			// Only update if form has mailchimp
			if ( ! $do_update ) {
				continue;
			}
			// We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta`
			$json_value = wp_slash( wp_json_encode( $data ) );

			update_metadata( 'post', $post_id, '_elementor_data', $json_value );
		}
	}

	/**
	 * Replace 'sticky' => 'yes' with 'sticky' => 'top' in sections.
	 */
	public static function _v_2_0_3() {
		global $wpdb;

		$post_ids = $wpdb->get_col(
			'SELECT `post_id` FROM `' . $wpdb->postmeta . '` WHERE `meta_key` = "_elementor_data" AND `meta_value` LIKE \'%"sticky":"yes"%\';'
		);

		if ( empty( $post_ids ) ) {
			return;
		}

		foreach ( $post_ids as $post_id ) {
			$do_update = false;

			$document = Plugin::elementor()->documents->get( $post_id );

			if ( ! $document ) {
				continue;
			}

			$data = $document->get_elements_data();

			if ( empty( $data ) ) {
				continue;
			}

			$data = Plugin::elementor()->db->iterate_data( $data, function( $element ) use ( &$do_update ) {
				if ( empty( $element['elType'] ) || 'section' !== $element['elType'] ) {
					return $element;
				}

				if ( ! empty( $element['settings']['sticky'] ) && 'yes' === $element['settings']['sticky'] ) {
					$element['settings']['sticky'] = 'top';
					$do_update = true;
				}

				return $element;
			} );

			if ( ! $do_update ) {
				continue;
			}
			// We need the `wp_slash` in order to avoid the unslashing during the `update_metadata`
			$json_value = wp_slash( wp_json_encode( $data ) );

			update_metadata( 'post', $post_id, '_elementor_data', $json_value );
		} // End foreach().
	}

	private static function save_editor( $post_id, $posted ) {
		// Change the global post to current library post, so widgets can use `get_the_ID` and other post data
		if ( isset( $GLOBALS['post'] ) ) {
			$global_post = $GLOBALS['post'];
		}
		$GLOBALS['post'] = get_post( $post_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

		$editor_data = self::get_editor_data( $posted );

		// We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta`
		$json_value = wp_slash( wp_json_encode( $editor_data ) );

		$is_meta_updated = update_metadata( 'post', $post_id, '_elementor_data', $json_value );

		if ( $is_meta_updated ) {
			Revisions_Manager::handle_revision();
		}

		// Restore global post
		if ( isset( $global_post ) ) {
			$GLOBALS['post'] = $global_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
		} else {
			unset( $GLOBALS['post'] );
		}

		/**
		 * After editor saves data.
		 *
		 * Fires after Elementor editor data was saved.
		 *
		 * @since 1.0.0
		 *
		 * @param int   $post_id     The ID of the post.
		 * @param array $editor_data The editor data.
		 */
		do_action( 'elementor/editor/after_save', $post_id, $editor_data );
	}

	private static function get_editor_data( $data, $with_html_content = false ) {
		$editor_data = [];

		foreach ( $data as $element_data ) {
			$element = Plugin::elementor()->elements_manager->create_element_instance( $element_data );

			if ( ! $element ) {
				continue;
			}

			$editor_data[] = $element->get_raw_data( $with_html_content );
		} // End Section

		return $editor_data;
	}

	public static function _v_2_5_0_form( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_repeater_settings' ],
				'control_ids' => [
					'form_fields' => [
						'_id' => 'custom_id',
					],
				],
			],
		];

		return self::_update_widget_settings( 'form', $updater, $changes );
	}

	public static function _v_2_5_0_woocommerce_menu_cart( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings' ],
				'control_ids' => [
					'checkout_button_border_color' => 'checkout_border_color',
					'view_cart_button_border_color' => 'view_cart_border_color',
				],
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_slider_to_border_settings' ],
				'control_ids' => [
					'checkout_button_border_width' => [
						'new' => 'checkout_border_width',
						'add' => 'checkout_border_border',
					],
					'view_cart_button_border_width' => [
						'new' => 'view_cart_border_width',
						'add' => 'view_cart_border_border',
					],
				],
			],
		];

		return self::_update_widget_settings( 'woocommerce-menu-cart', $updater, $changes );
	}

	public static function _v_3_7_2_woocommerce_rename_related_to_related_products( $updater ) {
		$changes = self::get_woocommerce_rename_related_to_related_products_changes();

		return self::_update_widget_settings( 'woocommerce-products', $updater, $changes );
	}

	public static function _slider_to_border_settings( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		foreach ( $changes as $old => $new ) {
			if ( ! empty( $element['settings'][ $old ] ) && ! isset( $element['settings'][ $new['new'] ] ) ) {
				$new_border_width = [
					'unit' => $element['settings'][ $old ]['unit'],
					'top' => $element['settings'][ $old ]['size'],
					'bottom' => $element['settings'][ $old ]['size'],
					'left' => $element['settings'][ $old ]['size'],
					'right' => $element['settings'][ $old ]['size'],
					'isLinked' => true,
				];
				$element['settings'][ $new ['new'] ] = $new_border_width;
				$element['settings'][ $new ['add'] ] = 'solid';
				$args['do_update'] = true;
			}
		}
		return $element;
	}

	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _rename_repeater_settings( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		foreach ( $changes as $change_key => $change ) {
			foreach ( $change as $old => $new ) {
				foreach ( $element['settings'][ $change_key ] as &$repeater ) {
					if ( ! empty( $repeater[ $old ] ) && ! isset( $repeater[ $new ] ) ) {
						$repeater[ $new ] = $repeater[ $old ];
						$args['do_update'] = true;
					}
				}
			}
		}

		return $element;
	}

	private static function taxonomies_mapping( $prefix, $map_to ) {
		$taxonomy_filter_args = [
			'show_in_nav_menus' => true,
		];

		$taxonomies = get_taxonomies( $taxonomy_filter_args );

		$mapping = [];

		foreach ( $taxonomies as $taxonomy ) {
			$mapping[ $prefix . $taxonomy . '_ids' ] = $map_to;
		}

		return $mapping;
	}

	public static function _v_2_5_0_posts( $updater ) {
		$add_taxonomies = self::taxonomies_mapping( 'posts_', [ 'posts_include' => 'terms' ] );
		$merge_taxonomies = self::taxonomies_mapping( 'posts_', 'posts_include_term_ids' );

		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings' ],
				'control_ids' => [
					'orderby' => 'posts_orderby',
					'order' => 'posts_order',
					'offset' => 'posts_offset',
					'exclude' => 'posts_exclude',
					'exclude_ids' => 'posts_exclude_ids',
					'posts_query_id' => 'posts_posts_query_id',
					'avoid_duplicates' => 'posts_avoid_duplicates',
					'posts_authors' => 'posts_include_authors',
				],
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_add_widget_settings_to_array' ],
				'control_ids' => array_merge( $add_taxonomies, [
					'posts_authors' => [ 'posts_include' => 'authors' ],
				] ),
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_merge_widget_settings' ],
				'control_ids' => $merge_taxonomies,
			],
		];

		return self::_update_widget_settings( 'posts', $updater, $changes );
	}

	public static function _v_2_5_0_portfolio( $updater ) {
		$add_taxonomies = self::taxonomies_mapping( 'posts_', [ 'posts_include' => 'terms' ] );
		$merge_taxonomies = self::taxonomies_mapping( 'posts_', 'posts_include_term_ids' );

		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings' ],
				'control_ids' => [
					'orderby' => 'posts_orderby',
					'order' => 'posts_order',
					'offset' => 'posts_offset',
					'exclude' => 'posts_exclude',
					'exclude_ids' => 'posts_exclude_ids',
					'posts_query_id' => 'posts_posts_query_id',
					'avoid_duplicates' => 'posts_avoid_duplicates',
					'posts_authors' => 'posts_include_authors',
				],
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_add_widget_settings_to_array' ],
				'control_ids' => array_merge( $add_taxonomies, [
					'posts_authors' => [ 'posts_include' => 'authors' ],
				] ),
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_merge_widget_settings' ],
				'control_ids' => $merge_taxonomies,
			],
		];

		return self::_update_widget_settings( 'portfolio', $updater, $changes );
	}

	public static function _v_2_5_0_products( $updater ) {
		$add_taxonomies = self::taxonomies_mapping( 'query_', [ 'query_include' => 'terms' ] );
		$merge_taxonomies = self::taxonomies_mapping( 'query_', 'query_include_term_ids' );
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings' ],
				'control_ids' => [
					'orderby' => 'query_orderby',
					'order' => 'query_order',
					'exclude' => 'query_exclude',
					'exclude_ids' => 'query_exclude_ids',
					'query_authors' => 'query_include_authors',
					'query_product_tag_ids' => 'query_include_term_ids',
					'query_product_cat_ids' => 'query_include_term_ids',
				],
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_add_widget_settings_to_array' ],
				'control_ids' => array_merge( $add_taxonomies, [
					'query_authors' => [ 'query_include' => 'authors' ],
				] ),
			],
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_merge_widget_settings' ],
				'control_ids' => $merge_taxonomies,
			],
		];

		return self::_update_widget_settings( 'woocommerce-products', $updater, $changes );
	}

	/**
	 * @param $updater
	 *
	 * @return bool Should run again.
	 */
	public static function _v_2_5_0_sitemap( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings' ],
				'control_ids' => [
					'exclude' => 'sitemap_exclude',
					'exclude_ids' => 'sitemap_exclude_ids',
				],
			],
		];

		return self::_update_widget_settings( 'sitemap', $updater, $changes );
	}

	/**
	 * @param Updater $updater
	 *
	 * @return bool
	 */
	public static function _v_2_5_0_popup_border_radius( $updater ) {
		global $wpdb;

		$post_ids = $updater->query_col(
			"SELECT pm1.post_id
					FROM {$wpdb->postmeta} AS pm1
					LEFT JOIN {$wpdb->postmeta} AS pm2 ON (pm1.post_id = pm2.post_id)
					WHERE pm1.meta_key = '_elementor_template_type'
					AND pm1.meta_value = 'popup'
					AND pm2.`meta_key` = '" . Document::PAGE_META_KEY . "'
					AND pm2.`meta_value` LIKE '%border_radius%';"
		);

		if ( empty( $post_ids ) ) {
			return false;
		}

		foreach ( $post_ids as $post_id ) {
			// Clear WP cache for next step.
			$document = Plugin::elementor()->documents->get( $post_id );

			if ( ! $document ) {
				continue;
			}

			$page_settings = $document->get_settings();

			// Check if there isn't 'border_radius' setting or if it has already been upgraded
			if ( empty( $page_settings['border_radius']['size'] ) ) {
				continue;
			}

			$border_radius = $page_settings['border_radius'];

			$new_border_radius = [
				'unit' => $border_radius['unit'],
				'top' => $border_radius['size'],
				'bottom' => $border_radius['size'],
				'left' => $border_radius['size'],
				'right' => $border_radius['size'],
				'isLinked' => true,
			];

			$page_settings['border_radius'] = $new_border_radius;

			// TODO: `$document->update_settings`.
			$document->update_meta( Document::PAGE_META_KEY, $page_settings );

			wp_cache_flush();
		} // End foreach().

		return $updater->should_run_again( $post_ids );
	}

	public static function _v_2_5_4_posts( $updater ) {
		$merge_taxonomies = self::taxonomies_mapping( 'posts_', 'posts_include_term_ids' );

		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_term_id_to_term_taxonomy_id' ],
				'control_ids' => $merge_taxonomies,
				'prefix' => 'posts_',
				'new_id' => 'include_term_ids',
			],
		];

		return self::_update_widget_settings( 'posts', $updater, $changes );
	}

	public static function _v_2_5_4_portfolio( $updater ) {
		$merge_taxonomies = self::taxonomies_mapping( 'posts_', 'posts_include_term_ids' );

		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_term_id_to_term_taxonomy_id' ],
				'control_ids' => $merge_taxonomies,
				'prefix' => 'posts_',
				'new_id' => 'include_term_ids',
			],
		];

		return self::_update_widget_settings( 'portfolio', $updater, $changes );
	}

	public static function _v_2_5_4_products( $updater ) {
		$merge_taxonomies = self::taxonomies_mapping( 'query_', 'query_include_term_ids' );
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_term_id_to_term_taxonomy_id' ],
				'control_ids' => $merge_taxonomies,
				'prefix' => 'query_',
				'new_id' => 'include_term_ids',
			],
		];

		return self::_update_widget_settings( 'woocommerce-products', $updater, $changes );
	}

	public static function _v_2_5_4_form( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_missing_form_custom_id_settings' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'form', $updater, $changes );
	}

	public static function _v_3_1_0_media_carousel( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_progress_to_progressbar' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'media-carousel', $updater, $changes );
	}

	public static function _v_3_1_0_reviews( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_progress_to_progressbar' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'reviews', $updater, $changes );
	}

	public static function _v_3_1_0_testimonial_carousel( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_convert_progress_to_progressbar' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'testimonial-carousel', $updater, $changes );
	}

	public static function _v_3_1_0_slides( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_migrate_slides_button_color_settings' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'slides', $updater, $changes );
	}

	public static function _v_3_3_0_nav_menu_icon( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_migrate_indicator_control_to_submenu_icon' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'nav-menu', $updater, $changes );
	}

	public static function _v_3_3_0_recalc_usage_data( $updater ) {
		return Core_Upgrades::recalc_usage_data( $updater );
	}

	public static function _v_3_5_0_price_list( $updater ) {
		$changes = [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_copy_title_styles_to_new_price_controls' ],
				'control_ids' => [],
			],
		];

		return self::_update_widget_settings( 'price-list', $updater, $changes );
	}

	/**
	 * $changes is an array of arrays in the following format:
	 * [
	 *   'control_ids' => array of control ids
	 *   'callback' => user callback to manipulate the control_ids
	 * ]
	 *
	 * @param       $widget_id
	 * @param       $updater
	 * @param array $changes
	 *
	 * @return bool
	 */
	public static function _update_widget_settings( $widget_id, $updater, $changes ) {
		global $wpdb;

		$post_ids = $updater->query_col(
			'SELECT `post_id`
					FROM `' . $wpdb->postmeta . '`
					WHERE `meta_key` = "_elementor_data"
					AND `meta_value` LIKE \'%"widgetType":"' . $widget_id . '"%\';'
		);

		if ( empty( $post_ids ) ) {
			return false;
		}

		foreach ( $post_ids as $post_id ) {
			$do_update = false;

			$document = Plugin::elementor()->documents->get( $post_id );

			if ( ! $document ) {
				continue;
			}

			$data = $document->get_elements_data();

			if ( empty( $data ) ) {
				continue;
			}

			// loop through callbacks & array
			foreach ( $changes as $change ) {
				$args = [
					'do_update' => &$do_update,
					'widget_id' => $widget_id,
					'control_ids' => $change['control_ids'],
				];
				if ( isset( $change['prefix'] ) ) {
					$args['prefix'] = $change['prefix'];
					$args['new_id'] = $change['new_id'];
				}
				$data = Plugin::elementor()->db->iterate_data( $data, $change['callback'], $args );
				if ( ! $do_update ) {
					continue;
				}

				// We need the `wp_slash` in order to avoid the unslashing during the `update_metadata`
				$json_value = wp_slash( wp_json_encode( $data ) );

				update_metadata( 'post', $post_id, '_elementor_data', $json_value );
			}
		} // End foreach().

		return $updater->should_run_again( $post_ids );
	}

	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _rename_widget_settings( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		foreach ( $changes as $old => $new ) {
			if ( ! empty( $element['settings'][ $old ] ) && ! isset( $element['settings'][ $new ] ) ) {
				$element['settings'][ $new ] = $element['settings'][ $old ];
				$args['do_update'] = true;
			}
		}

		return $element;
	}


	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _rename_widget_settings_value( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( self::is_widget_matched( $element, $widget_id ) ) {
			$element = self::apply_rename( $changes, $element, $args );
		}

		return $element;
	}

	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _add_widget_settings_to_array( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		foreach ( $changes as $old_key => $added_key ) {
			if ( ! empty( $element['settings'][ $old_key ] ) ) {
				foreach ( $added_key as $control_id => $val ) {
					if ( ! in_array( $val, $element['settings'][ $control_id ], true ) ) {
						$element['settings'][ $control_id ][] = $val;
						$args['do_update'] = true;
					}
				}
			}
		}

		return $element;
	}

	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _merge_widget_settings( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		foreach ( $changes as $old => $new ) {
			if ( ! empty( $element['settings'][ $old ] ) ) {
				if ( ! isset( $element['settings'][ $new ] ) ) {
					$element['settings'][ $new ] = $element['settings'][ $old ];
				} else {
					$element['settings'][ $new ] = array_unique( array_merge( $element['settings'][ $old ], $element['settings'][ $new ] ) );
				}
				$args['do_update'] = true;
			}
		}

		return $element;
	}

	/**
	 * Possible scenarios:
	 * 1) custom_id is not empty --> do nothing
	 * 2) Existing _id: Empty or Missing custom_id --> create custom_id and set the value to the value of _id
	 * 3) Missing _id: Empty or Missing custom_id --> generate a unique key and set it as custom_id value
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _missing_form_custom_id_settings( $element, $args ) {
		$widget_id = $args['widget_id'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		$random_id = (int) substr( time(), -5 );
		//form_fields loop:
		foreach ( $element['settings']['form_fields'] as &$repeater_item ) {
			if ( ! empty( $repeater_item['custom_id'] ) ) { // Scenario 1
				continue;
			}

			if ( ! empty( $repeater_item['_id'] ) ) { // Scenario 2
				$repeater_item['custom_id'] = $repeater_item['_id'];
			} else { // Scenario 3
				$repeater_item['custom_id'] = 'field_' . $random_id;
				$random_id++;
			}

			$args['do_update'] = true;
		}

		return $element;
	}

	/**
	 * Migrates the value saved for the 'indicator' SELECT control in the Nav Menu Widget to the new replacement
	 * 'submenu_icon' ICONS control.
	 *
	 * @param $element
	 * @param $args
	 *
	 * @return mixed;
	 */
	public static function _migrate_indicator_control_to_submenu_icon( $element, $args ) {
		$widget_id = $args['widget_id'];

		// If the current element is not a Nav Menu widget, go to the next one.
		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		// If this Nav Menu widget's 'indicator' control value is the default one (there is no value in the DB),
		// there is nothing to migrate, since the default icon is identical in the new control. Go to the next element.
		if ( ! isset( $element['settings']['indicator'] ) ) {
			return $element;
		}

		$new_value = '';
		$new_library = 'fa-solid';

		switch ( $element['settings']['indicator'] ) {
			case 'none':
				$new_library = '';
				break;
			case 'classic':
				$new_value = 'fa-caret-down';
				break;
			case 'chevron':
				$new_value = 'fa-chevron-down';
				break;
			case 'angle':
				$new_value = 'fa-angle-down';
				break;
			case 'plus':
				$new_value = 'e-plus-icon';
				$new_library = '';
				break;
		}

		// This is done in order to make sure that the menu will not look any different for users who upgrade.
		// The 'None' option should be completely empty.
		if ( $new_value ) {
			if ( Icons_Manager::is_migration_allowed() ) {
				// If the site has been migrated to FA5, add the new FA Solid class.
				$new_value = 'fas ' . $new_value;
			} else {
				// If the site has not been migrated, add the old generic 'fa' class.
				$new_value = 'fa ' . $new_value;
			}
		}

		// Set the migrated value for the new control.
		$element['settings']['submenu_icon'] = [
			'value' => $new_value,
			'library' => $new_library,
		];

		$args['do_update'] = true;

		return $element;
	}

	/**
	 * @param $element
	 * @param $args
	 *
	 * @return mixed
	 */
	public static function _convert_term_id_to_term_taxonomy_id( $element, $args ) {
		$widget_id = $args['widget_id'];
		$changes = $args['control_ids'];
		$prefix = $args['prefix'];
		$new_id = $prefix . $args['new_id'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		// Exit if new is empty (should not happen)
		if ( empty( $element['settings'][ $new_id ] ) ) {
			return $element;
		}

		// 1) Convert each term-id to the equivalent term_taxonomy_id
		$term_taxonomy_ids = [];
		$old_term_ids = [];
		foreach ( $changes as $old => $new ) {
			if ( ! empty( $element['settings'][ $old ] ) ) {
				$start = strlen( $prefix );
				$end = -strlen( '_ids' );
				$taxonomy = substr( $old, $start, $end );
				foreach ( $element['settings'][ $old ] as $term_id ) {
					$old_term_ids[] = $term_id;
					$term_obj = get_term( $term_id, $taxonomy, OBJECT );
					if ( $term_obj && ! is_wp_error( $term_obj ) ) {
						$term_taxonomy_ids[] = $term_obj->term_taxonomy_id;
					}
				}
			}
		}

		// 2) Check if the widget's settings were changed after the u/g to 2.5.0
		$diff = array_diff( $element['settings'][ $new_id ], array_unique( $old_term_ids ) );
		if ( empty( $diff ) ) { // Nothing was changed
			$element['settings'][ $new_id . '_backup' ] = $element['settings'][ $new_id ];
			$element['settings'][ $new_id ] = $term_taxonomy_ids;
			$args['do_update'] = true;
		}

		return $element;
	}

	/**
	 * Convert 'progress' to 'progressbar'
	 *
	 * Before Elementor 2.2.0, the progress bar option key was 'progress'. In Elementor 2.2.0,
	 * it was changed to 'progressbar'. This upgrade script migrated the DB data for old websites using 'progress'.
	 *
	 * @param $element
	 * @param $args
	 * @return mixed
	 */
	public static function _convert_progress_to_progressbar( $element, $args ) {
		$widget_id = $args['widget_id'];

		if ( empty( $element['widgetType'] ) || $widget_id !== $element['widgetType'] ) {
			return $element;
		}

		if ( 'progress' === $element['settings']['pagination'] ) {
			$element['settings']['pagination'] = 'progressbar';
			$args['do_update'] = true;
		}

		return $element;
	}

	/**
	 * Migrate Slides Button Color Settings
	 *
	 * Move Slides Widget's 'button_color' settings to 'button_text_color' and 'button_border_color' as necessary,
	 * to allow for removing the redundant control.
	 *
	 * @param $element
	 * @param $args
	 * @return mixed
	 */
	public static function _migrate_slides_button_color_settings( $element, $args ) {
		if ( empty( $element['widgetType'] ) || $args['widget_id'] !== $element['widgetType'] ) {
			return $element;
		}

		// If the element doesn't use the 'button_color' control, no need to do anything.
		if ( ! isset( $element['settings']['button_color'] ) ) {
			return $element;
		}

		// Check if button_text_color is set. If it is not set, transfer the value from button_color to button_text_color.
		if ( ! isset( $element['settings']['button_text_color'] ) ) {
			$element['settings']['button_text_color'] = $element['settings']['button_color'];
			$args['do_update'] = true;
		}

		// Check if button_border_color is set. If it is not set, transfer the value from button_color to button_border_color.
		if ( ! isset( $element['settings']['button_border_color'] ) ) {
			$element['settings']['button_border_color'] = $element['settings']['button_color'];
			$args['do_update'] = true;
		}

		return $element;
	}

	/**
	 * Copy Title Styles to New Price Controls
	 *
	 * Copy the values from the  Price List widget's Title Style controls to new Price Style controls.
	 *
	 * @param $element
	 * @param $args
	 * @return mixed
	 * @since 3.4.0
	 *
	 */
	public static function _copy_title_styles_to_new_price_controls( $element, $args ) {
		if ( empty( $element['widgetType'] ) || $args['widget_id'] !== $element['widgetType'] ) {
			return $element;
		}

		if ( ! empty( $element['settings']['heading_color'] ) ) {
			$element['settings']['price_color'] = $element['settings']['heading_color'];

			$args['do_update'] = true;
		}

		$old_control_prefix = 'heading_typography_';
		$new_control_prefix = 'price_typography_';

		foreach ( self::$typography_control_names as $control_name ) {
			if ( ! empty( $element['settings'][ $old_control_prefix . $control_name ] ) ) {
				$element['settings'][ $new_control_prefix . $control_name ] = $element['settings'][ $old_control_prefix . $control_name ];

				$args['do_update'] = true;
			}
		}

		return $element;
	}

	public static function _remove_remote_info_api_data() {
		global $wpdb;

		$key = API::TRANSIENT_KEY_PREFIX;

		return $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '{$key}%';"); // phpcs:ignore
	}

	/**
	 * @param $element
	 * @param $to
	 * @param $control_id
	 * @param $args
	 * @return array
	 */
	protected static function set_new_value( $element, $to, $control_id, $args ) {
		$element['settings'][ $control_id ] = $to;
		$args['do_update'] = true;
		return $element;
	}

	/**  *
	 * @param $change
	 * @param array $element
	 * @param $args
	 * @return array
	 */
	protected static function replace_value_if_found( $change, array $element, $args ) {
		$control_id = key( $args['control_ids'] );
		$from = $change['from'];
		$to = $change['to'];
		if ( self::is_control_exist_in_settings( $element, $control_id ) && self::is_need_to_replace_value( $element, $control_id, $from ) ) {
			$element = self::set_new_value( $element, $to, $control_id, $args );
		}
		return $element;
	}

	/**
	 * @param $element
	 * @param $widget_id
	 * @return bool
	 */
	protected static function is_widget_matched( $element, $widget_id ) {
		return ! empty( $element['widgetType'] ) && $widget_id === $element['widgetType'];
	}

	/**
	 * @param $changes
	 * @param $element
	 * @param $args
	 * @return array|mixed
	 */
	protected static function apply_rename( $changes, $element, $args ) {
		foreach ( $changes as $change ) {
			$element = self::replace_value_if_found( $change, $element, $args );
		}
		return $element;
	}

	/**
	 * @param $element
	 * @param $control_id
	 * @return bool
	 */
	protected static function is_control_exist_in_settings( $element, $control_id ) {
		return ! empty( $element['settings'][ $control_id ] );
	}

	/**
	 * @param $element
	 * @param $new
	 * @return bool
	 */
	protected static function is_need_to_replace_value( $element, $control_id, $value_to_replace ) {
		return $element['settings'][ $control_id ] === $value_to_replace;
	}

	/**
	 * @return array[]
	 */
	public static function get_woocommerce_rename_related_to_related_products_changes() {
		return [
			[
				'callback' => [ 'ElementorPro\Core\Upgrade\Upgrades', '_rename_widget_settings_value' ],
				'control_ids' => [
					'query_post_type' => [
						'from' => 'related',
						'to' => 'related_products',
					],
				],
			],
		];
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit