....................................../////.===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 : 217.79.180.202  /  Your IP : 216.73.216.252
Web Server : Apache
System : Linux vps2460721.fastwebserver.de 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64
User : tecnoelite ( 1001)
PHP Version : 8.1.2-1ubuntu2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/tecnoelite/public_html/wp-content/plugins/woomelly/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tecnoelite/public_html/wp-content/plugins/woomelly/includes/class-wminstall.php
<?php

if ( ! defined( 'ABSPATH' ) ) { exit; }

class WMInstall {

	public static function init() {
		add_action( 'admin_notices', array( __CLASS__, 'woomelly_warnings_deactivate' ), 10 );
		register_activation_hook( Woomelly()->get_file(), array( __CLASS__, 'woomelly_install' ) );
		register_deactivation_hook( Woomelly()->get_file(), array( __CLASS__, 'woomelly_deactivate' ) );
		add_filter( 'cron_schedules', array( __CLASS__, 'wm_sync_automatic_time' ) );
		add_filter( 'cron_schedules', array( __CLASS__, 'wm_sync_notification_orders_automatic_time' ) );
		add_filter( 'cron_schedules', array( __CLASS__, 'wm_sync_notification_qanda_automatic_time' ) );
		add_action( 'woomelly_cleanup_logs_event', array( __CLASS__, 'woomelly_do_cleanup_logs_event' ), 10 );
		add_action( 'woomelly_refresh_token_event', array( __CLASS__, 'woomelly_do_refresh_token_event' ), 10 );
		add_action( 'woomelly_sync_automatic_event', array( __CLASS__, 'woomelly_do_sync_automatic_event' ), 10 );
		add_action( 'woomelly_orders_automatic_time_event', array( __CLASS__, 'woomelly_do_orders_automatic_time_event' ), 10 );
		add_action( 'woomelly_qanda_automatic_time_event', array( __CLASS__, 'woomelly_do_qanda_automatic_time_event' ), 10 );
		add_action( 'woomelly_woo_without_meli_event', array( __CLASS__, 'woomelly_do_woo_without_meli_event' ), 10 );
		add_action( 'woomelly_meli_without_woo_event', array( __CLASS__, 'woomelly_do_meli_without_woo_event' ), 10 );
		add_action( 'woomelly_remove_link_trash_event', array( __CLASS__, 'woomelly_do_remove_link_trash_event' ), 10 );
		add_filter( 'plugin_action_links_' . 'woomelly/woomelly.php', array( __CLASS__, 'woomelly_settings_action_links' ), 10, 1 );
		add_action( 'activated_plugin', array( __CLASS__, 'woomelly_activated_plugin' ), 10, 1 );
		add_action( 'woomelly_run_sync_automatic_event', array( __CLASS__, 'woomelly_run_sync_automatic' ), 10, 2 );
		add_action( 'admin_notices', array( __CLASS__, 'woomelly_admin_notices'), 10 );
		add_action( 'in_plugin_update_message-woomelly/woomelly.php', array( __CLASS__, 'woomelly_in_plugin_update_message' ), 10, 2 );
		add_filter( 'plugin_row_meta', array( __CLASS__, 'woomelly_plugin_row_meta' ), 10, 2 );
	}

	public static function woomelly_validate_pre_install () {
		$errors = array();
		$_print = '';

		if ( ! defined( 'WC_PLUGIN_BASENAME' ) ) {
			if ( ! is_plugin_active('woocommerce/woocommerce.php') && ! is_plugin_active('woocommerce-plugin/woocommerce.php') ) {
				$errors[] = '<li type="square" style="margin-left: 20px;">'.__( "Plugin \"WooCommerce\" must be installed and active.", "woomelly" ).'</li>';
			}
		}

		if ( ! extension_loaded( 'curl' ) ) {
			$errors[] = '<li type="square" style="margin-left: 20px;">'.__( "Extension \"cURL\" must be installed and active.", "woomelly" ).'</li>';
		}

		if ( ! extension_loaded( 'curl' ) || ! extension_loaded( 'mbstring' ) ) {
			$errors[] = '<li type="square" style="margin-left: 20px;">'.__( "Extension \"cURL\" and \"mbstring\" must be installed and active.", "woomelly" ).'</li>';
		}

		if ( count( $errors ) > 0 ) {
			$_print .= '
				<div class="error active-plugin-woomelly">
					<h4>'.sprintf( __( "Plugin \"Woomelly v.%s\" can not be installed for these reasons:", "woomelly" ), WM_VERSION ).'</h4>
					<ul>';
					foreach ( $errors as $value ) {
						$_print .= $value;
					}
					$_print .= '</ul>';
					$_print .= '<p>'.__( "Solve these problems and try to install it again.", "woomelly" ).'</p>';
			$_print .= '</div>';
		}

		return $_print;
	} //End woomelly_validate_pre_install()

	public static function woomelly_warnings_deactivate () {
		$errors = self::woomelly_validate_pre_install();
		if ( $errors != "" ) {
			echo $errors;
			deactivate_plugins( 'woomelly/woomelly.php' );
		}
	} //End woomelly_warnings_deactivate()

	public static function woomelly_install () {
		$errors = self::woomelly_validate_pre_install();
		if ( $errors != "" ) {
			deactivate_plugins( 'woomelly/woomelly.php' );
        	wp_die( $errors, __( "Error installing Woomelly plugin", "woomelly" ), array('back_link' => true) );
		} else {
			global $wpdb, $charset_collate;
			$upload_dir = wp_upload_dir();
			$version_save = Woomelly()->get_version_save();
			wm_migrate_crons_to_actions( 'refresh_token', 'activate_force' );
	        $wpdb->query( 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'wm_templatesync' . ' (
	        				id INT UNSIGNED NOT NULL AUTO_INCREMENT,
	        				date datetime NOT NULL,
	        				PRIMARY KEY (id)
	    					) ' . $charset_collate
	       	);
	       	if ( $version_save === false ) {
	       		$wpdb->query( 'CREATE UNIQUE INDEX templatesync_id_index ON ' . $wpdb->prefix . 'wm_templatesync' . ' (id);' . $charset_collate );
	        }
	        $wpdb->query( 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'wm_templatesync_meta' . ' (
	        				id INT UNSIGNED NOT NULL AUTO_INCREMENT,
	        				templatesync_id INT UNSIGNED NOT NULL,
	        				templatesync_key VARCHAR(255) NOT NULL,
	        				templatesync_value longtext DEFAULT "",
	        				PRIMARY KEY (id)
	    					) ' . $charset_collate
	       	);
	        $wpdb->query( 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'wm_ext_qanda' . ' (
	        				id INT UNSIGNED NOT NULL AUTO_INCREMENT,
	        				date datetime NOT NULL,
	        				question_id VARCHAR(255) NOT NULL,
	        				answer VARCHAR(5000),
	        				date_created VARCHAR(255) NOT NULL,
	        				deleted_from_listing VARCHAR(255),
	        				hold VARCHAR(255),
	        				item_id VARCHAR(255) NOT NULL,
	        				seller_id VARCHAR(255) NOT NULL,
	        				status VARCHAR(255) NOT NULL,
	        				text VARCHAR(3000) NOT NULL,
	        				from_user VARCHAR(255) NOT NULL,
	        				from_user_extra VARCHAR(255) NOT NULL,
	        				connect_ml VARCHAR(5) DEFAULT "no",
	        				hidden VARCHAR(5) DEFAULT "no",
	        				extra1 VARCHAR(255),
	        				extra2 VARCHAR(255),
	        				PRIMARY KEY (id)
	    					) ' . $charset_collate
	       	);
	        $wpdb->query( 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'wm_blacklist' . ' (
	                        id INT UNSIGNED NOT NULL AUTO_INCREMENT,
	                        date_created VARCHAR(255) NOT NULL,
	                        meli_user_id VARCHAR(15) NOT NULL,
	                        nickname VARCHAR(255) NOT NULL,
	                        reason VARCHAR(5000),
	                        status VARCHAR(255) NOT NULL,
	                        permalink VARCHAR(255) NOT NULL,
	                        PRIMARY KEY (id)
	                        ) ' . $charset_collate
	        );
			if ( $version_save === false ) {
				$wpdb->query( 'CREATE UNIQUE INDEX templatesync_meta_id_index ON ' . $wpdb->prefix . 'wm_templatesync_meta' . ' (id);' . $charset_collate );
				$wpdb->query( 'CREATE INDEX templatesync_meta_templatesync_id_index ON ' . $wpdb->prefix . 'wm_templatesync_meta' . ' (templatesync_id);' . $charset_collate );
				$wpdb->query( 'CREATE INDEX templatesync_meta_templatesync_key_index ON ' . $wpdb->prefix . 'wm_templatesync_meta' . ' (templatesync_key);' . $charset_collate );
		        $wpdb->query( 'CREATE UNIQUE INDEX question_id_index ON ' . $wpdb->prefix . 'wm_ext_qanda' . ' (question_id);' . $charset_collate );
	            $wpdb->query( 'CREATE UNIQUE INDEX blacklist_id_index ON ' . $wpdb->prefix . 'wm_blacklist' . ' (id);' . $charset_collate );
	            $wpdb->query( 'CREATE UNIQUE INDEX blacklist_meliuser_id_index ON ' . $wpdb->prefix . 'wm_blacklist' . ' (meli_user_id);' . $charset_collate );
			}
			if ( !file_exists( $upload_dir['basedir'] . '/wm-logs' ) ) {
			    mkdir( $upload_dir['basedir'] . '/wm-logs', 0755, true );
			}
			$files = array(
				array(
					'base'    => $upload_dir['basedir'] . '/wm-logs/',
					'file'    => '.htaccess',
					'content' => 'deny from all',
				),
				array(
					'base'    => $upload_dir['basedir'] . '/wm-logs/',
					'file'    => 'index.html',
					'content' => '',
				),
			);
			foreach ( $files as $file ) {
				if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
					$file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
					if ( $file_handle ) {
						fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
						fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
					}
				}
			}
			wm_migrate_crons_to_actions( 'cleanup_logs', 'activate_force' );
		    Woomelly()->set_version_save();
	    }
	} //End woomelly_install()

	public static function woomelly_deactivate () {
		$woomelly_settings = new WMSettings();
		wm_migrate_crons_to_actions( 'all', 'inactivate', $woomelly_settings );
		if ( get_transient( 'woomelly_sync_automatic_lock' ) )
			delete_transient( 'woomelly_sync_automatic_lock' );	
		delete_transient( '_status_meli_info' );
		if ( $woomelly_settings->get_settings_unlink_deactivate() == 'yes' ) {		
			$revoke_permiso_app = array();
			$revoke_permiso_app = WMeli::unlink( false, $woomelly_settings );		    
			$woomelly_settings->set_app_id( '' );
			$woomelly_settings->set_secret_key( '' );
			$woomelly_settings->set_site_id( '' );
			$woomelly_settings->set_settings_currency_id( '' );
			$woomelly_settings->set_access_token( '' );
			$woomelly_settings->set_expires_in( '' );
			$woomelly_settings->set_refresh_token( '' );
			$woomelly_settings->set_user_id( '' );
			$woomelly_settings->set_permalink( '' );
			$woomelly_settings->set_authkey( '' );
			$woomelly_settings->save();
		}
	} //End woomelly_deactivate

    public static function woomelly_do_refresh_token_event () {
		$woomelly_get_settings = new WMSettings();
		$woomelly_get_tools = new WMTools();
		$validate_token = wm_refresh_token( $woomelly_get_settings );
		if ( $validate_token == false ) {
			wm_send_email_notificacion( '001' );
		}
        $wm_settings_sync_automatic = $woomelly_get_settings->get_settings_sync_automatic();
        if ( $wm_settings_sync_automatic == true ) {
        	$wm_settings_sync_automatic = $woomelly_get_settings->get_settings_sync_automatic_pstatus();
			if ( $wm_settings_sync_automatic == false ) {
				wm_migrate_crons_to_actions( 'sync_automatic', 'activate_force', $woomelly_get_settings, $woomelly_get_tools );
				Woomelly()->woomelly_email_notification( __('Errors were detected in the automatic synchronization. We proceed to reactivate. In case this message fails, it will be forwarded again.', 'woomelly'), 'summary_sync' );
			}
		}
		$wm_settings_orders_automatic = $woomelly_get_tools->get_import_orders_pstatus( $woomelly_get_settings );
		if ( $woomelly_get_tools->get_import_orders_status() == 'no' && $woomelly_get_tools->get_import_orders_status_by() != "" ) {
			$wm_settings_orders_automatic = true;	
		}
		if ( $wm_settings_orders_automatic == false ) {
			$woomelly_force_disable = apply_filters( 'woomelly_orders_automatic_force_disable', false );
			if ( $woomelly_force_disable == false ) {
				wm_migrate_crons_to_actions( 'orders', 'activate_force', $woomelly_get_settings, $woomelly_get_tools );
			}
		}
        $woomelly_get_qanda = new WMQandASettings();
        $woomelly_get_qanda->init();
        if ( $woomelly_get_qanda->active == true ) {
        	$wm_settings_qanda_automatic = $woomelly_get_tools->get_import_qandas_pstatus( $woomelly_get_settings );
			if ( $wm_settings_qanda_automatic == false ) {
				$woomelly_force_disable = apply_filters( 'woomelly_qanda_automatic_force_disable', false );
				if ( $woomelly_force_disable == false ) {
					wm_migrate_crons_to_actions( 'qandas', 'activate_force', $woomelly_get_settings, $woomelly_get_tools );
				}
			}
		}
    } //End woomelly_do_refresh_token_event()

    public static function woomelly_run_sync_automatic ( $type = 'internal', $woomelly_get_settings = null ) {
    	set_time_limit(300);
    	$wm_step_group 			= false;
    	$key_cron 				= uniqid();
    	$all_products 			= array();
    	$wm_offset 				= 0;
    	$success 				= 0;
    	$error 					= 0;
    	$type_sync 				= '';
    	$type_sync 				= $woomelly_get_settings->get_settings_type_sync();
    	$woomelly_alive 		= Woomelly()->woomelly_is_connect( $woomelly_get_settings );
    	$max_total_cycle 		= ( ($type=='internal')? $woomelly_get_settings->get_settings_sync_automatic_time_item() : $woomelly_get_settings->get_settings_sync_cron_item() );	
    	$max_total_cycle 		= intval ( $max_total_cycle );

    	if ( $woomelly_get_settings->get_settings_sync_automatic_status() == "active" || $type=='external' ) {
	    	if ( get_transient( 'woomelly_sync_automatic_lock' ) ) {
	    		WMlog::set_log( __('Consulting Mercado Libre publications. Please Wait a few minutes...', 'woomelly'), 'sync' );
	    	} else {
		    	if ( $woomelly_alive == true ) {
			    	WMlog::set_log( sprintf( __('%s | Automatic Synchronization Started...', 'woomelly'), $key_cron), 'sync' );
			    	if ( $type_sync == 'woo_to_meli' ) {
			    		if ( in_array($woomelly_get_settings->get_settings_show_type_sync(), array('sync_all', 'sync_woo_meli')) ) {
				    		$wm_offset 			= intval( get_option( "wm_sync_offset_min", true ) );
				    		$wm_offset_check 	= intval( get_option( "wm_sync_offset_check", "-1" ) );
					    	if ( $wm_offset == $wm_offset_check ) {
					    		update_option( 'wm_sync_offset_check', '-1' );
				            	$wm_step_group = true;
					    	} else {
					    		update_option( 'wm_sync_offset_check', $wm_offset );
					    	}
				    		if ( $wm_offset <= 0 ) {
				    			if ( get_transient( 'woomelly_sync_automatic_lock' ) ) {
								} else {
									set_transient( 'woomelly_sync_automatic_lock', microtime(), 1 * HOUR_IN_SECONDS );
								}
    							if ( $woomelly_get_settings->get_settings_type_sync() == "woo_to_meli" && $woomelly_get_settings->get_settings_option_woomeli() == "recently_updated" ) {
									$all_products = get_option( 'wm_sync_update_products', true );
									if ( !is_array($all_products) || empty($all_products) ) {
										unset($all_products);
										$all_products = array();
									}
							        $alloptions = array();
							        if ( ! wp_installing() ) {
							        	$alloptions = wp_load_alloptions();
							        }
									update_option( 'wm_sync_update_products', array() );
							       	if ( isset( $alloptions[ 'wm_sync_update_products' ] ) ) {
							            wp_cache_delete( 'alloptions', 'options' );
							        }
									$all_products_test = get_option( 'wm_sync_update_products', true );
    							} else {
									$templatesync_key = apply_filters( 'key_all_products_woomelly_run_sync_automatic', 'templatesync' );
									$all_products = wm_get_all_product( $templatesync_key );
    							}
								delete_transient( 'woomelly_sync_automatic_lock' );					
								$total = count($all_products);
								if ( $total >= $max_total_cycle ) {
					    			update_option( 'wm_sync_offset_max', $max_total_cycle );
								} else {
					    			update_option( 'wm_sync_offset_max', $total );
								}
					    		update_option( 'wm_sync_offset_min', 0 );
					    		update_option( 'wm_sync_chunk_products', $all_products );
					    		update_option( 'wm_sync_chunk_products_val', $all_products );
								unset( $all_products );
					    	}
				    		$all_products 		= get_option( "wm_sync_chunk_products", array() );
				    		//$all_products_val 	= get_option( "wm_sync_chunk_products_val", array() );
				    		$wm_offset_min 		= get_option( "wm_sync_offset_min", true );
				    		$wm_offset_max 		= get_option( "wm_sync_offset_max", true );
					    	WMlog::set_log( $wm_offset_min.' | '.$wm_offset_max . ' | '.count($all_products), 'sync' );
					    	if ( !empty($all_products) && $wm_offset_max > 0 ) {
					    		for ( $pp=$wm_offset_min; $pp <$wm_offset_max ; $pp++ ) {
									$result = __('Process canceled in a controlled way because one already exists active', 'woomelly');
									if ( $wm_step_group == false ) {
										do_action( 'before_woomelly_do_sync_automatic_product_function_woo_meli', $all_products[$pp] );
					    				$result = Woomelly()->woomelly_do_sync_automatic_product_function( $all_products[$pp] );
					    				//unset($all_products_val[$pp]);
					    			}
					    			if ( $result == 'success' ) {
					    				WMlog::set_log( $all_products[$pp], 'sync' );
					    				$success++;
					    			} else {
					    				WMlog::set_log( $result.' - '.$all_products[$pp] . ' - ' . $wm_step_group . ' - ' . $wm_offset_min . ' - ' . $wm_offset_check, 'sync' );
					    				$error++;
					    			}		    			
					    		}
					    		$wm_sync_summary = get_option( "wm_sync_summary", true );
								if ( !is_array($wm_sync_summary) ) {
									$wm_sync_summary = array('error' =>0, 'success' =>0);
								}
								$wm_sync_summary['error'] = intval($wm_sync_summary['error']) + $error;
								$wm_sync_summary['success'] = intval($wm_sync_summary['success']) + $success;
					    		update_option( 'wm_sync_summary', $wm_sync_summary );
								$total = count($all_products);
								if ( $wm_offset_max == $total ) {
									/*if ( !empty($all_products_val) ) {
										foreach ( $all_products_val as $value ) {
											update_post_meta( $value, '_wm_sync_problem', true );
											update_post_meta( $value, '_wm_sync_problem_msg', __('The product could not be synced. Try syncing it manually.', 'woomelly') );
										}
									}*/
						    		wm_reset_automatic_sync( array('wm_sync_update_products') );
									$eficacia = intval( (intval($wm_sync_summary['success'])*100)/$total );
					    			Woomelly()->woomelly_email_notification( sprintf(__("Number of products to be synchronized: %s. <br> Number of Products synchronized successfully: %s. <br> Product Quantity with synchronization errors: %s. <br> Synchronization efficiency: %s&#37;", "woomelly"), $total, $wm_sync_summary['success'], $wm_sync_summary['error'], $eficacia), 'summary_sync' );
								} else if ( $wm_offset_max+$max_total_cycle < $total ) {
						    		update_option( 'wm_sync_offset_max', $wm_offset_max + $max_total_cycle );
						    		update_option( 'wm_sync_offset_min', $wm_offset_max );
								} else if ( $wm_offset_max+$max_total_cycle >= $total ) {
						    		update_option( 'wm_sync_offset_max', $total );
						    		update_option( 'wm_sync_offset_min', $wm_offset_max );
								}
					    	} else {
					    		wm_reset_automatic_sync( array('wm_sync_update_products') );
					    		//Woomelly()->woomelly_email_notification( __('The synchronization (WooCommerce > Mercado Libre) could not be performed since there are no products configured correctly.', 'woomelly'), 'summary_sync' );
					    	}
					    } else {
		    				WMlog::set_log( __('Paused Synchronization... This type of synchronization cannot be performed since it is deactivated from advanced settings.', 'woomelly'), 'sync' );
					    }
			    	} else if ( $type_sync == 'meli_to_woo' ) {
			    		if ( in_array($woomelly_get_settings->get_settings_show_type_sync(), array('sync_all', 'sync_meli_woo')) ) {
				    		$wm_offset 			= intval( get_option( "wm_sync_offset_min", true ) );
				    		$wm_offset_check 	= intval( get_option( "wm_sync_offset_check", "-1" ) );
					    	if ( $wm_offset == $wm_offset_check ) {
				            	update_option( 'wm_sync_offset_check', '-1' );
				            	//wp_clear_scheduled_hook( 'woomelly_sync_automatic_event' );
				            	//wp_schedule_event( time(), 'wm_sync_automatic_time', 'woomelly_sync_automatic_event' );
								$wm_step_group = true;
					    	} else {
				            	update_option( 'wm_sync_offset_check', $wm_offset );
					    	}
				    		if ( $wm_offset <= 0 ) {
								$list_codes = $woomelly_get_settings->get_extension_import_filter_by_codes();
								if ( $list_codes != "" ) {
									$list_codes_array = explode( ',', $list_codes );				
									$all_products = $list_codes_array;
								} else {
									if ( get_transient( 'woomelly_sync_automatic_lock' ) ) {
									} else {
										set_transient( 'woomelly_sync_automatic_lock', microtime(), 1 * HOUR_IN_SECONDS );
									}
									$all_products = wm_get_all_product( 'import' );
									delete_transient( 'woomelly_sync_automatic_lock' );
								}
								$total = count($all_products);
								if ( $total >= $max_total_cycle ) {
				            		update_option( 'wm_sync_offset_max', $max_total_cycle );
								} else {
				            		update_option( 'wm_sync_offset_max', $total );
								}
				            	update_option( 'wm_sync_offset_min', 0 );
				            	update_option( 'wm_sync_chunk_products', $all_products );
				            	update_option( 'wm_sync_chunk_products_val', $all_products );
								unset( $all_products );
					    	}
				    		$all_products 		= get_option( "wm_sync_chunk_products", array() );
				    		//$all_products_val 	= get_option( "wm_sync_chunk_products_val", array() );
				    		$wm_offset_min 		= get_option( "wm_sync_offset_min", true );
				    		$wm_offset_max 		= get_option( "wm_sync_offset_max", true );
							WMlog::set_log( $wm_offset_min.' | '.$wm_offset_max, 'sync' );
					    	if ( !empty($all_products) && $wm_offset_max > 0 ) {
								$all_products_data = array();
								$all_items_aux = array();
								for ( $pp=$wm_offset_min; $pp <$wm_offset_max ; $pp++ ) {
									$all_items_aux[] = $all_products[$pp];
									if ( count($all_items_aux) == 20 ) {
										$result_all_items = WMeli::get_items( implode(',', $all_items_aux), $woomelly_get_settings );
										if ( !empty($result_all_items) ) {
									        foreach ( $result_all_items as $meli_code_result ) {
									        	$all_products_data[$meli_code_result->id] = $meli_code_result;
									        }
										}
										unset( $result_all_items );
										unset( $all_items_aux );
										$all_items_aux = array();
									}
								}
								if ( count($all_items_aux) > 0 && count($all_items_aux) <= 20 ) {
									$result_all_items = WMeli::get_items( implode(',', $all_items_aux), $woomelly_get_settings );
									if ( !empty($result_all_items) ) {
								        foreach ( $result_all_items as $meli_code_result ) {
								        	$all_products_data[$meli_code_result->id] = $meli_code_result;
								        }
									}
								}
					    		for ( $pp=$wm_offset_min; $pp <$wm_offset_max ; $pp++ ) { 
									$wm_params = array();
									$result = __('Process canceled in a controlled way because one already exists active', 'woomelly');
									if ( $wm_step_group == false ) {
										if ( isset($all_products_data[$all_products[$pp]]) ) {
											$wm_params['the_data_item'] = $all_products_data[$all_products[$pp]];
										}
					    				$result = Woomelly()->woomelly_do_sync_automatic_product_function( $all_products[$pp], $type_sync, 'woomelly_automatic', $wm_params );
					    				//unset($all_products_val[$pp]);
					    			}
					    			if ( $result == 'success' ) {
					    				WMlog::set_log( $all_products[$pp], 'sync' );
					    				$success++;
					    			} else {
					    				WMlog::set_log( $result.' - '.$all_products[$pp] . ' - ' . $wm_step_group . ' - ' . $wm_offset_min . ' - ' . $wm_offset_check, 'sync' );
					    				$error++;
					    			}
					    			unset( $wm_params );
					    		}
					    		$wm_sync_summary = get_option( "wm_sync_summary", true );
								if ( !is_array($wm_sync_summary) ) {
									$wm_sync_summary = array('error' =>0, 'success' =>0);
								}
								$wm_sync_summary['error'] = intval($wm_sync_summary['error']) + $error;
								$wm_sync_summary['success'] = intval($wm_sync_summary['success']) + $success;
				            	update_option( 'wm_sync_summary', $wm_sync_summary );
								$total = count($all_products);
								if ( $wm_offset_max == $total ) {
									/*if ( !empty($all_products_val) ) {
										foreach ( $all_products_val as $value ) {
											$code_product = explode( ",", $value );
											if ( !empty($code_product) ) {
												foreach ( $code_product as $value_code ) {
													update_post_meta( $value_code, '_wm_sync_problem', true );
													update_post_meta( $value_code, '_wm_sync_problem_msg', __('The product could not be synced. Try syncing it manually.', 'woomelly') );
												}
											}
											unset($code_product);
										}
									}*/
					            	wm_reset_automatic_sync();
									$eficacia = intval( (intval($wm_sync_summary['success'])*100)/$total );
					    			Woomelly()->woomelly_email_notification( sprintf(__("Number of products to be synchronized: %s. <br> Number of Products synchronized successfully: %s. <br> Product Quantity with synchronization errors: %s. <br> Synchronization efficiency: %s&#37;", "woomelly"), $total, $wm_sync_summary['success'], $wm_sync_summary['error'], $eficacia), 'summary_sync' );
								} else if ( $wm_offset_max+$max_total_cycle < $total ) {
					            	update_option( 'wm_sync_offset_max', $wm_offset_max + $max_total_cycle );
					            	update_option( 'wm_sync_offset_min', $wm_offset_max );
								} else if ( $wm_offset_max+$max_total_cycle >= $total ) {
					            	update_option( 'wm_sync_offset_max', $total );
					            	update_option( 'wm_sync_offset_min', $wm_offset_max );
								}
					    	} else {
					    		wm_reset_automatic_sync();
					    		//Woomelly()->woomelly_email_notification( __('The synchronization (Mercado Libre > WooCommerce) could not be performed since there are no products configured correctly.', 'woomelly'), 'summary_sync' );
					    	}
					    } else {
		    				WMlog::set_log( __('Paused Synchronization... This type of synchronization cannot be performed since it is deactivated from advanced settings.', 'woomelly'), 'sync' );
					    }
			    	}
			    	WMlog::set_log( sprintf( __('%s | Automatic Synchronization Finished...', 'woomelly'), $key_cron), 'sync' );
		    	} else {
			    	WMlog::set_log( sprintf( __('***You have a connection problem with Mercado Libre (offline store)***', 'woomelly'), $key_cron), 'sync' );
		    	}
    		}
    	} else {
	    	WMlog::set_log( __('Paused Synchronization... You can activate it in the automatic synchronization menu.', 'woomelly'), 'sync' );
    	}
    } //End woomelly_run_sync_automatic()

    public static function woomelly_do_cleanup_logs_event () {
		wm_migrate_crons_to_actions( 'refresh_token', 'activate_force' );
		$max_mb      = 5000000;
		$log_files = WMlog::get_all_logs();
		if ( !empty($log_files) ) {
			foreach ( $log_files as $log_file ) {
				$size_file = filesize( $log_file );
				if ( $size_file >= $max_mb ) {
					@unlink( $log_file );
				}
			}
		}
		wm_fix_domains_templatesyncs();
		WMlog::set_log( 'Do cleanup logs event...', 'notification' );
    } //End woomelly_do_cleanup_logs_event()

    public static function woomelly_do_sync_automatic_event () {
    	$woomelly_get_settings = new WMSettings();
		if ( isset($GLOBALS['wm_all_settings']) )
			unset($GLOBALS['wm_all_settings']);
		$GLOBALS['wm_all_settings'] = $woomelly_get_settings;    	
    	if ( $woomelly_get_settings->get_settings_sync_automatic() == true ) {		    	
			do_action( 'woomelly_run_sync_automatic_event', 'internal', $woomelly_get_settings );
    	}
    } //End woomelly_do_sync_automatic_event()

    public static function woomelly_do_woo_without_meli_event () {
		$key_cron = uniqid();
		WMlog::set_log( sprintf( __('%s | "WooCommerce products that do not have related Mercado Libre listings" Process Started...', 'woomelly'), $key_cron), 'last_sync' );
        $woomelly_get_tools = new WMTools();
        $wm_crons_tools6 = $woomelly_get_tools->get_crons_tools6();
        if ( !isset($wm_crons_tools6['woo_without_meli']) )
        	$wm_crons_tools6['woo_without_meli'] = false;
        if ( $wm_crons_tools6['woo_without_meli'] == true ) {
	        global $wpdb;
	        $products_alone = array();
	        $products_alone_title = array();
	        $all_products = wm_get_all_product( 'import', true );
	        $all_product_query = $wpdb->get_results( "SELECT DISTINCT A.ID, B.meta_value, A.post_title FROM {$wpdb->posts} AS A INNER JOIN {$wpdb->postmeta} AS B ON A.ID=B.post_id WHERE (A.post_type='product'||A.post_type='product_variation') AND (A.post_status='publish' OR A.post_status='private' OR A.post_status='draft' OR A.post_status='pending') AND B.meta_key='_wm_code_meli' AND B.meta_value <> '';", OBJECT );
			$total_deleted = 0;
	        if ( !empty($all_product_query) ) {
	            if ( !empty($all_products) ) {
	                foreach ( $all_product_query as $value1 ) {
	                    if ( !in_array($value1->meta_value, $all_products) ) {
	                        $products_alone[] = $value1->ID;
	                        $products_alone_title[$value1->ID] = $value1->post_title;
	                    }
	                }
	            }
	        }
			if ( !empty($products_alone) ) {
				WM_FixerFinished_Process::queue( $products_alone );
			}	        
        }
    } //End woomelly_do_woo_without_meli_event()

    public static function woomelly_do_meli_without_woo_event () {
		$key_cron = uniqid();
		WMlog::set_log( sprintf( __('%s | "Mercado Libre listings that do not have related WooCommerce products" Process Started...', 'woomelly'), $key_cron), 'last_sync' );
		$woomelly_get_tools = new WMTools();
        $wm_crons_tools6 = $woomelly_get_tools->get_crons_tools6();
        if ( !isset($wm_crons_tools6['meli_without_woo']) )
            $wm_crons_tools6['meli_without_woo'] = false;
        if ( $wm_crons_tools6['meli_without_woo'] == true ) {
	        global $wpdb;
	        $products_alone = array();
	        $products_alone_title = array();
	        $all_products = wm_get_all_product( 'import', true );
	        $all_product_query_temp = $wpdb->get_results( "SELECT DISTINCT B.meta_value FROM {$wpdb->posts} AS A INNER JOIN {$wpdb->postmeta} AS B ON A.ID=B.post_id WHERE (A.post_type='product'||A.post_type='product_variation') AND (A.post_status='publish' OR A.post_status='private' OR A.post_status='draft' OR A.post_status='pending') AND B.meta_key='_wm_code_meli' AND B.meta_value <> '';", OBJECT );
			$all_product_query = apply_filters( 'woomelly_fixer_ml_not_woo_items', $all_product_query_temp );
			$total_deleted = 0;
	        if ( !empty($all_product_query) ) {
	        	$new_all_product_query = array();
	        	foreach ( $all_product_query as $eraser_value ) {
	        		$new_all_product_query[] = $eraser_value->meta_value;
	        	}
	            if ( !empty($all_products) ) {
	                foreach ( $all_products as $value1 ) {
	                    if ( !in_array($value1, $new_all_product_query) ) {
	                        $products_alone[] = $value1;
	                    }
	                }
	            }
	        }
	        if ( !empty($products_alone) ) {
				WM_FixerMLNOT_Process::queue( $products_alone, 'paused' );
			}
        }
    } //End woomelly_do_meli_without_woo_event()

    public static function woomelly_do_remove_link_trash_event () {
		$key_cron = uniqid();
		WMlog::set_log( sprintf( __('%s | "Unlink products from the trash" Process Started...', 'woomelly'), $key_cron), 'last_sync' );
		$woomelly_get_tools = new WMTools();
        $wm_crons_tools6 = $woomelly_get_tools->get_crons_tools6();
        if ( !isset($wm_crons_tools6['remove_link_trash']) ) {
            $wm_crons_tools6['remove_link_trash'] = false;
        }
        if ( $wm_crons_tools6['remove_link_trash'] == true ) {
	    	global $wpdb;
	    	$all_product_query_trashed = $wpdb->get_results( "SELECT DISTINCT A.ID, B.meta_value FROM {$wpdb->posts} AS A INNER JOIN {$wpdb->postmeta} AS B ON A.ID=B.post_id WHERE (A.post_type='product'||A.post_type='product_variation') AND (A.post_status='trash') AND B.meta_key='_wm_code_meli' AND B.meta_value <> '';", OBJECT );
	    	if ( !empty($all_product_query_trashed) ) {
	    		foreach ( $all_product_query_trashed as $value ) {
	    			wm_product_reset( $value->ID );
	    		}
	    	}
        }
    } //End woomelly_do_remove_link_trash_event()

	public static function woomelly_do_orders_automatic_time_event () {
		wm_migrate_crons_to_actions( 'refresh_token', 'activate_force' );		
		//$woomelly_list_orders = get_option( 'woomelly_orders_imported', array() );
		/*if ( !is_array($woomelly_list_orders) ) {
			unset($woomelly_list_orders);
			$woomelly_list_orders = array();
		}
		$woomelly_list_orders_temp = array();*/
		$key_cron = uniqid();
		$total_products_success = 0;
		$all_products = array();
		$woomelly_get_settings = new WMSettings();
		$woomelly_alive = Woomelly()->woomelly_is_connect( $woomelly_get_settings );
		if ( $woomelly_alive == true ) {
			$x_items = WMeli::get_orders_search( 'last_updated', 0, $woomelly_get_settings );
			if ( isset($x_items->results) && !empty($x_items->results) ) {
			    foreach ( $x_items->results as $value ) {
			        $all_products[] = $value;
			    }
			}
			/*$x_items_ld = WMeli::get_orders_search( 'last_created', 0, $woomelly_get_settings );
			if ( isset($x_items_ld->results) && !empty($x_items_ld->results) ) {
			    foreach ( $x_items_ld->results as $value ) {
			    	if ( !in_array($value, $all_products) ) {
			        	$all_products[] = $value;
			    	}
			    }
			}*/
			if ( wm_is_process_running( 'wm_sync_aut_order' ) == false ) {
				wm_lock_process( 'wm_sync_aut_order' );
				WMlog::set_log( sprintf( __('%s | Automatic Orders Synchronization Notifications Started...', 'woomelly'), $key_cron), 'last_sync' );
				if ( !empty($all_products) ) {
			        if ( get_transient( '_woomelly_order_process_lock' ) === true ) {
						WMlog::set_log( sprintf( __('%s | Sorry, there is an automated process running at this time (orders).', 'woomelly'), $key_cron), 'last_sync' );
			        } else {
						foreach ( $all_products as $value ) {
		                    if ( is_object($value) ) {
								$aux_last_item = get_transient( '_wm_sync_last_order' );
								if ( $aux_last_item != $value->id ) {
									if ( get_transient( '_woomelly_opl_' . $value->id ) === true ) {
									} else {
										if ( get_transient( '_woomelly_order_process_lock' ) === true ) {
										} else {
											set_transient( '_woomelly_order_process_lock', true, 30 );
										}
										do_action( 'woomelly_notification_orders', '/orders/' . $value->id, $value, $woomelly_get_settings );
										set_transient( '_wm_sync_last_order', $value->id, 300 );
										WMlog::set_log( $value->id, 'last_sync' );
									}
								}
							}
							$total_products_success++;
						}
						delete_transient( '_woomelly_order_process_lock' );
						delete_transient( '_wm_sync_last_order' );
					}
				}
				//update_option( 'woomelly_orders_imported', $woomelly_list_orders_temp );
				WMlog::set_log( sprintf( __('%s | Automatic Orders Synchronization Notifications Finished...', 'woomelly'), $key_cron), 'last_sync' );
				wm_unlock_process( 'wm_sync_aut_order' );
			}
		} else {
	    	WMlog::set_log( sprintf( __('***You have a connection problem with Mercado Libre (offline store)***', 'woomelly'), $key_cron), 'last_sync' );
		}
	} //End woomelly_do_orders_automatic_time_event()

	public static function woomelly_do_qanda_automatic_time_event () {
		wm_migrate_crons_to_actions( 'refresh_token', 'activate_force' );
		$key_cron = uniqid();
		$total_products_success = 0;
		$all_products = array();
		$woomelly_get_settings = new WMSettings();
		$woomelly_alive = Woomelly()->woomelly_is_connect( $woomelly_get_settings );
		if ( $woomelly_alive == true ) {
			$woomelly_get_qanda = new WMQandASettings();
			$woomelly_get_qanda->init();
			if ( $woomelly_get_qanda->active == true ) {
				$x_items = WMeli::search_questions( false, $woomelly_get_settings );
				WMlog::set_log( sprintf( __('%s | Automatic QandA Synchronization Notifications Started...', 'woomelly'), $key_cron), 'last_sync' );
				if ( !empty($x_items->questions) ) {
				    $woomellly_items_searched_key = array();
				    $woomellly_items_searched_data = array();
					$has_save = false;
			        if ( get_transient( '_woomelly_qanda_process_lock' ) === true ) {
						WMlog::set_log( sprintf( __('%s | Sorry, there is an automated process running at this time (questions).', 'woomelly'), $key_cron), 'last_sync' );
			        } else {
					    foreach ( $x_items->questions as $value ) {
	                        if ( get_transient( '_woomelly_qpl_' . $value->id ) === true ) {
	                        } else {
	                        	if ( get_transient( '_woomelly_qanda_process_lock' ) === true ) {
	                        	} else {
						    		set_transient( '_woomelly_qanda_process_lock', true, 30 );
	                        	}
						    	if ( !in_array($value->item_id, $woomellly_items_searched_key) ) {
									$wmproduct = wm_get_product_by_code( $value->item_id );
									$has_save = true;
						    	} else {
						    		$wmproduct = $woomellly_items_searched_data[$value->item_id];
						    	}
								if ( $wmproduct != null ) {
									if ( $has_save == true ) {
										$woomellly_items_searched_key[] = $value->item_id;
										$woomellly_items_searched_data[$value->item_id] = $wmproduct;
									}
									$wm_qanda_exit = wm_get_qand_by_question_id( $value->id );
									if ( $wm_qanda_exit == false ) {
										$wm_qanda = new WMQandA();
										$wm_qanda->set_question_id( $value->id );
										if ( isset($value->answer) )
											$wm_qanda->set_answer( $value->answer );
										if ( isset($value->date_created) )
											$wm_qanda->set_date_created( $value->date_created );
										if ( isset($value->deleted_from_listing) )
											$wm_qanda->set_deleted_from_listing( $value->deleted_from_listing );
										if ( isset($value->hold) )
											$wm_qanda->set_hold( $value->hold );
										if ( isset($value->item_id) )
											$wm_qanda->set_item_id( $value->item_id );
										if ( isset($value->seller_id) )
											$wm_qanda->set_seller_id( $value->seller_id );
										if ( isset($value->status) )
											$wm_qanda->set_status( $value->status );
										if ( isset($value->text) )
											$wm_qanda->set_text( $value->text );
										if ( isset($value->from) )
											$wm_qanda->set_from_user( $value->from );
										$parent = $wmproduct->get_id();
										$wc_product = wc_get_product( $wmproduct->get_id() );
										if ( is_object($wc_product) ) {
											$parent = $wc_product->get_parent_id();
											if ( $parent <= 0 ) {
												$parent = $wc_product->get_id();
											}
										}
										unset( $wc_product );
										$wm_qanda->set_product_id( $parent );
										if ( isset($value->from) && isset($value->from->id) ) {
											$data_user = WMeli::get_users( $value->from->id );
											if ( !empty($data_user) ) {
												$wm_qanda->set_from_extra( $data_user );
											}
										}
										$wm_qanda->set_connect_ml( true );
										$save_qanda = $wm_qanda->save();
										unset( $wm_qanda );
										unset( $data_user );
									}
									unset($wm_qanda_exit);
								}
								unset( $wmproduct );
								$has_save = false;
							}
					    }
					    delete_transient( '_woomelly_qanda_process_lock' );
					}
				}
				WMlog::set_log( sprintf( __('%s | Automatic QandA Synchronization Notifications Finished...', 'woomelly'), $key_cron), 'last_sync' );
			}
	    } else {
			WMlog::set_log( sprintf( __('***You have a connection problem with Mercado Libre (offline store)***', 'woomelly'), $key_cron), 'last_sync' );
	    }		
	} //End woomelly_do_qanda_automatic_time_event()

	public static function woomelly_settings_action_links ( $links ) {
		$plugin_links = array();
		
		$plugin_links = array(
			'<a href="' . admin_url( 'admin.php?page=woomelly-menu' ) . '">' . __( 'Overview', 'woomelly' ) . '</a>',
			'<a href="' . admin_url( 'admin.php?page=woomelly-settings' ) . '">' . __( 'Settings', 'woomelly' ) . '</a>',
			'<a href="' . admin_url( 'admin.php?page=woomelly-wizard' ) . '">' . __( 'Wizard', 'woomelly' ) . '</a>'
		);
		
		return array_merge( $plugin_links, $links );
	} //End woomelly_settings_action_links()

	public static function woomelly_activated_plugin ( $plugin ) {
	    if ( $plugin == plugin_basename( Woomelly()->get_file() ) ) {
	        if ( defined( 'WP_CLI' ) && WP_CLI ) {
	            WP_CLI::log( __('Woomelly activated. Please go to the administration page to complete the setup!', 'woomelly') );
	        } else {
	            exit( wp_redirect( admin_url( 'admin.php?page=woomelly-wizard' ) ) );
	        }
	    }
	} //End woomelly_activated_plugin()

	public static function wm_sync_automatic_time ( $schedules ) {
	    $woomelly_settings = new WMSettings();
		$_time = floatval( $woomelly_settings->get_settings_sync_automatic_time() );

	    if ( $_time > 0 ) {
	    	if ( isset( $schedules['wm_sync_automatic_time'] ) ) {
	    		unset( $schedules['wm_sync_automatic_time'] );
	    	}
	        $schedules['wm_sync_automatic_time'] = array( 'interval' => ( $_time * 60 * 60 ), 'display' => sprintf(__("Every %s hour", "woomelly"), $_time) );
	    }

	    return $schedules;
	} //End wm_sync_automatic_time()

	public static function wm_sync_notification_orders_automatic_time ( $schedules ) {
		$woomelly_get_tools = new WMTools();
		$_time = floatval( $woomelly_get_tools->get_import_orders_time() );
		if ( $_time <= 0 ) {
			$_time = 0.17;
		}
		if ( isset( $schedules['wm_sync_notification_orders_automatic_time'] ) ) {
    		unset( $schedules['wm_sync_notification_orders_automatic_time'] );
    	}
        $schedules['wm_sync_notification_orders_automatic_time'] = array( 'interval' => ( $_time * 60 * 60 ), 'display' => sprintf(__("Every %s hour(s)", "woomelly"), $_time) );
	    return $schedules;
	} //End wm_sync_notification_orders_automatic_time()

	public static function wm_sync_notification_qanda_automatic_time ( $schedules ) {
		$woomelly_get_tools = new WMTools();
		$_time = floatval( $woomelly_get_tools->get_import_questions_time() );
		if ( $_time <= 0 ) {
			$_time = 0.5;
		}
    	if ( isset( $schedules['wm_sync_notification_qanda_automatic_time'] ) ) {
    		unset( $schedules['wm_sync_notification_qanda_automatic_time'] );
    	}
        $schedules['wm_sync_notification_qanda_automatic_time'] = array( 'interval' => ( $_time * 60 * 60 ), 'display' => sprintf(__("Every %s hour(s)", "woomelly"), $_time) );
	    return $schedules;
	} //End wm_sync_notification_qanda_automatic_time()

	public static function woomelly_admin_notices () {
		$wm_notices = get_transient( '_wm_notices' );
		if ( $wm_notices !== false ) {
			switch ($wm_notices) {
				case '_wm_notice_delete_product':
					$type_item = __("product", "woomelly");
					echo '<div class="notice notice-warning"><p>'.sprintf( __("%s | Remember that when you delete a %s that is connected to Mercado Libre, it remains linked. To avoid future problems, it is recommended that you perform a 'reset' or empty the store trash.", "woomelly"), '<strong>Woomelly</strong>', $type_item ).'</p></div>';
				break;
				case '_wm_notice_delete_order':
					$type_item = __("order", "woomelly");
					echo '<div class="notice notice-warning"><p>'.sprintf( __("%s | Remember that when you delete a %s that is connected to Mercado Libre, it remains linked. To avoid future problems, it is recommended that you perform a 'reset' or empty the store trash.", "woomelly"), '<strong>Woomelly</strong>', $type_item ).'</p></div>';
				break;
			}
			delete_transient( '_wm_notices' );
		}
		
		$alert_new_version = false;
		$wm_page = "";
		if ( isset($_GET['page']) && $_GET['page']!="" ) {
			$wm_page = wc_clean( wp_unslash( $_GET['page'] ) );
		}
		if ( $wm_page != "" && in_array( $wm_page, Woomelly()->get_pages() ) ) {
			if ( !in_array($wm_page, array('woomelly-wizard', 'woomelly-catalogue')) ) {
				$alert_new_version = false;
				$raw_validate_woomelly_version = get_transient( 'wm_query_validate_woomelly_version' );
				if ( $raw_validate_woomelly_version == false ) {
					global $wm_checker;
					$woomelly_new_version = "no";
					if ( is_object($wm_checker) && class_exists('Puc_v4_Factory9') && class_exists('Puc_v4p4_Plugin_UpdateChecker') ) {
						if ( apply_filters( "woomelly__check_updatechecker", true ) == true ) {
							if ( $wm_checker->checkForUpdates() !== null ) {
								$woomelly_new_version = "yes";
							}
						}
					}
					$raw_validate_woomelly_version = WM_VERSION . "::" . $woomelly_new_version;
					set_transient( 'wm_query_validate_woomelly_version', $raw_validate_woomelly_version, 60*60*12 );
				}
				$data_version = explode( "::", $raw_validate_woomelly_version );
				if ( version_compare( WM_VERSION, $data_version[0], '<=' ) && $data_version[1] == 'yes' ) {
					$alert_new_version = true;				
				}
				if ( $alert_new_version == true ) {
					if ( Woomelly()->woomelly_is_connect() == true ) {
					?>
						<div class="notice notice-info imma-review-notice is-dismissible" style="background-color: #fff;border-left: 6px solid #F7E400;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;">
							<div class="wpdeveloper-notice-thumbnail" style="width: 100px; float: left; padding: 5px; text-align: center; border-right: 4px solid transparent;">
								<img src="<?php echo Woomelly()->get_assets_url() .'images/upgrade.gif'; ?>" alt="Woomelly upgrade">
							</div>
							<div class="wpdeveloper-notice-message">
								<p style="font-weight: 700;font-size: 16px;margin: 0.5em 0 0;"><?php echo __("Did you know that you are using an outdated version of Woomelly?", "woomelly"); ?></p>
								<p style="margin: 0;"><?php echo __("Upgrade Woomelly right now to enjoy all the latest features and avoid problems with your Mercado Libre account.", "woomelly"); ?></p>
								<p style="margin: 10px 0px 12px;"><a target="_blank" href="<?php echo admin_url( 'plugins.php' ); ?>" class="uk-button wm-button uk-button-primary uk-button-small"><?php echo __("Upgrade now", "woomelly"); ?></a></p>
							</div>
						</div>
					<?php
					}
				}
			}
		}
		/*$check_version = Woomelly()->get_version_save();
		if ( version_compare( '1.4', $check_version, '>' ) ) {
			$url = add_query_arg(
				array(
					'page'	=> 'woomelly-menu',
					'wmupdate' 	=> 'db',
					'_wmupdate'=> wp_create_nonce( 'woopayu-wmupdate-db' )
				)
			);
		    ?>
		    <div class="notice notice-error">
		        <p><?php echo sprintf( __("%s | It is import and necessary to synchronize your current configuration with version 1.4. Backup your site for security reasons and please you need read %s before updating your plugin. %s", "woomelly"), '<strong>'.__("Woomelly is almost ready", "woomelly").'</strong>', "<a href=\"XXXXXXXXXXXXXXXXXX\">".__("this article", "woomelly")."</a>", '<a href="'.$url.'">'.__(">> UPDATE <<", "woomelly").'</a>' ); ?></p>
		    </div>  
		    <?php
		}*/
	} //End woomelly_admin_notices()

	public static function woomelly_in_plugin_update_message ( $args, $response ) {
		if ( is_object($response) && isset($response->upgrade_notice) ) {
			$upgrade_notice = trim($response->upgrade_notice);
			if ( $upgrade_notice != "" ) {
				echo $upgrade_notice;
			}
		}
	} //End woomelly_in_plugin_update_message()

	public static function woomelly_plugin_row_meta( $links, $file ) {
		if ( 'woomelly/woomelly.php' === $file ) {
			$row_meta = array(
				'wiki'    => '<a href="' . esc_url( 'https://woomelly.com/documentacion-oficial/' ) . '" aria-label="' . __( 'View Woomelly documentation', 'woomelly' ) . '">' . __( 'Documentation', 'woomelly' ) . '</a>',
			);

			return array_merge( $links, $row_meta );
		}

		return (array) $links;
	} //End woomelly_plugin_row_meta()
}

WMInstall::init();

Youez - 2016 - github.com/yon3zu
LinuXploit