....................................../////.===Hehe-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 : 198.54.125.254  /  Your IP : 216.73.217.14
Web Server : LiteSpeed
System : Linux premium80.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : vivegvwr ( 1774)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/vivegvwr/www/wp-content/themes/news-event/inc/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/vivegvwr/www/wp-content/themes/news-event/inc/admin/admin.php
<?php
/**
 * Admin page
 * 
 * @package News Event
 * @since 1.0.0
 */

namespace News_Event_Admin;

if( ! class_exists( 'Admin_Page' ) ) :
    /**
     * Handles everything going on in the admin
     * 
     * @package News Event
     * @since 1.0.0
     */
    class Admin_Page {
        
        /**
         * has demo data
         * 
         * @since 1.0.0
         */
        public $demos;

        public $ajax_response = [];

        /**
         * directory and file name of importer plugin relative to plugins directory in wp-content
         * 
         * @since 1.0.0
         */
        public $importer_plugin_file = 'blaze-demo-importer/blaze-demo-importer.php';

        /**
         * Zip file of importer plugin
         */
        public $importer_file = 'https://downloads.wordpress.org/plugin/blaze-demo-importer.zip';

        /**
         * Check if theme is premium version or not
         */
        public $is_premium;

        /**
         * Get id of current user
         */
        public $current_user_id;

        /**
         * Store the instance of class
         * 
         * @since 1.0.0
         */
        private static $_instance = null;

        /**
         * Ensures only one instance of the class is loaded or can be loaded
         * 
         * @access public
         * @static
         */
        public static function instance() {
            if( is_null( self::$_instance ) ) {
                self::$_instance = new self();
            }
            return self::$_instance;
        }

        /**
         * Function that runs when the class is instantiated.
         */
        public function __construct() {
            add_action( 'init', function(){
                $this->demos = include get_template_directory() . '/inc/admin/assets/demos.php';
            });
            $this->is_premium = preg_match( '/-pro/', wp_get_theme()->get( 'TextDomain' ) );
            $this->current_user_id = get_current_user_id();
            add_action( 'admin_menu', [ $this, 'news_event_info_page' ], 10 );
            add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] );
            add_action( 'wp_ajax_news_event_importer_plugin_action', array( $this, 'news_event_importer_plugin_action' ) );
            new Admin_Notices();
        }

        /**
         * Function to enqueue scripts in admin page
         */
        public function admin_scripts( $hook ) {
            if( $hook == 'toplevel_page_news-event-info' ) {
                wp_enqueue_style( 'news-event-info', get_template_directory_uri() . '/inc/admin/assets/admin-page.css', [], NEWS_EVENT_VERSION, 'all' );
                wp_enqueue_script( 'news-event-info', get_template_directory_uri() . '/inc/admin/assets/admin-page.js', [], NEWS_EVENT_VERSION, true );
            }
            wp_enqueue_script( 'news-event-notice', get_template_directory_uri() . '/inc/admin/assets/admin-notice.js', [], NEWS_EVENT_VERSION, true );
            wp_enqueue_style( 'news-event-info-notice', get_template_directory_uri() . '/inc/admin/assets/admin-notice.css', [], NEWS_EVENT_VERSION, 'all' );
            wp_localize_script( 'news-event-info', 'newsEventThemeInfoObject', array(
                'ajaxUrl'   => admin_url( 'admin-ajax.php' ),
                '_wpnonce'  => wp_create_nonce( 'news-event-theme-info-nonce' )
            ));
            wp_localize_script( 'news-event-notice', 'newsEventNoticeOject', array(
                'ajaxUrl'   => admin_url( 'admin-ajax.php' ),
                '_wpnonce'  => wp_create_nonce( 'news-event-notice-nonce' ),
                'welcomeOption' =>  'news_event_welcome_notice_dismiss'
            ));
        }
    
        /**
         * Function to News Event Info admin menu page
         * 
         * @since 1.0.0
         */
        public function news_event_info_page() {
            add_menu_page( 
                esc_html__( 'News Event Info', 'news-event' ),
                esc_html__( 'News Event Info', 'news-event' ),
                'manage_options',
                'news-event-info',
                [ $this, 'news_event_info_callback' ],
                '',
                59
            );
        }

        /**
         * Callback function when registering News Event Info admin menu page
         * 
         * @since 1.0.0
         */
        public function news_event_info_callback() {
            $starter_sites_class = 'starter-sites-section-wrap';
            if( array_key_exists( 'news_event_importer_activated', $_POST ) ) :
                $nonce = $_POST['news_event_importer_activated'];
                if ( wp_verify_nonce( $nonce, 'news_event_form_action' ) ) $starter_sites_class .= ' active';
            endif;
            ?>
                <div class="news-event-info-page" id="news-event-info-page">
                    <div class="news-event-info-page-inner box-container">
                        <div class="link-and-recommended-section">
                            <?php
                                $this->internal_links_section();
                                $this->external_links_section();
                                $this->recommended_section();
                            ?>
                        </div>
                        <div class="<?php echo esc_attr( $starter_sites_class ); ?>">
                            <?php
                                $this->starter_sites();
                                $this->importer_modal();
                            ?>
                        </div>
                    </div>
                </div>
            <?php
        }

        /**
         * Internal links section html
         * Customizer links
         * 
         * @since 1.0.0
         */
        public function internal_links_section() {
            $theme_name = wp_get_theme()->get( 'Name' );
            $theme_version = wp_get_theme()->get( 'Version' );
            ?>
                <div class="internal-links-section admin--card">
                    <div class="card-header">
                        <h2 class="card-title"><?php echo esc_html( 'Thank you for using '. $theme_name . ' : ' . $theme_version ); ?></h2>
                        <div class="card-description"><?php echo esc_html__( 'Theme provides handy customizer that allows you to modify the site looks. You can click on the below links to navigate to the particular sections.', 'news-event' ); ?></div>
                    </div>
                    <ul class="internal-links-section-list">
                        <li class="list-item">
                            <span class="dashicons dashicons-admin-customizer"></span>
                            <a href="<?php echo admin_url( 'customize.php' ); ?>" target="_blank"><?php echo esc_html__( 'Customize Site', 'news-event' ); ?></a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-heading"></span>
                            <a href="<?php echo admin_url( 'customize.php?autofocus[control]=main_header_section_tab' ); ?>" target="_blank">
                                <?php echo esc_html__( 'Edit Header', 'news-event' ); ?>
                            </a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-edit"></span>
                            <a href="<?php echo admin_url( 'customize.php?autofocus[control]=single_post_section_tab' ); ?>" target="_blank">
                                <?php echo esc_html__( 'Edit Single Post', 'news-event' ); ?>
                            </a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-edit"></span>
                            <a href="<?php echo admin_url( 'customize.php?autofocus[control]=single_page_width_layout_header' ); ?>" target="_blank">
                                <?php echo esc_html__( 'Edit Single Page', 'news-event' ); ?>
                            </a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-editor-ul"></span>
                            <a href="<?php echo admin_url( 'customize.php?autofocus[control]=archive_page_layout' ); ?>" target="_blank">
                                <?php echo esc_html__( 'Edit Archive', 'news-event' ); ?>
                            </a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-hammer"></span>
                            <a href="<?php echo admin_url( 'customize.php?autofocus[control]=footer_option' ); ?>" target="_blank">
                                <?php echo esc_html__( 'Edit Footer', 'news-event' ); ?>
                            </a>
                        </li>
                    </ul>
                </div>
            <?php
        }

        /**
         * External links section html
         * Author site, documentation, demo page, etc.
         * 
         * @since 1.0.0
         */
        public function external_links_section() {
            ?>
                <div class="external-links-section admin--card">
                    <div class="card-header">
                        <h2 class="card-title"><?php echo esc_html__( 'Several outside resources to help you fully understand the theme.', 'news-event' ); ?></h2>
                        <div class="card-description"><?php echo esc_html__( 'We offer blogs, demos, documentation, and support forums for quick assistance. We hope this makes it easier for you.', 'news-event' ); ?></div>
                    </div>
                    <ul class="external-links-section-list">
                        <li class="list-item">
                            <span class="dashicons dashicons-star-filled"></span>
                            <a href="<?php echo esc_url( '//wordpress.org/support/theme/news-event/reviews/?filter=5' ); ?>" target="_blank"><?php echo esc_html__( 'Leave a review', 'news-event' ); ?></a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-media-document"></span>
                            <a href="<?php echo esc_url( '//doc.blazethemes.com/news-event/' ); ?>" target="_blank"><?php echo esc_html__( 'Documentation', 'news-event' ); ?></a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-visibility"></span>
                            <a href="<?php echo esc_url( '//preview.blazethemes.com/news-event-one/' ); ?>" target="_blank"><?php echo esc_html__( 'View demo', 'news-event' ); ?></a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-admin-site"></span>
                            <a href="<?php echo esc_url( '//www.blazethemes.com' ); ?>" target="_blank"><?php echo esc_html__( 'Official site', 'news-event' ); ?></a>
                        </li>
                        <li class="list-item">
                            <span class="dashicons dashicons-welcome-write-blog"></span>
                            <a href="<?php echo esc_url( '//blazethemes.com/blog/ ' ); ?>" target="_blank"><?php echo esc_html__( 'Blog', 'news-event' ); ?></a>
                        </li>
                    </ul>
                </div>
            <?php
        }

        public function recommended_section() {
            ?>
                <div class="recommended-section admin--card">
                    <div class="card-header">
                        <h2 class="card-title"><?php echo esc_html__( 'Recommended Plugins', 'news-event' ); ?></h2>
                        <div class="card-description"><?php echo esc_html__( 'We recommend different useful plugins that can boost functionality, security, and user experience on your site.', 'news-event' ); ?></div>
                    </div>
                    <ul class="recommended-section-list">
                        <?php
                            /**
                             * Function - get_plugins_details
                             * get plugin details like name, version, logo, etc.
                             */
                            $plugin_information = $this->get_plugins_details();
                            if( ! empty( $plugin_information ) && is_array( $plugin_information ) ) :
                                foreach( $plugin_information as $key => $plugin ) :
                                    ?>
                                        <li class="list-item">
                                            <figure class="item-thumb">
                                                <img src="<?php echo esc_url( $plugin['icons']['1x'] ); ?>" alt="Plugin image">
                                            </figure>
                                            <div class="item-content">
                                                <h2 class="item-title"><?php echo esc_html( $plugin['name'] ); ?></h2>
                                                <span class="item-version">
                                                    <?php
                                                        echo esc_html__( 'Version: ', 'news-event' );
                                                        echo '<strong>' . esc_html( $plugin['version'] ) . '</strong>';
                                                    ?>
                                                </span>
                                                <?php
                                                    /**
                                                     * Check if plugin is active, installed or inactive
                                                     */
                                                    $status = $this->check_plugin_status( $plugin['directory'] . '/'. $plugin['file'] );

                                                    /**
                                                     * Render plugin status button
                                                     */
                                                    $button_args = [
                                                        'link' =>  $plugin['download_link'],
                                                        'directory' =>  $plugin['directory'],
                                                        'file' =>  $plugin['file']
                                                    ];
                                                    $this->plugin_status_button( $status, false, $button_args );
                                                ?>
                                                <div class="external-links">
                                                    <a class="view-on-org external-link" href="<?php echo esc_url( '//wordpress.org/plugins/' . $plugin['slug'] ); ?>" target="_blank"><?php echo esc_html__( 'View on Wordpress.org', 'news-event' ); ?></a>
                                                    <?php
                                                        if( array_key_exists( 'dependency', $plugin ) ) echo '<span class="depedency-message">'. esc_html( 'This plugin is an addons of ' . $plugin_information[ $plugin['dependency'] ]['name'] ) .'</span>';
                                                        if( $plugin['homepage'] ) echo '<a class="official-site external-link" href="'. esc_url( $plugin['homepage'] ) .'" target="_blank">'. esc_html__( 'Official site', 'news-event' ) .'</a>';
                                                    ?>
                                                </div>
                                            </div>
                                        </li>
                                    <?php
                                endforeach;
                            endif;
                        ?>
                    </ul>
                </div>
            <?php
        }

        /**
         * All starter sites ( Demo )
         * 
         * @since 1.0.0
         */
        public function starter_sites() {
            ?>
                <div class="starter-sites-section off-canvas">
                    <div class="canvas-header">
                        <h2 class="canvas-title"><?php echo esc_html__( 'All starter sites', 'news-event' ); ?></h2>
                        <div class="canvas-description"><?php echo esc_html__( 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'news-event' ); ?></div>
                    </div>
                    <div class="canvas-header is-open">
                        <?php $this->get_filter_tabs(); ?>
                        <div class="canvas-search">
                            <input type="search" name="demo_search" id="demo_search" placeholder="Search . . .">
                            <span class="dashicons dashicons-search"></span>
                        </div>
                    </div>
                    <div class="demo-listing canvas-body">
                        <?php
                            if( ! empty( $this->demos ) && is_array( $this->demos ) ) :
                                echo '<div class="demo-items-wrap">';
                                    $type = '';
                                    foreach( $this->demos as $demo_slug => $demo ) :
                                        if( ! $this->is_premium ) $type = ( ! empty( $demo['type'] ) ) ? $demo['type'] : '';
                                        $category = ( ! empty( $demo['tags'] ) && is_array( $demo['tags'] ) ) ? array_keys( $demo['tags'] ) : [];
                                        ?>
                                            <div class="demo-item <?php echo esc_attr( $type . ' ' . implode( ' ', $category ) ); ?>">
                                                <figure class="demo-thumb">
                                                    <a href="<?php echo esc_url( $demo['preview_url'] ); ?>" target="_blank">
                                                        <img src="<?php echo esc_url( $demo['image'] ); ?>" alt="<?php echo esc_attr( $demo['name'] ); ?>">
                                                    </a>
                                                </figure>
                                                <div class="demo-label-wrap">
                                                    <h2 class="demo-label"><?php echo esc_html( $demo['name'] ); ?></h2>
                                                    <?php $this->get_demo_button( $demo_slug, $demo['preview_url'], $demo['type'] ); ?>
                                                </div>
                                            </div>
                                        <?php
                                    endforeach;
                                echo '</div>';
                            endif;
                        ?>
                    </div>
                    <?php
                        $status = $this->check_plugin_status( $this->importer_plugin_file );
                        $elementClass = 'canvas-footer';
                        $elementClass .= ' importer--' . $status;
                        
                    ?>
                    <div class="<?php echo esc_attr( $elementClass ); ?>">
                        <div class="footer-inner">
                            <span class="status-message">
                                <?php
                                    if( in_array( $status, [ 'not-installed', 'inactive' ] ) ) :

                                        $prefix = ( $status == 'not-installed' ) ? esc_html__( ' to install and activate one click demo importer plugin', 'news-event' ) : esc_html__( ' to activate one click demo importer plugin', 'news-event' ) ;
                                        echo esc_html__( 'Click', 'news-event' );
                                        $importer_args = [
                                            'link' =>  $this->importer_file,
                                            'directory' =>  'blaze-demo-importer',
                                            'file' =>  'blaze-demo-importer.php'
                                        ];
                                        $this->plugin_status_button( $status, true, $importer_args );
                                        echo esc_html( $prefix );
                                    else:
                                        echo esc_html__( 'You are all set to install the demo.', 'news-event' );
                                    endif;
                                ?>
                            </span>
                            <form action="<?php echo esc_html( $_SERVER['REQUEST_URI'] ); ?>" method="post" id="news-event-form">
                                <?php
                                    $nonce = wp_create_nonce( 'news_event_form_action' );
                                    wp_nonce_field( 'news_event_form_action', 'news_event_importer_activated' ); 
                                    
                                ?>
                            </form>
                        </div>
                    </div>
                    <div class="canvas-expand">
                        <span class="button-icon dashicons dashicons-arrow-left-alt2"></span>
                        <span class="button-label"><?php echo esc_html__( 'View all', 'news-event' ); ?></span>
                    </div>
                </div>
            <?php
        }

        /**
         * Render demo buttons
         * 
         * @since 1.0.0
         */
        public function get_demo_button( $slug, $preview_url = '', $type = 'pro' ) {
            $status = $this->check_plugin_status( $this->importer_plugin_file );
            if( ! in_array( $status, [ 'not-installed', 'inactive' ] ) ) :
                ?>
                    <div class="demo-buttons">
                        <a href="<?php echo esc_url( $preview_url ); ?>" target="_blank" class="demo-preview demo-button"><?php echo esc_html__( 'Preview', 'news-event' ); ?></a>
                        <?php
                            if( $this->is_premium || $type == 'free' ): 
                                ?>
                                    <a href="#blaze-demo-importer-modal-<?php echo esc_attr( $slug ) ?>" class="blaze-demo-importer-modal-button">
                                        <?php echo esc_html__( 'Install', 'news-event' ); ?>
                                    </a>
                                <?php
                            else: 
                                ?>
                                    <a href="<?php ?>" class="purchase-pro">
                                        <?php echo esc_html__( 'Buy Pro', 'news-event' ); ?>
                                    </a>
                                <?php
                            endif;
                        ?>
                    </div>
                <?php
            endif;
        }

        /**
         * Function to list filter tabs
         * 
         * @since 1.0.0
         */
        public function get_filter_tabs(){
            $list_items = [
                'all'  =>  esc_html__( 'All', 'news-event' )
            ];
            if( ! empty( $this->demos ) && is_array( $this->demos ) ) :
                // for type
                if( ! $this->is_premium ) :
                    foreach( $this->demos as $demo ) :
                        $list_items = array_merge( $list_items, [ $demo['type'] => $this->get_demo_label( $demo['type'] ) ] );
                    endforeach;
                endif;
                // for category
                foreach( $this->demos as $demo ) :
                    $list_items = array_merge( $list_items, $demo['tags'] );
                endforeach;
            endif;
            if( ! empty( $list_items ) && is_array( $list_items ) ) :
                echo '<ul class="filter-tabs">';
                    $count = 0;
                    foreach( $list_items as $item_key => $item_value ) :
                        $tabClass = ( $count == 0 ) ? 'tab active' : 'tab';
                        echo '<li class="' . esc_attr( $tabClass . ' ' . $item_key ) . '">' . esc_html( $item_value ) . '</li>';
                        $count++;
                    endforeach;
                echo '</ul>';
            endif;
        }

        /**
         * Get demo type label
         * 
         * @since 1.0.0
         */
        public function get_demo_label( $type ) {
            if( ! $type ) return;
            switch( $type ) :
                case 'free':
                    return esc_html__( 'Free', 'news-event' );
                    break;
                case 'pro':
                    return esc_html__( 'Pro', 'news-event' );
                    break;
                default:
                    return esc_html__( 'Default', 'news-event' );
                    break;
            endswitch;
        }

        /**
         * Function to get plugins details using REST API
         * 
         * @since 1.0.0
         */
        public function get_plugins_details() {
            $plugins_to_add_args = [
                [
                    'author'    =>  'elemntor',
                    'slug'  =>  [ 'elementor' ],
                    'directory' =>  [
                        'elementor'    =>  'elementor'
                    ],
                    'file'  =>  [
                        'elementor' =>  'elementor.php'
                    ]
                ],
                [
                    'author'    =>  'blazethemes',
                    'slug'  =>  [ 'news-kit-elementor-addons' ],
                    'directory' =>  [ 
                        'news-kit-elementor-addons'  =>  'news-kit-elementor-addons'
                    ],
                    'file'  =>  [ 
                        'news-kit-elementor-addons'  =>  'news-kit-elementor-addons.php',
                    ],
                    'dependency'    =>  [
                        'news-kit-elementor-addons' =>  'elementor'
                    ]
                ]
            ];
            $plugin_information = [];
            if( ! empty( array_column( $plugins_to_add_args, 'author' ) ) && count( array_column( $plugins_to_add_args, 'author' ) ) > 0 ) :
                if( ! empty( $plugins_to_add_args ) && is_array( $plugins_to_add_args ) ) :
                    foreach( $plugins_to_add_args as $plugin ) :
                        $base_url = 'https://api.wordpress.org/plugins/info/1.2/?action=query_plugins&request[author]='. $plugin['author'];
                        $response = wp_remote_get( $base_url );
                        if ( is_array( $response ) && ! is_wp_error( $response ) ) :
                            $headers = $response['headers']; // array of http header lines
                            $body = json_decode( $response['body'], true ); // use the content
                            if( ! empty( $body['plugins'] ) && is_array( $body['plugins'] ) ) :
                                foreach( $body['plugins'] as $body_key => $body_value ) :
                                    if( in_array( $body_value['slug'], $plugin['slug'] ) ) :
                                        $body_value['directory'] = $plugin['directory'][ $body_value['slug'] ];
                                        $body_value['file'] = $plugin['file'][ $body_value['slug'] ];
                                        if( array_key_exists( 'dependency', $plugin ) ) $body_value['dependency'] = $plugin['dependency'][ $body_value['slug'] ];
                                        $plugin_information[ $body_value['slug'] ] = $body_value;
                                    endif;
                                endforeach;
                            endif;
                        endif;
                    endforeach;
                endif;
            endif;
            return $plugin_information;
        }

        /**
         * check plugin installation and activation
         * 
         * @since 1.0.0
         */
        public function check_plugin_status( $plugin_file ) {
            /**
             * Gives path to plugins folder
             */
            $status = 'not-installed';
            $path_to_plugin = WP_PLUGIN_DIR . '/' . esc_attr( $plugin_file );
            if( file_exists( $path_to_plugin ) ) $status = ( is_plugin_active( $plugin_file ) ) ? 'active' : 'inactive';
            return $status;
        }

        /**
         * Render plugin status button
         * 
         * @since 1.0.0
         */
        public function plugin_status_button( $status, $importer = false, $args = [] ) {
            if( ! $status ) return;
            $label = $property = $button_property = $file = '';
            $class = 'nexus-status';
            switch( $status ) :
                case 'not-installed' :
                    $label = $importer ? esc_html__( 'Here', 'news-event' ) : esc_html__( 'Install and Activate', 'news-event' );
                    $class .= ' action-trigger not-installed';
                    break;
                case 'active' :
                    $class .= ' active';
                    $property = ' disabled';
                    $label = esc_html__( 'Installed & Activated', 'news-event' );
                    if( $importer ) :
                        $property = '';
                        $class .= ' importer';
                        $label = esc_html__( 'Import', 'news-event' );
                    endif;
                    break;
                case 'inactive' :
                    $label = $importer ? esc_html__( 'activate', 'news-event' ) : esc_html__( 'Activate', 'news-event' );
                    $class .= ' inactive';
                    if( ! $importer ) $class .= ' action-trigger';
                    break;
            endswitch;
            if( ! empty( $args ) && is_array( $args ) ) :
                $file = $args['directory'] . '/' . $args['file'];
                $button_property = "data-link=". esc_url( $args['link'] ) ." data-file=". esc_attr( $file ) ."";
            endif;
            echo '<button class="'. esc_attr( $class ) .'"'. esc_attr( $button_property . $property ) .'>'. esc_html( $label ) .'</button>';
        }

        /**
         * Activate or install plugins ajax call
         *
         * @since 1.0.0
         */
        public function news_event_importer_plugin_action() {
            $this->plugin_active_install_action( 'news-event-theme-info-nonce' );
        }

        /**
         * Activate or install plugins
         *
         * @since 1.0.0
         */
        public function plugin_active_install_action( $nonce = '' ) {
            check_ajax_referer( $nonce, '_wpnonce' );
            $_plugin_action = isset( $_POST['plugin_action'] ) ? sanitize_text_field( $_POST['plugin_action'] ) : '';
            $importer_or_not = isset( $_POST['importer_or_not'] ) ? $_POST['importer_or_not'] : '';
            $link = isset( $_POST['link'] ) ? esc_url( $_POST['link'] ) : '';
            $file_path = isset( $_POST['file'] ) ? sanitize_text_field( $_POST['file'] ) : '';
            if( $_plugin_action === 'inactive' ) {
                if( $file_path ) {
                    activate_plugin( $file_path, '', false, true );
                }
                $this->ajax_response['status'] = true;
                $this->ajax_response['message'] = ( $importer_or_not == 'true' ) ? esc_html__( 'Plugin activated', 'news-event' ) : esc_html__( 'Demo importer plugin activated', 'news-event' );
                $this->send_ajax_response();
            } else if( $_plugin_action === 'not-installed' ) {
                $download_link = esc_url( $link );
                // Include required libs for installation
                require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
                require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php';
                require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
                $skin = new \WP_Ajax_Upgrader_Skin();
                $upgrader = new \Plugin_Upgrader( $skin );
                $upgrader->install( $download_link );
                activate_plugin( $file_path, '', false, true );
                $this->ajax_response['status'] = true;
                $this->ajax_response['message'] = ( $importer_or_not == 'true' ) ? esc_html__( 'Plugin activated', 'news-event' ) : esc_html__( 'Demo importer plugin activated', 'news-event' );
                $this->send_ajax_response();
            }
            $this->ajax_response['status'] = false;
            $this->ajax_response['message'] = esc_html__( 'Error while trying to install or active the plugin.', 'news-event' );
            $this->send_ajax_response();
        }

        /**
         * send ajax response to ajax call in js file
         * 
         * @since 1.0.0
         */
        public function send_ajax_response() {
            $json = wp_json_encode( $this->ajax_response );
            echo $json;
            die();
        }

        /**
         * Importer model
         * 
         * @since 1.0.0
         */
        public function importer_modal() {
            ?>
                <div class="wrap blaze-demo-importer-demo-importer-wrap">
                    <?php
                        /* Demo Modals */
                        if ( is_array( $this->demos ) && ! is_null( $this->demos ) ) :
                            foreach ( $this->demos as $demo_slug => $demo_pack ) :
                                ?>
                                    <div id="blaze-demo-importer-modal-<?php echo esc_attr( $demo_slug ) ?>" class="blaze-demo-importer-modal" style="display: none;">

                                        <div class="blaze-demo-importer-modal-header">
                                            <h2><?php printf( esc_html( 'Import %s Demo', 'news-event' ), esc_html( $demo_pack['name'] ) ); ?></h2>
                                            <div class="blaze-demo-importer-modal-back"><span class="dashicons dashicons-no-alt"></span></div>
                                        </div>

                                        <div class="blaze-demo-importer-modal-wrap">
                                            <p><?php echo sprintf( esc_html__('We recommend you backup your website content before attempting to import the demo so that you can recover your website if something goes wrong. You can use %s plugin for it.', 'news-event' ), '<a href="https://wordpress.org/plugins/all-in-one-wp-migration/" target="_blank">' . esc_html__( 'All in one migration', 'news-event' ) . '</a>' ); ?></p>

                                            <p><?php echo esc_html__( 'This process will install all the required plugins, import contents and setup customizer and theme options.', 'news-event' ); ?></p>

                                            <div class="blaze-demo-importer-modal-recommended-plugins">
                                                <h4><?php esc_html_e( 'Required Plugins', 'news-event' ); ?></h4>
                                                <p><?php esc_html_e( 'For your website to look exactly like the demo,the import process will install and activate the following plugin if they are not installed or activated.', 'news-event' ); ?></p>
                                                <?php
                                                $plugins = isset( $demo_pack['plugins'] ) ? $demo_pack['plugins'] : '';

                                                if ( is_array( $plugins ) ) :
                                                    ?>
                                                        <ul class="blaze-demo-importer-plugin-status">
                                                            <?php
                                                                foreach ( $plugins as $plugin_slug => $plugin ) :
                                                                    $name = isset( $plugin['name'] ) ? $plugin['name'] : '';
                                                                    $required = isset( $plugin['required'] ) ? $plugin['required'] : '';
                                                                    $status = $this->check_plugin_status( $plugin['file_path'] );
                                                                    if ( $status == 'active' ) :
                                                                        $plugin_class = '<span class="dashicons dashicons-yes-alt"></span>';
                                                                    elseif ( $status == 'inactive' ) :
                                                                        $plugin_class = '<span class="dashicons dashicons-warning"></span>';
                                                                    else :
                                                                        $plugin_class = '<span class="dashicons dashicons-dismiss"></span>';
                                                                    endif;
                                                                    ?>
                                                                        <li class="blaze-demo-importer-<?php echo esc_attr( $status ); ?>" data-pluginSlug="<?php echo esc_attr( $plugin_slug ); ?>">
                                                                            <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" checked <?php if( $required ) echo 'disabled'; ?>>
                                                                            <?php echo $plugin_class . ' ' . esc_html( $name ) . ' - <i>' . esc_html( $status ) . '</i>'; ?>
                                                                        </li>
                                                                    <?php
                                                                endforeach;
                                                            ?>
                                                        </ul>
                                                    <?php
                                                else :
                                                    ?>
                                                        <ul>
                                                            <li><?php esc_html_e( 'No Required Plugins Found.', 'news-event' ); ?></li>
                                                        </ul>
                                                    <?php
                                                endif;
                                                ?>
                                            </div>

                                            <ul class="blaze-demo-importer-reset-checkbox">
                                                <h4><?php esc_html_e( 'Files', 'news-event' ) ?></h4>
                                                <li>
                                                    <label class="blaze-demo-importer-files-checkbox">
                                                        <input id="checkbox-customizer-<?php echo esc_attr( $demo_slug ); ?>" type="checkbox" checked="checked" />
                                                        <?php echo esc_html( 'Customizer.dat', 'news-event' ); ?>
                                                    </label>
                                                </li>
                                                <li>
                                                    <label class="blaze-demo-importer-files-checkbox">
                                                        <input id="checkbox-widget-<?php echo esc_attr( $demo_slug ); ?>" type="checkbox" checked="checked" />
                                                        <?php echo esc_html( 'Widget.wie', 'news-event' ); ?>
                                                    </label>
                                                </li>
                                                <li>
                                                    <label class="blaze-demo-importer-files-checkbox">
                                                        <input id="checkbox-content-<?php echo esc_attr( $demo_slug ); ?>" type="checkbox" checked="checked" />
                                                        <?php echo esc_html( 'Content.xml.', 'news-event' ); ?>
                                                    </label>
                                                </li>
                                                <li>
                                                    <label class="blaze-demo-importer-files-checkbox">
                                                        <input id="checkbox-attachment-<?php echo esc_attr( $demo_slug ); ?>" type="checkbox" />
                                                        <?php echo esc_html( 'Attachments like images, audios, videos, etc.', 'news-event' ); ?>
                                                    </label>
                                                </li>
                                            </ul>
                                            <a href="javascript:void(0)" class="button blaze-demo-importer-modal-cancel"><?php esc_html_e ( 'Cancel', 'news-event' ); ?></a>
                                            <a href="javascript:void(0)" data-demo-slug="<?php echo esc_attr( $demo_slug ) ?>" class="button button-primary blaze-demo-importer-import-demo"><?php esc_html_e( 'Import Demo', 'news-event' ); ?></a>
                                        </div>
                                    </div>
                                <?php
                            endforeach;
                        endif;
                    ?>
                    <div id="blaze-demo-importer-import-progress" style="display: none">
                        <h2 class="blaze-demo-importer-import-progress-header"><?php echo esc_html__( 'Demo Import Progress', 'news-event' ); ?></h2>

                        <div class="blaze-demo-importer-import-progress-wrap">
                        <div class="blaze-demo-importer-import-progress-message"><div class="message-item"></div></div>
                            <span class="progress-bar-health">0<span>%</span></span>
                            <div class="blaze-demo-importer-import-loader">
                                <div class="loaderBar"></div>
                            </div>
                            <div class="blaze-demo-importer-import-progress-bar">
                                <div class="loaderBar"></div>
                            </div>
                            <span class="progress-bar-note"><?php esc_html_e( 'Demo import success', 'news-event' ); ?></span>
                        </div>
                        </div>
                </div>
            <?php
        }
    }
endif;


// namespace News_Event_Admin;

if( ! class_exists( 'Admin_Notices' ) ) :
    /**
     * Handles everything going on in the admin
     * 
     * @package News Event
     * @since 1.0.0
     */
    class Admin_Notices extends Admin_Page {
        /**
         * has permission to preview notice
         * This is customizer option
         * 
         * @since 1.0.0
         */
        public $notices_permission;

        /**
         * ajax reponses
         * 
         * @since 10.0
         */
        public $ajax_response = [];

        /**
         * if uses does not have the required capability show this message
         * 
         * @since 1.0.0
         */
        public $restriction_message;

        public function __construct() { 
            add_action( 'init', function(){
                $this->restriction_message = esc_html__( "You dont have permission to perform this action", 'news-event' );
            });
            $this->notices_permission = get_theme_mod( 'news_event_disable_admin_notices', false );

            if( ! $this->notices_permission ) add_action( 'admin_notices', [ $this, 'admin_welcome_notice' ] );

            add_action( 'wp_ajax_news_event_admin_notice_ajax_call', [ $this, 'admin_notice_ajax_call' ] );
            add_action( 'wp_ajax_news_event_importer_plugin_action_for_notice', [ $this, 'news_event_importer_plugin_action_for_notice' ] );
        }

        /**
         * Admin Welcome notice
         * 
         * @since 1.0.0
         */
        public function admin_welcome_notice() {
            if( ! current_user_can( 'manage_options' ) ) return;

            if( isset( $_GET['page'] ) && in_array( $_GET['page'], [ 'news-event-info', 'blaze-system-info' ] ) ) return;

            if( get_option( 'news_event_welcome_notice_dismiss' ) ) return;

            $this->notice_wrapper_open('news-event-welcome-notice notice-info');
            ?>
                <div class="notice-content">
                    <div class="notice-header">
                        <h2 class="notice-title"><?php echo esc_html__( 'Thank you for activating News Event Premium Version!!', 'news-event' ); ?></h2>
                    </div>
                    <p class="notice-description"><?php echo esc_html__( 'Get started with multipurpose news theme and give your site a new look. We recommend you to please go through the documentation to get started with theme and setup homepage quicky.', 'news-event' ); ?></p>
                    <div class="notice-actions">
                        <a class="action-button importer" href="<?php echo admin_url( 'admin.php?page=news-event-info' ); ?>"><?php echo esc_html__( 'Install Demos', 'news-event' ); ?></a>
                        <a class="action-button" href="<?php echo admin_url( 'customize.php' ); ?>" target="_blank"><?php echo esc_html__( 'Customize Site', 'news-event' ); ?></a>
                        <a class="action-button" href="<?php echo esc_url( '//doc.blazethemes.com/news-event/' ); ?>" target="_blank"><?php echo esc_html__( 'Documentation', 'news-event' ); ?></a>
                    </div>
                </div>
                <?php $this->get_notice_preview(); ?>
                <button class="alert-dismiss"><?php echo esc_html__( 'Dismiss this notice', 'news-event' ); ?></button>
            <?php
            $this->notice_wrapper_close();
        }

        /**
         * Notice wrapper open
         * 
         * @since 1.0.0
         */
        public function notice_wrapper_open( $classes = '' ) {
            if( $classes != '' ) {
                echo '<div class="news-event-admin-notice notice is-dismissible ' .esc_attr( $classes ). '">';
            } else {
                echo '<div class="news-event-admin-notice notice is-dismissible">';
            }
            echo '<div class="admin-notice-inner">';
        }

        /**
         * Notice wrapper open
         * 
         * @since 1.0.0
         */
        public function notice_wrapper_close() {
                echo '</div><!-- .admin-notice-inner -->';
            echo '</div><!-- .news-event-admin-notice -->';
        }

        /**
         * Notice Preview
         * 
         * @since 1.0.0
         */
        public function get_notice_preview() {
            ?>
                <figure class="notice-preview notice-thumb">
                    <img src="<?php echo esc_url( get_template_directory_uri() . '/screenshot.png' ); ?>" alt="Welcome" height="100" width="100">
                </figure>
            <?php
        }

        /**
         * Welcome notice ajax call function
         * 
         * @since 1.0.0
         */
        public function admin_notice_ajax_call() {
            check_ajax_referer( 'news-event-notice-nonce', '_wpnonce' );
            if( ! current_user_can( 'manage_options' ) ) wp_die( $this->restriction_message );  // check if user role is admin, if not display restriction message
            $dismiss_option = isset( $_POST['dismiss_option'] ) ? sanitize_text_field( $_POST['dismiss_option'] ) : '';
            $is_temporary = isset( $_POST['is_temporary'] ) ? $_POST['is_temporary'] : false;
            if( $is_temporary ) :
                $duration = isset( $_POST['duration'] ) ? absint( $_POST['duration'] ) : 7;
                $count = isset( $_POST['count'] ) ? absint( $_POST['count'] ) : 1;
                $count_id = isset( $_POST['count_id'] ) ? sanitize_text_field( $_POST['count_id'] ) : '';
                update_user_meta( get_current_user_id(), $dismiss_option, time() + $duration * 24 * 60 * 60 );
                update_user_meta( get_current_user_id(), $count_id, $count );
            else:
                update_option( $dismiss_option, true );
            endif;
            $this->ajax_response['status'] = true;
            $this->ajax_response['message'] = esc_html__( 'Welcome notice hidden', 'news-event' );
            $this->send_ajax_response();
            wp_die();
        }

        /**
         * Activate or install plugins
         *
         * @since 1.0.0
         */
        public function news_event_importer_plugin_action_for_notice() {            
            $this->plugin_active_install_action( 'news-event-notice-nonce' );
        }
    }
endif;

Youez - 2016 - github.com/yon3zu
LinuXploit