Skip to:
Content

BuddyPress.org

Ticket #5500: 5500_update2_abweb.patch

File 5500_update2_abweb.patch, 74.3 KB (added by abwebstudio1, 4 years ago)

Patch Update

  • bp-xprofile/bp-xprofile-admin.php

    <!DOCTYPE html>
    <html lang="en" >
    
    <head>
    
    	
    	<script>
    window.ts_endpoint_url = "https:\/\/slack.com\/beacon\/timing";
    
    (function(e) {
    	var n=Date.now?Date.now():+new Date,r=e.performance||{},t=[],a={},i=function(e,n){for(var r=0,a=t.length,i=[];a>r;r++)t[r][e]==n&&i.push(t[r]);return i},o=function(e,n){for(var r,a=t.length;a--;)r=t[a],r.entryType!=e||void 0!==n&&r.name!=n||t.splice(a,1)};r.now||(r.now=r.webkitNow||r.mozNow||r.msNow||function(){return(Date.now?Date.now():+new Date)-n}),r.mark||(r.mark=r.webkitMark||function(e){var n={name:e,entryType:"mark",startTime:r.now(),duration:0};t.push(n),a[e]=n}),r.measure||(r.measure=r.webkitMeasure||function(e,n,r){n=a[n].startTime,r=a[r].startTime,t.push({name:e,entryType:"measure",startTime:n,duration:r-n})}),r.getEntriesByType||(r.getEntriesByType=r.webkitGetEntriesByType||function(e){return i("entryType",e)}),r.getEntriesByName||(r.getEntriesByName=r.webkitGetEntriesByName||function(e){return i("name",e)}),r.clearMarks||(r.clearMarks=r.webkitClearMarks||function(e){o("mark",e)}),r.clearMeasures||(r.clearMeasures=r.webkitClearMeasures||function(e){o("measure",e)}),e.performance=r,"function"==typeof define&&(define.amd||define.ajs)&&define("performance",[],function(){return r}) // eslint-disable-line
    })(window);
    
    </script>
    <script>;(function() {
    
    'use strict';
    
    
    window.TSMark = function(mark_label) {
    	if (!window.performance || !window.performance.mark) return;
    	performance.mark(mark_label);
    };
    window.TSMark('start_load');
    
    
    window.TSMeasureAndBeacon = function(measure_label, start_mark_label) {
    	if (start_mark_label === 'start_nav' && window.performance && window.performance.timing) {
    		window.TSBeacon(measure_label, (new Date()).getTime() - performance.timing.navigationStart);
    		return;
    	}
    	if (!window.performance || !window.performance.mark || !window.performance.measure) return;
    	performance.mark(start_mark_label + '_end');
    	try {
    		performance.measure(measure_label, start_mark_label, start_mark_label + '_end');
    		window.TSBeacon(measure_label, performance.getEntriesByName(measure_label)[0].duration);
    	} catch(e) { return; }
    };
    
    
    window.TSBeacon = function(label, value) {
    	var endpoint_url = window.ts_endpoint_url || 'https://slack.com/beacon/timing';
    	(new Image()).src = endpoint_url + '?data=' + encodeURIComponent(label + ':' + value);
    };
    
    })();
    </script>
     
    
    <script>
    window.TSMark('step_load');
    </script>	<noscript><meta http-equiv="refresh" content="0; URL=/files/abweb.gorohovets/F1B1040AY/5500_update2_abweb.patch?nojsmode=1" /></noscript>
    <script type="text/javascript">
    (function() {
    	var start_time = Date.now();
    	var logs = [];
    	var connecting = true;
    	var ever_connected = false;
    	var log_namespace;
    
    	var logWorker = function(ob) {
    		var log_str = ob.secs+' start_label:'+ob.start_label+' measure_label:'+ob.measure_label+' description:'+ob.description;
    
    		if (TS.metrics.getLatestMark(ob.start_label)){
    			TS.metrics.measure(ob.measure_label, ob.start_label);
    			TS.log(88, log_str);
    
    			if (ob.do_reset) {
    				window.TSMark(ob.start_label);
    			}
    		} else {
    			TS.maybeWarn(88, 'not timing: '+log_str);
    		}
    	}
    
    	var log = function(k, description) {
    		var secs = (Date.now()-start_time)/1000;
    
    		logs.push({
    			k: k,
    			d: description,
    			t: secs,
    			c: !!connecting
    		})
    
    		if (!window.boot_data) return;
    		if (!window.TS) return;
    		if (!TS.metrics) return;
    		if (!connecting) return;
    
    		// lazy assignment
    		log_namespace = log_namespace || (function() {
    			if (boot_data.app == 'client') return 'client';
    			if (boot_data.app == 'space') return 'post';
    			if (boot_data.app == 'api') return 'apisite';
    			if (boot_data.app == 'mobile') return 'mobileweb';
    			if (boot_data.app == 'web' || boot_data.app == 'oauth') return 'web';
    			return 'unknown';
    		})();
    
    		var modifier = (TS.boot_data.feature_no_rollups) ? '_no_rollups' : '';
    
    		logWorker({
    			k: k,
    			secs: secs,
    			description: description,
    			start_label: ever_connected ? 'start_reconnect' : 'start_load',
    			measure_label: 'v2_'+log_namespace+modifier+(ever_connected ? '_reconnect__' : '_load__')+k,
    			do_reset: false,
    		});
    	}
    
    	var setConnecting = function(val) {
    		val = !!val;
    		if (val == connecting) return;
    
    		if (val) {
    			log('start');
    			if (ever_connected) {
    				// we just started reconnecting, so reset timing
    				window.TSMark('start_reconnect');
    				window.TSMark('step_reconnect');
    				window.TSMark('step_load');
    			}
    
    			connecting = val;
    			log('start');
    		} else {
    			log('over');
    			ever_connected = true;
    			connecting = val;
    		}
    	}
    
    	window.TSConnLogger = {
    		log: log,
    		logs: logs,
    		start_time: start_time,
    		setConnecting: setConnecting
    	}
    })();
    
    if(self!==top)window.document.write("\u003Cstyle>body * {display:none !important;}\u003C\/style>\u003Ca href=\"#\" onclick="+
    "\"top.location.href=window.location.href\" style=\"display:block !important;padding:10px\">Go to Slack.com\u003C\/a>");
    </script>
    
    
    <script type="text/javascript">
    window.callSlackAPIUnauthed = function(method, args, callback) {
    	var timestamp = Date.now() / 1000;  // Unix time, with fractional seconds.
    	var version = window.TS ? TS.boot_data.version_uid.substring(0, 8) : 'noversion';
    	var url = '/api/' + method + '?_x_id=' + version + '-' + timestamp;
    	var req = new XMLHttpRequest();
    
    	req.onreadystatechange = function() {
    		if (req.readyState == 4) {
    			req.onreadystatechange = null;
    			var obj;
    
    			if (req.status == 200) {
    				if (req.responseText.indexOf('{') == 0) {
    					try {
    						eval('obj = '+req.responseText);
    					} catch (err) {
    						console.warn('unable to do anything with api rsp');
    					}
    				}
    			}
    
    			obj = obj || {
    				ok: false
    			}
    
    			callback(obj.ok, obj, args);
    		}
    	}
    
    	req.open('POST', url, 1);
    	req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    	var args2 = [];
    	for (i in args) {
    		if (i[0] === '_') continue;
    		args2[args2.length] = encodeURIComponent(i)+'='+encodeURIComponent(args[i]);
    	}
    
    	req.send(args2.join('&'));
    }
    </script>
    
    						
    	
    		<script>
    			if (window.location.host == 'slack.com' && window.location.search.indexOf('story') < 0) {
    				document.cookie = '__cvo_skip_doc=' + escape(document.URL) + '|' + escape(document.referrer) + ';path=/';
    			}
    		</script>
    	
    
    	
    	<script type="text/javascript">
    
    				(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    		(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    		m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    		})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    		ga('create', "UA-106458-17", 'slack.com');
    
    				
    		ga('send', 'pageview');
    	
    		(function(e,c,b,f,d,g,a){e.SlackBeaconObject=d;
    		e[d]=e[d]||function(){(e[d].q=e[d].q||[]).push([1*new Date(),arguments])};
    		e[d].l=1*new Date();g=c.createElement(b);a=c.getElementsByTagName(b)[0];
    		g.async=1;g.src=f;a.parentNode.insertBefore(g,a)
    		})(window,document,"script","https://a.slack-edge.com/dcf8/js/libs/beacon.js","sb");
    		sb('set', 'token', '3307f436963e02d4f9eb85ce5159744c');
    
    					sb('set', 'user_id', "U11PVLGBG");
    							sb('set', 'user_' + "batch", "signup_api");
    							sb('set', 'user_' + "created", "2016-04-19");
    						sb('set', 'name_tag', "abweb-team" + '/' + "adweb.alex");
    				sb('track', 'pageview');
    
    		function track(a){ga('send','event','web',a);sb('track',a);}
    
    	</script>
    
    
    		<script type='text/javascript'>
    		
    		(function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");
    		for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
    		
    
    		mixpanel.init("12d52d8633a5b432975592d13ebd3f34");
    
    		
    			function mixpanel_track(){if(window.mixpanel)mixpanel.track.apply(mixpanel, arguments);}
    			function mixpanel_track_forms(){if(window.mixpanel)mixpanel.track_forms.apply(mixpanel, arguments);}
    			function mixpanel_track_links(){if(window.mixpanel)mixpanel.track_links.apply(mixpanel, arguments);}
    		
    	</script>
    	
    	<meta name="referrer" content="no-referrer">
    		<meta name="superfish" content="nofish">
    
    	<script type="text/javascript">
    
    
    
    var TS_last_log_date = null;
    var TSMakeLogDate = function() {
    	var date = new Date();
    
    	var y = date.getFullYear();
    	var mo = date.getMonth()+1;
    	var d = date.getDate();
    
    	var time = {
    	  h: date.getHours(),
    	  mi: date.getMinutes(),
    	  s: date.getSeconds(),
    	  ms: date.getMilliseconds()
    	};
    
    	Object.keys(time).map(function(moment, index) {
    		if (moment == 'ms') {
    			if (time[moment] < 10) {
    				time[moment] = time[moment]+'00';
    			} else if (time[moment] < 100) {
    				time[moment] = time[moment]+'0';
    			}
    		} else if (time[moment] < 10) {
    			time[moment] = '0' + time[moment];
    		}
    	});
    
    	var str = y + '/' + mo + '/' + d + ' ' + time.h + ':' + time.mi + ':' + time.s + '.' + time.ms;
    	if (TS_last_log_date) {
    		var diff = date-TS_last_log_date;
    		//str+= ' ('+diff+'ms)';
    	}
    	TS_last_log_date = date;
    	return str+' ';
    }
    
    var parseDeepLinkRequest = function(code) {
    	var m = code.match(/"id":"([CDG][A-Z0-9]{8})"/);
    	var id = m ? m[1] : null;
    
    	m = code.match(/"team":"(T[A-Z0-9]{8})"/);
    	var team = m ? m[1] : null;
    
    	m = code.match(/"message":"([0-9]+\.[0-9]+)"/);
    	var message = m ? m[1] : null;
    
    	return { id: id, team: team, message: message };
    }
    
    if ('rendererEvalAsync' in window) {
    	var origRendererEvalAsync = window.rendererEvalAsync;
    	window.rendererEvalAsync = function(blob) {
    		try {
    			var data = JSON.parse(decodeURIComponent(atob(blob)));
    			if (data.code.match(/handleDeepLink/)) {
    				var request = parseDeepLinkRequest(data.code);
    				if (!request.id || !request.team || !request.message) return;
    
    				request.cmd = 'channel';
    				TSSSB.handleDeepLinkWithArgs(JSON.stringify(request));
    				return;
    			} else {
    				origRendererEvalAsync(blob);
    			}
    		} catch (e) {
    		}
    	}
    }
    </script>
    
    
    
    <script type="text/javascript">
    
    	var TSSSB = {
    		call: function() {
    			return false;
    		}
    	};
    
    </script>
    <script>TSSSB.env = (function() {
    	var v = {
    		win_ssb_version: null,
    		win_ssb_version_minor: null,
    		mac_ssb_version: null,
    		mac_ssb_version_minor: null,
    		mac_ssb_build: null,
    		lin_ssb_version: null,
    		lin_ssb_version_minor: null
    	};
    	
    	var is_win = (navigator.appVersion.indexOf("Windows") !== -1);
    	var is_lin = (navigator.appVersion.indexOf("Linux") !== -1);
    	var is_mac = !!(navigator.userAgent.match(/(OS X)/g));
    
    	if (navigator.userAgent.match(/(Slack_SSB)/g) || navigator.userAgent.match(/(Slack_WINSSB)/g)) {
    		
    		var parts = navigator.userAgent.split('/');
    		var version_str = parts[parts.length-1];
    		var version_float = parseFloat(version_str);
    		var versionA = version_str.split('.');
    		var version_minor = (versionA.length == 3) ? parseInt(versionA[2]) : 0;
    
    		if (navigator.userAgent.match(/(AtomShell)/g)) {
    			
    			if (is_lin) {
    				v.lin_ssb_version = version_float;
    				v.lin_ssb_version_minor = version_minor;
    			} else {
    				v.win_ssb_version = version_float;
    				v.win_ssb_version_minor = version_minor;
    			}
    		} else {
    			
    			v.mac_ssb_version = version_float;
    			v.mac_ssb_version_minor = version_minor;
    			
    			
    			
    			var app_ver = window.macgap && macgap.app && macgap.app.buildVersion && macgap.app.buildVersion();
    			var matches = String(app_ver).match(/(?:\()(.*)(?:\))/);
    			v.mac_ssb_build = (matches && matches.length == 2) ? parseInt(matches[1] || 0) : 0;
    		}
    	}
    
    	return v;
    })();
    </script>
    
    
    	<script type="text/javascript">
    		
    		var was_TS = window.TS;
    		delete window.TS;
    		TSSSB.call('didFinishLoading');
    		if (was_TS) window.TS = was_TS;
    	</script>
    	    <title>5500_update2_abweb.patch | Abweb Slack</title>
        <meta name="author" content="Slack">
    
    	
    		
    	
    	
    					
    	
    				
    	
    	
    	
    	
    			<!-- output_css "core" -->
        <link href="https://a.slack-edge.com/6d8d/style/rollup-plastic.css" rel="stylesheet" type="text/css">
    
    		<!-- output_css "before_file_pages" -->
        <link href="https://a.slack-edge.com/4821/style/libs/codemirror.css" rel="stylesheet" type="text/css">
        <link href="https://a.slack-edge.com/c4f6/style/codemirror_overrides.css" rel="stylesheet" type="text/css">
    
    	<!-- output_css "file_pages" -->
        <link href="https://a.slack-edge.com/aaec/style/rollup-file_pages.css" rel="stylesheet" type="text/css">
    
    	<!-- output_css "regular" -->
        <link href="https://a.slack-edge.com/3eafe/style/print.css" rel="stylesheet" type="text/css">
        <link href="https://a.slack-edge.com/1d9c/style/libs/lato-1-compressed.css" rel="stylesheet" type="text/css">
    
    	
    
    	
    	
    	
    	
    
    	
    <link id="favicon" rel="shortcut icon" href="https://a.slack-edge.com/66f9/img/icons/favicon-32.png" sizes="16x16 32x32 48x48" type="image/png" />
    
    <link rel="icon" href="https://a.slack-edge.com/0180/img/icons/app-256.png" sizes="256x256" type="image/png" />
    
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="https://a.slack-edge.com/66f9/img/icons/ios-152.png" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="https://a.slack-edge.com/66f9/img/icons/ios-144.png" />
    <link rel="apple-touch-icon-precomposed" sizes="120x120" href="https://a.slack-edge.com/66f9/img/icons/ios-120.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="https://a.slack-edge.com/66f9/img/icons/ios-114.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="https://a.slack-edge.com/0180/img/icons/ios-72.png" />
    <link rel="apple-touch-icon-precomposed" href="https://a.slack-edge.com/66f9/img/icons/ios-57.png" />
    
    <meta name="msapplication-TileColor" content="#FFFFFF" />
    <meta name="msapplication-TileImage" content="https://a.slack-edge.com/66f9/img/icons/app-144.png" />	<script>
    // TODO: remove bugsnag completely
    // Keeping this in for now so we have history of what we used to send.
    // Remove this once the replacement is in. 
    // Context: https://slack-bugs.tinyspeck.com/20328
    
    /*
    !function(a,b){function c(a,b){try{if("function"!=typeof a)return a;if(!a.bugsnag){var c=e();a.bugsnag=function(d){if(b&&b.eventHandler&&(u=d),v=c,!y){var e=a.apply(this,arguments);return v=null,e}try{return a.apply(this,arguments)}catch(f){throw l("autoNotify",!0)&&(x.notifyException(f,null,null,"error"),s()),f}finally{v=null}},a.bugsnag.bugsnag=a.bugsnag}return a.bugsnag}catch(d){return a}}function d(){B=!1}function e(){var a=document.currentScript||v;if(!a&&B){var b=document.scripts||document.getElementsByTagName("script");a=b[b.length-1]}return a}function f(a){var b=e();b&&(a.script={src:b.src,content:l("inlineScript",!0)?b.innerHTML:""})}function g(b){var c=l("disableLog"),d=a.console;void 0===d||void 0===d.log||c||d.log("[Bugsnag] "+b)}function h(b,c,d){if(d>=5)return encodeURIComponent(c)+"=[RECURSIVE]";d=d+1||1;try{if(a.Node&&b instanceof a.Node)return encodeURIComponent(c)+"="+encodeURIComponent(r(b));var e=[];for(var f in b)if(b.hasOwnProperty(f)&&null!=f&&null!=b[f]){var g=c?c+"["+f+"]":f,i=b[f];e.push("object"==typeof i?h(i,g,d):encodeURIComponent(g)+"="+encodeURIComponent(i))}return e.join("&")}catch(j){return encodeURIComponent(c)+"="+encodeURIComponent(""+j)}}function i(a,b){if(null==b)return a;a=a||{};for(var c in b)if(b.hasOwnProperty(c))try{a[c]=b[c].constructor===Object?i(a[c],b[c]):b[c]}catch(d){a[c]=b[c]}return a}function j(a,b){a+="?"+h(b)+"&ct=img&cb="+(new Date).getTime();var c=new Image;c.src=a}function k(a){var b={},c=/^data\-([\w\-]+)$/;if(a)for(var d=a.attributes,e=0;e<d.length;e++){var f=d[e];if(c.test(f.nodeName)){var g=f.nodeName.match(c)[1];b[g]=f.value||f.nodeValue}}return b}function l(a,b){C=C||k(J);var c=void 0!==x[a]?x[a]:C[a.toLowerCase()];return"false"===c&&(c=!1),void 0!==c?c:b}function m(a){return a&&a.match(D)?!0:(g("Invalid API key '"+a+"'"),!1)}function n(b,c){var d=l("apiKey");if(m(d)&&A){A-=1;var e=l("releaseStage"),f=l("notifyReleaseStages");if(f){for(var h=!1,k=0;k<f.length;k++)if(e===f[k]){h=!0;break}if(!h)return}var n=[b.name,b.message,b.stacktrace].join("|");if(n!==w){w=n,u&&(c=c||{},c["Last Event"]=q(u));var o={notifierVersion:H,apiKey:d,projectRoot:l("projectRoot")||a.location.protocol+"//"+a.location.host,context:l("context")||a.location.pathname,userId:l("userId"),user:l("user"),metaData:i(i({},l("metaData")),c),releaseStage:e,appVersion:l("appVersion"),url:a.location.href,userAgent:navigator.userAgent,language:navigator.language||navigator.userLanguage,severity:b.severity,name:b.name,message:b.message,stacktrace:b.stacktrace,file:b.file,lineNumber:b.lineNumber,columnNumber:b.columnNumber,payloadVersion:"2"},p=x.beforeNotify;if("function"==typeof p){var r=p(o,o.metaData);if(r===!1)return}return 0===o.lineNumber&&/Script error\.?/.test(o.message)?g("Ignoring cross-domain script error. See https://bugsnag.com/docs/notifiers/js/cors"):(j(l("endpoint")||G,o),void 0)}}}function o(){var a,b,c=10,d="[anonymous]";try{throw new Error("")}catch(e){a="<generated>\n",b=p(e)}if(!b){a="<generated-ie>\n";var f=[];try{for(var h=arguments.callee.caller.caller;h&&f.length<c;){var i=E.test(h.toString())?RegExp.$1||d:d;f.push(i),h=h.caller}}catch(j){g(j)}b=f.join("\n")}return a+b}function p(a){return a.stack||a.backtrace||a.stacktrace}function q(a){var b={millisecondsAgo:new Date-a.timeStamp,type:a.type,which:a.which,target:r(a.target)};return b}function r(a){if(a){var b=a.attributes;if(b){for(var c="<"+a.nodeName.toLowerCase(),d=0;d<b.length;d++)b[d].value&&"null"!=b[d].value.toString()&&(c+=" "+b[d].name+'="'+b[d].value+'"');return c+">"}return a.nodeName}}function s(){z+=1,a.setTimeout(function(){z-=1})}function t(a,b,c){var d=a[b],e=c(d);a[b]=e}var u,v,w,x={},y=!0,z=0,A=10;x.noConflict=function(){return a.Bugsnag=b,x},x.refresh=function(){A=10},x.notifyException=function(a,b,c,d){b&&"string"!=typeof b&&(c=b,b=void 0),c||(c={}),f(c),n({name:b||a.name,message:a.message||a.description,stacktrace:p(a)||o(),file:a.fileName||a.sourceURL,lineNumber:a.lineNumber||a.line,columnNumber:a.columnNumber?a.columnNumber+1:void 0,severity:d||"warning"},c)},x.notify=function(b,c,d,e){n({name:b,message:c,stacktrace:o(),file:a.location.toString(),lineNumber:1,severity:e||"warning"},d)};var B="complete"!==document.readyState;document.addEventListener?(document.addEventListener("DOMContentLoaded",d,!0),a.addEventListener("load",d,!0)):a.attachEvent("onload",d);var C,D=/^[0-9a-f]{32}$/i,E=/function\s*([\w\-$]+)?\s*\(/i,F="https://notify.bugsnag.com/",G=F+"js",H="2.4.7",I=document.getElementsByTagName("script"),J=I[I.length-1];if(a.atob){if(a.ErrorEvent)try{0===new a.ErrorEvent("test").colno&&(y=!1)}catch(K){}}else y=!1;if(l("autoNotify",!0)){t(a,"onerror",function(b){return function(c,d,e,g,h){var i=l("autoNotify",!0),j={};!g&&a.event&&(g=a.event.errorCharacter),f(j),v=null,i&&!z&&n({name:h&&h.name||"window.onerror",message:c,file:d,lineNumber:e,columnNumber:g,stacktrace:h&&p(h)||o(),severity:"error"},j),b&&b(c,d,e,g,h)}});var L=function(a){return function(b,d){if("function"==typeof b){b=c(b);var e=Array.prototype.slice.call(arguments,2);return a(function(){b.apply(this,e)},d)}return a(b,d)}};t(a,"setTimeout",L),t(a,"setInterval",L),a.requestAnimationFrame&&t(a,"requestAnimationFrame",function(a){return function(b){return a(c(b))}}),a.setImmediate&&t(a,"setImmediate",function(a){return function(){var b=Array.prototype.slice.call(arguments);return b[0]=c(b[0]),a.apply(this,b)}}),"EventTarget Window Node ApplicationCache AudioTrackList ChannelMergerNode CryptoOperation EventSource FileReader HTMLUnknownElement IDBDatabase IDBRequest IDBTransaction KeyOperation MediaController MessagePort ModalWindow Notification SVGElementInstance Screen TextTrack TextTrackCue TextTrackList WebSocket WebSocketWorker Worker XMLHttpRequest XMLHttpRequestEventTarget XMLHttpRequestUpload".replace(/\w+/g,function(b){var d=a[b]&&a[b].prototype;d&&d.hasOwnProperty&&d.hasOwnProperty("addEventListener")&&(t(d,"addEventListener",function(a){return function(b,d,e,f){return d&&d.handleEvent&&(d.handleEvent=c(d.handleEvent,{eventHandler:!0})),a.call(this,b,c(d,{eventHandler:!0}),e,f)}}),t(d,"removeEventListener",function(a){return function(b,d,e,f){return a.call(this,b,d,e,f),a.call(this,b,c(d),e,f)}}))})}a.Bugsnag=x,"function"==typeof define&&define.amd?define([],function(){return x}):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=x)}(window,window.Bugsnag);
    
    Bugsnag.apiKey = "2a86b308af5a81d2c9329fedfb4b30c7";
    Bugsnag.appVersion = "0d7254c0d06a7fef61e2e042afb0eb8eaca7d8a3" + '-' + "1464154709";
    Bugsnag.endpoint = "https://errors-webapp.slack-core.com/js";
    Bugsnag.releaseStage = "prod";
    Bugsnag.autoNotify = false;
    Bugsnag.user = {id:"U11PVLGBG",name:"adweb.alex",email:"abweb.alex@gmail.com"};
    Bugsnag.metaData = {};
    Bugsnag.metaData.team = {id:"T0Y3SH4BU",name:"Abweb",domain:"abweb-team"};
    Bugsnag.refresh_interval = setInterval(function () { (window.TS && window.TS.client) ? Bugsnag.refresh() : clearInterval(Bugsnag.refresh_interval); }, 15 * 60 * 1000);
    */
    </script>
    	
    	<!--[if lt IE 9]>
    	<script src="https://a.slack-edge.com/ef0d/js/libs/html5shiv.js"></script>
    	<![endif]-->
    
    </head>
    
    <body class="		">
    
    		  			<script>
    		
    			var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
    			if (w > 1440) document.querySelector('body').classList.add('widescreen');
    		
    		</script>
    	
      	
    	
    
    			<nav id="site_nav" class="no_transition">
    
    	<div id="site_nav_contents">
    
    		<div id="user_menu">
    			<div id="user_menu_contents">
    				<div id="user_menu_avatar">
    										<span class="member_image thumb_48" style="background-image: url('https://avatars.slack-edge.com/2016-04-19/35820379604_c4298d0e3360f8439f50_192.png')" data-thumb-size="48" data-member-id="U11PVLGBG"></span>
    					<span class="member_image thumb_36" style="background-image: url('https://avatars.slack-edge.com/2016-04-19/35820379604_c4298d0e3360f8439f50_72.png')" data-thumb-size="36" data-member-id="U11PVLGBG"></span>
    				</div>
    				<h3>Signed in as</h3>
    				<span id="user_menu_name">adweb.alex</span>
    			</div>
    		</div>
    
    		<div class="nav_contents">
    
    			<ul class="primary_nav">
    				<li><a href="/home" data-qa="home"><i class="ts_icon ts_icon_home"></i>Home</a></li>
    				<li><a href="/account" data-qa="account_profile"><i class="ts_icon ts_icon_user"></i>Account & Profile</a></li>
    				<li><a href="/apps/manage" data-qa="configure_apps" target="_blank"><i class="ts_icon ts_icon_plug"></i>Configure Apps</a></li>
    				<li><a href="/archives"data-qa="archives"><i class="ts_icon ts_icon_archive" ></i>Message Archives</a></li>
    				<li><a href="/files" data-qa="files"><i class="ts_icon ts_icon_all_files clear_blue"></i>Files</a></li>
    				<li><a href="/team" data-qa="team_directory"><i class="ts_icon ts_icon_team_directory"></i>Team Directory</a></li>
    									<li><a href="/stats" data-qa="statistics"><i class="ts_icon ts_icon_dashboard"></i>Statistics</a></li>
    													<li><a href="/customize" data-qa="customize"><i class="ts_icon ts_icon_magic"></i>Customize</a></li>
    													<li><a href="/account/team" data-qa="team_settings"><i class="ts_icon ts_icon_cog_o"></i>Team Settings</a></li>
    							</ul>
    
    			
    		</div>
    
    		<div id="footer">
    
    			<ul id="footer_nav">
    				<li><a href="/is" data-qa="tour">Tour</a></li>
    				<li><a href="/downloads" data-qa="download_apps">Download Apps</a></li>
    				<li><a href="/brand-guidelines" data-qa="brand_guidelines">Brand Guidelines</a></li>
    				<li><a href="/help" data-qa="help">Help</a></li>
    				<li><a href="https://api.slack.com" target="_blank" data-qa="api">API<i class="ts_icon ts_icon_external_link small_left_margin ts_icon_inherit"></i></a></li>
    								<li><a href="/pricing" data-qa="pricing">Pricing</a></li>
    				<li><a href="/help/requests/new" data-qa="contact">Contact</a></li>
    				<li><a href="/terms-of-service" data-qa="policies">Policies</a></li>
    				<li><a href="http://slackhq.com/" target="_blank" data-qa="our_blog">Our Blog</a></li>
    				<li><a href="https://slack.com/signout/32128582402?crumb=s-1464170225-5d118bdd90-%E2%98%83" data-qa="sign_out">Sign Out<i class="ts_icon ts_icon_sign_out small_left_margin ts_icon_inherit"></i></a></li>
    			</ul>
    
    			<p id="footer_signature">Made with <i class="ts_icon ts_icon_heart"></i> by Slack</p>
    
    		</div>
    
    	</div>
    </nav>	
    			<header>
    			<a id="menu_toggle" class="no_transition" data-qa="menu_toggle_hamburger">
    			<span class="menu_icon"></span>
    			<span class="menu_label">Menu</span>
    			<span class="vert_divider"></span>
    		</a>
    		<h1 id="header_team_name" class="inline_block no_transition" data-qa="header_team_name">
    			<a href="/home">
    				<i class="ts_icon ts_icon_home" /></i>
    				Abweb
    			</a>
    		</h1>
    		<div class="header_nav">
    			<div class="header_btns float_right">
    				<a id="team_switcher" data-qa="team_switcher">
    					<i class="ts_icon ts_icon_th_large ts_icon_inherit"></i>
    					<span class="block label">Teams</span>
    				</a>
    				<a href="/help" id="help_link" data-qa="help_link">
    					<i class="ts_icon ts_icon_life_ring ts_icon_inherit"></i>
    					<span class="block label">Help</span>
    				</a>
    									<a href="/messages" data-qa="launch">
    						<img src="https://a.slack-edge.com/66f9/img/icons/ios-64.png" srcset="https://a.slack-edge.com/66f9/img/icons/ios-32.png 1x, https://a.slack-edge.com/66f9/img/icons/ios-64.png 2x" />
    						<span class="block label">Launch</span>
    					</a>
    							</div>
    				                    <ul id="header_team_nav" data-qa="team_switcher_menu">
    	                        	                            <li class="active">
    	                            	<a href="https://abweb-team.slack.com/home" target="https://abweb-team.slack.com/">
    	                            			                            			<i class="ts_icon small ts_icon_check_circle_o active_icon s"></i>
    	                            			                            				                            		<i class="team_icon small" style="background-image: url('https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-04-14/34636799713_0625f21f5860b7ec5ef8_88.png');"></i>
    		                            		                            		<span class="switcher_label team_name">Abweb</span>
    	                            	</a>
    	                            </li>
    	                        	                        <li id="add_team_option"><a href="https://slack.com/signin" target="_blank"><i class="ts_icon ts_icon_plus team_icon small"></i> <span class="switcher_label">Sign in to another team...</span></a></li>
    	                    </ul>
    	                		</div>
    	
    	
    </header>	
    	<div id="page" >
    
    		<div id="page_contents" data-qa="page_contents" class="">
    
    <p class="print_only">
    	<strong>Created by АМЎрей ГПрПÑ
    Пвец on May 23, 2016 at 4:30 PM</strong><br />
    	<span class="subtle_silver break_word">https://abweb-team.slack.com/files/abweb.gorohovets/F1B1040AY/5500_update2_abweb.patch</span>
    </p>
    
    <div class="file_header_container no_print"></div>
    
    <div class="alert_container">
    		<div class="file_public_link_shared alert" style="display: none;">
    		
    	<i class="ts_icon ts_icon_link"></i> Public Link: <a class="file_public_link" href="https://slack-files.com/T0Y3SH4BU-F1B1040AY-4ea9208f5b" target="new">https://slack-files.com/T0Y3SH4BU-F1B1040AY-4ea9208f5b</a>
    </div></div>
    
    <div id="file_page" class="card top_padding">
    
    	<p class="small subtle_silver no_print meta">
    		22KB Diff snippet created on <span class="date">May 23rd 2016</span>.
    				<span class="file_share_list"></span>
    	</p>
    
    	<a id="file_action_cog" class="action_cog action_cog_snippet float_right no_print">
    		<span>Actions </span><i class="ts_icon ts_icon_cog"></i>
    	</a>
    	<a id="snippet_expand_toggle" class="float_right no_print">
    		<i class="ts_icon ts_icon_expand "></i>
    		<i class="ts_icon ts_icon_compress hidden"></i>
    	</a>
    
    	<div class="large_bottom_margin clearfix">
    		<pre id="file_contents">Index: bp-xprofile/bp-xprofile-admin.php
    IDEA additional info: Date xprofile field enhancement 
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    &lt;+&gt;UTF-8
     
    331331        xprofile_admin( $message, $type );
    332332}
    333333
     334        function xprofile_admin_manage_datebox_option( $message ) {
     335                if( empty( $_POST[&#039;datebox_option&#039;] ) ) return;
     336
     337                $_POST[&#039;datebox_option&#039;][0] = isset( $_POST[&#039;datebox_option&#039;][0] ) ? &#039;yes&#039; : &#039;no&#039;;
     338
     339                $_POST[&#039;datebox_option&#039;][1] = ( isset( $_POST[&#039;datebox_option&#039;][1] ) || $_POST[&#039;datebox_option&#039;][7] == &#039;elapsed&#039; ) ? &#039;yes&#039; : &#039;no&#039;;
     340
     341                $_POST[&#039;datebox_option&#039;][2] = ( isset( $_POST[&#039;datebox_option&#039;][2] ) &amp;&amp; $_POST[&#039;datebox_option&#039;][2] == &#039;year&#039; ) ? &#039;year&#039; : &#039;ago&#039;;
     342
     343                $message .= ( $_POST[&#039;datebox_option&#039;][3] == &#039;&#039; ) ? __( &#039;Field &quot;Max years ago&quot; - required! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     344                $_POST[&#039;datebox_option&#039;][3] = isset( $_POST[&#039;datebox_option&#039;][3] ) ? mb_substr( abs ( intval ( $_POST[&#039;datebox_option&#039;][3] ) ), 0, 4, &#039;UTF-8&#039; ) : 100;
     345
     346                $message .= ( $_POST[&#039;datebox_option&#039;][4] == &#039;&#039; ) ? __( &#039;Field &quot;Min years ago&quot; - required! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     347                $_POST[&#039;datebox_option&#039;][4] =
     348                        isset( $_POST[&#039;datebox_option&#039;][4] ) ? mb_substr( intval( $_POST[&#039;datebox_option&#039;][4] ), 0, 5, &#039;UTF-8&#039; ) : 18;
     349
     350                if ( isset( $_POST[&#039;datebox_option_3_from_type&#039;] ) &amp;&amp; $_POST[&#039;datebox_option_3_from_type&#039;] ) {
     351                        $test_from = intval( date(&#039;Y&#039;) + $_POST[&#039;datebox_option&#039;][3] );
     352                } else {
     353                        $test_from = intval( date(&#039;Y&#039;) - $_POST[&#039;datebox_option&#039;][3] );
     354                        $_POST[&#039;datebox_option&#039;][3] = -intval( $_POST[&#039;datebox_option&#039;][3] );
     355                }
     356
     357                if ( isset( $_POST[&#039;datebox_option_3_to_type&#039;] ) &amp;&amp; $_POST[&#039;datebox_option_3_to_type&#039;] ) {
     358                        $test_to = intval( date(&#039;Y&#039;) + $_POST[&#039;datebox_option&#039;][4] );
     359                } else {
     360                        $test_to = intval( date(&#039;Y&#039;) - $_POST[&#039;datebox_option&#039;][4] );
     361                        $_POST[&#039;datebox_option&#039;][4] = -intval( $_POST[&#039;datebox_option&#039;][4] );
     362                }
     363
     364                $message .= ( $test_from &lt; $test_to ) ? __( &#039;Wrong year range! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     365
     366                $message .= ( $_POST[&#039;datebox_option&#039;][5] == &#039;&#039; ) ? __( &#039;Field &quot;Erliest&quot; - required! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     367                $_POST[&#039;datebox_option&#039;][5] = ( isset( $_POST[&#039;datebox_option&#039;][5] ) )
     368                        ? mb_substr( intval($_POST[&#039;datebox_option&#039;][5] ), 0, 5, &#039;UTF-8&#039; ) : date(&quot;Y&quot;) - 100;
     369
     370                $message .= ( $_POST[&#039;datebox_option&#039;][5] == &#039;&#039; ) ? __( &#039;Field &quot;Latest&quot; - required! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     371                $_POST[&#039;datebox_option&#039;][6] = ( isset($_POST[&#039;datebox_option&#039;][6] ) )
     372                        ? mb_substr( abs( intval( $_POST[&#039;datebox_option&#039;][6] ) ), 0, 4, &#039;UTF-8&#039;) : date(&quot;Y&quot;) - 18;
     373
     374                $message .= ( $_POST[&#039;datebox_option&#039;][5] &gt; $_POST[&#039;datebox_option&#039;][6] ) ? __( &#039;Wrong Erliest/Latest range! &#039;, &#039;buddypress&#039; ) : &#039;&#039;;
     375
     376                ksort( $_POST[&#039;datebox_option&#039;], SORT_NUMERIC );
     377                reset( $_POST[&#039;datebox_option&#039;] );
     378
     379                if(!empty($message)){
     380                        $GLOBALS[&#039;message&#039;] = $message;
     381                }
     382        }
     383
    334384/**
    335385 * Handles the adding or editing of profile field data for a user.
    336386 *
     
    351401        $field-&gt;group_id = $group_id;
    352402
    353403        if ( isset( $_POST[&#039;saveField&#039;] ) ) {
     404                xprofile_admin_manage_datebox_option($message);
     405
    354406                if ( BP_XProfile_Field::admin_validate() ) {
    355407                        $field-&gt;is_required = $_POST[&#039;required&#039;];
    356408                        $field-&gt;type        = $_POST[&#039;fieldtype&#039;];
  • bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    &lt;+&gt;UTF-8
     
    2828                $this-&gt;category = _x( &#039;Single Fields&#039;, &#039;xprofile field type category&#039;, &#039;buddypress&#039; );
    2929                $this-&gt;name     = _x( &#039;Date Selector&#039;, &#039;xprofile field type&#039;, &#039;buddypress&#039; );
    3030
     31                $this-&gt;supports_options = true; # This parameter - added
     32
    3133                $this-&gt;set_format( &#039;/^\d{4}-\d{1,2}-\d{1,2} 00:00:00$/&#039;, &#039;replace&#039; ); // &quot;Y-m-d 00:00:00&quot;
    3234
    3335                /**
     
    4143                do_action( &#039;bp_xprofile_field_type_datebox&#039;, $this );
    4244        }
    4345
     46        public function is_valid($value) {
     47                if ($value) {
     48                        return true;
     49                }
     50                return false;
     51        }
     52
    4453        /**
    4554         * Output the edit field HTML for this field type.
    4655         *
     
    162171
    163172                        // If MySQL timestamp.
    164173                        } else {
    165                                 $day   = mysql2date( &#039;j&#039;, $date );
    166                                 $month = mysql2date( &#039;F&#039;, $date, false ); // Not localized, so that selected() works below.
    167                                 $year  = mysql2date( &#039;Y&#039;, $date );
     174                                $DT = new DateTime($date); // problem 2038 year http://php.net/manual/en/class.datetime.php
     175                                $day = $DT-&gt;format(&#039;j&#039;);
     176                                $month = $DT-&gt;format(&#039;F&#039;);
     177                                $year = $DT-&gt;format(&#039;Y&#039;);
    168178                        }
    169179                }
    170180
     
    226236                        case &#039;year&#039;:
    227237                                $html = sprintf( &#039;&lt;option value=&quot;&quot; %1$s&gt;%2$s&lt;/option&gt;&#039;, selected( $year, 0, false ), /* translators: no option picked in select box */ __( &#039;----&#039;, &#039;buddypress&#039; ) );
    228238
    229                                 for ( $i = 2037; $i &gt; 1901; $i-- ) {
    230                                         $html .= sprintf( &#039;&lt;option value=&quot;%1$s&quot; %2$s&gt;%3$s&lt;/option&gt;&#039;, (int) $i, selected( $year, $i, false ), (int) $i );
    231                                 }
     239                                $ord = bp_xprofile_get_meta( &#039;bp_date_field&#039;, &#039;field&#039;, &#039;BPOptRegData&#039; );
     240                                $ord = unserialize($ord);
     241                                $opt = $this-&gt;field_obj-&gt;get_children();
     242
     243                                if(isset($opt[2]-&gt;name)){
     244                                        $ord[&#039;range-curr&#039;] = ($opt[2]-&gt;name == &#039;year&#039;) ? &#039;year&#039; : &#039;ago&#039;;
     245                                } else {
     246                                        $ord[&#039;range-curr&#039;] = &#039;ago&#039;;
     247                                }
     248
     249                                if(isset($opt[3]-&gt;name)) {
     250                                        $ord[&#039;range-year&#039;][&#039;ago&#039;][&#039;max&#039;] = $opt[3]-&gt;name;
     251                                }
     252
     253                                if(isset($opt[4]-&gt;name)){
     254                                        $ord[&#039;range-year&#039;][&#039;ago&#039;][&#039;min&#039;] = $opt[4]-&gt;name;
     255                                }
     256
     257                                if(isset($opt[5]-&gt;name)){
     258                                        $ord[&#039;range-year&#039;][&#039;year&#039;][&#039;earliest&#039;] = $opt[5]-&gt;name;
     259                                }
     260
     261                                if(isset($opt[6]-&gt;name)){
     262                                        $ord[&#039;range-year&#039;][&#039;year&#039;][&#039;latest&#039;] = $opt[6]-&gt;name;
     263                                }
     264
     265                                if($ord[&#039;range-curr&#039;] == &#039;ago&#039;){
     266                                        $ord[&#039;range-year&#039;][&#039;year&#039;][&#039;latest&#039;] = date(&quot;Y&quot;) + $ord[&#039;range-year&#039;][&#039;ago&#039;][&#039;min&#039;];
     267                                        $ord[&#039;range-year&#039;][&#039;year&#039;][&#039;earliest&#039;] = date(&quot;Y&quot;) + $ord[&#039;range-year&#039;][&#039;ago&#039;][&#039;max&#039;];
     268                                }
     269
     270                                for ( $i = $ord[&#039;range-year&#039;][&#039;year&#039;][&#039;latest&#039;]; $i &gt; ($ord[&#039;range-year&#039;][&#039;year&#039;][&#039;earliest&#039;]-1); $i-- ) {
     271                                        $html .= sprintf( &#039;&lt;option value=&quot;%1$s&quot; %2$s&gt;%3$s&lt;/option&gt;&#039;, (int) $i, selected( $year, $i, false ), (int) $i );
     272                                }
    232273                        break;
    233274                }
    234275
     
    272313                $year_r = bp_parse_args( $raw_properties, array(
    273314                        &#039;id&#039;   =&gt; bp_get_the_profile_field_input_name() . &#039;_year&#039;,
    274315                        &#039;name&#039; =&gt; bp_get_the_profile_field_input_name() . &#039;_year&#039;
    275                 ) ); ?&gt;
     316                ) );
    276317
    277                 &lt;label for=&quot;&lt;?php bp_the_profile_field_input_name(); ?&gt;_day&quot; class=&quot;screen-reader-text&quot;&gt;&lt;?php esc_html_e( &#039;Select day&#039;, &#039;buddypress&#039; ); ?&gt;&lt;/label&gt;
    278                 &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $day_r ); ?&gt;&gt;
    279                         &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;day&#039; ) ); ?&gt;
    280                 &lt;/select&gt;
     318                // Change the location of selects, depending on the &quot;date_format&quot;
     319
     320                ob_start();
     321                ?&gt;
     322            &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $day_r ); ?&gt;&gt;
     323                        &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;day&#039; ) ); ?&gt;
     324            &lt;/select&gt;
     325                &lt;?php
     326                $selectDay = ob_get_contents();
     327                ob_end_clean();
    281328
    282                 &lt;label for=&quot;&lt;?php bp_the_profile_field_input_name(); ?&gt;_month&quot; class=&quot;screen-reader-text&quot;&gt;&lt;?php esc_html_e( &#039;Select month&#039;, &#039;buddypress&#039; ); ?&gt;&lt;/label&gt;
    283                 &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $month_r ); ?&gt;&gt;
    284                         &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;month&#039; ) ); ?&gt;
    285                 &lt;/select&gt;
     329                ob_start();
     330                ?&gt;
     331            &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $month_r ); ?&gt;&gt;
     332                        &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;month&#039; ) ); ?&gt;
     333            &lt;/select&gt;
     334                &lt;?php
     335                $selectMonth = ob_get_contents();
     336                ob_end_clean();
    286337
    287                 &lt;label for=&quot;&lt;?php bp_the_profile_field_input_name(); ?&gt;_year&quot; class=&quot;screen-reader-text&quot;&gt;&lt;?php esc_html_e( &#039;Select year&#039;, &#039;buddypress&#039; ); ?&gt;&lt;/label&gt;
    288                 &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $year_r ); ?&gt;&gt;
    289                         &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;year&#039; ) ); ?&gt;
    290                 &lt;/select&gt;
     338                ob_start();
     339                ?&gt;
     340            &lt;select &lt;?php echo $this-&gt;get_edit_field_html_elements( $year_r ); ?&gt;&gt;
     341                        &lt;?php bp_the_profile_field_options( array( &#039;type&#039; =&gt; &#039;year&#039; ) ); ?&gt;
     342            &lt;/select&gt;
     343                &lt;?php
     344                $selectYear = ob_get_contents();
     345                ob_end_clean();
    291346
     347                // Change the location of selects, depending on the &quot;date_format&quot;
     348
     349                $format = get_option(&#039;date_format&#039;, &#039;d/m/Y&#039;);
     350
     351                switch( $format )
     352                {
     353                        case &#039;m/d/Y&#039;;#m/d/Y
     354                        case &#039;m-d-Y&#039;;
     355                        case &#039;m.d.Y&#039;;
     356                                echo $selectMonth;
     357                                echo $selectDay;
     358                                echo $selectYear;
     359                                break;
     360
     361                        case &#039;d/m/Y&#039;; #d/m/Y
     362                        case &#039;d-m-Y&#039;;
     363                        case &#039;d.m.Y&#039;;
     364                                echo $selectDay;
     365                                echo $selectMonth;
     366                                echo $selectYear;
     367                                break;
     368
     369                        default; #Y-m-d
     370                                echo $selectYear;
     371                                echo $selectMonth;
     372                                echo $selectDay;
     373                                break;
     374                }
     375
     376                ?&gt;
     377
     378
    292379        &lt;?php
    293380        }
    294381
     
    302389         * @param string            $control_type  Optional. HTML input type used to render the current
    303390         *                                         field&#039;s child options.
    304391         */
    305         public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = &#039;&#039; ) {}
     392        public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = &#039;&#039; ) {
     393                //parent::admin_new_field_html( $current_field, &#039;checkbox&#039; );
     394                $type = array_search( get_class( $this ), bp_xprofile_get_field_types() );
    306395
     396                if ( false === $type ) {
     397                        return;
     398                }
     399
     400                $class = $current_field-&gt;type != $type ? &#039;display: none;&#039; : &#039;&#039;;
     401                $current_type_obj = bp_xprofile_create_field_type( $type );
     402                $SET = $current_field-&gt;BPOptRegData;
     403                $SET = unserialize( $SET );
     404                $OPT = $current_field-&gt;get_children( true );
     405
     406
     407                ?&gt;
     408
     409    &lt;div id=&quot;&lt;?php echo esc_attr( $type ); ?&gt;&quot; class=&quot;postbox bp-options-box&quot; style=&quot;&lt;?php echo esc_attr( $class ); ?&gt; margin-top: 15px;&quot;&gt;
     410        &lt;h3&gt;&lt;?php esc_html_e( &#039;Please enter options for this Field:&#039;, &#039;buddypress&#039; ); ?&gt;&lt;/h3&gt;
     411
     412        &lt;div class=&quot;inside&quot;&gt;
     413
     414            &lt;div id=&quot;datebox_div1&quot; class=&quot;bp-option sortable&quot;&gt;
     415
     416            &lt;h2 style=&quot;font-size: 23px;&quot;&gt;Date field&lt;/h2&gt;
     417
     418                &lt;table class=&quot;form-table&quot; style=&quot;margin: 8px 13px;&quot;&gt;
     419                                        &lt;tr&gt;
     420                                                &lt;th style=&quot;width: 100px;&quot;&gt;Date format&lt;/th&gt;
     421                                                &lt;td&gt;
     422                                                        &lt;fieldset&gt;
     423
     424                                                                &lt;legend class=&quot;screen-reader-text&quot;&gt;&lt;span&gt;Date format&lt;/span&gt;&lt;/legend&gt;
     425                                                                &lt;?php
     426                                                                        $date_formats = array_unique( apply_filters( &#039;date_formats&#039;, array( __( &#039;F j, Y&#039; ), &#039;Y-m-d&#039;, &#039;m/d/Y&#039;, &#039;d/m/Y&#039; ) ) );
     427                                                                ?&gt;
     428                                                                &lt;?php if( !empty( $date_formats ) ): ?&gt;
     429                                                                        &lt;?php foreach ( $date_formats as $key =&gt; $format ): ?&gt;
     430                                                                        &lt;?php
     431                                                                                $checked = &#039;&#039;;
     432                                                                                if( $OPT[7]-&gt;name == $format || ( !$OPT[7]-&gt;name &amp;&amp; !$key ) ) {
     433                                                                                        $checked = &#039;checked&#039;;
     434                                                                                        $custom_format = false;
     435                                                                                }
     436                                                                        ?&gt;
     437
     438                                                                        &lt;label title=&#039;&lt;?=esc_attr( $format ); ?&gt;&#039;&gt;
     439                                                                                &lt;input &lt;?=$checked; ?&gt; type=&#039;radio&#039; name=&#039;datebox_option[7]&#039; value=&#039;&lt;?= esc_attr($format); ?&gt;&#039; /&gt;
     440                                                                                &lt;span class=&quot;date-time-text format-i18n&quot;&gt;&lt;?=date_i18n( $format );?&gt;&lt;/span&gt;
     441                                                                                &lt;code&gt;&lt;?=$format?&gt;&lt;/code&gt;
     442                                                                        &lt;/label&gt;&lt;br/&gt;
     443
     444                                                                        &lt;?php endforeach;?&gt;
     445                                                                &lt;?php endif; ?&gt;
     446
     447                                                                &lt;label&gt;
     448                                                                        &lt;input type=&quot;radio&quot; &lt;?= ( $SET[&#039;show-time&#039;] == &#039;yes&#039; OR $OPT[1]-&gt;name == &#039;yes&#039; ) ? &#039; checked=&quot;checked&quot; &#039; : &#039;&#039;; ?&gt; value=&quot;elapsed&quot; id=&quot;date_format_elapsed_radio&quot; name=&quot;datebox_option[7]&quot;&gt;
     449                                                                        Time elapsed
     450                                                                        &lt;span style=&quot;padding-left: 15px;&quot;&gt; Examples: &lt;/span&gt;
     451                                                                        &lt;code&gt;4 years ago&lt;/code&gt;,
     452                                                                        &lt;code&gt;4 years from now&lt;/code&gt;
     453                                                                &lt;/label&gt;
     454
     455                                                                &lt;label&gt;
     456                                                                        &lt;input type=&quot;radio&quot; &lt;?=( $custom_format )? &#039;checked&#039;: &#039;&#039;; ?&gt; value=&quot;custom&quot; id=&quot;date_format_custom_radio&quot; name=&quot;datebox_option[7]&quot;&gt;
     457                                                                        Custom:
     458                                                                        &lt;input type=&quot;text&quot; style=&quot;width: 80px;&quot; class=&quot;small-text&quot; value=&#039;&lt;?= esc_attr( $OPT[7]-&gt;name ); ?&gt;&#039; id=&quot;date_format_custom&quot; name=&quot;date_format_custom&quot;&gt;
     459                                                                        &lt;span style=&quot;padding-left: 15px;&quot;&gt; Example: &lt;/span&gt;
     460                                                                        &lt;code&gt;d.m.Y&lt;/code&gt;
     461                                                                &lt;/label&gt;&lt;br/&gt;
     462
     463                                                        &lt;/fieldset&gt;
     464                                                &lt;/td&gt;
     465                                        &lt;/tr&gt;
     466                                        &lt;tr&gt;
     467                                                &lt;th style=&quot;width: 100px;&quot;&gt;Range&lt;/th&gt;
     468                                                &lt;td&gt;
     469                                                        &lt;fieldset&gt;
     470                                                                &lt;legend class=&quot;screen-reader-text&quot;&gt;&lt;span&gt;Range&lt;/span&gt;&lt;/legend&gt;
     471
     472                                                                &lt;label&gt;
     473                                                                        &lt;input type=&quot;radio&quot; name=&quot;datebox_option[2]&quot; value=&quot;year&quot;
     474                                                                                &lt;?= ( $SET[&#039;range-curr&#039;] == &#039;year&#039; || $OPT[2]-&gt;name == &#039;year&#039; ) ? &#039; checked=&quot;checked&quot; &#039; : &#039;&#039;; ?&gt; /&gt;
     475
     476                                                                        &lt;span class=&quot;date-time-text format-i18n&quot;&gt;From&lt;/span&gt;
     477                                                                        &lt;input type=&quot;text&quot; name=&quot;datebox_option[5]&quot; size=&quot;3&quot; maxlength=&quot;5&quot;
     478                                                                                                value=&quot;&lt;?= isset( $OPT[5]-&gt;name ) ? $OPT[5]-&gt;name : $SET[&#039;range-year&#039;][&#039;year&#039;][&#039;earliest&#039;]; ?&gt;&quot; /&gt;
     479
     480                                                                        &lt;span class=&quot;date-time-text format-i18n&quot; style=&quot;padding-left:7px;padding-right:7px;&quot;&gt;to&lt;/span&gt;
     481                                                                        &lt;input type=&quot;text&quot; name=&quot;datebox_option[6]&quot; size=&quot;3&quot; maxlength=&quot;4&quot;
     482                                                                                          value=&quot;&lt;?= isset( $OPT[6]-&gt;name ) ? $OPT[6]-&gt;name : $SET[&#039;range-year&#039;][&#039;year&#039;][&#039;latest&#039;]; ?&gt;&quot; /&gt;
     483                                                                &lt;/label&gt;&lt;br/&gt;
     484
     485                                                                &lt;label&gt;
     486                                                                        &lt;input type=&quot;radio&quot; name=&quot;datebox_option[2]&quot;  value=&quot;ago&quot;
     487                                                        &lt;?= ( $SET[&#039;range-curr&#039;] == &#039;ago&#039; || $OPT[2]-&gt;name == &#039;ago&#039; ) ? &#039; checked=&quot;checked&quot; &#039; : &#039;&#039;; ?&gt; /&gt;
     488
     489                                                                        &lt;span class=&quot;date-time-text format-i18n&quot;&gt;From&lt;/span&gt;
     490                                                                        &lt;input type=&quot;text&quot; name=&quot;datebox_option[3]&quot; size=&quot;3&quot; maxlength=&quot;4&quot;
     491                                                                value=&quot;&lt;?= isset( $OPT[3]-&gt;name ) ? abs( $OPT[3]-&gt;name ) : $SET[&#039;range-year&#039;][&#039;ago&#039;][&#039;max&#039;]; ?&gt;&quot; /&gt;
     492                                                                        &lt;select name=&quot;datebox_option_3_from_type&quot;&gt;
     493                                                                                &lt;option value=&quot;0&quot; &lt;?php if ( isset( $OPT[3]-&gt;name ) &amp;&amp; intval( $OPT[3]-&gt;name ) &lt; 0 ) echo &#039;selected=&quot;selected&quot;&#039;; ?&gt;&gt;years ago&lt;/option&gt;
     494                                                                                &lt;option value=&quot;1&quot; &lt;?php if ( isset( $OPT[3]-&gt;name ) &amp;&amp; intval( $OPT[3]-&gt;name ) &gt; 0 ) echo &#039;selected=&quot;selected&quot;&#039;; ?&gt;&gt;years from now&lt;/option&gt;
     495                                                                        &lt;/select&gt;
     496
     497                                                                        &lt;span class=&quot;date-time-text format-i18n&quot; style=&quot;padding-left:7px;padding-right:7px;&quot;&gt;to&lt;/span&gt;
     498                                                                        &lt;input type=&quot;text&quot; name=&quot;datebox_option[4]&quot; size=&quot;3&quot; maxlength=&quot;5&quot;
     499                                                       value=&quot;&lt;?= isset( $OPT[4]-&gt;name ) ? abs( $OPT[4]-&gt;name ) : $SET[&#039;range-year&#039;][&#039;ago&#039;][&#039;min&#039;]; ?&gt;&quot; /&gt;
     500                                                                        &lt;select name=&quot;datebox_option_3_to_type&quot;&gt;
     501                                                                                &lt;option value=&quot;0&quot; &lt;?php if (isset( $OPT[4]-&gt;name ) &amp;&amp; intval( $OPT[4]-&gt;name ) &lt; 0) echo &#039;selected=&quot;selected&quot;&#039;; ?&gt;&gt;years ago&lt;/option&gt;
     502                                                                                &lt;option value=&quot;1&quot; &lt;?php if (isset( $OPT[4]-&gt;name ) &amp;&amp; intval( $OPT[4]-&gt;name ) &gt; 0) echo &#039;selected=&quot;selected&quot;&#039;; ?&gt;&gt;years from now&lt;/option&gt;
     503                                                                        &lt;/select&gt;
     504                                                                &lt;/label&gt;&lt;br/&gt;
     505
     506                                                        &lt;/fieldset&gt;
     507                                                &lt;/td&gt;
     508                                        &lt;/tr&gt;
     509                    &lt;tr&gt;
     510                        &lt;td&gt;&lt;/td&gt;
     511                        &lt;td colspan=&quot;3&quot;&gt;
     512                                                                                                        &lt;p&gt;&lt;a href=&quot;https://codex.wordpress.org/Formatting_Date_and_Time&quot;&gt;Documentation on date and time formatting&lt;/a&gt;.&lt;/p&gt;
     513                                                                                                        &lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: Range is allowed between 1902 and 2037 years only.&lt;/p&gt;
     514                                                                                                &lt;/td&gt;
     515                        &lt;/tr&gt;
     516                &lt;/table&gt;
     517         &lt;/div&gt;
     518
     519            &lt;input type=&quot;hidden&quot; name=&quot;datebox_option_number&quot; id=&quot;datebox_option_number&quot; value=&quot;8&quot;/&gt;
     520            &lt;input type=&quot;hidden&quot; name=&quot;sort_order_datebox&quot; id=&quot;sort_order_datebox&quot; value=&quot;custom&quot;/&gt;
     521
     522            &lt;?php /*div id=&quot;datebox_more&quot;&gt;&lt;/div&gt;
     523            &lt;p&gt;&lt;a href=&quot;javascript:add_option(&#039;datebox&#039;)&quot;&gt;Add Another Option&lt;/a&gt;&lt;/p*/ ?&gt;
     524        &lt;/div&gt;
     525    &lt;/div&gt;
     526           &lt;script&gt;
     527                   jQuery(document).ready(function($) {
     528                                $(&quot;input[name=&#039;date_format&#039;]&quot;).click(function(){
     529                                                if ( &quot;date_format_custom_radio&quot; != $(this).attr(&quot;id&quot;) )
     530                                                        $( &quot;input[name=&#039;date_format_custom&#039;]&quot; ).val( $( this ).val() ).siblings( &#039;.example&#039; ).text( $( this ).parent( &#039;label&#039; ).text() );
     531                                        });
     532
     533                                        $(&quot;input[name=&#039;date_format_custom&#039;]&quot;).focus(function(){
     534                                                $( &#039;#date_format_custom_radio&#039; ).prop( &#039;checked&#039;, true );
     535                                        });
     536
     537                           $(&quot;input[name=&#039;date_format_custom&#039;], input[name=&#039;time_format_custom&#039;]&quot;).change( function() {
     538                                                var format = $(this);
     539                                                $(&#039;#date_format_custom_radio&#039; ).val(format.val());
     540                                                format.siblings( &#039;.spinner&#039; ).addClass( &#039;is-active&#039; );
     541                                                $.post(ajaxurl, {
     542                                                                action: &#039;date_format_custom&#039; == format.attr(&#039;name&#039;) ? &#039;date_format&#039; : &#039;time_format&#039;,
     543                                                                date : format.val()
     544                                                                }, function(d) {
     545                                                                        format.siblings( &#039;.spinner&#039; ).removeClass( &#039;is-active&#039; ); format.siblings(&#039;.example&#039;).text(d);
     546
     547                                                                } );
     548                                                });
     549                       });
     550            &lt;/script&gt;
     551
     552                &lt;?php
     553        }
     554
    307555        /**
    308556         * Format Date values for display.
    309557         *
     
    322570                        $field_value = strtotime( $field_value );
    323571                }
    324572
    325                 return bp_format_time( $field_value, true, false );
    326         }
     573                global $wpdb, $bp;
     574                $option = unserialize( bp_xprofile_get_meta( &#039;bp_date_field&#039;, &#039;field&#039;, &#039;BPOptRegData&#039; ) );
     575                //$uid = bp_displayed_user_id();
     576                $parent_id = isset( $GLOBALS[&#039;field&#039;]-&gt;id ) ? $GLOBALS[&#039;field&#039;]-&gt;id : $field_id;
     577                $sort_sql = &#039;ORDER BY option_order ASC&#039;;
     578                $sql = $wpdb-&gt;prepare( &quot;SELECT * FROM {$bp-&gt;profile-&gt;table_name_fields} WHERE parent_id = %d $sort_sql&quot;, $parent_id);
     579                $opt = $wpdb-&gt;get_results( $sql );
     580
     581                $option[&#039;date-format&#039;] = $opt[7]-&gt;name;
     582
     583                if(isset($opt[0]) &amp;&amp; isset($opt[1])){
     584                        $option[&#039;show-year&#039;] = $opt[0]-&gt;name;
     585                        $option[&#039;show-time&#039;] = $opt[1]-&gt;name;
     586                }
     587
     588
     589                if($option[&#039;show-time&#039;] == &#039;yes&#039;){
     590                        $field_value = self::formatDateByBPOptRegData($field_value,$option, true, true);
     591
     592                }else {
     593                        $field_value = self::formatDateByBPOptRegData($field_value,$option, true, false);
     594                }
     595
     596                return $field_value;
     597        }
     598
     599        private function formatDateByBPOptRegData( $time, $option, $localize_time = true, $show) {
     600
     601                        if ( ! isset( $time ) || ! is_numeric( $time ) ) {
     602                                return false;
     603                        }
     604
     605                        if ( ! empty( $localize_time ) ) {
     606                                $root_blog_offset = get_blog_option( bp_get_root_blog_id(), &#039;gmt_offset&#039; );
     607                        }else{
     608                                $root_blog_offset = false;
     609                        }
     610
     611                        $time_offset = $time + ( $root_blog_offset * 3600 );
     612
     613                        if($show === false){
     614                                $date = date_i18n( $option[&#039;date-format&#039;], $time_offset );
     615                        } else {  // Here we calculate the number of years
     616                                $current_year = intval( date(&quot;Y&quot;) );
     617                                $selected_year = intval( date( &quot;Y&quot;, $time_offset ) );
     618                                if ( $selected_year &gt; $current_year ) {
     619                                        $date = &#039; &#039; . ( $selected_year - $current_year ) . __(&#039; years from now&#039;, &#039;buddypress&#039;);
     620                                } else {
     621                                        $date = &#039; &#039; . ( $current_year - $selected_year ) . __(&#039; years ago&#039;, &#039;buddypress&#039;);
     622                                }
     623                        }
     624
     625                        return $date;
     626                }
    327627}
  • bp-xprofile/bp-xprofile-screens.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    &lt;+&gt;UTF-8
     
    6565                return;
    6666        }
    6767
     68
    6869        // No errors.
    6970        $errors = false;
    7071
     
    9192
    9293                                if ( !empty( $_POST[&#039;field_&#039; . $field_id . &#039;_day&#039;] ) &amp;&amp; !empty( $_POST[&#039;field_&#039; . $field_id . &#039;_month&#039;] ) &amp;&amp; !empty( $_POST[&#039;field_&#039; . $field_id . &#039;_year&#039;] ) ) {
    9394                                        // Concatenate the values.
    94                                         $date_value =   $_POST[&#039;field_&#039; . $field_id . &#039;_day&#039;] . &#039; &#039; . $_POST[&#039;field_&#039; . $field_id . &#039;_month&#039;] . &#039; &#039; . $_POST[&#039;field_&#039; . $field_id . &#039;_year&#039;];
     95                                        $eng_months = array( 1=&gt;&#039;January&#039;, &#039;February&#039;, &#039;March&#039;, &#039;April&#039;, &#039;May&#039;, &#039;June&#039;, &#039;July&#039;, &#039;August&#039;, &#039;September&#039;, &#039;October&#039;, &#039;November&#039;, &#039;December&#039; );
     96                                        $_POST[&#039;field_&#039; . $field_id . &#039;_month&#039;] = array_search( $_POST[&#039;field_&#039; . $field_id . &#039;_month&#039;], $eng_months );
     97                                        $date_value = $_POST[&#039;field_&#039; . $field_id . &#039;_year&#039;] . &#039;-&#039; . $_POST[&#039;field_&#039; . $field_id . &#039;_month&#039;] . &#039;-&#039; . $_POST[&#039;field_&#039; . $field_id . &#039;_day&#039;];
    9598
    9699                                        // Turn the concatenated value into a timestamp.
    97                                         $_POST[&#039;field_&#039; . $field_id] = date( &#039;Y-m-d H:i:s&#039;, strtotime( $date_value ) );
     100                                        $date = new DateTime( $date_value );
     101                                        $_POST[&#039;field_&#039; . $field_id] = $date-&gt;getTimestamp();
    98102                                }
    99103
    100104                        }
     
    114118
    115119                        // Reset the errors var.
    116120                        $errors = false;
    117 
    118121                        // Now we&#039;ve checked for required fields, lets save the values.
    119122                        $old_values = $new_values = array();
    120123                        foreach ( (array) $posted_field_ids as $field_id ) {
  • bp-xprofile/classes/class-bp-xprofile-field.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    &lt;+&gt;UTF-8
     
    162162         */
    163163        protected $member_types;
    164164
     165
     166
     167        public $BPOptRegData = array();
     168
    165169        /**
    166170         * Initialize and/or populate profile field.
    167171         *
     
    181185                        $this-&gt;type_obj            = bp_xprofile_create_field_type( &#039;textbox&#039; );
    182186                        $this-&gt;type_obj-&gt;field_obj = $this;
    183187                }
     188
     189                        $this-&gt;BPOptRegData = $this-&gt;runCheckBPOptRegDate();
     190        }
     191
     192
     193        public function runCheckBPOptRegDate() {
     194
     195                $BPOptRegData = bp_xprofile_get_meta( &#039;bp_date_field&#039;, &#039;field&#039;, &#039;BPOptRegData&#039; );
     196
     197                $serialize = serialize(
     198                        array(
     199                                &#039;show-year&#039; =&gt; &#039;yes&#039;,
     200                                &#039;show-time&#039; =&gt; &#039;no&#039;,
     201                                &#039;range-curr&#039; =&gt; &#039;year&#039;,
     202                                &#039;range-year&#039; =&gt; array(
     203                                        &#039;ago&#039; =&gt; array(&#039;min&#039; =&gt; 18, &#039;max&#039; =&gt; 100),
     204                                        &#039;year&#039; =&gt; array(&#039;earliest&#039; =&gt; (date(&quot;Y&quot;)-101), &#039;latest&#039; =&gt; (date(&quot;Y&quot;)-18))
     205                                ),
     206                                &#039;date-format&#039; =&gt; &quot;Y-m-d&quot;,
     207                        )
     208                );
     209
     210                bp_xprofile_update_meta( &#039;bp_date_field&#039;, &#039;field&#039;, &#039;BPOptRegData&#039;, $serialize );
     211
     212                return $serialize;
    184213        }
    185214
    186215        /**
  • bp-xprofile/bp-xprofile-functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    &lt;+&gt;UTF-8
     
    434434        }
    435435
    436436        // For certain fields, only certain parameters are acceptable, so add them to the whitelist.
    437         if ( $field_type_obj-&gt;supports_options ) {
     437        if ( $field_type_obj-&gt;supports_options &amp;&amp; $field_type_obj-&gt;name != &#039;Date Selector&#039; ) {
    438438                $field_type_obj-&gt;set_whitelist_values( wp_list_pluck( $field-&gt;get_children(), &#039;name&#039; ) );
    439439        }
    440440