From ada937ab1e22041e1d8a6b7eff748654e91cdec3 Mon Sep 17 00:00:00 2001 From: Arpit Pandey Date: Tue, 23 Oct 2018 17:27:07 +0530 Subject: [PATCH] Fixed spacing to make it consistent throughout project --- controller/action/ContentActions.class.php | 2 +- controller/action/DeveloperActions.class.php | 2 +- controller/action/MailActions.class.php | 2 +- controller/action/OpsActions.class.php | 2 +- lib/vendor/S3.class.php | 10 +++++----- view/template/acquisition/youtube_status.php | 2 +- .../acquisition/youtube_status_redirect.php | 4 ++-- web/js/emailSettings.js | 2 +- web/js/yt2/FormValidation.js | 19 +++++++++---------- web/js/yt2/SyncStatus.js | 2 +- web/js/yt2/app.js | 10 +++++----- web/js/yt2/youtube_video.js | 2 +- 12 files changed, 29 insertions(+), 30 deletions(-) diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index a198fadd..acb6b071 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -81,7 +81,7 @@ class ContentActions extends Actions if (!$slug) { $allPosts = Post::find(static::VIEW_FOLDER_FAQ, Post::SORT_ORD_ASC); - $allCategories = [ + $allCategories = [ 'LBRY 101' => 'Intro to LBRY', 'getstarted' => 'Getting Started', 'publisher' => 'Publishers and Creators', diff --git a/controller/action/DeveloperActions.class.php b/controller/action/DeveloperActions.class.php index 69ab7e8f..2b43a264 100644 --- a/controller/action/DeveloperActions.class.php +++ b/controller/action/DeveloperActions.class.php @@ -7,7 +7,7 @@ class DeveloperActions extends Actions public static function executeQuickstart(string $step = null) { - $stepLabels = [ + $stepLabels = [ '' => 'Home', 'install' => 'Installation', 'api' => 'The API', diff --git a/controller/action/MailActions.class.php b/controller/action/MailActions.class.php index d4b2095c..67c5140f 100644 --- a/controller/action/MailActions.class.php +++ b/controller/action/MailActions.class.php @@ -63,7 +63,7 @@ class MailActions extends Actions public static function editEmailSettings(string $token) { list($status, $headers, $response) = LBRY::emailStatus($token); - if( $status == 403){ + if ($status == 403) { //Catch 403 to return elegant error message. $response['error'] = "This email link is invalid. If you clicked this from an older email it may have been expired for security purposes. Please email help@lbry.io for a valid one."; } diff --git a/controller/action/OpsActions.class.php b/controller/action/OpsActions.class.php index e64d1ea6..78b0578b 100644 --- a/controller/action/OpsActions.class.php +++ b/controller/action/OpsActions.class.php @@ -35,7 +35,7 @@ class OpsActions extends Actions } $rawPost = file_get_contents('php://input'); - $secret = Config::get(Config::GITHUB_KEY); + $secret = Config::get(Config::GITHUB_KEY); if ($hash !== hash_hmac($algo, $rawPost, $secret)) { return NavActions::execute400(['error' => 'Hash does not match.']); } diff --git a/lib/vendor/S3.class.php b/lib/vendor/S3.class.php index 660844c4..49caf02d 100644 --- a/lib/vendor/S3.class.php +++ b/lib/vendor/S3.class.php @@ -858,7 +858,7 @@ class S3 { $rest = new S3Request('PUT', $bucket, '', self::$endpoint); - if( empty($bucket) || empty($location) ) { + if (empty($bucket) || empty($location)) { self::__triggerError("S3::setBucketRedirect({$bucket}, {$location}): Empty parameter.", __FILE__, __LINE__); return false; } @@ -876,10 +876,10 @@ class S3 $rest->setHeader('Content-Type', 'application/xml'); $rest = $rest->getResponse(); - if ($rest->error === false && $rest->code !== 200) - $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); - if ($rest->error !== false) - { + if ($rest->error === false && $rest->code !== 200) { + $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status'); + } + if ($rest->error !== false) { self::__triggerError(sprintf("S3::setBucketRedirect({$bucket}, {$location}): [%s] %s", $rest->error['code'], $rest->error['message']), __FILE__, __LINE__); return false; diff --git a/view/template/acquisition/youtube_status.php b/view/template/acquisition/youtube_status.php index e67fe638..dea7505f 100644 --- a/view/template/acquisition/youtube_status.php +++ b/view/template/acquisition/youtube_status.php @@ -10,7 +10,7 @@ - if(!localStorage.getItem('status_token')) { + if (!localStorage.getItem('status_token')) { ga('send', 'event', 'YT Sync', '', ''); fbq('track', 'Lead'); diff --git a/view/template/acquisition/youtube_status_redirect.php b/view/template/acquisition/youtube_status_redirect.php index d83b7061..ba55b475 100644 --- a/view/template/acquisition/youtube_status_redirect.php +++ b/view/template/acquisition/youtube_status_redirect.php @@ -1,11 +1,11 @@ -if(localStorage.getItem('status_token')){ +if (localStorage.getItem('status_token')) { var status_token = localStorage.getItem('status_token'); url = '/youtube/status/' + status_token; $(location).attr('href', url); } -else{ +else { $(location).attr('href', '/youtube'); } diff --git a/web/js/emailSettings.js b/web/js/emailSettings.js index 19e7aa8d..01e49768 100644 --- a/web/js/emailSettings.js +++ b/web/js/emailSettings.js @@ -5,7 +5,7 @@ lbry.emailSettingsForm = function (formSelector, tags, userAuthToken) { tagSection = form.find('.tag-section'), tagMap = new Map(); - $.each(tags, function(tag, enabled){ + $.each(tags, function(tag, enabled) { tagMap[tag] = enabled; }); diff --git a/web/js/yt2/FormValidation.js b/web/js/yt2/FormValidation.js index 1f85c939..56dbe7e4 100644 --- a/web/js/yt2/FormValidation.js +++ b/web/js/yt2/FormValidation.js @@ -1,6 +1,6 @@ var is_first_time = true; -function submitEditForm(){ +function submitEditForm() { $("#youtube_settings").submit(function (event) { // get value from id @@ -12,21 +12,20 @@ function submitEditForm(){ $('#email-error').hide(); // If the channel name is invalid or blank stop the post request - if(!validateLBRYName(lbry_channel_name) || lbry_channel_name === ''){ + if (!validateLBRYName(lbry_channel_name) || lbry_channel_name === '') { $('#lbry_channel_name').addClass('error_form'); $('#channel-name-error').show(); event.preventDefault(); } - if(!validateEmail(email) || email === ''){ + if (!validateEmail(email) || email === '') { $('#email').addClass('error_form'); $('#email-error').show(); event.preventDefault(); } - else if(!validateEmailIsNotGooglePlus(email)){ - + else if (!validateEmailIsNotGooglePlus(email)) { $('#email').addClass('error_form'); - if(is_first_time){ + if (is_first_time) { $('#email').addClass('error_form'); $('#email-google-plus-error').show(); is_first_time = false; @@ -49,7 +48,7 @@ function submitDetailsForm() { $('#lbry_error').hide(); // If the lbry name is invalid or blank stop the post request - if(!validateLBRYName(lbry_channel_name) || lbry_channel_name === '') { + if (!validateLBRYName(lbry_channel_name) || lbry_channel_name === '') { $('#lbry_channel_name').addClass('error_form'); $('#lbry_error').show(); event.preventDefault(); @@ -62,17 +61,17 @@ function validateEmail(email) { return re.test(email); } -function validateLBRYName(lbry_channel_name){ +function validateLBRYName(lbry_channel_name) { var re = /^[@A-Za-z0-9-]*$/g; return re.test(lbry_channel_name); } -function validateYoutubeChannelUrl(youtube_channel_url){ +function validateYoutubeChannelUrl(youtube_channel_url) { var re = /^UC[A-Za-z0-9_-]{22}$/; return re.test(youtube_channel_url); } -function validateEmailIsNotGooglePlus(email){ +function validateEmailIsNotGooglePlus(email) { var re = /^[A-Za-z0-9._%+-]+@(?!plusgoogle.com)[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/; return re.test(email); } diff --git a/web/js/yt2/SyncStatus.js b/web/js/yt2/SyncStatus.js index a38752e7..f5819c48 100644 --- a/web/js/yt2/SyncStatus.js +++ b/web/js/yt2/SyncStatus.js @@ -2,7 +2,7 @@ $(document).ready(function () { var status_token = localStorage.getItem("status_token"); var lbry_channel_name_sync = localStorage.getItem("lbry_channel_name_sync"); - if (status_token || lbry_channel_name_sync){ + if (status_token || lbry_channel_name_sync) { var url = "/youtube/status/" + status_token; $("#sync-status").show(); $("#sync-status").html("Hey, " + lbry_channel_name_sync + "! " + "" + "See your channel sync status here."); diff --git a/web/js/yt2/app.js b/web/js/yt2/app.js index 9a1ecfcd..3791133e 100644 --- a/web/js/yt2/app.js +++ b/web/js/yt2/app.js @@ -64,7 +64,7 @@ App.prototype._onReadyStateChange = function(e) { var response = JSON.parse(this._xhr.responseText); var price = parseFloat(response[0].price_usd); var lines = Array.prototype.slice.call(document.getElementsByClassName('line'),0); - lines.forEach(function(line){ + lines.forEach(function(line) { var subscriber = line.getElementsByTagName('p')[0]; var monthly = line.getElementsByTagName('p')[1]; var amount = line.getElementsByTagName('p')[2]; @@ -106,7 +106,7 @@ App.prototype._goToTop = function() { App.prototype._onTick = function() { // Header animation - this._points.forEach(function(point,i){ + this._points.forEach(function(point,i) { var line = this._lines[i]; var path = line.getElement(); var index = parseFloat(path.getAttribute('data-from')); @@ -154,7 +154,7 @@ App.prototype._onTick = function() { TweenLite.set(this._journey,{width:this._percent+'%'}); - this._steps.forEach(function(step){ + this._steps.forEach(function(step) { var enableAt = parseFloat(step.getAttribute('data-enable')); if (this._percent > enableAt) { if (step.className.indexOf('enabled') !== -1) { @@ -167,7 +167,7 @@ App.prototype._onTick = function() { } },this); } else { - this._steps.forEach(function(step){ + this._steps.forEach(function(step) { if (step.className.indexOf('enabled') === -1) { step.className += ' enabled'; } @@ -176,7 +176,7 @@ App.prototype._onTick = function() { }; App.prototype._onResize = function() { - this._points.forEach(function(point,i){ + this._points.forEach(function(point,i) { point.resetOrigin(); },this); this._start = this._how.offsetTop - this._how.scrollTop - window.innerHeight / 2 - this._offset; diff --git a/web/js/yt2/youtube_video.js b/web/js/yt2/youtube_video.js index d4a1ec83..0a0a3ed0 100644 --- a/web/js/yt2/youtube_video.js +++ b/web/js/yt2/youtube_video.js @@ -1,5 +1,5 @@ -function playVideo(id){ +function playVideo(id) { var myVideo = document.getElementById(id); myVideo.play();