....................................../////.===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 :  /proc/thread-self/cwd/wp-content/plugins/user-registration/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/cwd/wp-content/plugins/user-registration/includes//functions-ur-template.php
<?php

/**
 * UserRegistration Template
 *
 * Functions for the templating system.
 *
 * @author   WPEverest
 * @category Core
 * @package  UserRegistration/Functions
 * @version  1.0.0
 */

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

add_action('template_redirect', 'ur_template_redirect');
add_action('template_redirect', 'ur_login_template_redirect');
add_action('template_redirect', 'ur_registration_template_redirect');

/**
 * Redirect after logout.
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 */
function ur_template_redirect()
{
	global $wp;

	if (isset($wp->query_vars['user-logout']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'user-logout')) {
		// Logout
		$redirect_url = str_replace('/user-logout', '', $wp->request);
		wp_safe_redirect(str_replace('&amp;', '&', wp_logout_url($redirect_url)));
		exit;
	} elseif (isset($wp->query_vars['user-logout']) && 'true' === $wp->query_vars['user-logout']) {

		// Redirect to the correct logout endpoint.
		wp_safe_redirect(esc_url_raw(ur_get_page_permalink('user-logout')));
		exit;
	}
}

/**
 * Check for login shortcode in the page and redirect to the url passed with login shortcode parameter redirect_url
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 */
function ur_login_template_redirect()
{
	global $post;

	$post_content = isset($post->post_content) ? $post->post_content : '';

	if ((has_shortcode($post_content, 'user_registration_login') || has_shortcode($post_content, 'user_registration_my_account')) && is_user_logged_in()) {
		preg_match('/' . get_shortcode_regex() . '/s', $post_content, $matches);

		// Remove all html tags.
		$escaped_atts_string = preg_replace('/<[\/]{0,1}[^<>]*>/', '', $matches[3]);

		$attributes   = shortcode_parse_atts($escaped_atts_string);
		$redirect_url = isset($attributes['redirect_url']) ? $attributes['redirect_url'] : '';
		$redirect_url = trim($redirect_url, ']');
		$redirect_url = trim($redirect_url, '"');
		$redirect_url = trim($redirect_url, "'");

		if (!is_elementor_editing_page() && !empty($redirect_url)) {
			wp_redirect($redirect_url);
			exit();
		}
	}
}

/**
 * Redirects the logged in user to the option set in form settings if registration page is selected.
 * Donot redirect for admins.
 *
 * @return void
 * @since  1.5.1
 */
function ur_registration_template_redirect()
{

	// Return if the user is not logged in.
	if (is_user_logged_in() === false) {
		return;
	}

	$current_user    = wp_get_current_user();
	$current_user_id = $current_user->ID;

	// Donot redirect for admins.
	if (in_array('administrator', wp_get_current_user()->roles)) {
		return;
	} else {

		global $post;

		$post_content = isset($post->post_content) ? $post->post_content : '';

		if (has_shortcode($post_content, 'user_registration_form')) {

			$attributes = ur_get_shortcode_attr($post_content);
			$form_id    = isset($attributes[0]['id']) ? $attributes[0]['id'] : 0;

			preg_match_all('!\d+!', $form_id, $form_id);

			$redirect_url = ur_get_single_post_meta($form_id[0][0], 'user_registration_form_setting_redirect_options', '');
			$redirect_url = apply_filters('user_registration_redirect_from_registration_page', $redirect_url, $current_user);
			$redirect_url = ur_string_translation( $form_id[0][0], 'user_registration_form_setting_redirect_options', $redirect_url );

			if (!is_elementor_editing_page() && !empty($redirect_url)) {
				wp_redirect($redirect_url);
				exit();
			}
		}
	}
}

/**
 * Add body classes for UR pages.
 *
 * @param  array $classes
 *
 * @return array
 */
function ur_body_class($classes)
{
	$classes   = (array) $classes;
	$classes[] = 'user-registration-page';
	if (is_ur_account_page()) {
		$classes[] = 'user-registration-account';
	}

	foreach (UR()->query->query_vars as $key => $value) {
		if (is_ur_endpoint_url($key)) {
			$classes[] = 'user-registration-' . sanitize_html_class($key);
		}
	}

	return array_unique($classes);
}


if (!function_exists('user_registration_form_field')) {

	/**
	 * Outputs a form fields on frontend.
	 *
	 * @param string $key
	 * @param mixed  $args
	 * @param string $value (default: null)
	 *
	 * @return string
	 */
	function user_registration_form_field($key, $args, $value = null)
	{

		/* Conditional Logic codes */
		$rules                      = array();
		$rules['conditional_rules'] = isset($args['conditional_rules']) ? $args['conditional_rules'] : '';
		$rules['logic_gate']        = isset($args['logic_gate']) ? $args['logic_gate'] : '';
		$rules['rules']             = isset($args['rules']) ? $args['rules'] : array();
		$rules['required']          = isset($args['required']) ? $args['required'] : '';

		foreach ($rules['rules'] as $rules_key => $rule) {
			if (empty($rule['field'])) {
				unset($rules['rules'][$rules_key]);
			}
		}

		$rules['rules'] = array_values($rules['rules']);

		$rules = (!empty($rules['rules']) && isset($args['enable_conditional_logic'])) ? wp_json_encode($rules) : '';
		/*Conditonal Logic codes end*/

		$defaults = array(
			'type'              => 'text',
			'label'             => '',
			'description'       => '',
			'placeholder'       => '',
			'size'              => false,
			'min'               => false,
			'max'               => false,
			'required'          => false,
			'autocomplete'      => false,
			'id'                => $key,
			'class'             => array(),
			'input_class'       => array(),
			'return'            => false,
			'options'           => array(),
			'custom_attributes' => array(),
			'validate'          => array(),
			'default'           => '',
			'autofocus'         => '',
			'priority'          => '',
		);

		$args = wp_parse_args($args, $defaults);
		$args = apply_filters('user_registration_form_field_args', $args, $key, $value);

		if (true === $args['required']) {
			$args['class'][] = 'validate-required';
			$required        = ' <abbr class="required" title="' . esc_attr__('required', 'user-registration') . '">*</abbr>';
		} else {
			$args['required'] = $required = '';
		}

		if (is_null($value) || empty($value)) {
			$value = $args['default'];
		}

		// Custom attribute handling
		$custom_attributes         = array();
		$args['custom_attributes'] = array_filter((array) $args['custom_attributes']);

		if ($args['size']) {
			$args['custom_attributes']['maxlength'] = absint($args['size']);
		}

		if (!empty($args['min']) || '0' === $args['min']) {
			$args['custom_attributes']['min'] = $args['min'];
		}

		if (!empty($args['max']) || '0' === $args['max']) {
			$args['custom_attributes']['max'] = $args['max'];
		}

		if (!empty($args['step'])) {
			$args['custom_attributes']['step'] = $args['step'];
		}

		if (!empty($args['autocomplete'])) {
			$args['custom_attributes']['autocomplete'] = $args['autocomplete'];
		}

		if (true === $args['autofocus']) {
			$args['custom_attributes']['autofocus'] = 'autofocus';
		}

		if (!empty($args['custom_attributes']) && is_array($args['custom_attributes'])) {
			foreach ($args['custom_attributes'] as $attribute => $attribute_value) {
				$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
			}
		}

		if (!empty($args['validate'])) {
			foreach ($args['validate'] as $validate) {
				$args['class'][] = 'validate-' . $validate;
			}
		}

		$tooltip_html = !empty($args['tip']) ? ur_help_tip($args['tip']) : '';
		$cl_html      = '';

		if (isset($args['enable_conditional_logic']) && true === $args['enable_conditional_logic']) {
			$cl_map  = isset($args['cl_map']) ? $args['cl_map'] : '';
			$cl_html = sprintf('data-conditional-logic-enabled="yes" data-conditional-logic-map="%s"', esc_attr($cl_map));
		}

		$field           = '';
		$label_id        = $args['id'];
		$sort            = $args['priority'] ? $args['priority'] : '';
		$field_container = '<div class="form-row %1$s" id="%2$s" data-priority="' . esc_attr($sort) . '" ' . $cl_html . '>%3$s</div>';
		$class = '';
		if (!is_admin()) {
			$form_id = isset( $args['form_id'] )? $args['form_id'] : '' ;
			$enable_field_icon   = ur_get_single_post_meta($form_id, 'user_registration_enable_field_icon');

			if ('1' === $enable_field_icon) {
				$class = "";
			} else {
				$class = "without_icon";
			}
		}

		switch ($args['type']) {

			case 'title':
				$field .= '<h4>' . esc_html($args['title']) . '</h4>';
				break;

			case 'textarea':
				$field .= '<textarea data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" name="' . esc_attr($key) . '" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '" ' . (empty($args['custom_attributes']['rows']) ? ' rows="2"' : '') . (empty($args['custom_attributes']['cols']) ? ' cols="5"' : '') . implode(' ', $custom_attributes) . '>' . esc_textarea($value) . '</textarea>';
				break;

			case 'checkbox':
				$field_key     = isset( $args['field_key'] ) ? $args['field_key'] : '';
				$default_value = isset( $args['default_value'] ) ? $args['default_value'] : '';    // Backward compatibility. Modified since 1.5.7
				$default       = ! empty( $value ) ? $value : $default_value;
				$select_all    = isset( $args['select_all'] ) ?  $args['select_all'] : "";
				$options       = isset( $args['options'] ) ? $args['options'] : ( $args['choices'] ? $args['choices'] : array() ); // $args['choices'] for backward compatibility. Modified since 1.5.7.
				$choice_limit = isset( $args['choice_limit'] ) ?  $args['choice_limit'] : "";
				$choice_limit_attr = "";
				if ("" !== $choice_limit) {
					$choice_limit_attr = 'data-choice-limit="' . $choice_limit . '"';
				}

				if (isset($options) && array_filter($options)) {

					if (!empty($default)) {
						$default = (is_serialized($default)) ? unserialize($default) : $default;
					}

					$choices = isset($options) ? $options : array();

					$field  = '<label class="ur-label" ' . implode(' ', $custom_attributes) . '>';
					$field .= $args['label'] . $required . $tooltip_html . '</label>';

					$checkbox_start = 0;

					$field .= '<ul ' . $choice_limit_attr . '>';

					if("yes" ===  $select_all){
					$field .= '<li class="ur-checkbox-list"><input type="checkbox" id="checkall" class="ur-input-checkbox"  data-check="'. esc_attr( $key )	.'"/>';
					$field .= '<label class="ur-checkbox-label">  Select All</label></li>';
					}
					foreach ( $choices as $choice_index => $choice ) {

						$value = '';
						if ('' !== $default) {
							if (is_array($default) && in_array(trim($choice_index), $default)) {
								$value = 'checked="checked"';
							} elseif ($default === $choice_index) {
								$value = 'checked="checked"';
							}
						}
						$field .= '<li class="ur-checkbox-list">';
						$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" ' . implode(' ', $custom_attributes) . ' data-value="' . esc_attr($choice_index) . '" type="' . esc_attr($args['type']) . '" class="input-checkbox ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '[]" id="' . esc_attr($args['id']) . '_' . esc_attr($choice_index) . '" value="' . trim($choice_index) . '"' . esc_attr($value) . ' /> ';
						$field .= '<label class="ur-checkbox-label" for="' . esc_attr($args['id']) . '_' . esc_attr($choice_index) . '">' . trim($choice) . '</label> </li>';
						$checkbox_start++;
					}
					$field .= '</ul>';
				} else {
					$field = '<label class="ur-label checkbox" ' . implode(' ', $custom_attributes) . '>
							<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" ' . implode(' ', $custom_attributes) . ' data-value="' . $value . '" type="' . esc_attr($args['type']) . '" class="input-checkbox ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" value="1" ' . checked($value, 1, false) . ' /> '
						. $args['label'] . $required . $tooltip_html . '</label>';
				}
				break;

			case 'password':
				$extra_params_key = str_replace('user_registration_', 'ur_', $key) . '_params';
				$extra_params     = json_decode(get_user_meta(get_current_user_id(), $extra_params_key, true));
				$field .= ' <span class="input-wrapper"> ';
				if (empty($extra_params)) {
					$field_container = '<div class="form-row %1$s hide_show_password" id="%2$s" data-priority="' . esc_attr($sort) . '">%3$s</div>';
					$field          .= '<span class="password-input-group input-form-field-icons">';
					$field          .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="' . esc_attr($args['type']) . '" class="input-text '.$class.' input-' . esc_attr($args['type']) . ' ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '"  value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' />';
					if ('yes' === get_option('user_registration_login_option_hide_show_password', 'no')) {
						$field .= '<a href="javaScript:void(0)" class="password_preview dashicons dashicons-hidden" title=" Show password "></a>';
					}
					$field .= '</span>';
				} else {
					$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="' . esc_attr($args['type']) . '" class="input-text  ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '"  value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' />';
				}
				if (!is_admin()) {
					if ('yes' === $enable_field_icon || '1' === $enable_field_icon) {
						$field .= '<span class="' . $args['icon'] . '"></span>';
					}
					$field .= ' </span> ';
				}
				break;

			case 'text':
			case 'email':
			case 'tel':
			case 'number':
			case 'url':
			case 'file':
			case 'timepicker':
				$extra_params_key = str_replace('user_registration_', 'ur_', $key) . '_params';
				$extra_params     = json_decode(get_user_meta(get_current_user_id(), $extra_params_key, true));
				$current_time     = isset( $args[ 'current_time' ] ) ?  $args[ 'current_time' ] : "";
				$time_interval    = isset( $args[ 'time_interval' ] ) ?  $args[ 'time_interval' ] : "";
				$time_min    = isset( $args[ 'time_min' ] ) ?  $args[ 'time_min' ] : "";
				$time_max    = isset( $args[ 'time_max' ] ) ?  $args[ 'time_max' ] : "";
				$username_length  = isset($args['username_length']) ?  $args['username_length'] : "";
				$username_character = isset($args['username_character']) ?  $args['username_character'] : "";
				$attr = "";
				if ("" !== $username_length) {
					$attr .= 'data-username-length="' . $username_length . '"';
				}

				if ($username_character) {
					$attr .= 'data-username-character="' . $username_character . '"';
				}

				if( "" !== $time_interval )  {
					$attr .= 'data-time-interval="' . $time_interval . '"';
				}

				if( "" !== $time_min )  {
					$attr .= 'data-time-min="' . $time_min . '"';
				}

				if( "" !== $time_max )  {
					$attr .= 'data-time-max="' . $time_max . '"';
				}

				if ($current_time) {
					$attr .= 'data-current-time="' . $current_time . '"';
				}

				$field .= ' <span class="input-wrapper"> ';
				if (empty($extra_params)) {
					$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="' . esc_attr($args['type']) . '" class="input-text ' . $class . ' input-' . esc_attr($args['type']) . ' ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '"  value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' ' . $attr . '/>';
				} else {
					$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="' . esc_attr($args['type']) . '" class="input-text ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '"  value="' . esc_attr($value) . '" ' . implode(' ', $custom_attributes) . ' ' . $attr . ' />';
				}

				if (!is_admin()) {
					if ('yes' === $enable_field_icon || '1' === $enable_field_icon && 'file' != $args['type']) {
						$field .= '<span class="' . $args['icon'] . '"></span>';
					}
					$field .= ' </span> ';
				}
				break;

			case 'date':
				$extra_params_key = str_replace('user_registration_', 'ur_', $key) . '_params';
				$extra_params     = json_decode(get_user_meta(get_current_user_id(), $extra_params_key, true));

				$actual_value = $value;
				if (isset($args['custom_attributes']['data-date-format'])) {
					$date_format  = $args['custom_attributes']['data-date-format'];
					$default_date = isset($args['custom_attributes']['data-default-date']) ? $args['custom_attributes']['data-default-date'] : '';
					if (empty($value) && 'today' === $default_date) {
						$value        = date_i18n($date_format);
						$actual_value = date_i18n($date_format);
					} else {
						$value = str_replace('/', '-', $value);
						if (!strpos($value, 'to')) {
							$value = '' !== $value ? date_i18n($date_format, strtotime($value)) : '';
						} else {
							$date_range = explode('to', $value);
							$value      = date_i18n($date_format, strtotime(trim($date_range[0]))) . ' to ' . date_i18n($date_format, strtotime(trim($date_range[1])));
						}
					}
				}

				$field .= ' <span class="input-wrapper"> ';

				if ( empty( $extra_params ) ) {
					$field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="text" id="load_flatpickr" value="' . esc_attr( $actual_value ) . '" class="regular-text '. $class .'" readonly placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
					$field .= '<input type="hidden" id="formated_date" value="' . esc_attr( $value ) . '"/>';
					$field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="text" data-field-type="' . esc_attr( $args['type'] ) . '" value="' . esc_attr( $actual_value ) . '" class="input-text input-' . esc_attr( $args['type'] ) . ' ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '"  ' . implode( ' ', $custom_attributes ) . ' style="display:none"/>';
				} else {
					$field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="text" id="load_flatpickr" value="' . esc_attr( $actual_value ) . '"  class="regular-text '. $class .'" readonly placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
					$field .= '<input type="hidden" id="formated_date" value="' . esc_attr( $value ) . '"/>';
					$field .= '<input data-rules="' . esc_attr( $rules ) . '" data-id="' . esc_attr( $key ) . '" type="text" data-field-type="' . esc_attr( $args['type'] ) . '" value="' . esc_attr( $actual_value ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '"  ' . implode( ' ', $custom_attributes ) . ' style="display:none" />';
				}

				if('yes' === $enable_field_icon || '1'===$enable_field_icon) {
					if(!is_admin(  ) ){
						$field .= '<span class="'.$args['icon'].'"></span>';
					}
				}
				$field .= '</span> ';
				break;

			case 'color':
				$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="text" class="input-text input-color ' . esc_attr(implode(' ', $args['input_class'])) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" placeholder="' . esc_attr($args['placeholder']) . '"  value="' . esc_attr($value) . '" data-default-color="' . esc_attr($args['default']) . '" ' . implode(' ', $custom_attributes) . ' />';
				break;

			case 'select':
				$default_value = isset($args['default_value']) ? $args['default_value'] : ''; // Backward compatibility. Modified since 1.5.7

				$value   = !empty($value) ? $value : $default_value;
				$options = $field .= '';
				if (!empty($args['options'])) {
					// If we have a blank option, select2 needs a placeholder
					if (!empty($args['placeholder'])) {
						$options .= '<option value="" selected disabled>' . esc_html($args['placeholder']) . '</option>';
					}

					$custom_attributes[] = 'data-allow_clear="true"';
					foreach ($args['options'] as $option_key => $option_text) {
						$selected_attribute = '';

						if (empty($args['placeholder'])) {
							$selected_attribute = selected($value, trim($option_key), false);
						}
						$options .= '<option value="' . esc_attr(trim($option_key)) . '" ' . $selected_attribute . '>' . esc_attr(trim($option_text)) . '</option>';
					}

					$field .= '<select data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '" class="select ' . esc_attr(implode(' ', $args['input_class'])) . '" ' . implode(' ', $custom_attributes) . ' data-placeholder="' . esc_attr($args['placeholder']) . '">
							' . $options . '
						</select>';
				}
				break;

			case 'multiselect':
				$options = $field .= '';

				if (is_serialized($value)) {
					$default_value = unserialize($value);
				} else {
					$default_value = $value;
				}

				if (!empty($args['options'])) {
					foreach ($args['options'] as $option_key => $option_text) {

						if ('' === $option_key) {
							// If we have a blank option, select2 needs a placeholder
							if (empty($args['placeholder'])) {
								$args['placeholder'] = $option_text ? $option_text : __('Choose an option', 'user-registration');
							}
							$custom_attributes[] = 'data-allow_clear="true"';
						}

						if (is_array($default_value)) {
							$options .= '<option value="' . esc_attr(trim($option_key)) . '" ' . selected(in_array(trim($option_key), $default_value), true, false) . '>' . esc_attr(trim($option_text)) . '</option>';
						} else {
							$options .= '<option value="' . esc_attr(trim($option_key)) . '" ' . selected($default_value, trim($option_key), false) . '>' . esc_attr(trim($option_text)) . '</option>';
						}
					}

					$field .= '<select multiple data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" name="' . esc_attr($key) . '[]" id="' . esc_attr($args['id']) . '" class="select ur-enhanced-select' . esc_attr(implode(' ', $args['input_class'])) . '" ' . implode(' ', $custom_attributes) . ' data-placeholder="' . esc_attr($args['placeholder']) . '">
							' . $options . '
						</select>';
				}
				break;

			case 'radio':
				$default_value = isset($args['default_value']) ? $args['default_value'] : ''; // Backward compatibility. Modified since 1.5.7
				$value         = !empty($value) ? $value : $default_value;
				$label_id      = current(array_keys($args['options']));
				if (!empty($args['options'])) {

					$field .= '<ul>';
					foreach ($args['options'] as $option_index => $option_text) {

						$field .= '<li class="ur-radio-list">';

						$checked = '';
						if (!empty($value)) {
							$checked = checked($value, trim($option_index), false);
						}

						$field .= '<input data-rules="' . esc_attr($rules) . '" data-id="' . esc_attr($key) . '" type="radio" class="input-radio ' . esc_attr(implode(' ', $args['input_class'])) . '" value="' . esc_attr(trim($option_index)) . '" name="' . esc_attr($key) . '" id="' . esc_attr($args['id']) . '_' . esc_attr($option_text) . '" ' . implode(' ', $custom_attributes) . ' / ' . $checked . ' /> ';
						$field .= '<label for="' . esc_attr($args['id']) . '_' . esc_attr($option_text) . '" class="radio">';

						$field .= wp_kses(
							trim($option_text),
							array(
								'a'    => array(
									'href'  => array(),
									'title' => array(),
								),
								'span' => array(),
							)
						) . '</label></li>';
					}
					$field .= '</ul>';
				}
				break;
		} // End switch().

		if ($args['description']) {
			$field .= '<span class="description">' . $args['description'] . '</span>';
		}



		if (!empty($field)) {

			$field_html = '';
			if ($args['label'] && 'checkbox' != $args['type']) {
				$field_html .= '<label for="' . esc_attr($label_id) . '" class="ur-label">' . wp_kses(
					$args['label'],
					array(
						'a'    => array(
							'href'  => array(),
							'title' => array(),
						),
						'span' => array(),
					)
				) . $required . $tooltip_html . '</label>';
			}

			$field_html     .= $field;
			$container_class = esc_attr(implode(' ', $args['class']));
			$container_id    = esc_attr($args['id']) . '_field';
			$field           = sprintf($field_container, $container_class, $container_id, $field_html);
		}

		$field = apply_filters('user_registration_form_field_' . $args['type'], $field, $key, $args, $value);
		if ($args['return']) {
			return $field;
		} else {
			echo $field;
		}
	}
} // End if().

if (!function_exists('user_registration_form_data')) {

	/**
	 * Get form fields to display on profile tab
	 *
	 * @param string $user_id
	 * @param string $form_id
	 *
	 * @return array
	 */
	function user_registration_form_data($user_id = 0, $form_id = 0)
	{
		$all_meta_value = get_user_meta($user_id);
		$fields         = array();

		$post_content_array = ($form_id) ? UR()->form->get_form($form_id, array('content_only' => true)) : array();

		$all_meta_value_keys = array();
		if (gettype($all_meta_value) === 'array') {
			$all_meta_value_keys = array_keys($all_meta_value);
		}

		$post_content_array = apply_filters('user_registration_profile_account_filter_all_fields', $post_content_array, $form_id);

		foreach ($post_content_array as $post_content_row) {
			foreach ($post_content_row as $post_content_grid) {
				foreach ($post_content_grid as $field) {
					$field_name        = isset($field->general_setting->field_name) ? $field->general_setting->field_name : '';
					$field_label       = isset($field->general_setting->label) ? $field->general_setting->label : '';
					$field_description = isset($field->general_setting->description) ? $field->general_setting->description : '';
					$placeholder       = isset($field->general_setting->placeholder) ? $field->general_setting->placeholder : '';
					$options           = isset($field->general_setting->options) ? $field->general_setting->options : array();
					$field_key         = isset($field->field_key) ? ($field->field_key) : '';
					$field_type        = isset($field->field_key) ? ur_get_field_type($field_key) : '';
					$required          = isset($field->general_setting->required) ? $field->general_setting->required : '';
					$required          = 'yes' == $required ? true : false;
					$enable_cl         = isset($field->advance_setting->enable_conditional_logic) && ('1' === $field->advance_setting->enable_conditional_logic || 'on' === $field->advance_setting->enable_conditional_logic) ? true : false;
					$cl_map            = isset($field->advance_setting->cl_map) ? $field->advance_setting->cl_map : '';
					$custom_attributes = isset($field->general_setting->custom_attributes) ? $field->general_setting->custom_attributes : array();

					if (empty($field_label)) {
						$field_label_array = explode('_', $field_name);
						$field_label       = join(' ', array_map('ucwords', $field_label_array));
					}

					if (!empty($field_name)) {
						$extra_params = array();

						switch ($field_key) {

							case 'radio':
							case 'select':
								$advanced_options        = isset($field->advance_setting->options) ? $field->advance_setting->options : '';
								$advanced_options        = explode(',', $advanced_options);
								$extra_params['options'] = !empty($options) ? $options : $advanced_options;
								$extra_params['options'] = array_map('trim', $extra_params['options']);

								$extra_params['options'] = array_combine($extra_params['options'], $extra_params['options']);

								break;

							case 'checkbox':
								$advanced_options        = isset($field->advance_setting->choices) ? $field->advance_setting->choices : '';
								$advanced_options        = explode(',', $advanced_options);
								$extra_params['options'] = !empty($options) ? $options : $advanced_options;
								$extra_params['options'] = array_map('trim', $extra_params['options']);

								$extra_params['options'] =  array_combine($extra_params['options'], $extra_params['options']);

								break;

							case 'date':
								$date_format       = isset($field->advance_setting->date_format) ? $field->advance_setting->date_format : '';
								$min_date          = isset($field->advance_setting->min_date) ? str_replace('/', '-', $field->advance_setting->min_date) : '';
								$max_date          = isset($field->advance_setting->max_date) ? str_replace('/', '-', $field->advance_setting->max_date) : '';
								$set_current_date  = isset($field->advance_setting->set_current_date) ? $field->advance_setting->set_current_date : '';
								$enable_date_range = isset($field->advance_setting->enable_date_range) ? $field->advance_setting->enable_date_range : '';
								$extra_params['custom_attributes']['data-date-format'] = $date_format;

								if (isset($field->advance_setting->enable_min_max) && 'true' === $field->advance_setting->enable_min_max) {
									$extra_params['custom_attributes']['data-min-date'] = '' !== $min_date ? date_i18n($date_format, strtotime($min_date)) : '';
									$extra_params['custom_attributes']['data-max-date'] = '' !== $max_date ? date_i18n($date_format, strtotime($max_date)) : '';
								}
								$extra_params['custom_attributes']['data-default-date'] = $set_current_date;
								$extra_params['custom_attributes']['data-mode']         = $enable_date_range;
								break;

							case 'country':
								$class_name              = ur_load_form_field_class($field_key);
								$extra_params['options'] = $class_name::get_instance()->get_selected_countries($form_id, $field_name);
								break;

							case 'file':
								$extra_params['max_files'] = isset($field->general_setting->max_files) ? $field->general_setting->max_files : '';
								break;

							case 'phone':
								$extra_params['phone_format'] = isset($field->general_setting->phone_format) ? $field->general_setting->phone_format : '';
								break;

							default:
								break;
						}

						$extra_params['default'] = isset($all_meta_value['user_registration_' . $field_name][0]) ? $all_meta_value['user_registration_' . $field_name][0] : '';

						if (in_array($field_key, ur_get_user_profile_field_only())) {

							$fields['user_registration_' . $field_name] = array(
								'label'       => ur_string_translation($form_id, 'user_registration_' . $field_name . '_label', $field_label),
								'description' => ur_string_translation($form_id, 'user_registration_' . $field_name . '_description', $field_description),
								'type'        => $field_type,
								'placeholder' => ur_string_translation($form_id, 'user_registration_' . $field_name . '_placeholder', $placeholder),
								'field_key'   => $field_key,
								'required'    => $required,
							);

							if (true === $enable_cl) {
								$fields['user_registration_' . $field_name]['enable_conditional_logic'] = $enable_cl;
								$fields['user_registration_' . $field_name]['cl_map']                   = $cl_map;
							}
						}

						if (true === $enable_cl) {
							$fields['user_registration_' . $field_name]['enable_conditional_logic'] = $enable_cl;
							$fields['user_registration_' . $field_name]['cl_map']                   = $cl_map;
						}

						if (count($custom_attributes) > 0) {
							$extra_params['custom_attributes'] = $custom_attributes;
						}

						if (isset($fields['user_registration_' . $field_name]) && count($extra_params) > 0) {
							$fields['user_registration_' . $field_name] = array_merge($fields['user_registration_' . $field_name], $extra_params);
						}
						$filter_data = array(
							'fields'     => $fields,
							'field'      => $field,
							'field_name' => $field_name,
						);

						$filtered_data_array = apply_filters('user_registration_profile_account_filter_' . $field_key, $filter_data, $form_id);
						if (isset($filtered_data_array['fields'])) {
							$fields = $filtered_data_array['fields'];
						}
					} // End if().
				} // End foreach().
			} // End foreach().
		} // End foreach().
		return $fields;
	}
} // End if().

if (!function_exists('user_registration_account_content')) {

	/**
	 * My Account content output.
	 */
	function user_registration_account_content()
	{
		global $wp;

		if (!empty($wp->query_vars)) {
			foreach ($wp->query_vars as $key => $value) {
				// Ignore pagename param.
				if ('pagename' === $key) {
					continue;
				}

				if (has_action('user_registration_account_' . $key . '_endpoint')) {
					do_action('user_registration_account_' . $key . '_endpoint', $value);
					return;
				}
			}
		}

		// No endpoint found? Default to dashboard.
		ur_get_template(
			'myaccount/dashboard.php',
			array(
				'current_user' => get_user_by('id', get_current_user_id()),
			)
		);
	}
}

if (!function_exists('user_registration_account_navigation')) {

	/**
	 * My Account navigation template.
	 */
	function user_registration_account_navigation()
	{
		ur_get_template('myaccount/navigation.php');
	}
}

if (!function_exists('user_registration_account_edit_profile')) {

	/**
	 * My Account > Edit profile template.
	 */
	function user_registration_account_edit_profile()
	{
		UR_Shortcode_My_Account::edit_profile();
	}
}

if (!function_exists('user_registration_account_edit_account')) {

	/**
	 * My Account > Edit account template.
	 */
	function user_registration_account_edit_account()
	{
		UR_Shortcode_My_Account::edit_account();
	}
}

/**
 * Get logout endpoint.
 *
 * @return string
 */

function ur_logout_url( $redirect = '' ) {
	$logout_endpoint = get_option( 'user_registration_logout_endpoint' );

	global $post;
	$post_content = isset( $post->post_content ) ? $post->post_content : '';
	$blocks = parse_blocks( $post_content );
	foreach( $blocks as $block ) {

		if ( 'core/shortcode' === $block['blockName'] && isset( $block['innerHTML'] ) ) {
			$new_shortcode = $block['innerHTML'];
		} elseif ( 'user-registration/form-selector' === $block['blockName'] && isset( $block['attrs']['shortcode'] ) ) {
			$new_shortcode = "[". $block['attrs']['shortcode'] . "]";
		}

	}

	if ( ( ur_post_content_has_shortcode( 'user_registration_login' ) || ur_post_content_has_shortcode( 'user_registration_my_account' ) ) && is_user_logged_in() ) {
		preg_match( '/' . get_shortcode_regex() . '/s', $new_shortcode, $matches );

		$attributes = shortcode_parse_atts($matches[3]);
		/**
		 * Introduced logout_redirect parameter in user_registration_my_account shortcode.
		 *
		 * @since  1.7.5
		 */
		if (isset($attributes['logout_redirect'])) {
			$redirect = isset($attributes['logout_redirect']) ? $attributes['logout_redirect'] : '';
			$redirect = trim($redirect, ']');
			$redirect = trim($redirect, '"');
			$redirect = trim($redirect, "'");
			$redirect = '' != $redirect ? home_url($redirect) : ur_get_page_permalink('myaccount');
		}
	}else {
		$blocks = parse_blocks( $post->post_content );

   		foreach ( $blocks as $block ) {
			if ( 'user-registration/form-selector' === $block['blockName'] && isset( $block['attrs']['logoutUrl'] ) ) {
				$redirect = home_url( $block['attrs']['logoutUrl'] );
			}
		}
	}
	$redirect = apply_filters('user_registration_redirect_after_logout', $redirect);

	if ($logout_endpoint && !is_front_page()) {
		return wp_nonce_url(ur_get_endpoint_url('user-logout', '', $redirect), 'user-logout');
	} else {
		if ('' === $redirect) {
			$redirect = home_url();
		}
		return wp_logout_url($redirect);
	}
}

/**
 * See if current page elementor page for editing.
 *
 * @since 1.8.5
 *
 * @return bool
 */
function is_elementor_editing_page()
{
	return (!empty($_POST['action']) && 'elementor_ajax' === $_POST['action']) ||
		!empty($_GET['elementor-preview']) ||
		(!empty($_GET['action']) && 'elementor' === $_GET['action']);
}

Youez - 2016 - github.com/yon3zu
LinuXploit