diff --git a/app/Comment.php b/app/Comment.php
index fd050a720..20fe3a866 100644
--- a/app/Comment.php
+++ b/app/Comment.php
@@ -8,11 +8,11 @@ class Comment extends Model
{
public function profile()
{
- return $this->belongsTo(Profile::class);
+ return $this->belongsTo(Profile::class);
}
public function status()
{
- return $this->belongsTo(Status::class);
+ return $this->belongsTo(Status::class);
}
}
diff --git a/app/Console/Commands/CatchUnoptimizedMedia.php b/app/Console/Commands/CatchUnoptimizedMedia.php
index 01b8f79c0..0ca48b850 100644
--- a/app/Console/Commands/CatchUnoptimizedMedia.php
+++ b/app/Console/Commands/CatchUnoptimizedMedia.php
@@ -2,9 +2,9 @@
namespace App\Console\Commands;
-use Illuminate\Console\Command;
-use App\Media;
use App\Jobs\ImageOptimizePipeline\ImageOptimize;
+use App\Media;
+use Illuminate\Console\Command;
class CatchUnoptimizedMedia extends Command
{
@@ -40,7 +40,7 @@ class CatchUnoptimizedMedia extends Command
public function handle()
{
$medias = Media::whereNull('processed_at')->take(50)->get();
- foreach($medias as $media) {
+ foreach ($medias as $media) {
ImageOptimize::dispatch($media);
}
}
diff --git a/app/Console/Commands/SeedFollows.php b/app/Console/Commands/SeedFollows.php
index d11685648..813ea2667 100644
--- a/app/Console/Commands/SeedFollows.php
+++ b/app/Console/Commands/SeedFollows.php
@@ -2,9 +2,10 @@
namespace App\Console\Commands;
-use App\{Follower, Profile};
-use Illuminate\Console\Command;
+use App\Follower;
use App\Jobs\FollowPipeline\FollowPipeline;
+use App\Profile;
+use Illuminate\Console\Command;
class SeedFollows extends Command
{
@@ -41,12 +42,12 @@ class SeedFollows extends Command
{
$limit = 10000;
- for ($i=0; $i < $limit; $i++) {
+ for ($i = 0; $i < $limit; $i++) {
try {
$actor = Profile::inRandomOrder()->firstOrFail();
$target = Profile::inRandomOrder()->firstOrFail();
- $follow = new Follower;
+ $follow = new Follower();
$follow->profile_id = $actor->id;
$follow->following_id = $target->id;
$follow->save();
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 6912655e6..37dfa92db 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
+ * @param \Illuminate\Console\Scheduling\Schedule $schedule
+ *
* @return void
*/
protected function schedule(Schedule $schedule)
diff --git a/app/EmailVerification.php b/app/EmailVerification.php
index cdc9b8bb1..688034164 100644
--- a/app/EmailVerification.php
+++ b/app/EmailVerification.php
@@ -8,8 +8,9 @@ class EmailVerification extends Model
{
public function url()
{
- $base = config('app.url');
- $path = '/i/confirm-email/' . $this->user_token . '/' . $this->random_token;
- return "{$base}{$path}";
+ $base = config('app.url');
+ $path = '/i/confirm-email/'.$this->user_token.'/'.$this->random_token;
+
+ return "{$base}{$path}";
}
}
diff --git a/app/Events/AuthLoginEvent.php b/app/Events/AuthLoginEvent.php
index 946cbe09e..72c6e74e6 100644
--- a/app/Events/AuthLoginEvent.php
+++ b/app/Events/AuthLoginEvent.php
@@ -2,14 +2,11 @@
namespace App\Events;
-use Illuminate\Broadcasting\Channel;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Broadcasting\PrivateChannel;
-use Illuminate\Broadcasting\PresenceChannel;
-use Illuminate\Foundation\Events\Dispatchable;
+use App\User;
+use App\UserSetting;
use Illuminate\Broadcasting\InteractsWithSockets;
-use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
-use App\{User, UserSetting};
+use Illuminate\Foundation\Events\Dispatchable;
+use Illuminate\Queue\SerializesModels;
class AuthLoginEvent
{
@@ -27,8 +24,8 @@ class AuthLoginEvent
public function handle(User $user)
{
- if(empty($user->settings)) {
- $settings = new UserSetting;
+ if (empty($user->settings)) {
+ $settings = new UserSetting();
$settings->user_id = $user->id;
$settings->save();
}
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 043cad6bc..3b97f12b4 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -29,7 +29,8 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
- * @param \Exception $exception
+ * @param \Exception $exception
+ *
* @return void
*/
public function report(Exception $exception)
@@ -40,8 +41,9 @@ class Handler extends ExceptionHandler
/**
* Render an exception into an HTTP response.
*
- * @param \Illuminate\Http\Request $request
- * @param \Exception $exception
+ * @param \Illuminate\Http\Request $request
+ * @param \Exception $exception
+ *
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
diff --git a/app/Follower.php b/app/Follower.php
index b2b8675de..118495fe2 100644
--- a/app/Follower.php
+++ b/app/Follower.php
@@ -8,30 +8,32 @@ class Follower extends Model
{
public function actor()
{
- return $this->belongsTo(Profile::class, 'profile_id', 'id');
+ return $this->belongsTo(Profile::class, 'profile_id', 'id');
}
public function target()
{
- return $this->belongsTo(Profile::class, 'following_id', 'id');
+ return $this->belongsTo(Profile::class, 'following_id', 'id');
}
public function profile()
{
- return $this->belongsTo(Profile::class, 'following_id', 'id');
+ return $this->belongsTo(Profile::class, 'following_id', 'id');
}
public function toText()
{
- $actorName = $this->actor->username;
- return "{$actorName} " . __('notification.startedFollowingYou');
+ $actorName = $this->actor->username;
+
+ return "{$actorName} ".__('notification.startedFollowingYou');
}
public function toHtml()
{
- $actorName = $this->actor->username;
- $actorUrl = $this->actor->url();
- return "{$actorName} " .
+ $actorName = $this->actor->username;
+ $actorUrl = $this->actor->url();
+
+ return "{$actorName} ".
__('notification.startedFollowingYou');
}
}
diff --git a/app/Hashtag.php b/app/Hashtag.php
index 6314accc8..29c4ca9b2 100644
--- a/app/Hashtag.php
+++ b/app/Hashtag.php
@@ -6,11 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class Hashtag extends Model
{
- public $fillable = ['name','slug'];
+ public $fillable = ['name', 'slug'];
public function posts()
{
- return $this->hasManyThrough(
+ return $this->hasManyThrough(
Status::class,
StatusHashtag::class,
'hashtag_id',
@@ -22,7 +22,6 @@ class Hashtag extends Model
public function url()
{
- return config('routes.hashtag.base') . $this->slug;
+ return config('routes.hashtag.base').$this->slug;
}
-
}
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 76a47e938..acf17a247 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -2,77 +2,78 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use Carbon\Carbon;
+use App\EmailVerification;
use App\Mail\ConfirmEmail;
-use Auth, DB, Cache, Mail, Redis;
-use App\{
- EmailVerification,
- Notification,
- Profile,
- User,
- UserFilter
-};
+use App\Notification;
+use App\Profile;
+use App\User;
+use App\UserFilter;
+use Auth;
+use Cache;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+use Mail;
+use Redis;
class AccountController extends Controller
{
protected $filters = [
'user.mute',
- 'user.block'
+ 'user.block',
];
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function notifications(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'page' => 'nullable|min:1|max:3',
'a' => 'nullable|alpha_dash',
]);
- $profile = Auth::user()->profile;
- $action = $request->input('a');
- $timeago = Carbon::now()->subMonths(6);
- if($action && in_array($action, ['comment', 'follow', 'mention'])) {
- $notifications = Notification::whereProfileId($profile->id)
+ $profile = Auth::user()->profile;
+ $action = $request->input('a');
+ $timeago = Carbon::now()->subMonths(6);
+ if ($action && in_array($action, ['comment', 'follow', 'mention'])) {
+ $notifications = Notification::whereProfileId($profile->id)
->whereAction($action)
->whereDate('created_at', '>', $timeago)
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->simplePaginate(30);
- } else {
- $notifications = Notification::whereProfileId($profile->id)
+ } else {
+ $notifications = Notification::whereProfileId($profile->id)
->whereDate('created_at', '>', $timeago)
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->simplePaginate(30);
- }
+ }
- return view('account.activity', compact('profile', 'notifications'));
+ return view('account.activity', compact('profile', 'notifications'));
}
public function followingActivity(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'page' => 'nullable|min:1|max:3',
'a' => 'nullable|alpha_dash',
]);
- $profile = Auth::user()->profile;
- $action = $request->input('a');
- $timeago = Carbon::now()->subMonths(1);
- $following = $profile->following->pluck('id');
- $notifications = Notification::whereIn('actor_id', $following)
+ $profile = Auth::user()->profile;
+ $action = $request->input('a');
+ $timeago = Carbon::now()->subMonths(1);
+ $following = $profile->following->pluck('id');
+ $notifications = Notification::whereIn('actor_id', $following)
->where('profile_id', '!=', $profile->id)
->whereDate('created_at', '>', $timeago)
- ->orderBy('notifications.id','desc')
+ ->orderBy('notifications.id', 'desc')
->simplePaginate(30);
- return view('account.following', compact('profile', 'notifications'));
+ return view('account.following', compact('profile', 'notifications'));
}
public function verifyEmail(Request $request)
{
- return view('account.verify_email');
+ return view('account.verify_email');
}
public function sendVerifyEmail(Request $request)
@@ -82,19 +83,18 @@ class AccountController extends Controller
->where('created_at', '>', $timeLimit)->count();
$exists = EmailVerification::whereUserId(Auth::id())->count();
- if($recentAttempt == 1 && $exists == 1) {
+ if ($recentAttempt == 1 && $exists == 1) {
return redirect()->back()->with('error', 'A verification email has already been sent recently. Please check your email, or try again later.');
} elseif ($recentAttempt == 0 && $exists !== 0) {
// Delete old verification and send new one.
EmailVerification::whereUserId(Auth::id())->delete();
}
-
$user = User::whereNull('email_verified_at')->find(Auth::id());
$utoken = hash('sha512', $user->id);
$rtoken = str_random(40);
- $verify = new EmailVerification;
+ $verify = new EmailVerification();
$verify->user_id = $user->id;
$verify->email = $user->email;
$verify->user_token = $utoken;
@@ -112,55 +112,56 @@ class AccountController extends Controller
->where('random_token', $randomToken)
->firstOrFail();
- if(Auth::id() === $verify->user_id) {
- $user = User::find(Auth::id());
- $user->email_verified_at = Carbon::now();
- $user->save();
- return redirect('/');
+ if (Auth::id() === $verify->user_id) {
+ $user = User::find(Auth::id());
+ $user->email_verified_at = Carbon::now();
+ $user->save();
+
+ return redirect('/');
}
}
public function fetchNotifications($id)
{
- $key = config('cache.prefix') . ":user.{$id}.notifications";
- $redis = Redis::connection();
- $notifications = $redis->lrange($key, 0, 30);
- if(empty($notifications)) {
- $notifications = Notification::whereProfileId($id)
- ->orderBy('id','desc')->take(30)->get();
- } else {
- $notifications = $this->hydrateNotifications($notifications);
- }
+ $key = config('cache.prefix').":user.{$id}.notifications";
+ $redis = Redis::connection();
+ $notifications = $redis->lrange($key, 0, 30);
+ if (empty($notifications)) {
+ $notifications = Notification::whereProfileId($id)
+ ->orderBy('id', 'desc')->take(30)->get();
+ } else {
+ $notifications = $this->hydrateNotifications($notifications);
+ }
- return $notifications;
+ return $notifications;
}
public function hydrateNotifications($keys)
{
- $prefix = 'notification.';
- $notifications = collect([]);
- foreach($keys as $key) {
- $notifications->push(Cache::get("{$prefix}{$key}"));
- }
- return $notifications;
+ $prefix = 'notification.';
+ $notifications = collect([]);
+ foreach ($keys as $key) {
+ $notifications->push(Cache::get("{$prefix}{$key}"));
+ }
+
+ return $notifications;
}
public function messages()
{
- return view('account.messages');
+ return view('account.messages');
}
-
public function showMessage(Request $request, $id)
{
- return view('account.message');
+ return view('account.message');
}
public function mute(Request $request)
{
$this->validate($request, [
'type' => 'required|string',
- 'item' => 'required|integer|min:1'
+ 'item' => 'required|integer|min:1',
]);
$user = Auth::user()->profile;
@@ -168,50 +169,49 @@ class AccountController extends Controller
$item = $request->input('item');
$action = "{$type}.mute";
- if(!in_array($action, $this->filters)) {
- return abort(406);
+ if (!in_array($action, $this->filters)) {
+ return abort(406);
}
$filterable = [];
switch ($type) {
case 'user':
$profile = Profile::findOrFail($item);
- if($profile->id == $user->id) {
- return abort(403);
+ if ($profile->id == $user->id) {
+ return abort(403);
}
$class = get_class($profile);
$filterable['id'] = $profile->id;
$filterable['type'] = $class;
break;
-
+
default:
- # code...
+ // code...
break;
}
$filter = UserFilter::firstOrCreate([
- 'user_id' => $user->id,
- 'filterable_id' => $filterable['id'],
+ 'user_id' => $user->id,
+ 'filterable_id' => $filterable['id'],
'filterable_type' => $filterable['type'],
- 'filter_type' => 'mute'
+ 'filter_type' => 'mute',
]);
return redirect()->back();
-
}
public function block(Request $request)
{
$this->validate($request, [
'type' => 'required|string',
- 'item' => 'required|integer|min:1'
+ 'item' => 'required|integer|min:1',
]);
-
+
$user = Auth::user()->profile;
$type = $request->input('type');
$item = $request->input('item');
$action = "{$type}.block";
- if(!in_array($action, $this->filters)) {
- return abort(406);
+ if (!in_array($action, $this->filters)) {
+ return abort(406);
}
$filterable = [];
switch ($type) {
@@ -221,21 +221,19 @@ class AccountController extends Controller
$filterable['id'] = $profile->id;
$filterable['type'] = $class;
break;
-
+
default:
- # code...
+ // code...
break;
}
$filter = UserFilter::firstOrCreate([
- 'user_id' => $user->id,
- 'filterable_id' => $filterable['id'],
+ 'user_id' => $user->id,
+ 'filterable_id' => $filterable['id'],
'filterable_type' => $filterable['type'],
- 'filter_type' => 'block'
+ 'filter_type' => 'block',
]);
return redirect()->back();
-
}
-
}
diff --git a/app/Http/Controllers/Admin/AdminReportController.php b/app/Http/Controllers/Admin/AdminReportController.php
index 0e72e7efb..537c72be0 100644
--- a/app/Http/Controllers/Admin/AdminReportController.php
+++ b/app/Http/Controllers/Admin/AdminReportController.php
@@ -2,84 +2,83 @@
namespace App\Http\Controllers\Admin;
-use Illuminate\Http\Request;
+use App\Report;
use Carbon\Carbon;
-use App\{Comment, Like, Media, Profile, Report, Status, User};
-use App\Http\Controllers\Controller;
+use Illuminate\Http\Request;
trait AdminReportController
{
public function updateReport(Request $request, $id)
{
- $this->validate($request, [
- 'action' => 'required|string'
- ]);
+ $this->validate($request, [
+ 'action' => 'required|string',
+ ]);
- $action = $request->input('action');
+ $action = $request->input('action');
- $actions = [
- 'ignore',
- 'cw',
- 'unlist',
- 'delete',
- 'shadowban',
- 'ban'
- ];
+ $actions = [
+ 'ignore',
+ 'cw',
+ 'unlist',
+ 'delete',
+ 'shadowban',
+ 'ban',
+ ];
- if(!in_array($action, $actions)) {
- return abort(403);
- }
+ if (!in_array($action, $actions)) {
+ return abort(403);
+ }
- $report = Report::findOrFail($id);
+ $report = Report::findOrFail($id);
- $this->handleReportAction($report, $action);
+ $this->handleReportAction($report, $action);
- return response()->json(['msg'=> 'Success']);
+ return response()->json(['msg'=> 'Success']);
}
public function handleReportAction(Report $report, $action)
{
- $item = $report->reported();
- $report->admin_seen = Carbon::now();
+ $item = $report->reported();
+ $report->admin_seen = Carbon::now();
- switch ($action) {
- case 'ignore':
- $report->not_interested = true;
- break;
+ switch ($action) {
+ case 'ignore':
+ $report->not_interested = true;
+ break;
- case 'cw':
- $item->is_nsfw = true;
- $item->save();
- $report->nsfw = true;
- break;
+ case 'cw':
+ $item->is_nsfw = true;
+ $item->save();
+ $report->nsfw = true;
+ break;
- case 'unlist':
- $item->visibility = 'unlisted';
- $item->save();
- break;
+ case 'unlist':
+ $item->visibility = 'unlisted';
+ $item->save();
+ break;
- case 'delete':
- // Todo: fire delete job
- $report->admin_seen = null;
- break;
+ case 'delete':
+ // Todo: fire delete job
+ $report->admin_seen = null;
+ break;
- case 'shadowban':
- // Todo: fire delete job
- $report->admin_seen = null;
- break;
+ case 'shadowban':
+ // Todo: fire delete job
+ $report->admin_seen = null;
+ break;
- case 'ban':
- // Todo: fire delete job
- $report->admin_seen = null;
- break;
-
- default:
- $report->admin_seen = null;
- break;
- }
+ case 'ban':
+ // Todo: fire delete job
+ $report->admin_seen = null;
+ break;
- $report->save();
+ default:
+ $report->admin_seen = null;
+ break;
+ }
- return $this;
+ $report->save();
+
+ return $this;
}
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index 71f2b8a64..912397790 100644
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -2,43 +2,48 @@
namespace App\Http\Controllers;
+use App\Media;
+use App\Status;
+use App\User;
use Illuminate\Http\Request;
-use App\{Comment, Like, Media, Profile, Status, User};
class AdminController extends Controller
{
public function __construct()
{
- return $this->middleware('admin');
+ return $this->middleware('admin');
}
public function home()
{
- return view('admin.home');
+ return view('admin.home');
}
public function users(Request $request)
{
- $users = User::orderBy('id', 'desc')->paginate(10);
- return view('admin.users.home', compact('users'));
- }
+ $users = User::orderBy('id', 'desc')->paginate(10);
+ return view('admin.users.home', compact('users'));
+ }
public function statuses(Request $request)
{
- $statuses = Status::orderBy('id', 'desc')->paginate(10);
- return view('admin.statuses.home', compact('statuses'));
+ $statuses = Status::orderBy('id', 'desc')->paginate(10);
+
+ return view('admin.statuses.home', compact('statuses'));
}
public function showStatus(Request $request, $id)
{
- $status = Status::findOrFail($id);
- return view('admin.statuses.show', compact('status'));
+ $status = Status::findOrFail($id);
+
+ return view('admin.statuses.show', compact('status'));
}
public function media(Request $request)
{
- $media = Status::whereHas('media')->orderby('id', 'desc')->paginate(12);
- return view('admin.media.home', compact('media'));
+ $media = Status::whereHas('media')->orderby('id', 'desc')->paginate(12);
+
+ return view('admin.media.home', compact('media'));
}
}
diff --git a/app/Http/Controllers/Api/BaseApiController.php b/app/Http/Controllers/Api/BaseApiController.php
index 41c9f68fb..04be48afa 100644
--- a/app/Http/Controllers/Api/BaseApiController.php
+++ b/app/Http/Controllers/Api/BaseApiController.php
@@ -2,23 +2,17 @@
namespace App\Http\Controllers\Api;
-use Auth, Cache;
-use App\{
- Avatar,
- Like,
- Profile,
- Status
-};
-use League\Fractal;
-use Illuminate\Http\Request;
-use App\Http\Controllers\Controller;
+use App\Avatar;
use App\Http\Controllers\AvatarController;
-use App\Util\Webfinger\Webfinger;
-use App\Transformer\Api\{
- AccountTransformer,
- StatusTransformer
-};
+use App\Http\Controllers\Controller;
use App\Jobs\AvatarPipeline\AvatarOptimize;
+use App\Profile;
+use App\Transformer\Api\AccountTransformer;
+use App\Transformer\Api\StatusTransformer;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
+use League\Fractal;
use League\Fractal\Serializer\ArraySerializer;
class BaseApiController extends Controller
@@ -35,8 +29,9 @@ class BaseApiController extends Controller
public function accounts(Request $request, $id)
{
$profile = Profile::findOrFail($id);
- $resource = new Fractal\Resource\Item($profile, new AccountTransformer);
+ $resource = new Fractal\Resource\Item($profile, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray();
+
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
@@ -44,8 +39,9 @@ class BaseApiController extends Controller
{
$profile = Profile::findOrFail($id);
$followers = $profile->followers;
- $resource = new Fractal\Resource\Collection($followers, new AccountTransformer);
+ $resource = new Fractal\Resource\Collection($followers, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray();
+
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
@@ -53,8 +49,9 @@ class BaseApiController extends Controller
{
$profile = Profile::findOrFail($id);
$following = $profile->following;
- $resource = new Fractal\Resource\Collection($following, new AccountTransformer);
+ $resource = new Fractal\Resource\Collection($following, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray();
+
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
@@ -62,17 +59,18 @@ class BaseApiController extends Controller
{
$profile = Profile::findOrFail($id);
$statuses = $profile->statuses()->orderBy('id', 'desc')->paginate(20);
- $resource = new Fractal\Resource\Collection($statuses, new StatusTransformer);
+ $resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
+
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
-
public function followSuggestions(Request $request)
{
$followers = Auth::user()->profile->recommendFollowers();
- $resource = new Fractal\Resource\Collection($followers, new AccountTransformer);
+ $resource = new Fractal\Resource\Collection($followers, new AccountTransformer());
$res = $this->fractal->createData($resource)->toArray();
+
return response()->json($res);
}
@@ -81,33 +79,34 @@ class BaseApiController extends Controller
$this->validate($request, [
'upload' => 'required|mimes:jpeg,png,gif|max:2000',
]);
+
try {
- $user = Auth::user();
- $profile = $user->profile;
- $file = $request->file('upload');
- $path = (new AvatarController())->getPath($user, $file);
- $dir = $path['root'];
- $name = $path['name'];
- $public = $path['storage'];
- $currentAvatar = storage_path('app/'.$profile->avatar->media_path);
- $loc = $request->file('upload')->storeAs($public, $name);
+ $user = Auth::user();
+ $profile = $user->profile;
+ $file = $request->file('upload');
+ $path = (new AvatarController())->getPath($user, $file);
+ $dir = $path['root'];
+ $name = $path['name'];
+ $public = $path['storage'];
+ $currentAvatar = storage_path('app/'.$profile->avatar->media_path);
+ $loc = $request->file('upload')->storeAs($public, $name);
- $avatar = Avatar::whereProfileId($profile->id)->firstOrFail();
- $opath = $avatar->media_path;
- $avatar->media_path = "$public/$name";
- $avatar->thumb_path = null;
- $avatar->change_count = ++$avatar->change_count;
- $avatar->last_processed_at = null;
- $avatar->save();
+ $avatar = Avatar::whereProfileId($profile->id)->firstOrFail();
+ $opath = $avatar->media_path;
+ $avatar->media_path = "$public/$name";
+ $avatar->thumb_path = null;
+ $avatar->change_count = ++$avatar->change_count;
+ $avatar->last_processed_at = null;
+ $avatar->save();
- Cache::forget("avatar:{$profile->id}");
- AvatarOptimize::dispatch($user->profile, $currentAvatar);
+ Cache::forget("avatar:{$profile->id}");
+ AvatarOptimize::dispatch($user->profile, $currentAvatar);
} catch (Exception $e) {
}
return response()->json([
'code' => 200,
- 'msg' => 'Avatar successfully updated'
+ 'msg' => 'Avatar successfully updated',
]);
}
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php
index e28dc3d95..b6810f025 100644
--- a/app/Http/Controllers/ApiController.php
+++ b/app/Http/Controllers/ApiController.php
@@ -2,14 +2,14 @@
namespace App\Http\Controllers;
-use Auth, Cache;
-use App\{Like, Status};
-use Illuminate\Http\Request;
use App\Http\Controllers\Api\BaseApiController;
+use App\Like;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
class ApiController extends BaseApiController
{
-
public function hydrateLikes(Request $request)
{
$this->validate($request, [
@@ -18,7 +18,7 @@ class ApiController extends BaseApiController
]);
$profile = Auth::user()->profile;
- $res = Cache::remember('api:like-ids:user:'.$profile->id, 1440, function() use ($profile) {
+ $res = Cache::remember('api:like-ids:user:'.$profile->id, 1440, function () use ($profile) {
return Like::whereProfileId($profile->id)
->orderBy('id', 'desc')
->take(1000)
@@ -30,6 +30,5 @@ class ApiController extends BaseApiController
public function loadMoreComments(Request $request)
{
- return;
}
}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index af596e02c..45214af2f 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -2,8 +2,9 @@
namespace App\Http\Controllers\Auth;
-use App\{AccountLog, User};
+use App\AccountLog;
use App\Http\Controllers\Controller;
+use App\User;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
@@ -41,17 +42,18 @@ class LoginController extends Controller
/**
* Validate the user login request.
*
- * @param \Illuminate\Http\Request $request
+ * @param \Illuminate\Http\Request $request
+ *
* @return void
*/
public function validateLogin($request)
{
$rules = [
$this->username() => 'required|string',
- 'password' => 'required|string',
+ 'password' => 'required|string',
];
- if(config('pixelfed.recaptcha')) {
+ if (config('pixelfed.recaptcha')) {
$rules['g-recaptcha-response'] = 'required|recaptcha';
}
@@ -61,13 +63,14 @@ class LoginController extends Controller
/**
* The user has been authenticated.
*
- * @param \Illuminate\Http\Request $request
- * @param mixed $user
+ * @param \Illuminate\Http\Request $request
+ * @param mixed $user
+ *
* @return mixed
*/
protected function authenticated($request, $user)
{
- $log = new AccountLog;
+ $log = new AccountLog();
$log->user_id = $user->id;
$log->item_id = $user->id;
$log->item_type = 'App\User';
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 270e9a6e6..11a3e805d 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -2,12 +2,12 @@
namespace App\Http\Controllers\Auth;
+use App\Http\Controllers\Controller;
use App\User;
use App\Util\Lexer\RestrictedNames;
-use App\Http\Controllers\Controller;
+use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
-use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
@@ -45,7 +45,8 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
- * @param array $data
+ * @param array $data
+ *
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
@@ -57,21 +58,21 @@ class RegisterController extends Controller
'min:2',
'max:15',
'unique:users',
- function($attribute, $value, $fail) {
- if(!ctype_alpha($value[0])) {
- return $fail($attribute . ' is invalid. Username must be alpha-numeric and start with a letter.');
+ function ($attribute, $value, $fail) {
+ if (!ctype_alpha($value[0])) {
+ return $fail($attribute.' is invalid. Username must be alpha-numeric and start with a letter.');
}
- }
- ];
+ },
+ ];
$rules = [
- 'name' => 'required|string|max:' . config('pixelfed.max_name_length'),
+ 'name' => 'required|string|max:'.config('pixelfed.max_name_length'),
'username' => $usernameRules,
- 'email' => 'required|string|email|max:255|unique:users',
+ 'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
];
- if(config('pixelfed.recaptcha')) {
+ if (config('pixelfed.recaptcha')) {
$rules['g-recaptcha-response'] = 'required|recaptcha';
}
@@ -81,15 +82,16 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
- * @param array $data
+ * @param array $data
+ *
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
- 'name' => $data['name'],
+ 'name' => $data['name'],
'username' => $data['username'],
- 'email' => $data['email'],
+ 'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
@@ -98,7 +100,7 @@ class RegisterController extends Controller
{
$restricted = RestrictedNames::get();
- if(in_array($username, $restricted)) {
+ if (in_array($username, $restricted)) {
return abort(403);
}
}
@@ -106,7 +108,7 @@ class RegisterController extends Controller
public function openRegistrationCheck()
{
$openRegistration = config('pixelfed.open_registration');
- if(false == $openRegistration) {
+ if (false == $openRegistration) {
abort(403);
}
}
diff --git a/app/Http/Controllers/AvatarController.php b/app/Http/Controllers/AvatarController.php
index 3c131f2a5..ebcf99a6c 100644
--- a/app/Http/Controllers/AvatarController.php
+++ b/app/Http/Controllers/AvatarController.php
@@ -2,10 +2,12 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use Auth, Cache, Log, Storage;
use App\Avatar;
use App\Jobs\AvatarPipeline\AvatarOptimize;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
+use Storage;
class AvatarController extends Controller
{
@@ -17,31 +19,33 @@ class AvatarController extends Controller
public function store(Request $request)
{
$this->validate($request, [
- 'avatar' => 'required|mimes:jpeg,png|max:2000'
+ 'avatar' => 'required|mimes:jpeg,png|max:2000',
]);
+
try {
- $user = Auth::user();
- $profile = $user->profile;
- $file = $request->file('avatar');
- $path = $this->getPath($user, $file);
- $dir = $path['root'];
- $name = $path['name'];
- $public = $path['storage'];
- $currentAvatar = storage_path('app/'.$profile->avatar->media_path);
- $loc = $request->file('avatar')->storeAs($public, $name);
+ $user = Auth::user();
+ $profile = $user->profile;
+ $file = $request->file('avatar');
+ $path = $this->getPath($user, $file);
+ $dir = $path['root'];
+ $name = $path['name'];
+ $public = $path['storage'];
+ $currentAvatar = storage_path('app/'.$profile->avatar->media_path);
+ $loc = $request->file('avatar')->storeAs($public, $name);
- $avatar = Avatar::whereProfileId($profile->id)->firstOrFail();
- $opath = $avatar->media_path;
- $avatar->media_path = "$public/$name";
- $avatar->thumb_path = null;
- $avatar->change_count = ++$avatar->change_count;
- $avatar->last_processed_at = null;
- $avatar->save();
+ $avatar = Avatar::whereProfileId($profile->id)->firstOrFail();
+ $opath = $avatar->media_path;
+ $avatar->media_path = "$public/$name";
+ $avatar->thumb_path = null;
+ $avatar->change_count = ++$avatar->change_count;
+ $avatar->last_processed_at = null;
+ $avatar->save();
- Cache::forget("avatar:{$profile->id}");
- AvatarOptimize::dispatch($user->profile, $currentAvatar);
+ Cache::forget("avatar:{$profile->id}");
+ AvatarOptimize::dispatch($user->profile, $currentAvatar);
} catch (Exception $e) {
}
+
return redirect()->back()->with('status', 'Avatar updated successfully. It may take a few minutes to update across the site.');
}
@@ -54,15 +58,15 @@ class AvatarController extends Controller
$path = $this->buildPath($id);
$dir = storage_path('app/'.$path);
$this->checkDir($dir);
- $name = 'avatar.' . $file->guessExtension();
- $res = ['root' => 'storage/app/' . $path, 'name' => $name, 'storage' => $path];
+ $name = 'avatar.'.$file->guessExtension();
+ $res = ['root' => 'storage/app/'.$path, 'name' => $name, 'storage' => $path];
return $res;
}
public function checkDir($path)
{
- if(!is_dir($path)) {
+ if (!is_dir($path)) {
mkdir($path);
}
}
@@ -71,25 +75,26 @@ class AvatarController extends Controller
{
$padded = str_pad($id, 12, 0, STR_PAD_LEFT);
$parts = str_split($padded, 3);
- foreach($parts as $k => $part) {
- if($k == 0) {
- $prefix = storage_path('app/public/avatars/'.$parts[0]);
- $this->checkDir($prefix);
- }
- if($k == 1) {
- $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1]);
- $this->checkDir($prefix);
- }
- if($k == 2) {
- $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2]);
- $this->checkDir($prefix);
- }
- if($k == 3) {
- $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3];
- $prefix = storage_path('app/'.$avatarpath);
- $this->checkDir($prefix);
- }
+ foreach ($parts as $k => $part) {
+ if ($k == 0) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0]);
+ $this->checkDir($prefix);
+ }
+ if ($k == 1) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1]);
+ $this->checkDir($prefix);
+ }
+ if ($k == 2) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2]);
+ $this->checkDir($prefix);
+ }
+ if ($k == 3) {
+ $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3];
+ $prefix = storage_path('app/'.$avatarpath);
+ $this->checkDir($prefix);
+ }
}
+
return $avatarpath;
}
}
diff --git a/app/Http/Controllers/BookmarkController.php b/app/Http/Controllers/BookmarkController.php
index fb374dbcc..0357a36dd 100644
--- a/app/Http/Controllers/BookmarkController.php
+++ b/app/Http/Controllers/BookmarkController.php
@@ -2,8 +2,9 @@
namespace App\Http\Controllers;
+use App\Bookmark;
+use App\Status;
use Auth;
-use App\{Bookmark, Profile, Status};
use Illuminate\Http\Request;
class BookmarkController extends Controller
@@ -16,7 +17,7 @@ class BookmarkController extends Controller
public function store(Request $request)
{
$this->validate($request, [
- 'item' => 'required|integer|min:1'
+ 'item' => 'required|integer|min:1',
]);
$profile = Auth::user()->profile;
@@ -26,17 +27,16 @@ class BookmarkController extends Controller
['status_id' => $status->id], ['profile_id' => $profile->id]
);
- if(!$bookmark->wasRecentlyCreated) {
+ if (!$bookmark->wasRecentlyCreated) {
$bookmark->delete();
}
- if($request->ajax()) {
- $response = ['code' => 200, 'msg' => 'Bookmark saved!'];
- } else {
- $response = redirect()->back();
- }
-
- return $response;
- }
+ if ($request->ajax()) {
+ $response = ['code' => 200, 'msg' => 'Bookmark saved!'];
+ } else {
+ $response = redirect()->back();
+ }
+ return $response;
+ }
}
diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php
index 2cfb4f4cc..4c2377cc2 100644
--- a/app/Http/Controllers/CommentController.php
+++ b/app/Http/Controllers/CommentController.php
@@ -2,61 +2,66 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
+use App\Comment;
use App\Jobs\CommentPipeline\CommentPipeline;
use App\Jobs\StatusPipeline\NewStatusPipeline;
-use Auth, Hashids;
-use App\{Comment, Profile, Status};
+use App\Profile;
+use App\Status;
+use Auth;
+use Illuminate\Http\Request;
class CommentController extends Controller
{
-
public function show(Request $request, $username, int $id, int $cid)
{
- $user = Profile::whereUsername($username)->firstOrFail();
- $status = Status::whereProfileId($user->id)->whereInReplyToId($id)->findOrFail($cid);
- return view('status.reply', compact('user', 'status'));
+ $user = Profile::whereUsername($username)->firstOrFail();
+ $status = Status::whereProfileId($user->id)->whereInReplyToId($id)->findOrFail($cid);
+
+ return view('status.reply', compact('user', 'status'));
}
public function showAll(Request $request, $username, int $id)
{
- $user = Profile::whereUsername($username)->firstOrFail();
- $status = Status::whereProfileId($user->id)->findOrFail($id);
- $replies = Status::whereInReplyToId($id)->paginate(40);
- return view('status.comments', compact('user', 'status', 'replies'));
+ $user = Profile::whereUsername($username)->firstOrFail();
+ $status = Status::whereProfileId($user->id)->findOrFail($id);
+ $replies = Status::whereInReplyToId($id)->paginate(40);
+
+ return view('status.comments', compact('user', 'status', 'replies'));
}
public function store(Request $request)
{
- if(Auth::check() === false) { abort(403); }
- $this->validate($request, [
+ if (Auth::check() === false) {
+ abort(403);
+ }
+ $this->validate($request, [
'item' => 'required|integer',
- 'comment' => 'required|string|max:500'
+ 'comment' => 'required|string|max:500',
]);
- $comment = $request->input('comment');
- $statusId = $request->item;
+ $comment = $request->input('comment');
+ $statusId = $request->item;
- $user = Auth::user();
- $profile = $user->profile;
- $status = Status::findOrFail($statusId);
+ $user = Auth::user();
+ $profile = $user->profile;
+ $status = Status::findOrFail($statusId);
- $reply = new Status();
- $reply->profile_id = $profile->id;
- $reply->caption = e($comment);
- $reply->rendered = $comment;
- $reply->in_reply_to_id = $status->id;
- $reply->in_reply_to_profile_id = $status->profile_id;
- $reply->save();
+ $reply = new Status();
+ $reply->profile_id = $profile->id;
+ $reply->caption = e($comment);
+ $reply->rendered = $comment;
+ $reply->in_reply_to_id = $status->id;
+ $reply->in_reply_to_profile_id = $status->profile_id;
+ $reply->save();
- NewStatusPipeline::dispatch($reply, false);
- CommentPipeline::dispatch($status, $reply);
+ NewStatusPipeline::dispatch($reply, false);
+ CommentPipeline::dispatch($status, $reply);
- if($request->ajax()) {
- $response = ['code' => 200, 'msg' => 'Comment saved', 'username' => $profile->username, 'url' => $reply->url(), 'profile' => $profile->url(), 'comment' => $reply->caption];
- } else {
- $response = redirect($status->url());
- }
+ if ($request->ajax()) {
+ $response = ['code' => 200, 'msg' => 'Comment saved', 'username' => $profile->username, 'url' => $reply->url(), 'profile' => $profile->url(), 'comment' => $reply->caption];
+ } else {
+ $response = redirect($status->url());
+ }
- return $response;
+ return $response;
}
}
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 03e02a23e..a0a2a8a34 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -2,10 +2,10 @@
namespace App\Http\Controllers;
-use Illuminate\Foundation\Bus\DispatchesJobs;
-use Illuminate\Routing\Controller as BaseController;
-use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use Illuminate\Foundation\Validation\ValidatesRequests;
+use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php
index dc3692baa..09cd8b1ae 100644
--- a/app/Http/Controllers/DiscoverController.php
+++ b/app/Http/Controllers/DiscoverController.php
@@ -2,57 +2,60 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use App\{Hashtag, Follower, Profile, Status, StatusHashtag};
+use App\Follower;
+use App\Hashtag;
+use App\Profile;
+use App\Status;
use Auth;
+use Illuminate\Http\Request;
class DiscoverController extends Controller
{
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function home()
{
- $pid = Auth::user()->profile->id;
+ $pid = Auth::user()->profile->id;
- $following = Follower::whereProfileId($pid)
+ $following = Follower::whereProfileId($pid)
->pluck('following_id');
- $people = Profile::inRandomOrder()
+ $people = Profile::inRandomOrder()
->where('id', '!=', $pid)
->whereNotIn('id', $following)
->take(3)
->get();
- $posts = Status::whereHas('media')
+ $posts = Status::whereHas('media')
->where('profile_id', '!=', $pid)
->whereNotIn('profile_id', $following)
->orderBy('created_at', 'desc')
->simplePaginate(21);
- return view('discover.home', compact('people', 'posts'));
+ return view('discover.home', compact('people', 'posts'));
}
public function showTags(Request $request, $hashtag)
{
- $this->validate($request, [
- 'page' => 'nullable|integer|min:1|max:10'
+ $this->validate($request, [
+ 'page' => 'nullable|integer|min:1|max:10',
]);
- $tag = Hashtag::with('posts')
+ $tag = Hashtag::with('posts')
->withCount('posts')
->whereSlug($hashtag)
->firstOrFail();
- $posts = $tag->posts()
+ $posts = $tag->posts()
->whereIsNsfw(false)
->whereVisibility('public')
->has('media')
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->simplePaginate(12);
- return view('discover.tags.show', compact('tag', 'posts'));
+ return view('discover.tags.show', compact('tag', 'posts'));
}
}
diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php
index 376cad616..3a4cd61c5 100644
--- a/app/Http/Controllers/FederationController.php
+++ b/app/Http/Controllers/FederationController.php
@@ -2,162 +2,165 @@
namespace App\Http\Controllers;
-use Auth, Cache;
+use App\Jobs\InboxPipeline\InboxWorker;
+use App\Jobs\RemoteFollowPipeline\RemoteFollowPipeline;
use App\Profile;
-use Carbon\Carbon;
-use League\Fractal;
-use Illuminate\Http\Request;
+use App\Transformer\ActivityPub\ProfileOutbox;
use App\Util\Lexer\Nickname;
use App\Util\Webfinger\Webfinger;
-use App\Transformer\ActivityPub\{
- ProfileOutbox,
- ProfileTransformer
-};
-use App\Jobs\RemoteFollowPipeline\RemoteFollowPipeline;
-use App\Jobs\InboxPipeline\InboxWorker;
+use Auth;
+use Cache;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+use League\Fractal;
class FederationController extends Controller
{
public function authCheck()
{
- if(!Auth::check()) {
- return abort(403);
- }
+ if (!Auth::check()) {
+ return abort(403);
+ }
}
public function authorizeFollow(Request $request)
{
- $this->authCheck();
- $this->validate($request, [
- 'acct' => 'required|string|min:3|max:255'
+ $this->authCheck();
+ $this->validate($request, [
+ 'acct' => 'required|string|min:3|max:255',
]);
- $acct = $request->input('acct');
- $nickname = Nickname::normalizeProfileUrl($acct);
- return view('federation.authorizefollow', compact('acct', 'nickname'));
+ $acct = $request->input('acct');
+ $nickname = Nickname::normalizeProfileUrl($acct);
+
+ return view('federation.authorizefollow', compact('acct', 'nickname'));
}
public function remoteFollow()
{
- $this->authCheck();
- return view('federation.remotefollow');
+ $this->authCheck();
+
+ return view('federation.remotefollow');
}
public function remoteFollowStore(Request $request)
{
- $this->authCheck();
- $this->validate($request, [
- 'url' => 'required|string'
+ $this->authCheck();
+ $this->validate($request, [
+ 'url' => 'required|string',
]);
- if(config('pixelfed.remote_follow_enabled') !== true) {
- abort(403);
- }
+ if (config('pixelfed.remote_follow_enabled') !== true) {
+ abort(403);
+ }
- $follower = Auth::user()->profile;
- $url = $request->input('url');
+ $follower = Auth::user()->profile;
+ $url = $request->input('url');
- RemoteFollowPipeline::dispatch($follower, $url);
+ RemoteFollowPipeline::dispatch($follower, $url);
- return redirect()->back();
+ return redirect()->back();
}
public function nodeinfoWellKnown()
{
- $res = [
+ $res = [
'links' => [
[
'href' => config('pixelfed.nodeinfo.url'),
- 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0'
- ]
- ]
+ 'rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
+ ],
+ ],
];
- return response()->json($res);
+
+ return response()->json($res);
}
public function nodeinfo()
{
- $res = Cache::remember('api:nodeinfo', 60, function() {
- return [
+ $res = Cache::remember('api:nodeinfo', 60, function () {
+ return [
'metadata' => [
'nodeName' => config('app.name'),
'software' => [
'homepage' => 'https://pixelfed.org',
- 'github' => 'https://github.com/pixelfed',
- 'follow' => 'https://mastodon.social/@pixelfed'
+ 'github' => 'https://github.com/pixelfed',
+ 'follow' => 'https://mastodon.social/@pixelfed',
],
],
'openRegistrations' => config('pixelfed.open_registration'),
- 'protocols' => [
- 'activitypub'
+ 'protocols' => [
+ 'activitypub',
],
'services' => [
- 'inbound' => [],
- 'outbound' => []
+ 'inbound' => [],
+ 'outbound' => [],
],
'software' => [
- 'name' => 'pixelfed',
- 'version' => config('pixelfed.version')
+ 'name' => 'pixelfed',
+ 'version' => config('pixelfed.version'),
],
'usage' => [
- 'localPosts' => \App\Status::whereLocal(true)->whereHas('media')->count(),
+ 'localPosts' => \App\Status::whereLocal(true)->whereHas('media')->count(),
'localComments' => \App\Status::whereLocal(true)->whereNotNull('in_reply_to_id')->count(),
- 'users' => [
- 'total' => \App\User::count(),
+ 'users' => [
+ 'total' => \App\User::count(),
'activeHalfyear' => \App\User::where('updated_at', '>', Carbon::now()->subMonths(6)->toDateTimeString())->count(),
- 'activeMonth' => \App\User::where('updated_at', '>', Carbon::now()->subMonths(1)->toDateTimeString())->count(),
- ]
+ 'activeMonth' => \App\User::where('updated_at', '>', Carbon::now()->subMonths(1)->toDateTimeString())->count(),
+ ],
],
- 'version' => '2.0'
+ 'version' => '2.0',
];
- });
- return response()->json($res, 200, [], JSON_PRETTY_PRINT);
- }
+ });
+ return response()->json($res, 200, [], JSON_PRETTY_PRINT);
+ }
public function webfinger(Request $request)
{
- $this->validate($request, ['resource'=>'required|string|min:3|max:255']);
-
- $hash = hash('sha256', $request->input('resource'));
+ $this->validate($request, ['resource'=>'required|string|min:3|max:255']);
- $webfinger = Cache::remember('api:webfinger:'.$hash, 1440, function() use($request) {
- $resource = $request->input('resource');
- $parsed = Nickname::normalizeProfileUrl($resource);
- $username = $parsed['username'];
- $user = Profile::whereUsername($username)->firstOrFail();
- return (new Webfinger($user))->generate();
- });
- return response()->json($webfinger, 200, [], JSON_PRETTY_PRINT);
+ $hash = hash('sha256', $request->input('resource'));
+
+ $webfinger = Cache::remember('api:webfinger:'.$hash, 1440, function () use ($request) {
+ $resource = $request->input('resource');
+ $parsed = Nickname::normalizeProfileUrl($resource);
+ $username = $parsed['username'];
+ $user = Profile::whereUsername($username)->firstOrFail();
+
+ return (new Webfinger($user))->generate();
+ });
+
+ return response()->json($webfinger, 200, [], JSON_PRETTY_PRINT);
}
public function userOutbox(Request $request, $username)
{
- if(config('pixelfed.activitypub_enabled') == false) {
- abort(403);
- }
-
- $user = Profile::whereNull('remote_url')->whereUsername($username)->firstOrFail();
- $timeline = $user->statuses()->orderBy('created_at','desc')->paginate(10);
- $fractal = new Fractal\Manager();
- $resource = new Fractal\Resource\Item($user, new ProfileOutbox);
- $res = $fractal->createData($resource)->toArray();
- return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
+ if (config('pixelfed.activitypub_enabled') == false) {
+ abort(403);
+ }
+
+ $user = Profile::whereNull('remote_url')->whereUsername($username)->firstOrFail();
+ $timeline = $user->statuses()->orderBy('created_at', 'desc')->paginate(10);
+ $fractal = new Fractal\Manager();
+ $resource = new Fractal\Resource\Item($user, new ProfileOutbox());
+ $res = $fractal->createData($resource)->toArray();
+
+ return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
}
public function userInbox(Request $request, $username)
{
- if(config('pixelfed.activitypub_enabled') == false) {
- abort(403);
- }
- $mimes = [
- 'application/activity+json',
- 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
+ if (config('pixelfed.activitypub_enabled') == false) {
+ abort(403);
+ }
+ $mimes = [
+ 'application/activity+json',
+ 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
];
- if(!in_array($request->header('Content-Type'), $mimes)) {
- abort(500, 'Invalid request');
- }
- $profile = Profile::whereUsername($username)->firstOrFail();
- InboxWorker::dispatch($request, $profile, $request->all());
+ if (!in_array($request->header('Content-Type'), $mimes)) {
+ abort(500, 'Invalid request');
+ }
+ $profile = Profile::whereUsername($username)->firstOrFail();
+ InboxWorker::dispatch($request, $profile, $request->all());
}
-
}
diff --git a/app/Http/Controllers/FollowerController.php b/app/Http/Controllers/FollowerController.php
index 42c776b23..12480d218 100644
--- a/app/Http/Controllers/FollowerController.php
+++ b/app/Http/Controllers/FollowerController.php
@@ -2,41 +2,41 @@
namespace App\Http\Controllers;
-use Auth;
-use App\{Follower, Profile};
-use Illuminate\Http\Request;
+use App\Follower;
use App\Jobs\FollowPipeline\FollowPipeline;
+use App\Profile;
+use Auth;
+use Illuminate\Http\Request;
class FollowerController extends Controller
{
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function store(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'item' => 'required|integer',
]);
- $user = Auth::user()->profile;
- $target = Profile::where('id', '!=', $user->id)->findOrFail($request->input('item'));
+ $user = Auth::user()->profile;
+ $target = Profile::where('id', '!=', $user->id)->findOrFail($request->input('item'));
- $isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->count();
+ $isFollowing = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->count();
- if($isFollowing == 0) {
- $follower = new Follower;
- $follower->profile_id = $user->id;
- $follower->following_id = $target->id;
- $follower->save();
- FollowPipeline::dispatch($follower);
- } else {
- $follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
- $follower->delete();
- }
+ if ($isFollowing == 0) {
+ $follower = new Follower();
+ $follower->profile_id = $user->id;
+ $follower->following_id = $target->id;
+ $follower->save();
+ FollowPipeline::dispatch($follower);
+ } else {
+ $follower = Follower::whereProfileId($user->id)->whereFollowingId($target->id)->firstOrFail();
+ $follower->delete();
+ }
-
- return redirect()->back();
+ return redirect()->back();
}
}
diff --git a/app/Http/Controllers/HashtagController.php b/app/Http/Controllers/HashtagController.php
index a4afae3aa..d444c96e5 100644
--- a/app/Http/Controllers/HashtagController.php
+++ b/app/Http/Controllers/HashtagController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class HashtagController extends Controller
{
//
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index a3af7dd8b..26d463559 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class HomeController extends Controller
{
/**
diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php
index a6cd00a89..28fc590ef 100644
--- a/app/Http/Controllers/LikeController.php
+++ b/app/Http/Controllers/LikeController.php
@@ -2,55 +2,58 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use Auth, Cache, Hashids;
-use App\{Like, Profile, Status, User};
use App\Jobs\LikePipeline\LikePipeline;
+use App\Like;
+use App\Status;
+use App\User;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
class LikeController extends Controller
{
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function store(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'item' => 'required|integer',
]);
- $profile = Auth::user()->profile;
- $status = Status::withCount('likes')->findOrFail($request->input('item'));
+ $profile = Auth::user()->profile;
+ $status = Status::withCount('likes')->findOrFail($request->input('item'));
- $count = $status->likes_count;
+ $count = $status->likes_count;
- if($status->likes()->whereProfileId($profile->id)->count() !== 0) {
- $like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
- $like->forceDelete();
- $count--;
- } else {
- $like = new Like;
- $like->profile_id = $profile->id;
- $like->status_id = $status->id;
- $like->save();
- $count++;
- LikePipeline::dispatch($like);
- }
+ if ($status->likes()->whereProfileId($profile->id)->count() !== 0) {
+ $like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
+ $like->forceDelete();
+ $count--;
+ } else {
+ $like = new Like();
+ $like->profile_id = $profile->id;
+ $like->status_id = $status->id;
+ $like->save();
+ $count++;
+ LikePipeline::dispatch($like);
+ }
- $likes = Like::whereProfileId($profile->id)
+ $likes = Like::whereProfileId($profile->id)
->orderBy('id', 'desc')
->take(1000)
->pluck('status_id');
-
- Cache::put('api:like-ids:user:'.$profile->id, $likes, 1440);
- if($request->ajax()) {
- $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
- } else {
- $response = redirect($status->url());
- }
+ Cache::put('api:like-ids:user:'.$profile->id, $likes, 1440);
- return $response;
+ if ($request->ajax()) {
+ $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
+ } else {
+ $response = redirect($status->url());
+ }
+
+ return $response;
}
}
diff --git a/app/Http/Controllers/MediaController.php b/app/Http/Controllers/MediaController.php
index 9cef3b14e..477d8a730 100644
--- a/app/Http/Controllers/MediaController.php
+++ b/app/Http/Controllers/MediaController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class MediaController extends Controller
{
//
diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php
index 7bd130ac7..93fdac709 100644
--- a/app/Http/Controllers/NotificationController.php
+++ b/app/Http/Controllers/NotificationController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class NotificationController extends Controller
{
//
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 4e647caba..1a21e6116 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -2,133 +2,135 @@
namespace App\Http\Controllers;
+use App\Follower;
+use App\Profile;
+use App\Transformer\ActivityPub\ProfileTransformer;
+use App\User;
+use Auth;
use Illuminate\Http\Request;
-use Auth, Cache;
-use App\{Follower, Profile, User};
use League\Fractal;
-use App\Util\Lexer\Nickname;
-use App\Util\Webfinger\Webfinger;
-use App\Transformer\ActivityPub\{
- ProfileOutbox,
- ProfileTransformer
-};
class ProfileController extends Controller
{
public function show(Request $request, $username)
{
- $user = Profile::whereUsername($username)->firstOrFail();
- if($user->remote_url) {
- $settings = new \StdClass;
- $settings->crawlable = false;
- } else {
- $settings = User::whereUsername($username)->firstOrFail()->settings;
- }
-
- if($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
- return $this->showActivityPub($request, $user);
- }
-
- if($user->is_private == true) {
- $can_access = $this->privateProfileCheck($user);
- if($can_access !== true) {
- abort(403);
+ $user = Profile::whereUsername($username)->firstOrFail();
+ if ($user->remote_url) {
+ $settings = new \StdClass();
+ $settings->crawlable = false;
+ } else {
+ $settings = User::whereUsername($username)->firstOrFail()->settings;
}
- }
- // TODO: refactor this mess
- $owner = Auth::check() && Auth::id() === $user->user_id;
- $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
- $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
- $timeline = $user->statuses()
+
+ if ($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
+ return $this->showActivityPub($request, $user);
+ }
+
+ if ($user->is_private == true) {
+ $can_access = $this->privateProfileCheck($user);
+ if ($can_access !== true) {
+ abort(403);
+ }
+ }
+ // TODO: refactor this mess
+ $owner = Auth::check() && Auth::id() === $user->user_id;
+ $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
+ $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
+ $timeline = $user->statuses()
->whereHas('media')
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
- ->orderBy('created_at','desc')
+ ->orderBy('created_at', 'desc')
->withCount(['comments', 'likes'])
->simplePaginate(21);
- return view('profile.show', compact('user', 'settings', 'owner', 'is_following', 'is_admin', 'timeline'));
+ return view('profile.show', compact('user', 'settings', 'owner', 'is_following', 'is_admin', 'timeline'));
}
public function permalinkRedirect(Request $request, $username)
{
- $user = Profile::whereUsername($username)->firstOrFail();
- $settings = User::whereUsername($username)->firstOrFail()->settings;
+ $user = Profile::whereUsername($username)->firstOrFail();
+ $settings = User::whereUsername($username)->firstOrFail()->settings;
- if($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
- return $this->showActivityPub($request, $user);
- }
+ if ($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
+ return $this->showActivityPub($request, $user);
+ }
- return redirect($user->url());
+ return redirect($user->url());
}
protected function privateProfileCheck(Profile $profile)
{
- if(Auth::check() === false) {
- return false;
- }
+ if (Auth::check() === false) {
+ return false;
+ }
- $follower_ids = (array) $profile->followers()->pluck('followers.profile_id');
- $pid = Auth::user()->profile->id;
- if(!in_array($pid, $follower_ids) && $pid !== $profile->id) {
- return false;
- }
+ $follower_ids = (array) $profile->followers()->pluck('followers.profile_id');
+ $pid = Auth::user()->profile->id;
+ if (!in_array($pid, $follower_ids) && $pid !== $profile->id) {
+ return false;
+ }
- return true;
+ return true;
}
public function showActivityPub(Request $request, $user)
{
- $fractal = new Fractal\Manager();
- $resource = new Fractal\Resource\Item($user, new ProfileTransformer);
- $res = $fractal->createData($resource)->toArray();
- return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
+ $fractal = new Fractal\Manager();
+ $resource = new Fractal\Resource\Item($user, new ProfileTransformer());
+ $res = $fractal->createData($resource)->toArray();
+
+ return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
}
public function showAtomFeed(Request $request, $user)
{
- $profile = Profile::whereUsername($user)->firstOrFail();
- $items = $profile->statuses()->orderBy('created_at', 'desc')->take(10)->get();
- return response()->view('atom.user', compact('profile', 'items'))
+ $profile = Profile::whereUsername($user)->firstOrFail();
+ $items = $profile->statuses()->orderBy('created_at', 'desc')->take(10)->get();
+
+ return response()->view('atom.user', compact('profile', 'items'))
->header('Content-Type', 'application/atom+xml');
}
public function followers(Request $request, $username)
{
- $profile = Profile::whereUsername($username)->firstOrFail();
- // TODO: fix $profile/$user mismatch in profile & follower templates
- $user = $profile;
- $owner = Auth::check() && Auth::id() === $user->user_id;
- $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
- $followers = $profile->followers()->orderBy('created_at','desc')->simplePaginate(12);
- $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
- return view('profile.followers', compact('user', 'profile', 'followers', 'owner', 'is_following', 'is_admin'));
+ $profile = Profile::whereUsername($username)->firstOrFail();
+ // TODO: fix $profile/$user mismatch in profile & follower templates
+ $user = $profile;
+ $owner = Auth::check() && Auth::id() === $user->user_id;
+ $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
+ $followers = $profile->followers()->orderBy('created_at', 'desc')->simplePaginate(12);
+ $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
+
+ return view('profile.followers', compact('user', 'profile', 'followers', 'owner', 'is_following', 'is_admin'));
}
public function following(Request $request, $username)
{
- $profile = Profile::whereUsername($username)->firstOrFail();
- // TODO: fix $profile/$user mismatch in profile & follower templates
- $user = $profile;
- $owner = Auth::check() && Auth::id() === $user->user_id;
- $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
- $following = $profile->following()->orderBy('created_at','desc')->simplePaginate(12);
- $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
- return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following', 'is_admin'));
+ $profile = Profile::whereUsername($username)->firstOrFail();
+ // TODO: fix $profile/$user mismatch in profile & follower templates
+ $user = $profile;
+ $owner = Auth::check() && Auth::id() === $user->user_id;
+ $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
+ $following = $profile->following()->orderBy('created_at', 'desc')->simplePaginate(12);
+ $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
+
+ return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following', 'is_admin'));
}
public function savedBookmarks(Request $request, $username)
{
- if(Auth::check() === false || $username !== Auth::user()->username) {
- abort(403);
- }
- $user = Auth::user()->profile;
- $settings = User::whereUsername($username)->firstOrFail()->settings;
- $owner = true;
- $following = false;
- $timeline = $user->bookmarks()->withCount(['likes','comments'])->orderBy('created_at','desc')->simplePaginate(10);
- $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
- $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
- return view('profile.show', compact('user', 'settings', 'owner', 'following', 'timeline', 'is_following', 'is_admin'));
+ if (Auth::check() === false || $username !== Auth::user()->username) {
+ abort(403);
+ }
+ $user = Auth::user()->profile;
+ $settings = User::whereUsername($username)->firstOrFail()->settings;
+ $owner = true;
+ $following = false;
+ $timeline = $user->bookmarks()->withCount(['likes', 'comments'])->orderBy('created_at', 'desc')->simplePaginate(10);
+ $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
+ $is_admin = is_null($user->domain) ? $user->user->is_admin : false;
+
+ return view('profile.show', compact('user', 'settings', 'owner', 'following', 'timeline', 'is_following', 'is_admin'));
}
}
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 832cb88c9..1eeb480a4 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -2,9 +2,12 @@
namespace App\Http\Controllers;
+use App\Profile;
+use App\Report;
+use App\Status;
+use App\User;
use Auth;
use Illuminate\Http\Request;
-use App\{Avatar, Profile, Report, Status, User};
class ReportController extends Controller
{
@@ -12,95 +15,96 @@ class ReportController extends Controller
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function showForm(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'type' => 'required|alpha_dash',
- 'id' => 'required|integer|min:1'
+ 'id' => 'required|integer|min:1',
]);
- return view('report.form');
+
+ return view('report.form');
}
public function notInterestedForm(Request $request)
{
- return view('report.not-interested');
+ return view('report.not-interested');
}
public function spamForm(Request $request)
{
- return view('report.spam');
+ return view('report.spam');
}
public function spamCommentForm(Request $request)
{
- return view('report.spam.comment');
+ return view('report.spam.comment');
}
public function spamPostForm(Request $request)
{
- return view('report.spam.post');
+ return view('report.spam.post');
}
public function spamProfileForm(Request $request)
{
- return view('report.spam.profile');
+ return view('report.spam.profile');
}
public function sensitiveCommentForm(Request $request)
{
- return view('report.sensitive.comment');
+ return view('report.sensitive.comment');
}
public function sensitivePostForm(Request $request)
{
- return view('report.sensitive.post');
+ return view('report.sensitive.post');
}
public function sensitiveProfileForm(Request $request)
{
- return view('report.sensitive.profile');
+ return view('report.sensitive.profile');
}
public function abusiveCommentForm(Request $request)
{
- return view('report.abusive.comment');
+ return view('report.abusive.comment');
}
public function abusivePostForm(Request $request)
{
- return view('report.abusive.post');
+ return view('report.abusive.post');
}
public function abusiveProfileForm(Request $request)
{
- return view('report.abusive.profile');
+ return view('report.abusive.profile');
}
-
+
public function formStore(Request $request)
{
- $this->validate($request, [
+ $this->validate($request, [
'report' => 'required|alpha_dash',
'type' => 'required|alpha_dash',
'id' => 'required|integer|min:1',
- 'msg' => 'nullable|string|max:150'
+ 'msg' => 'nullable|string|max:150',
]);
- $profile = Auth::user()->profile;
- $reportType = $request->input('report');
- $object_id = $request->input('id');
- $object_type = $request->input('type');
- $msg = $request->input('msg');
- $object = null;
- $types = ['spam', 'sensitive', 'abusive'];
+ $profile = Auth::user()->profile;
+ $reportType = $request->input('report');
+ $object_id = $request->input('id');
+ $object_type = $request->input('type');
+ $msg = $request->input('msg');
+ $object = null;
+ $types = ['spam', 'sensitive', 'abusive'];
- if(!in_array($reportType, $types)) {
- return redirect('/timeline')->with('error', 'Invalid report type');
- }
+ if (!in_array($reportType, $types)) {
+ return redirect('/timeline')->with('error', 'Invalid report type');
+ }
- switch ($object_type) {
+ switch ($object_type) {
case 'post':
$object = Status::findOrFail($object_id);
$object_type = 'App\Status';
@@ -109,31 +113,30 @@ class ReportController extends Controller
->whereObjectType('App\Status')
->count();
break;
-
+
default:
return redirect('/timeline')->with('error', 'Invalid report type');
break;
}
- if($exists !== 0) {
- return redirect('/timeline')->with('error', 'You have already reported this!');
- }
+ if ($exists !== 0) {
+ return redirect('/timeline')->with('error', 'You have already reported this!');
+ }
- if($object->profile_id == $profile->id) {
- return redirect('/timeline')->with('error', 'You cannot report your own content!');
- }
+ if ($object->profile_id == $profile->id) {
+ return redirect('/timeline')->with('error', 'You cannot report your own content!');
+ }
- $report = new Report;
- $report->profile_id = $profile->id;
- $report->user_id = Auth::id();
- $report->object_id = $object->id;
- $report->object_type = $object_type;
- $report->reported_profile_id = $object->profile_id;
- $report->type = $request->input('report');
- $report->message = $request->input('msg');
- $report->save();
+ $report = new Report();
+ $report->profile_id = $profile->id;
+ $report->user_id = Auth::id();
+ $report->object_id = $object->id;
+ $report->object_type = $object_type;
+ $report->reported_profile_id = $object->profile_id;
+ $report->type = $request->input('report');
+ $report->message = $request->input('msg');
+ $report->save();
- return redirect('/timeline')->with('status', 'Report successfully sent!');
+ return redirect('/timeline')->with('status', 'Report successfully sent!');
}
-
}
diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php
index bcedd947e..2244004c1 100644
--- a/app/Http/Controllers/SearchController.php
+++ b/app/Http/Controllers/SearchController.php
@@ -2,7 +2,8 @@
namespace App\Http\Controllers;
-use App\{Hashtag, Profile};
+use App\Hashtag;
+use App\Profile;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
@@ -10,33 +11,34 @@ class SearchController extends Controller
{
public function searchAPI(Request $request, $tag)
{
- $res = Cache::remember('api:search:tag:' . $tag, 1440, function() use($tag) {
- $res = Hashtag::where('slug', 'like', '%'.$tag.'%')->get();
- $tags = $res->map(function($item, $key) {
- return [
- 'count' => $item->posts()->count(),
- 'url' => $item->url(),
- 'type' => 'hashtag',
- 'value' => $item->name,
+ $res = Cache::remember('api:search:tag:'.$tag, 1440, function () use ($tag) {
+ $res = Hashtag::where('slug', 'like', '%'.$tag.'%')->get();
+ $tags = $res->map(function ($item, $key) {
+ return [
+ 'count' => $item->posts()->count(),
+ 'url' => $item->url(),
+ 'type' => 'hashtag',
+ 'value' => $item->name,
'tokens' => explode('-', $item->name),
- 'name' => null
+ 'name' => null,
];
- });
- $res = Profile::where('username', 'like', '%'.$tag.'%')->get();
- $profiles = $res->map(function($item, $key) {
- return [
- 'count' => 0,
- 'url' => $item->url(),
- 'type' => 'profile',
- 'value' => $item->username,
+ });
+ $res = Profile::where('username', 'like', '%'.$tag.'%')->get();
+ $profiles = $res->map(function ($item, $key) {
+ return [
+ 'count' => 0,
+ 'url' => $item->url(),
+ 'type' => 'profile',
+ 'value' => $item->username,
'tokens' => [$item->username],
- 'name' => $item->name
+ 'name' => $item->name,
];
- });
- $tags = $tags->push($profiles[0]);
- return $tags;
- });
+ });
+ $tags = $tags->push($profiles[0]);
- return response()->json($res);
+ return $tags;
+ });
+
+ return response()->json($res);
}
}
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 8d21aee19..6449bcb3a 100644
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -2,10 +2,15 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use App\{AccountLog, EmailVerification, Media, Profile, User};
-use Auth, DB;
+use App\AccountLog;
+use App\EmailVerification;
+use App\Media;
+use App\Profile;
+use App\User;
use App\Util\Lexer\PrettyNumber;
+use Auth;
+use DB;
+use Illuminate\Http\Request;
class SettingsController extends Controller
{
@@ -16,229 +21,237 @@ class SettingsController extends Controller
public function home()
{
- $id = Auth::user()->profile->id;
- $storage = [];
- $used = Media::whereProfileId($id)->sum('size');
- $storage['limit'] = config('pixelfed.max_account_size') * 1024;
- $storage['used'] = $used;
- $storage['percentUsed'] = ceil($storage['used'] / $storage['limit'] * 100);
- $storage['limitPretty'] = PrettyNumber::size($storage['limit']);
- $storage['usedPretty'] = PrettyNumber::size($storage['used']);
- return view('settings.home', compact('storage'));
+ $id = Auth::user()->profile->id;
+ $storage = [];
+ $used = Media::whereProfileId($id)->sum('size');
+ $storage['limit'] = config('pixelfed.max_account_size') * 1024;
+ $storage['used'] = $used;
+ $storage['percentUsed'] = ceil($storage['used'] / $storage['limit'] * 100);
+ $storage['limitPretty'] = PrettyNumber::size($storage['limit']);
+ $storage['usedPretty'] = PrettyNumber::size($storage['used']);
+
+ return view('settings.home', compact('storage'));
}
public function homeUpdate(Request $request)
{
- $this->validate($request, [
- 'name' => 'required|string|max:' . config('pixelfed.max_name_length'),
- 'bio' => 'nullable|string|max:' . config('pixelfed.max_bio_length'),
+ $this->validate($request, [
+ 'name' => 'required|string|max:'.config('pixelfed.max_name_length'),
+ 'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'),
'website' => 'nullable|url',
- 'email' => 'nullable|email'
+ 'email' => 'nullable|email',
]);
- $changes = false;
- $name = $request->input('name');
- $bio = $request->input('bio');
- $website = $request->input('website');
- $email = $request->input('email');
- $user = Auth::user();
- $profile = $user->profile;
+ $changes = false;
+ $name = $request->input('name');
+ $bio = $request->input('bio');
+ $website = $request->input('website');
+ $email = $request->input('email');
+ $user = Auth::user();
+ $profile = $user->profile;
- $validate = config('pixelfed.enforce_email_verification');
+ $validate = config('pixelfed.enforce_email_verification');
- if($user->email != $email) {
- $changes = true;
- $user->email = $email;
+ if ($user->email != $email) {
+ $changes = true;
+ $user->email = $email;
- if($validate) {
- $user->email_verified_at = null;
- // Prevent old verifications from working
- EmailVerification::whereUserId($user->id)->delete();
- }
- }
-
- // Only allow email to be updated if not yet verified
- if(!$validate || !$changes && $user->email_verified_at) {
- if($profile->name != $name) {
- $changes = true;
- $user->name = $name;
- $profile->name = $name;
+ if ($validate) {
+ $user->email_verified_at = null;
+ // Prevent old verifications from working
+ EmailVerification::whereUserId($user->id)->delete();
+ }
}
- if(!$profile->website || $profile->website != $website) {
- $changes = true;
- $profile->website = $website;
+ // Only allow email to be updated if not yet verified
+ if (!$validate || !$changes && $user->email_verified_at) {
+ if ($profile->name != $name) {
+ $changes = true;
+ $user->name = $name;
+ $profile->name = $name;
+ }
+
+ if (!$profile->website || $profile->website != $website) {
+ $changes = true;
+ $profile->website = $website;
+ }
+
+ if (!$profile->bio || !$profile->bio != $bio) {
+ $changes = true;
+ $profile->bio = $bio;
+ }
}
- if(!$profile->bio || !$profile->bio != $bio) {
- $changes = true;
- $profile->bio = $bio;
+ if ($changes === true) {
+ $user->save();
+ $profile->save();
+
+ return redirect('/settings/home')->with('status', 'Profile successfully updated!');
}
- }
- if($changes === true) {
- $user->save();
- $profile->save();
- return redirect('/settings/home')->with('status', 'Profile successfully updated!');
- }
-
- return redirect('/settings/home');
+ return redirect('/settings/home');
}
public function password()
{
- return view('settings.password');
+ return view('settings.password');
}
public function passwordUpdate(Request $request)
{
- $this->validate($request, [
- 'current' => 'required|string',
- 'password' => 'required|string',
+ $this->validate($request, [
+ 'current' => 'required|string',
+ 'password' => 'required|string',
'password_confirmation' => 'required|string',
]);
- $current = $request->input('current');
- $new = $request->input('password');
- $confirm = $request->input('password_confirmation');
+ $current = $request->input('current');
+ $new = $request->input('password');
+ $confirm = $request->input('password_confirmation');
- $user = Auth::user();
+ $user = Auth::user();
- if(password_verify($current, $user->password) && $new === $confirm) {
- $user->password = bcrypt($new);
- $user->save();
+ if (password_verify($current, $user->password) && $new === $confirm) {
+ $user->password = bcrypt($new);
+ $user->save();
- return redirect('/settings/home')->with('status', 'Password successfully updated!');
- }
- return redirect('/settings/home')->with('error', 'There was an error with your request!');
+ return redirect('/settings/home')->with('status', 'Password successfully updated!');
+ }
+
+ return redirect('/settings/home')->with('error', 'There was an error with your request!');
}
public function email()
{
- return view('settings.email');
+ return view('settings.email');
}
public function avatar()
{
- return view('settings.avatar');
+ return view('settings.avatar');
}
public function accessibility()
{
- $settings = Auth::user()->settings;
- return view('settings.accessibility', compact('settings'));
+ $settings = Auth::user()->settings;
+
+ return view('settings.accessibility', compact('settings'));
}
public function accessibilityStore(Request $request)
{
- $settings = Auth::user()->settings;
- $fields = [
+ $settings = Auth::user()->settings;
+ $fields = [
'compose_media_descriptions',
'reduce_motion',
'optimize_screen_reader',
'high_contrast_mode',
- 'video_autoplay'
+ 'video_autoplay',
];
- foreach($fields as $field) {
- $form = $request->input($field);
- if($form == 'on') {
- $settings->{$field} = true;
- } else {
- $settings->{$field} = false;
- }
- $settings->save();
- }
- return redirect(route('settings.accessibility'))->with('status', 'Settings successfully updated!');
+ foreach ($fields as $field) {
+ $form = $request->input($field);
+ if ($form == 'on') {
+ $settings->{$field} = true;
+ } else {
+ $settings->{$field} = false;
+ }
+ $settings->save();
+ }
+
+ return redirect(route('settings.accessibility'))->with('status', 'Settings successfully updated!');
}
public function notifications()
{
- return view('settings.notifications');
+ return view('settings.notifications');
}
public function privacy()
{
- $settings = Auth::user()->settings;
- $is_private = Auth::user()->profile->is_private;
- $settings['is_private'] = (bool) $is_private;
- return view('settings.privacy', compact('settings'));
+ $settings = Auth::user()->settings;
+ $is_private = Auth::user()->profile->is_private;
+ $settings['is_private'] = (bool) $is_private;
+
+ return view('settings.privacy', compact('settings'));
}
public function privacyStore(Request $request)
{
- $settings = Auth::user()->settings;
- $profile = Auth::user()->profile;
- $fields = [
+ $settings = Auth::user()->settings;
+ $profile = Auth::user()->profile;
+ $fields = [
'is_private',
'crawlable',
'show_profile_follower_count',
- 'show_profile_following_count'
+ 'show_profile_following_count',
];
- foreach($fields as $field) {
- $form = $request->input($field);
- if($field == 'is_private') {
- if($form == 'on') {
- $profile->{$field} = true;
- $settings->show_guests = false;
- $settings->show_discover = false;
- $profile->save();
+ foreach ($fields as $field) {
+ $form = $request->input($field);
+ if ($field == 'is_private') {
+ if ($form == 'on') {
+ $profile->{$field} = true;
+ $settings->show_guests = false;
+ $settings->show_discover = false;
+ $profile->save();
+ } else {
+ $profile->{$field} = false;
+ $profile->save();
+ }
+ } elseif ($field == 'crawlable') {
+ if ($form == 'on') {
+ $settings->{$field} = false;
+ } else {
+ $settings->{$field} = true;
+ }
} else {
- $profile->{$field} = false;
- $profile->save();
+ if ($form == 'on') {
+ $settings->{$field} = true;
+ } else {
+ $settings->{$field} = false;
+ }
}
- } elseif($field == 'crawlable') {
- if($form == 'on') {
- $settings->{$field} = false;
- } else {
- $settings->{$field} = true;
- }
- } else {
- if($form == 'on') {
- $settings->{$field} = true;
- } else {
- $settings->{$field} = false;
- }
- }
- $settings->save();
- }
- return redirect(route('settings.privacy'))->with('status', 'Settings successfully updated!');
+ $settings->save();
+ }
+
+ return redirect(route('settings.privacy'))->with('status', 'Settings successfully updated!');
}
public function security()
{
- $sessions = DB::table('sessions')
+ $sessions = DB::table('sessions')
->whereUserId(Auth::id())
->limit(20)
->get();
- $activity = AccountLog::whereUserId(Auth::id())
- ->orderBy('created_at','desc')
+ $activity = AccountLog::whereUserId(Auth::id())
+ ->orderBy('created_at', 'desc')
->limit(50)
->get();
- return view('settings.security', compact('sessions', 'activity'));
+
+ return view('settings.security', compact('sessions', 'activity'));
}
public function applications()
{
- return view('settings.applications');
+ return view('settings.applications');
}
public function dataExport()
{
- return view('settings.dataexport');
+ return view('settings.dataexport');
}
public function dataImport()
{
- return view('settings.import.home');
+ return view('settings.import.home');
}
public function dataImportInstagram()
{
- return view('settings.import.instagram.home');
+ return view('settings.import.instagram.home');
}
public function developers()
{
- return view('settings.developers');
+ return view('settings.developers');
}
}
diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php
index 18eb861b7..ec4b00d72 100644
--- a/app/Http/Controllers/SiteController.php
+++ b/app/Http/Controllers/SiteController.php
@@ -2,20 +2,24 @@
namespace App\Http\Controllers;
-use App, Auth, Cache;
-use Illuminate\Http\Request;
-use App\{Follower, Profile, Status, User};
+use App;
+use App\Follower;
+use App\Profile;
+use App\Status;
+use App\User;
use App\Util\Lexer\PrettyNumber;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
class SiteController extends Controller
{
-
public function home()
{
- if(Auth::check()) {
- return $this->homeTimeline();
+ if (Auth::check()) {
+ return $this->homeTimeline();
} else {
- return $this->homeGuest();
+ return $this->homeGuest();
}
}
@@ -26,40 +30,44 @@ class SiteController extends Controller
public function homeTimeline()
{
- // TODO: Use redis for timelines
- $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id');
- $following->push(Auth::user()->profile->id);
- $timeline = Status::whereIn('profile_id', $following)
+ // TODO: Use redis for timelines
+ $following = Follower::whereProfileId(Auth::user()->profile->id)->pluck('following_id');
+ $following->push(Auth::user()->profile->id);
+ $timeline = Status::whereIn('profile_id', $following)
->whereHas('media')
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->withCount(['comments', 'likes', 'shares'])
->simplePaginate(20);
- $type = 'personal';
- return view('timeline.template', compact('timeline', 'type'));
+ $type = 'personal';
+
+ return view('timeline.template', compact('timeline', 'type'));
}
public function changeLocale(Request $request, $locale)
{
- if(!App::isLocale($locale)) {
- return redirect()->back();
+ if (!App::isLocale($locale)) {
+ return redirect()->back();
}
App::setLocale($locale);
+
return redirect()->back();
}
public function about()
{
- $res = Cache::remember('site:page:about', 15, function() {
- $statuses = Status::whereHas('media')
+ $res = Cache::remember('site:page:about', 15, function () {
+ $statuses = Status::whereHas('media')
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
->count();
- $statusCount = PrettyNumber::convert($statuses);
- $userCount = PrettyNumber::convert(User::count());
- $remoteCount = PrettyNumber::convert(Profile::whereNotNull('remote_url')->count());
- $adminContact = User::whereIsAdmin(true)->first();
- return view('site.about')->with(compact('statusCount', 'userCount', 'remoteCount', 'adminContact'))->render();
+ $statusCount = PrettyNumber::convert($statuses);
+ $userCount = PrettyNumber::convert(User::count());
+ $remoteCount = PrettyNumber::convert(Profile::whereNotNull('remote_url')->count());
+ $adminContact = User::whereIsAdmin(true)->first();
+
+ return view('site.about')->with(compact('statusCount', 'userCount', 'remoteCount', 'adminContact'))->render();
});
+
return $res;
}
}
diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php
index 6a9299939..3a6a2597e 100644
--- a/app/Http/Controllers/StatusController.php
+++ b/app/Http/Controllers/StatusController.php
@@ -2,14 +2,18 @@
namespace App\Http\Controllers;
-use Auth, Cache;
-use League\Fractal;
-use Illuminate\Http\Request;
-use Vinkla\Hashids\Facades\Hashids;
-use App\{Media, Profile, Status, User};
use App\Jobs\ImageOptimizePipeline\ImageOptimize;
+use App\Jobs\StatusPipeline\NewStatusPipeline;
+use App\Jobs\StatusPipeline\StatusDelete;
+use App\Media;
+use App\Profile;
+use App\Status;
use App\Transformer\ActivityPub\StatusTransformer;
-use App\Jobs\StatusPipeline\{NewStatusPipeline, StatusDelete};
+use App\User;
+use Auth;
+use Cache;
+use Illuminate\Http\Request;
+use League\Fractal;
class StatusController extends Controller
{
@@ -21,8 +25,8 @@ class StatusController extends Controller
->withCount(['likes', 'comments', 'media'])
->findOrFail($id);
- if($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
- return $this->showActivityPub($request, $status);
+ if ($request->wantsJson() && config('pixelfed.activitypub_enabled')) {
+ return $this->showActivityPub($request, $status);
}
$template = $this->detectTemplate($status);
@@ -34,25 +38,28 @@ class StatusController extends Controller
protected function detectTemplate($status)
{
- $template = Cache::rememberForever('template:status:type:'.$status->id, function () use($status) {
- $template = 'status.show.photo';
- if(!$status->media_path && $status->in_reply_to_id) {
- $template = 'status.reply';
- }
- if($status->media->count() > 1) {
- $template = 'status.show.album';
- }
- if($status->viewType() == 'video') {
- $template = 'status.show.video';
- }
- return $template;
+ $template = Cache::rememberForever('template:status:type:'.$status->id, function () use ($status) {
+ $template = 'status.show.photo';
+ if (!$status->media_path && $status->in_reply_to_id) {
+ $template = 'status.reply';
+ }
+ if ($status->media->count() > 1) {
+ $template = 'status.show.album';
+ }
+ if ($status->viewType() == 'video') {
+ $template = 'status.show.video';
+ }
+
+ return $template;
});
+
return $template;
}
public function compose()
{
$this->authCheck();
+
return view('status.compose');
}
@@ -63,27 +70,27 @@ class StatusController extends Controller
$size = Media::whereUserId($user->id)->sum('size') / 1000;
$limit = (int) config('pixelfed.max_account_size');
- if($size >= $limit) {
- return redirect()->back()->with('error', 'You have exceeded your storage limit. Please click here for more info.');
+ if ($size >= $limit) {
+ return redirect()->back()->with('error', 'You have exceeded your storage limit. Please click here for more info.');
}
$this->validate($request, [
- 'photo.*' => 'required|mimes:jpeg,png,gif|max:' . config('pixelfed.max_photo_size'),
- 'caption' => 'string|max:' . config('pixelfed.max_caption_length'),
- 'cw' => 'nullable|string',
+ 'photo.*' => 'required|mimes:jpeg,png,gif|max:'.config('pixelfed.max_photo_size'),
+ 'caption' => 'string|max:'.config('pixelfed.max_caption_length'),
+ 'cw' => 'nullable|string',
'filter_class' => 'nullable|string',
- 'filter_name' => 'nullable|string',
+ 'filter_name' => 'nullable|string',
]);
- if(count($request->file('photo')) > config('pixelfed.max_album_length')) {
- return redirect()->back()->with('error', 'Too many files, max limit per post: ' . config('pixelfed.max_album_length'));
+ if (count($request->file('photo')) > config('pixelfed.max_album_length')) {
+ return redirect()->back()->with('error', 'Too many files, max limit per post: '.config('pixelfed.max_album_length'));
}
$cw = $request->filled('cw') && $request->cw == 'on' ? true : false;
- $monthHash = hash('sha1', date('Y') . date('m'));
- $userHash = hash('sha1', $user->id . (string) $user->created_at);
+ $monthHash = hash('sha1', date('Y').date('m'));
+ $userHash = hash('sha1', $user->id.(string) $user->created_at);
$profile = $user->profile;
- $status = new Status;
+ $status = new Status();
$status->profile_id = $profile->id;
$status->caption = strip_tags($request->caption);
$status->is_nsfw = $cw;
@@ -93,47 +100,47 @@ class StatusController extends Controller
$photos = $request->file('photo');
$order = 1;
foreach ($photos as $k => $v) {
- $storagePath = "public/m/{$monthHash}/{$userHash}";
- $path = $v->store($storagePath);
- $hash = \hash_file('sha256', $v);
- $media = new Media;
- $media->status_id = $status->id;
- $media->profile_id = $profile->id;
- $media->user_id = $user->id;
- $media->media_path = $path;
- $media->original_sha256 = $hash;
- $media->size = $v->getClientSize();
- $media->mime = $v->getClientMimeType();
- $media->filter_class = $request->input('filter_class');
- $media->filter_name = $request->input('filter_name');
- $media->order = $order;
- $media->save();
- ImageOptimize::dispatch($media);
- $order++;
+ $storagePath = "public/m/{$monthHash}/{$userHash}";
+ $path = $v->store($storagePath);
+ $hash = \hash_file('sha256', $v);
+ $media = new Media();
+ $media->status_id = $status->id;
+ $media->profile_id = $profile->id;
+ $media->user_id = $user->id;
+ $media->media_path = $path;
+ $media->original_sha256 = $hash;
+ $media->size = $v->getClientSize();
+ $media->mime = $v->getClientMimeType();
+ $media->filter_class = $request->input('filter_class');
+ $media->filter_name = $request->input('filter_name');
+ $media->order = $order;
+ $media->save();
+ ImageOptimize::dispatch($media);
+ $order++;
}
NewStatusPipeline::dispatch($status);
// TODO: Send to subscribers
-
+
return redirect($status->url());
}
public function delete(Request $request)
{
- if(!Auth::check()) {
- abort(403);
+ if (!Auth::check()) {
+ abort(403);
}
$this->validate($request, [
'type' => 'required|string',
- 'item' => 'required|integer|min:1'
+ 'item' => 'required|integer|min:1',
]);
$status = Status::findOrFail($request->input('item'));
- if($status->profile_id === Auth::user()->profile->id || Auth::user()->is_admin == true) {
- StatusDelete::dispatch($status);
+ if ($status->profile_id === Auth::user()->profile->id || Auth::user()->is_admin == true) {
+ StatusDelete::dispatch($status);
}
return redirect(Auth::user()->url());
@@ -153,26 +160,26 @@ class StatusController extends Controller
$exists = Status::whereProfileId(Auth::user()->profile->id)
->whereReblogOfId($status->id)
->count();
- if($exists !== 0) {
- $shares = Status::whereProfileId(Auth::user()->profile->id)
+ if ($exists !== 0) {
+ $shares = Status::whereProfileId(Auth::user()->profile->id)
->whereReblogOfId($status->id)
->get();
- foreach($shares as $share) {
- $share->delete();
- $count--;
- }
+ foreach ($shares as $share) {
+ $share->delete();
+ $count--;
+ }
} else {
- $share = new Status;
- $share->profile_id = $profile->id;
- $share->reblog_of_id = $status->id;
- $share->save();
- $count++;
+ $share = new Status();
+ $share->profile_id = $profile->id;
+ $share->reblog_of_id = $status->id;
+ $share->save();
+ $count++;
}
- if($request->ajax()) {
- $response = ['code' => 200, 'msg' => 'Share saved', 'count' => $count];
+ if ($request->ajax()) {
+ $response = ['code' => 200, 'msg' => 'Share saved', 'count' => $count];
} else {
- $response = redirect($status->url());
+ $response = redirect($status->url());
}
return $response;
@@ -180,10 +187,11 @@ class StatusController extends Controller
public function showActivityPub(Request $request, $status)
{
- $fractal = new Fractal\Manager();
- $resource = new Fractal\Resource\Item($status, new StatusTransformer);
- $res = $fractal->createData($resource)->toArray();
- return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
+ $fractal = new Fractal\Manager();
+ $resource = new Fractal\Resource\Item($status, new StatusTransformer());
+ $res = $fractal->createData($resource)->toArray();
+
+ return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
}
public function edit(Request $request, $username, $id)
@@ -193,10 +201,10 @@ class StatusController extends Controller
$status = Status::whereProfileId($user->id)
->with(['media'])
->findOrFail($id);
+
return view('status.edit', compact('user', 'status'));
}
-
public function editStore(Request $request, $username, $id)
{
$this->authCheck();
@@ -206,9 +214,9 @@ class StatusController extends Controller
->findOrFail($id);
$this->validate($request, [
- 'id' => 'required|integer|min:1',
+ 'id' => 'required|integer|min:1',
'caption' => 'nullable',
- 'filter' => 'nullable|alpha_dash|max:30'
+ 'filter' => 'nullable|alpha_dash|max:30',
]);
$id = $request->input('id');
@@ -221,27 +229,27 @@ class StatusController extends Controller
$changed = false;
- if($media->caption != $caption) {
- $media->caption = $caption;
- $changed = true;
+ if ($media->caption != $caption) {
+ $media->caption = $caption;
+ $changed = true;
}
- if($media->filter_class != $filter) {
- $media->filter_class = $filter;
- $changed = true;
+ if ($media->filter_class != $filter) {
+ $media->filter_class = $filter;
+ $changed = true;
}
- if($changed === true) {
- $media->save();
+ if ($changed === true) {
+ $media->save();
}
+
return response()->json([], 200);
}
protected function authCheck()
{
- if(Auth::check() == false)
- {
- abort(403);
+ if (Auth::check() == false) {
+ abort(403);
}
}
}
diff --git a/app/Http/Controllers/StoryController.php b/app/Http/Controllers/StoryController.php
index aafaa107e..ea45411d1 100644
--- a/app/Http/Controllers/StoryController.php
+++ b/app/Http/Controllers/StoryController.php
@@ -2,10 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-use App\Profile;
-
class StoryController extends Controller
{
-
-}
\ No newline at end of file
+}
diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php
index 9cbc579ed..4ccb78709 100644
--- a/app/Http/Controllers/TimelineController.php
+++ b/app/Http/Controllers/TimelineController.php
@@ -2,57 +2,61 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
+use App\Follower;
+use App\Profile;
+use App\Status;
+use App\User;
+use App\UserFilter;
use Auth;
-use App\{Follower, Profile, Status, User, UserFilter};
class TimelineController extends Controller
{
public function __construct()
{
- $this->middleware('auth');
+ $this->middleware('auth');
}
public function personal()
{
- $pid = Auth::user()->profile->id;
- // TODO: Use redis for timelines
- $following = Follower::whereProfileId($pid)->pluck('following_id');
- $following->push($pid);
- $filtered = UserFilter::whereUserId($pid)
+ $pid = Auth::user()->profile->id;
+ // TODO: Use redis for timelines
+ $following = Follower::whereProfileId($pid)->pluck('following_id');
+ $following->push($pid);
+ $filtered = UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id');
- $timeline = Status::whereIn('profile_id', $following)
+ $timeline = Status::whereIn('profile_id', $following)
->whereNotIn('profile_id', $filtered)
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->withCount(['comments', 'likes'])
->simplePaginate(20);
- $type = 'personal';
- return view('timeline.template', compact('timeline', 'type'));
+ $type = 'personal';
+
+ return view('timeline.template', compact('timeline', 'type'));
}
public function local()
{
- // TODO: Use redis for timelines
- // $timeline = Timeline::build()->local();
- $pid = Auth::user()->profile->id;
+ // TODO: Use redis for timelines
+ // $timeline = Timeline::build()->local();
+ $pid = Auth::user()->profile->id;
- $filtered = UserFilter::whereUserId($pid)
+ $filtered = UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id');
- $private = Profile::whereIsPrivate(true)->pluck('id');
- $filtered = $filtered->merge($private);
- $timeline = Status::whereHas('media')
+ $private = Profile::whereIsPrivate(true)->pluck('id');
+ $filtered = $filtered->merge($private);
+ $timeline = Status::whereHas('media')
->whereNotIn('profile_id', $filtered)
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
->withCount(['comments', 'likes'])
- ->orderBy('id','desc')
+ ->orderBy('id', 'desc')
->simplePaginate(20);
- $type = 'local';
- return view('timeline.template', compact('timeline', 'type'));
- }
+ $type = 'local';
+ return view('timeline.template', compact('timeline', 'type'));
+ }
}
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 61e44822f..cb2b91876 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -51,15 +51,15 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
- 'admin' => \App\Http\Middleware\Admin::class,
- 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
- 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
- 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
+ 'admin' => \App\Http\Middleware\Admin::class,
+ 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
+ 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
+ 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
- 'can' => \Illuminate\Auth\Middleware\Authorize::class,
- 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
- 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
- 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
- 'validemail' => \App\Http\Middleware\EmailVerificationCheck::class,
+ 'can' => \Illuminate\Auth\Middleware\Authorize::class,
+ 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
+ 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
+ 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+ 'validemail' => \App\Http\Middleware\EmailVerificationCheck::class,
];
}
diff --git a/app/Http/Middleware/Admin.php b/app/Http/Middleware/Admin.php
index e78290450..422477483 100644
--- a/app/Http/Middleware/Admin.php
+++ b/app/Http/Middleware/Admin.php
@@ -2,20 +2,22 @@
namespace App\Http\Middleware;
-use Auth, Closure;
+use Auth;
+use Closure;
class Admin
{
/**
* Handle an incoming request.
*
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ *
* @return mixed
*/
public function handle($request, Closure $next)
{
- if(Auth::check() == false || Auth::user()->is_admin == false) {
+ if (Auth::check() == false || Auth::user()->is_admin == false) {
return redirect(config('app.url'));
}
diff --git a/app/Http/Middleware/EmailVerificationCheck.php b/app/Http/Middleware/EmailVerificationCheck.php
index 1d748db3b..502f4fd23 100644
--- a/app/Http/Middleware/EmailVerificationCheck.php
+++ b/app/Http/Middleware/EmailVerificationCheck.php
@@ -2,26 +2,28 @@
namespace App\Http\Middleware;
-use Auth, Closure;
+use Closure;
class EmailVerificationCheck
{
/**
* Handle an incoming request.
*
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ *
* @return mixed
*/
public function handle($request, Closure $next)
{
- if($request->user() &&
+ if ($request->user() &&
config('pixelfed.enforce_email_verification') &&
- is_null($request->user()->email_verified_at) &&
+ is_null($request->user()->email_verified_at) &&
!$request->is('i/verify-email', 'log*', 'i/confirm-email/*', 'settings/home')
) {
return redirect('/i/verify-email');
- }
+ }
+
return $next($request);
}
}
diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php
index e4cec9c8b..afe1c26c6 100644
--- a/app/Http/Middleware/RedirectIfAuthenticated.php
+++ b/app/Http/Middleware/RedirectIfAuthenticated.php
@@ -10,9 +10,10 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @param string|null $guard
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @param string|null $guard
+ *
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php
index 7daf51f16..c661475cd 100644
--- a/app/Http/Middleware/TrustProxies.php
+++ b/app/Http/Middleware/TrustProxies.php
@@ -2,8 +2,8 @@
namespace App\Http\Middleware;
-use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
+use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
diff --git a/app/Jobs/AvatarPipeline/AvatarOptimize.php b/app/Jobs/AvatarPipeline/AvatarOptimize.php
index 749224784..6a9df55e7 100644
--- a/app/Jobs/AvatarPipeline/AvatarOptimize.php
+++ b/app/Jobs/AvatarPipeline/AvatarOptimize.php
@@ -2,14 +2,15 @@
namespace App\Jobs\AvatarPipeline;
-use \Carbon\Carbon;
-use Image as Intervention;
-use App\{Avatar, Profile};
+use App\Avatar;
+use App\Profile;
+use Carbon\Carbon;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Image as Intervention;
class AvatarOptimize implements ShouldQueue
{
@@ -54,16 +55,15 @@ class AvatarOptimize implements ShouldQueue
$avatar->save();
$this->deleteOldAvatar($avatar->media_path, $this->current);
} catch (Exception $e) {
-
}
}
protected function deleteOldAvatar($new, $current)
{
- if(storage_path('app/' . $new) == $current) {
+ if (storage_path('app/'.$new) == $current) {
return;
}
- if(is_file($current)) {
+ if (is_file($current)) {
@unlink($current);
}
}
diff --git a/app/Jobs/AvatarPipeline/CreateAvatar.php b/app/Jobs/AvatarPipeline/CreateAvatar.php
index 40e54deb2..06c42af85 100644
--- a/app/Jobs/AvatarPipeline/CreateAvatar.php
+++ b/app/Jobs/AvatarPipeline/CreateAvatar.php
@@ -2,23 +2,24 @@
namespace App\Jobs\AvatarPipeline;
-use App\{Avatar, Profile};
-use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Foundation\Bus\Dispatchable;
-use Illuminate\Support\Str;
-use Bitverse\Identicon\Identicon;
+use App\Avatar;
+use App\Profile;
+use App\Util\Identicon\Preprocessor\HashPreprocessor;
use Bitverse\Identicon\Color\Color;
use Bitverse\Identicon\Generator\RingsGenerator;
-use App\Util\Identicon\Preprocessor\HashPreprocessor;
+use Bitverse\Identicon\Identicon;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class CreateAvatar implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $profile;
+
/**
* Create a new job instance.
*
@@ -44,66 +45,63 @@ class CreateAvatar implements ShouldQueue
$identicon = new Identicon(new HashPreprocessor('sha256'), $generator);
- $hash = $username . str_random(12);
+ $hash = $username.str_random(12);
$icon = $identicon->getIcon($hash);
try {
-
- $baseDir = storage_path('app/public/avatars');
- if(!is_dir($baseDir)) {
- mkdir($baseDir);
- }
+ $baseDir = storage_path('app/public/avatars');
+ if (!is_dir($baseDir)) {
+ mkdir($baseDir);
+ }
- $prefix = $profile->id;
- $padded = str_pad($prefix, 12, 0, STR_PAD_LEFT);
- $parts = str_split($padded, 3);
- foreach($parts as $k => $part) {
- if($k == 0) {
- $prefix = storage_path('app/public/avatars/'.$parts[0]);
- if(!is_dir($prefix)) {
- mkdir($prefix);
+ $prefix = $profile->id;
+ $padded = str_pad($prefix, 12, 0, STR_PAD_LEFT);
+ $parts = str_split($padded, 3);
+ foreach ($parts as $k => $part) {
+ if ($k == 0) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0]);
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
+ }
+ if ($k == 1) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1]);
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
+ }
+ if ($k == 2) {
+ $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2]);
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
+ }
+ if ($k == 3) {
+ $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3];
+ $prefix = storage_path('app/'.$avatarpath);
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
}
}
- if($k == 1) {
- $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1]);
- if(!is_dir($prefix)) {
- mkdir($prefix);
- }
+ $dir = storage_path('app/'.$avatarpath);
+ //$dir = storage_path('app/public/avatars/'.$prefix);
+ if (!is_dir($dir)) {
+ mkdir($dir);
}
- if($k == 2) {
- $prefix = storage_path('app/public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2]);
- if(!is_dir($prefix)) {
- mkdir($prefix);
- }
- }
- if($k == 3) {
- $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3];
- $prefix = storage_path('app/'.$avatarpath);
- if(!is_dir($prefix)) {
- mkdir($prefix);
- }
- }
- }
- $dir = storage_path('app/'.$avatarpath);
- //$dir = storage_path('app/public/avatars/'.$prefix);
- if(!is_dir($dir)) {
- mkdir($dir);
- }
- //$path = 'public/avatars/' . $prefix . '/avatar.svg';
- $path = $avatarpath . '/avatar.svg';
- $basePath = storage_path('app/' . $path);
- file_put_contents($basePath, $icon);
+ //$path = 'public/avatars/' . $prefix . '/avatar.svg';
+ $path = $avatarpath.'/avatar.svg';
+ $basePath = storage_path('app/'.$path);
+ file_put_contents($basePath, $icon);
} catch (Exception $e) {
-
}
- $avatar = new Avatar;
+ $avatar = new Avatar();
$avatar->profile_id = $profile->id;
$avatar->media_path = $path;
$avatar->thumb_path = $path;
$avatar->change_count = 0;
$avatar->last_processed_at = \Carbon\Carbon::now();
$avatar->save();
-
}
}
diff --git a/app/Jobs/CommentPipeline/CommentPipeline.php b/app/Jobs/CommentPipeline/CommentPipeline.php
index e220709d1..8c1eb21a8 100644
--- a/app/Jobs/CommentPipeline/CommentPipeline.php
+++ b/app/Jobs/CommentPipeline/CommentPipeline.php
@@ -2,14 +2,16 @@
namespace App\Jobs\CommentPipeline;
-use Cache, Log, Redis;
-use App\{Like, Notification, Status};
-use App\Util\Lexer\Hashtag as HashtagLexer;
+use App\Notification;
+use App\Status;
+use Cache;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Log;
+use Redis;
class CommentPipeline implements ShouldQueue
{
@@ -42,13 +44,12 @@ class CommentPipeline implements ShouldQueue
$target = $status->profile;
$actor = $comment->profile;
- if($actor->id === $target->id) {
+ if ($actor->id === $target->id) {
return true;
}
try {
-
- $notification = new Notification;
+ $notification = new Notification();
$notification->profile_id = $target->id;
$notification->actor_id = $actor->id;
$notification->action = 'comment';
@@ -58,16 +59,14 @@ class CommentPipeline implements ShouldQueue
$notification->item_type = "App\Status";
$notification->save();
- Cache::forever('notification.' . $notification->id, $notification);
-
+ Cache::forever('notification.'.$notification->id, $notification);
+
$redis = Redis::connection();
- $nkey = config('cache.prefix').':user.' . $target->id . '.notifications';
+ $nkey = config('cache.prefix').':user.'.$target->id.'.notifications';
$redis->lpush($nkey, $notification->id);
-
} catch (Exception $e) {
Log::error($e);
}
-
}
}
diff --git a/app/Jobs/FollowPipeline/FollowPipeline.php b/app/Jobs/FollowPipeline/FollowPipeline.php
index f7cfa6506..54489cc29 100644
--- a/app/Jobs/FollowPipeline/FollowPipeline.php
+++ b/app/Jobs/FollowPipeline/FollowPipeline.php
@@ -2,14 +2,15 @@
namespace App\Jobs\FollowPipeline;
-use Cache, Log, Redis;
-use App\{Like, Notification};
+use App\Notification;
+use Cache;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
-use App\Jobs\FollowPipeline\FollowDiscover;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Log;
+use Redis;
class FollowPipeline implements ShouldQueue
{
@@ -39,8 +40,7 @@ class FollowPipeline implements ShouldQueue
$target = $follower->target;
try {
-
- $notification = new Notification;
+ $notification = new Notification();
$notification->profile_id = $target->id;
$notification->actor_id = $actor->id;
$notification->action = 'follow';
@@ -50,13 +50,12 @@ class FollowPipeline implements ShouldQueue
$notification->item_type = "App\Profile";
$notification->save();
- Cache::forever('notification.' . $notification->id, $notification);
-
+ Cache::forever('notification.'.$notification->id, $notification);
+
$redis = Redis::connection();
- $nkey = config('cache.prefix').':user.' . $target->id . '.notifications';
+ $nkey = config('cache.prefix').':user.'.$target->id.'.notifications';
$redis->lpush($nkey, $notification->id);
-
} catch (Exception $e) {
Log::error($e);
}
diff --git a/app/Jobs/ImageOptimizePipeline/ImageOptimize.php b/app/Jobs/ImageOptimizePipeline/ImageOptimize.php
index c609debd1..2fdd439c6 100644
--- a/app/Jobs/ImageOptimizePipeline/ImageOptimize.php
+++ b/app/Jobs/ImageOptimizePipeline/ImageOptimize.php
@@ -2,19 +2,17 @@
namespace App\Jobs\ImageOptimizePipeline;
-use Carbon\Carbon;
-use ImageOptimizer;
-use App\{Media, Status};
+use App\Media;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class ImageOptimize implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
-
+
protected $media;
/**
@@ -35,8 +33,8 @@ class ImageOptimize implements ShouldQueue
public function handle()
{
$media = $this->media;
- $path = storage_path('app/'. $media->media_path);
- if(!is_file($path)) {
+ $path = storage_path('app/'.$media->media_path);
+ if (!is_file($path)) {
return;
}
diff --git a/app/Jobs/ImageOptimizePipeline/ImageResize.php b/app/Jobs/ImageOptimizePipeline/ImageResize.php
index 065ed4a41..f7dd622b6 100644
--- a/app/Jobs/ImageOptimizePipeline/ImageResize.php
+++ b/app/Jobs/ImageOptimizePipeline/ImageResize.php
@@ -2,15 +2,13 @@
namespace App\Jobs\ImageOptimizePipeline;
-use Carbon\Carbon;
-use ImageOptimizer;
-use App\{Media, Status};
+use App\Media;
use App\Util\Media\Image;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class ImageResize implements ShouldQueue
{
@@ -36,16 +34,15 @@ class ImageResize implements ShouldQueue
public function handle()
{
$media = $this->media;
- $path = storage_path('app/'. $media->media_path);
- if(!is_file($path)) {
+ $path = storage_path('app/'.$media->media_path);
+ if (!is_file($path)) {
return;
}
try {
- $img = new Image;
+ $img = new Image();
$img->resizeImage($media);
} catch (Exception $e) {
-
}
ImageThumbnail::dispatch($media);
diff --git a/app/Jobs/ImageOptimizePipeline/ImageThumbnail.php b/app/Jobs/ImageOptimizePipeline/ImageThumbnail.php
index b771c39a3..601c010b3 100644
--- a/app/Jobs/ImageOptimizePipeline/ImageThumbnail.php
+++ b/app/Jobs/ImageOptimizePipeline/ImageThumbnail.php
@@ -2,14 +2,14 @@
namespace App\Jobs\ImageOptimizePipeline;
-use Carbon\Carbon;
-use App\{Media, Status};
+use App\Media;
use App\Util\Media\Image;
+use Carbon\Carbon;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class ImageThumbnail implements ShouldQueue
{
@@ -35,16 +35,15 @@ class ImageThumbnail implements ShouldQueue
public function handle()
{
$media = $this->media;
- $path = storage_path('app/'. $media->media_path);
- if(!is_file($path)) {
+ $path = storage_path('app/'.$media->media_path);
+ if (!is_file($path)) {
return;
}
try {
- $img = new Image;
+ $img = new Image();
$img->resizeThumbnail($media);
} catch (Exception $e) {
-
}
$media->processed_at = Carbon::now();
diff --git a/app/Jobs/ImageOptimizePipeline/ImageUpdate.php b/app/Jobs/ImageOptimizePipeline/ImageUpdate.php
index 482176bec..34fde30f4 100644
--- a/app/Jobs/ImageOptimizePipeline/ImageUpdate.php
+++ b/app/Jobs/ImageOptimizePipeline/ImageUpdate.php
@@ -2,13 +2,13 @@
namespace App\Jobs\ImageOptimizePipeline;
-use ImageOptimizer;
-use App\{Media, Status};
+use App\Media;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use ImageOptimizer;
class ImageUpdate implements ShouldQueue
{
@@ -19,7 +19,7 @@ class ImageUpdate implements ShouldQueue
protected $protectedMimes = [
'image/gif',
'image/bmp',
- 'video/mp4'
+ 'video/mp4',
];
/**
@@ -40,18 +40,18 @@ class ImageUpdate implements ShouldQueue
public function handle()
{
$media = $this->media;
- $path = storage_path('app/'. $media->media_path);
- $thumb = storage_path('app/'. $media->thumbnail_path);
+ $path = storage_path('app/'.$media->media_path);
+ $thumb = storage_path('app/'.$media->thumbnail_path);
+
try {
- if(!in_array($media->mime, $this->protectedMimes))
- {
+ if (!in_array($media->mime, $this->protectedMimes)) {
ImageOptimizer::optimize($thumb);
ImageOptimizer::optimize($path);
}
} catch (Exception $e) {
return;
}
- if(!is_file($path) || !is_file($thumb)) {
+ if (!is_file($path) || !is_file($thumb)) {
return;
}
$photo_size = filesize($path);
diff --git a/app/Jobs/InboxPipeline/InboxWorker.php b/app/Jobs/InboxPipeline/InboxWorker.php
index db65c3580..d5dad3174 100644
--- a/app/Jobs/InboxPipeline/InboxWorker.php
+++ b/app/Jobs/InboxPipeline/InboxWorker.php
@@ -5,10 +5,10 @@ namespace App\Jobs\InboxPipeline;
use App\Profile;
use App\Util\ActivityPub\Inbox;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class InboxWorker implements ShouldQueue
{
@@ -39,5 +39,4 @@ class InboxWorker implements ShouldQueue
{
(new Inbox($this->request, $this->profile, $this->payload))->handle();
}
-
}
diff --git a/app/Jobs/InboxPipeline/SharedInboxWorker.php b/app/Jobs/InboxPipeline/SharedInboxWorker.php
index dcc0db282..f9d4954c9 100644
--- a/app/Jobs/InboxPipeline/SharedInboxWorker.php
+++ b/app/Jobs/InboxPipeline/SharedInboxWorker.php
@@ -2,13 +2,12 @@
namespace App\Jobs\InboxPipeline;
-use App\Profile;
use App\Util\ActivityPub\Inbox;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class SharedInboxWorker implements ShouldQueue
{
diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php
index 8eccd726f..eb9e86b2b 100644
--- a/app/Jobs/LikePipeline/LikePipeline.php
+++ b/app/Jobs/LikePipeline/LikePipeline.php
@@ -2,19 +2,23 @@
namespace App\Jobs\LikePipeline;
-use Cache, Log, Redis;
-use App\{Like, Notification};
+use App\Like;
+use App\Notification;
+use Cache;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Log;
+use Redis;
class LikePipeline implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $like;
+
/**
* Create a new job instance.
*
@@ -37,7 +41,7 @@ class LikePipeline implements ShouldQueue
$status = $this->like->status;
$actor = $this->like->actor;
- if($status->url !== null) {
+ if ($status->url !== null) {
// Ignore notifications to remote statuses
return;
}
@@ -49,13 +53,12 @@ class LikePipeline implements ShouldQueue
->whereItemType('App\Status')
->count();
- if($actor->id === $status->profile_id || $exists !== 0) {
+ if ($actor->id === $status->profile_id || $exists !== 0) {
return true;
}
try {
-
- $notification = new Notification;
+ $notification = new Notification();
$notification->profile_id = $status->profile_id;
$notification->actor_id = $actor->id;
$notification->action = 'like';
@@ -65,12 +68,11 @@ class LikePipeline implements ShouldQueue
$notification->item_type = "App\Status";
$notification->save();
- Cache::forever('notification.' . $notification->id, $notification);
-
- $redis = Redis::connection();
- $key = config('cache.prefix').':user.' . $status->profile_id . '.notifications';
- $redis->lpush($key, $notification->id);
+ Cache::forever('notification.'.$notification->id, $notification);
+ $redis = Redis::connection();
+ $key = config('cache.prefix').':user.'.$status->profile_id.'.notifications';
+ $redis->lpush($key, $notification->id);
} catch (Exception $e) {
Log::error($e);
}
diff --git a/app/Jobs/MentionPipeline/MentionPipeline.php b/app/Jobs/MentionPipeline/MentionPipeline.php
index 69b7ebbb2..8029e231f 100644
--- a/app/Jobs/MentionPipeline/MentionPipeline.php
+++ b/app/Jobs/MentionPipeline/MentionPipeline.php
@@ -2,13 +2,14 @@
namespace App\Jobs\MentionPipeline;
-use Cache, Log, Redis;
-use App\{Mention, Notification, Profile, Status};
+use App\Mention;
+use App\Notification;
+use App\Status;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class MentionPipeline implements ShouldQueue
{
@@ -35,7 +36,6 @@ class MentionPipeline implements ShouldQueue
*/
public function handle()
{
-
$status = $this->status;
$mention = $this->mention;
$actor = $this->status->profile;
@@ -48,13 +48,12 @@ class MentionPipeline implements ShouldQueue
->whereItemType('App\Status')
->count();
- if($actor->id === $target || $exists !== 0) {
+ if ($actor->id === $target || $exists !== 0) {
return true;
}
try {
-
- $notification = new Notification;
+ $notification = new Notification();
$notification->profile_id = $target;
$notification->actor_id = $actor->id;
$notification->action = 'mention';
@@ -63,10 +62,7 @@ class MentionPipeline implements ShouldQueue
$notification->item_id = $status->id;
$notification->item_type = "App\Status";
$notification->save();
-
} catch (Exception $e) {
-
}
-
}
}
diff --git a/app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.php b/app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.php
index 9341babcb..435dffe0b 100644
--- a/app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.php
+++ b/app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.php
@@ -2,18 +2,20 @@
namespace App\Jobs\RemoteFollowPipeline;
-use Zttp\Zttp;
-use Log, Storage;
+use App\Jobs\ImageOptimizePipeline\ImageThumbnail;
+use App\Jobs\StatusPipeline\NewStatusPipeline;
+use App\Media;
+use App\Status;
use Carbon\Carbon;
-use Illuminate\Http\File;
-use App\{Media, Profile, Status};
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
-use App\Jobs\StatusPipeline\NewStatusPipeline;
-use App\Jobs\ImageOptimizePipeline\ImageThumbnail;
+use Illuminate\Http\File;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Log;
+use Storage;
+use Zttp\Zttp;
class RemoteFollowImportRecent implements ShouldQueue
{
@@ -42,7 +44,7 @@ class RemoteFollowImportRecent implements ShouldQueue
'image/jpg',
'image/jpeg',
'image/png',
- 'image/gif'
+ 'image/gif',
];
}
@@ -62,7 +64,7 @@ class RemoteFollowImportRecent implements ShouldQueue
$url = ($url == false) ? $this->actor['outbox'] : $url;
$response = Zttp::withHeaders([
- 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org'
+ 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org',
])->get($url);
$this->outbox = $response->json();
@@ -73,13 +75,14 @@ class RemoteFollowImportRecent implements ShouldQueue
{
$types = ['OrderedCollection', 'OrderedCollectionPage'];
- if(isset($outbox['totalItems']) && $outbox['totalItems'] < 1) {
+ if (isset($outbox['totalItems']) && $outbox['totalItems'] < 1) {
// Skip remote fetch, not enough posts
Log::info('not enough items');
+
return;
}
- if(isset($outbox['type']) && in_array($outbox['type'], $types)) {
+ if (isset($outbox['type']) && in_array($outbox['type'], $types)) {
Log::info('handle ordered collection');
$this->handleOrderedCollection();
}
@@ -89,19 +92,20 @@ class RemoteFollowImportRecent implements ShouldQueue
{
$outbox = $this->outbox;
- if(!isset($outbox['next']) && !isset($outbox['first']['next']) && $this->cursor !== 1) {
+ if (!isset($outbox['next']) && !isset($outbox['first']['next']) && $this->cursor !== 1) {
$this->cursor = 40;
$outbox['next'] = false;
}
- if($outbox['type'] == 'OrderedCollectionPage') {
+ if ($outbox['type'] == 'OrderedCollectionPage') {
$this->nextUrl = $outbox['next'];
}
- if(isset($outbox['first']) && !is_array($outbox['first'])) {
+ if (isset($outbox['first']) && !is_array($outbox['first'])) {
// Mastodon detected
Log::info('Mastodon detected...');
$this->nextUrl = $outbox['first'];
+
return $this->fetchOutbox($this->nextUrl);
} else {
// Pleroma detected.
@@ -110,33 +114,31 @@ class RemoteFollowImportRecent implements ShouldQueue
$orderedItems = isset($outbox['orderedItems']) ? $outbox['orderedItems'] : $outbox['first']['orderedItems'];
}
-
- foreach($orderedItems as $item) {
+ foreach ($orderedItems as $item) {
Log::info('Parsing items...');
$parsed = $this->parseObject($item);
- if($parsed !== 0) {
+ if ($parsed !== 0) {
Log::info('Found media!');
$this->importActivity($item);
}
}
- if($this->cursor < 40 && $this->mediaCount < 9) {
+ if ($this->cursor < 40 && $this->mediaCount < 9) {
$this->cursor++;
$this->mediaCount++;
$this->fetchOutbox($this->nextUrl);
}
-
}
public function parseObject($parsed)
{
- if($parsed['type'] !== 'Create') {
+ if ($parsed['type'] !== 'Create') {
return 0;
}
$activity = $parsed['object'];
- if(isset($activity['attachment']) && !empty($activity['attachment'])) {
+ if (isset($activity['attachment']) && !empty($activity['attachment'])) {
return $this->detectSupportedMedia($activity['attachment']);
}
}
@@ -146,7 +148,7 @@ class RemoteFollowImportRecent implements ShouldQueue
$supported = $this->supported;
$count = 0;
- foreach($attachments as $media) {
+ foreach ($attachments as $media) {
$mime = $media['mediaType'];
$count = in_array($mime, $supported) ? ($count + 1) : $count;
}
@@ -161,11 +163,11 @@ class RemoteFollowImportRecent implements ShouldQueue
$attachments = $activity['object']['attachment'];
$caption = str_limit($activity['object']['content'], 125);
- if(Status::whereUrl($activity['id'])->count() !== 0) {
+ if (Status::whereUrl($activity['id'])->count() !== 0) {
return true;
}
- $status = new Status;
+ $status = new Status();
$status->profile_id = $profile->id;
$status->url = $activity['id'];
$status->local = false;
@@ -174,56 +176,56 @@ class RemoteFollowImportRecent implements ShouldQueue
$count = 0;
- foreach($attachments as $media) {
- Log::info($media['mediaType'] . ' - ' . $media['url']);
+ foreach ($attachments as $media) {
+ Log::info($media['mediaType'].' - '.$media['url']);
$url = $media['url'];
$mime = $media['mediaType'];
- if(!in_array($mime, $supported)) {
- Log::info('Invalid media, skipping. ' . $mime);
+ if (!in_array($mime, $supported)) {
+ Log::info('Invalid media, skipping. '.$mime);
continue;
}
$count++;
- if($count === 1) {
+ if ($count === 1) {
$status->save();
}
$this->importMedia($url, $mime, $status);
}
- Log::info(count($attachments) . ' media found...');
+ Log::info(count($attachments).' media found...');
- if($count !== 0) {
+ if ($count !== 0) {
NewStatusPipeline::dispatch($status, $status->media->first());
}
}
public function importMedia($url, $mime, $status)
{
- $user = $this->profile;
- $monthHash = hash('sha1', date('Y') . date('m'));
- $userHash = hash('sha1', $user->id . (string) $user->created_at);
- $storagePath = "public/m/{$monthHash}/{$userHash}";
- try {
- $info = pathinfo($url);
- $img = file_get_contents($url);
- $file = '/tmp/' . str_random(12) . $info['basename'];
- file_put_contents($file, $img);
- $path = Storage::putFile($storagePath, new File($file), 'public');
-
- $media = new Media;
- $media->status_id = $status->id;
- $media->profile_id = $status->profile_id;
- $media->user_id = null;
- $media->media_path = $path;
- $media->size = 0;
- $media->mime = $mime;
- $media->save();
-
- ImageThumbnail::dispatch($media);
-
- return true;
- } catch (Exception $e) {
- return false;
- }
- }
+ $user = $this->profile;
+ $monthHash = hash('sha1', date('Y').date('m'));
+ $userHash = hash('sha1', $user->id.(string) $user->created_at);
+ $storagePath = "public/m/{$monthHash}/{$userHash}";
+ try {
+ $info = pathinfo($url);
+ $img = file_get_contents($url);
+ $file = '/tmp/'.str_random(12).$info['basename'];
+ file_put_contents($file, $img);
+ $path = Storage::putFile($storagePath, new File($file), 'public');
+
+ $media = new Media();
+ $media->status_id = $status->id;
+ $media->profile_id = $status->profile_id;
+ $media->user_id = null;
+ $media->media_path = $path;
+ $media->size = 0;
+ $media->mime = $mime;
+ $media->save();
+
+ ImageThumbnail::dispatch($media);
+
+ return true;
+ } catch (Exception $e) {
+ return false;
+ }
+ }
}
diff --git a/app/Jobs/RemoteFollowPipeline/RemoteFollowPipeline.php b/app/Jobs/RemoteFollowPipeline/RemoteFollowPipeline.php
index 5854e90fe..44626614d 100644
--- a/app/Jobs/RemoteFollowPipeline/RemoteFollowPipeline.php
+++ b/app/Jobs/RemoteFollowPipeline/RemoteFollowPipeline.php
@@ -2,18 +2,17 @@
namespace App\Jobs\RemoteFollowPipeline;
-use Zttp\Zttp;
+use App\Jobs\AvatarPipeline\CreateAvatar;
use App\{Profile};
use GuzzleHttp\Client;
use HttpSignatures\Context;
use HttpSignatures\GuzzleHttpSignatures;
-use App\Jobs\RemoteFollowPipeline\RemoteFollowImportRecent;
-use App\Jobs\AvatarPipeline\CreateAvatar;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Zttp\Zttp;
class RemoteFollowPipeline implements ShouldQueue
{
@@ -44,27 +43,28 @@ class RemoteFollowPipeline implements ShouldQueue
$follower = $this->follower;
$url = $this->url;
- if(Profile::whereRemoteUrl($url)->count() !== 0) {
+ if (Profile::whereRemoteUrl($url)->count() !== 0) {
return true;
}
$this->discover($url);
+
return true;
}
public function discover($url)
{
$context = new Context([
- 'keys' => ['examplekey' => 'secret-key-here'],
+ 'keys' => ['examplekey' => 'secret-key-here'],
'algorithm' => 'hmac-sha256',
- 'headers' => ['(request-target)', 'date'],
+ 'headers' => ['(request-target)', 'date'],
]);
$handlerStack = GuzzleHttpSignatures::defaultHandlerFromContext($context);
$client = new Client(['handler' => $handlerStack]);
$response = Zttp::withHeaders([
- 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
- 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org'
+ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
+ 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org',
])->get($url);
$this->response = $response->json();
@@ -78,7 +78,7 @@ class RemoteFollowPipeline implements ShouldQueue
$username = $res['preferredUsername'];
$remoteUsername = "@{$username}@{$domain}";
- $profile = new Profile;
+ $profile = new Profile();
$profile->user_id = null;
$profile->domain = $domain;
$profile->username = $remoteUsername;
@@ -98,8 +98,8 @@ class RemoteFollowPipeline implements ShouldQueue
$url = $res['inbox'];
$activity = Zttp::withHeaders(['Content-Type' => 'application/activity+json'])->post($url, [
- 'type' => 'Follow',
- 'object' => $this->follower->url()
+ 'type' => 'Follow',
+ 'object' => $this->follower->url(),
]);
}
}
diff --git a/app/Jobs/StatusPipeline/NewStatusPipeline.php b/app/Jobs/StatusPipeline/NewStatusPipeline.php
index 8939dd9ad..adca3a31d 100644
--- a/app/Jobs/StatusPipeline/NewStatusPipeline.php
+++ b/app/Jobs/StatusPipeline/NewStatusPipeline.php
@@ -2,14 +2,14 @@
namespace App\Jobs\StatusPipeline;
-use Cache, Redis;
-use App\{Media, Status};
-use App\Jobs\ImageOptimizePipeline\ImageOptimize;
+use App\Status;
+use Cache;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+use Redis;
class NewStatusPipeline implements ShouldQueue
{
@@ -39,9 +39,9 @@ class NewStatusPipeline implements ShouldQueue
StatusEntityLexer::dispatch($status);
//StatusActivityPubDeliver::dispatch($status);
- Cache::forever('post.' . $status->id, $status);
-
+ Cache::forever('post.'.$status->id, $status);
+
$redis = Redis::connection();
- $redis->lpush(config('cache.prefix').':user.' . $status->profile_id . '.posts', $status->id);
+ $redis->lpush(config('cache.prefix').':user.'.$status->profile_id.'.posts', $status->id);
}
}
diff --git a/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php b/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php
index acf660ca4..081a1410f 100644
--- a/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php
+++ b/app/Jobs/StatusPipeline/StatusActivityPubDeliver.php
@@ -2,18 +2,19 @@
namespace App\Jobs\StatusPipeline;
-use App\{Media, Status};
+use App\Status;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class StatusActivityPubDeliver implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $status;
+
/**
* Create a new job instance.
*
diff --git a/app/Jobs/StatusPipeline/StatusDelete.php b/app/Jobs/StatusPipeline/StatusDelete.php
index f48b200a3..c3e83d7f9 100644
--- a/app/Jobs/StatusPipeline/StatusDelete.php
+++ b/app/Jobs/StatusPipeline/StatusDelete.php
@@ -2,12 +2,14 @@
namespace App\Jobs\StatusPipeline;
-use App\{Media, Notification, StatusHashtag, Status};
+use App\Notification;
+use App\Status;
+use App\StatusHashtag;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class StatusDelete implements ShouldQueue
{
@@ -38,28 +40,27 @@ class StatusDelete implements ShouldQueue
public function unlinkRemoveMedia($status)
{
- if($status->media()->count() == 0) {
+ if ($status->media()->count() == 0) {
return;
}
- foreach($status->media as $media) {
+ foreach ($status->media as $media) {
$thumbnail = storage_path("app/{$media->thumbnail_path}");
$photo = storage_path("app/{$media->media_path}");
try {
- if(is_file($thumbnail)) {
+ if (is_file($thumbnail)) {
unlink($thumbnail);
}
- if(is_file($photo)) {
+ if (is_file($photo)) {
unlink($photo);
}
$media->delete();
} catch (Exception $e) {
-
}
}
$comments = Status::where('in_reply_to_id', $status->id)->get();
- foreach($comments as $comment) {
+ foreach ($comments as $comment) {
$comment->in_reply_to_id = null;
$comment->save();
Notification::whereItemType('App\Status')
diff --git a/app/Jobs/StatusPipeline/StatusEntityLexer.php b/app/Jobs/StatusPipeline/StatusEntityLexer.php
index 48b95d9a5..588adfb77 100644
--- a/app/Jobs/StatusPipeline/StatusEntityLexer.php
+++ b/app/Jobs/StatusPipeline/StatusEntityLexer.php
@@ -2,23 +2,20 @@
namespace App\Jobs\StatusPipeline;
-use DB, Cache;
-use App\{
- Hashtag,
- Media,
- Mention,
- Profile,
- Status,
- StatusHashtag
-};
-use App\Util\Lexer\Hashtag as HashtagLexer;
-use App\Util\Lexer\{Autolink, Extractor};
+use App\Hashtag;
+use App\Jobs\MentionPipeline\MentionPipeline;
+use App\Mention;
+use App\Profile;
+use App\Status;
+use App\StatusHashtag;
+use App\Util\Lexer\Autolink;
+use App\Util\Lexer\Extractor;
+use DB;
use Illuminate\Bus\Queueable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
-use App\Jobs\MentionPipeline\MentionPipeline;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
class StatusEntityLexer implements ShouldQueue
{
@@ -57,7 +54,7 @@ class StatusEntityLexer implements ShouldQueue
public function extractEntities()
{
$this->entities = Extractor::create()->extract($this->status->caption);
- $this->autolinkStatus();
+ $this->autolinkStatus();
}
public function autolinkStatus()
@@ -83,7 +80,7 @@ class StatusEntityLexer implements ShouldQueue
$tags = array_unique($this->entities['hashtags']);
$status = $this->status;
- foreach($tags as $tag) {
+ foreach ($tags as $tag) {
DB::transaction(function () use ($status, $tag) {
$slug = str_slug($tag);
$hashtag = Hashtag::firstOrCreate(
@@ -101,22 +98,21 @@ class StatusEntityLexer implements ShouldQueue
$mentions = array_unique($this->entities['mentions']);
$status = $this->status;
- foreach($mentions as $mention) {
+ foreach ($mentions as $mention) {
$mentioned = Profile::whereUsername($mention)->firstOrFail();
-
- if(empty($mentioned) || !isset($mentioned->id)) {
+
+ if (empty($mentioned) || !isset($mentioned->id)) {
continue;
}
DB::transaction(function () use ($status, $mentioned) {
- $m = new Mention;
+ $m = new Mention();
$m->status_id = $status->id;
$m->profile_id = $mentioned->id;
$m->save();
-
+
MentionPipeline::dispatch($status, $m);
});
}
}
-
}
diff --git a/app/Like.php b/app/Like.php
index c70b647bc..e85d248c0 100644
--- a/app/Like.php
+++ b/app/Like.php
@@ -18,25 +18,27 @@ class Like extends Model
public function actor()
{
- return $this->belongsTo(Profile::class, 'profile_id', 'id');
+ return $this->belongsTo(Profile::class, 'profile_id', 'id');
}
public function status()
{
- return $this->belongsTo(Status::class);
+ return $this->belongsTo(Status::class);
}
public function toText()
{
- $actorName = $this->actor->username;
- return "{$actorName} " . __('notification.likedPhoto');
+ $actorName = $this->actor->username;
+
+ return "{$actorName} ".__('notification.likedPhoto');
}
public function toHtml()
{
- $actorName = $this->actor->username;
- $actorUrl = $this->actor->url();
- return "{$actorName} " .
+ $actorName = $this->actor->username;
+ $actorUrl = $this->actor->url();
+
+ return "{$actorName} ".
__('notification.likedPhoto');
}
}
diff --git a/app/Mail/ConfirmEmail.php b/app/Mail/ConfirmEmail.php
index 83191f5fe..874f249eb 100644
--- a/app/Mail/ConfirmEmail.php
+++ b/app/Mail/ConfirmEmail.php
@@ -6,7 +6,6 @@ use App\EmailVerification;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
-use Illuminate\Contracts\Queue\ShouldQueue;
class ConfirmEmail extends Mailable
{
diff --git a/app/Media.php b/app/Media.php
index 7ac547f32..c1d36e558 100644
--- a/app/Media.php
+++ b/app/Media.php
@@ -2,9 +2,9 @@
namespace App;
-use Storage;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Storage;
class Media extends Model
{
@@ -16,18 +16,20 @@ class Media extends Model
* @var array
*/
protected $dates = ['deleted_at'];
-
+
public function url()
{
- $path = $this->media_path;
- $url = Storage::url($path);
- return url($url);
+ $path = $this->media_path;
+ $url = Storage::url($path);
+
+ return url($url);
}
public function thumbnailUrl()
{
- $path = $this->thumbnail_path;
- $url = Storage::url($path);
- return url($url);
+ $path = $this->thumbnail_path;
+ $url = Storage::url($path);
+
+ return url($url);
}
}
diff --git a/app/Mention.php b/app/Mention.php
index bc76bdc97..25c91ff11 100644
--- a/app/Mention.php
+++ b/app/Mention.php
@@ -18,25 +18,27 @@ class Mention extends Model
public function profile()
{
- return $this->belongsTo(Profile::class, 'profile_id', 'id');
+ return $this->belongsTo(Profile::class, 'profile_id', 'id');
}
public function status()
{
- return $this->belongsTo(Status::class, 'status_id', 'id');
+ return $this->belongsTo(Status::class, 'status_id', 'id');
}
public function toText()
{
- $actorName = $this->status->profile->username;
- return "{$actorName} " . __('notification.mentionedYou');
+ $actorName = $this->status->profile->username;
+
+ return "{$actorName} ".__('notification.mentionedYou');
}
public function toHtml()
{
- $actorName = $this->status->profile->username;
- $actorUrl = $this->status->profile->url();
- return "{$actorName} " .
+ $actorName = $this->status->profile->username;
+ $actorUrl = $this->status->profile->url();
+
+ return "{$actorName} ".
__('notification.mentionedYou');
}
}
diff --git a/app/Notification.php b/app/Notification.php
index 9aef5b197..cd4212b15 100644
--- a/app/Notification.php
+++ b/app/Notification.php
@@ -15,25 +15,24 @@ class Notification extends Model
* @var array
*/
protected $dates = ['deleted_at'];
-
+
public function actor()
{
- return $this->belongsTo(Profile::class, 'actor_id', 'id');
+ return $this->belongsTo(Profile::class, 'actor_id', 'id');
}
public function profile()
{
- return $this->belongsTo(Profile::class, 'profile_id', 'id');
+ return $this->belongsTo(Profile::class, 'profile_id', 'id');
}
public function item()
{
- return $this->morphTo();
+ return $this->morphTo();
}
public function status()
{
- return $this->belongsTo(Status::class, 'item_id', 'id');
+ return $this->belongsTo(Status::class, 'item_id', 'id');
}
-
}
diff --git a/app/Observer/UserObserver.php b/app/Observer/UserObserver.php
index 6f2a1dfca..78698cb25 100644
--- a/app/Observer/UserObserver.php
+++ b/app/Observer/UserObserver.php
@@ -2,28 +2,31 @@
namespace App\Observers;
-use App\{Profile, User, UserSetting};
use App\Jobs\AvatarPipeline\CreateAvatar;
+use App\Profile;
+use App\User;
+use App\UserSetting;
class UserObserver
{
/**
* Listen to the User created event.
*
- * @param \App\User $user
+ * @param \App\User $user
+ *
* @return void
*/
public function saved(User $user)
{
- if(empty($user->profile)) {
- $profile = new Profile;
+ if (empty($user->profile)) {
+ $profile = new Profile();
$profile->user_id = $user->id;
$profile->username = $user->username;
$profile->name = $user->name;
$pkiConfig = [
- "digest_alg" => "sha512",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_RSA,
+ 'digest_alg' => 'sha512',
+ 'private_key_bits' => 2048,
+ 'private_key_type' => OPENSSL_KEYTYPE_RSA,
];
$pki = openssl_pkey_new($pkiConfig);
openssl_pkey_export($pki, $pki_private);
@@ -37,11 +40,10 @@ class UserObserver
CreateAvatar::dispatch($profile);
}
- if(empty($user->settings)) {
- $settings = new UserSetting;
+ if (empty($user->settings)) {
+ $settings = new UserSetting();
$settings->user_id = $user->id;
$settings->save();
}
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Profile.php b/app/Profile.php
index 4487f81b6..5381f8a11 100644
--- a/app/Profile.php
+++ b/app/Profile.php
@@ -2,10 +2,12 @@
namespace App;
-use Auth, Cache, Storage;
use App\Util\Lexer\PrettyNumber;
+use Auth;
+use Cache;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Storage;
class Profile extends Model
{
@@ -30,27 +32,28 @@ class Profile extends Model
public function url($suffix = '')
{
- if($this->remote_url) {
+ if ($this->remote_url) {
return $this->remote_url;
} else {
- return url($this->username . $suffix);
+ return url($this->username.$suffix);
}
}
public function localUrl($suffix = '')
{
- return url($this->username . $suffix);
+ return url($this->username.$suffix);
}
public function permalink($suffix = '')
{
- return url('users/' . $this->username . $suffix);
+ return url('users/'.$this->username.$suffix);
}
public function emailUrl()
{
$domain = parse_url(config('app.url'), PHP_URL_HOST);
- return $this->username . '@' . $domain;
+
+ return $this->username.'@'.$domain;
}
public function statuses()
@@ -61,7 +64,7 @@ class Profile extends Model
public function followingCount($short = false)
{
$count = $this->following()->count();
- if($short) {
+ if ($short) {
return PrettyNumber::convert($count);
} else {
return $count;
@@ -71,7 +74,7 @@ class Profile extends Model
public function followerCount($short = false)
{
$count = $this->followers()->count();
- if($short) {
+ if ($short) {
return PrettyNumber::convert($count);
} else {
return $count;
@@ -81,7 +84,7 @@ class Profile extends Model
public function following()
{
return $this->belongsToMany(
- Profile::class,
+ self::class,
'followers',
'profile_id',
'following_id'
@@ -91,7 +94,7 @@ class Profile extends Model
public function followers()
{
return $this->belongsToMany(
- Profile::class,
+ self::class,
'followers',
'following_id',
'profile_id'
@@ -126,18 +129,20 @@ class Profile extends Model
public function avatar()
{
return $this->hasOne(Avatar::class)->withDefault([
- 'media_path' => 'public/avatars/default.png'
+ 'media_path' => 'public/avatars/default.png',
]);
}
public function avatarUrl()
{
- $url = Cache::remember("avatar:{$this->id}", 1440, function() {
+ $url = Cache::remember("avatar:{$this->id}", 1440, function () {
$path = optional($this->avatar)->media_path;
$version = hash('sha1', $this->avatar->created_at);
$path = "{$path}?v={$version}";
+
return url(Storage::url($path));
});
+
return $url;
}
@@ -167,8 +172,8 @@ class Profile extends Model
->limit(3)
->pluck('following_id');
$recommended = [];
- foreach($following as $follow) {
- $recommended[] = Profile::findOrFail($follow);
+ foreach ($following as $follow) {
+ $recommended[] = self::findOrFail($follow);
}
return $recommended;
@@ -176,9 +181,10 @@ class Profile extends Model
public function keyId()
{
- if($this->remote_url) {
+ if ($this->remote_url) {
return;
}
+
return $this->permalink('#main-key');
}
}
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 8a21a2a7d..dca968bb5 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -2,9 +2,10 @@
namespace App\Providers;
-use App\User;
-use Auth, Horizon;
use App\Observers\UserObserver;
+use App\User;
+use Auth;
+use Horizon;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
@@ -26,34 +27,39 @@ class AppServiceProvider extends ServiceProvider
return Auth::check() && $request->user()->is_admin;
});
- Blade::directive('prettyNumber', function($expression) {
+ Blade::directive('prettyNumber', function ($expression) {
$num = $expression;
- $abbrevs = array(12 => "T", 9 => "B", 6 => "M", 3 => "K", 0 => "");
- foreach($abbrevs as $exponent => $abbrev) {
- if($expression >= pow(10, $exponent)) {
- $display_num = $expression / pow(10, $exponent);
- $num = number_format($display_num,0) . $abbrev;
- return "";
+ $abbrevs = [12 => 'T', 9 => 'B', 6 => 'M', 3 => 'K', 0 => ''];
+ foreach ($abbrevs as $exponent => $abbrev) {
+ if ($expression >= pow(10, $exponent)) {
+ $display_num = $expression / pow(10, $exponent);
+ $num = number_format($display_num, 0).$abbrev;
+
+ return "";
}
}
+
return "";
});
- Blade::directive('prettySize', function($expression) {
+ Blade::directive('prettySize', function ($expression) {
$size = intval($expression);
$precision = 0;
$short = true;
$units = $short ?
- ['B','k','M','G','T','P','E','Z','Y'] :
- ['B','kB','MB','GB','TB','PB','EB','ZB','YB'];
- for($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {}
+ ['B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] :
+ ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+ for ($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {
+ }
$res = round($size, $precision).$units[$i];
+
return "";
});
- Blade::directive('maxFileSize', function() {
- $value = config('pixelfed.max_photo_size');
- return \App\Util\Lexer\PrettyNumber::size($value, true);
+ Blade::directive('maxFileSize', function () {
+ $value = config('pixelfed.max_photo_size');
+
+ return \App\Util\Lexer\PrettyNumber::size($value, true);
});
}
diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php
index 9784b1a30..9e68caa6f 100644
--- a/app/Providers/AuthServiceProvider.php
+++ b/app/Providers/AuthServiceProvider.php
@@ -2,7 +2,6 @@
namespace App\Providers;
-use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php
index 352cce44a..395c518bc 100644
--- a/app/Providers/BroadcastServiceProvider.php
+++ b/app/Providers/BroadcastServiceProvider.php
@@ -2,8 +2,8 @@
namespace App\Providers;
-use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
+use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index d05aed739..4ebcb57a2 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -2,8 +2,8 @@
namespace App\Providers;
-use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
+use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 5ea48d39d..548e4be7b 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -2,8 +2,8 @@
namespace App\Providers;
-use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
+use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
diff --git a/app/Report.php b/app/Report.php
index 495f400ed..ef202266a 100644
--- a/app/Report.php
+++ b/app/Report.php
@@ -7,34 +7,35 @@ use Illuminate\Database\Eloquent\Model;
class Report extends Model
{
protected $dates = ['admin_seen'];
-
+
public function url()
{
- return url('/i/admin/reports/show/' . $this->id);
+ return url('/i/admin/reports/show/'.$this->id);
}
public function reporter()
{
- return $this->belongsTo(Profile::class, 'profile_id');
+ return $this->belongsTo(Profile::class, 'profile_id');
}
public function reported()
{
- $class = $this->object_type;
- switch ($class) {
+ $class = $this->object_type;
+ switch ($class) {
case 'App\Status':
$column = 'id';
break;
-
+
default:
$column = 'id';
break;
}
- return (new $class())->where($column, $this->object_id)->firstOrFail();
+
+ return (new $class())->where($column, $this->object_id)->firstOrFail();
}
public function reportedUser()
{
- return $this->belongsTo(Profile::class, 'reported_profile_id', 'id');
+ return $this->belongsTo(Profile::class, 'reported_profile_id', 'id');
}
}
diff --git a/app/Status.php b/app/Status.php
index d0f734cad..bfbdeb4e6 100644
--- a/app/Status.php
+++ b/app/Status.php
@@ -2,9 +2,10 @@
namespace App;
-use Auth, Storage;
+use Auth;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Storage;
class Status extends Model
{
@@ -16,125 +17,133 @@ class Status extends Model
* @var array
*/
protected $dates = ['deleted_at'];
-
+
public function profile()
{
- return $this->belongsTo(Profile::class);
+ return $this->belongsTo(Profile::class);
}
public function media()
{
- return $this->hasMany(Media::class);
+ return $this->hasMany(Media::class);
}
public function firstMedia()
{
- return $this->hasMany(Media::class)->orderBy('order', 'asc')->first();
+ return $this->hasMany(Media::class)->orderBy('order', 'asc')->first();
}
public function viewType()
{
- $media = $this->firstMedia();
- $type = explode('/', $media->mime);
- return $type[0];
+ $media = $this->firstMedia();
+ $type = explode('/', $media->mime);
+
+ return $type[0];
}
-
+
public function thumb($showNsfw = false)
{
- $type = $this->viewType();
- $is_nsfw = !$showNsfw ? $this->is_nsfw : false;
- if($this->media->count() == 0 || $is_nsfw || $type != 'image') {
- return "data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
- }
- return url(Storage::url($this->firstMedia()->thumbnail_path));
+ $type = $this->viewType();
+ $is_nsfw = !$showNsfw ? $this->is_nsfw : false;
+ if ($this->media->count() == 0 || $is_nsfw || $type != 'image') {
+ return 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
+ }
+
+ return url(Storage::url($this->firstMedia()->thumbnail_path));
}
public function url()
{
- $id = $this->id;
- $username = $this->profile->username;
- $path = config('app.url') . "/p/{$username}/{$id}";
- if(!is_null($this->in_reply_to_id)) {
- $pid = $this->in_reply_to_id;
- $path = config('app.url') . "/p/{$username}/{$pid}/c/{$id}";
- }
- return url($path);
+ $id = $this->id;
+ $username = $this->profile->username;
+ $path = config('app.url')."/p/{$username}/{$id}";
+ if (!is_null($this->in_reply_to_id)) {
+ $pid = $this->in_reply_to_id;
+ $path = config('app.url')."/p/{$username}/{$pid}/c/{$id}";
+ }
+
+ return url($path);
}
public function permalink($suffix = '/activity')
{
- $id = $this->id;
- $username = $this->profile->username;
- $path = config('app.url') . "/p/{$username}/{$id}{$suffix}";
- return url($path);
+ $id = $this->id;
+ $username = $this->profile->username;
+ $path = config('app.url')."/p/{$username}/{$id}{$suffix}";
+
+ return url($path);
}
public function editUrl()
{
- return $this->url() . '/edit';
+ return $this->url().'/edit';
}
public function mediaUrl()
{
- $media = $this->firstMedia();
- $path = $media->media_path;
- $hash = is_null($media->processed_at) ? md5('unprocessed') : md5($media->created_at);
- $url = Storage::url($path) . "?v={$hash}";
- return url($url);
+ $media = $this->firstMedia();
+ $path = $media->media_path;
+ $hash = is_null($media->processed_at) ? md5('unprocessed') : md5($media->created_at);
+ $url = Storage::url($path)."?v={$hash}";
+
+ return url($url);
}
public function likes()
{
- return $this->hasMany(Like::class);
+ return $this->hasMany(Like::class);
}
public function liked() : bool
{
- $profile = Auth::user()->profile;
- return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
+ $profile = Auth::user()->profile;
+
+ return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
}
public function comments()
{
- return $this->hasMany(Status::class, 'in_reply_to_id');
+ return $this->hasMany(self::class, 'in_reply_to_id');
}
public function bookmarked()
{
- if(!Auth::check()) {
- return 0;
- }
- $profile = Auth::user()->profile;
- return Bookmark::whereProfileId($profile->id)->whereStatusId($this->id)->count();
+ if (!Auth::check()) {
+ return 0;
+ }
+ $profile = Auth::user()->profile;
+
+ return Bookmark::whereProfileId($profile->id)->whereStatusId($this->id)->count();
}
public function shares()
{
- return $this->hasMany(Status::class, 'reblog_of_id');
+ return $this->hasMany(self::class, 'reblog_of_id');
}
public function shared() : bool
{
- $profile = Auth::user()->profile;
- return Status::whereProfileId($profile->id)->whereReblogOfId($this->id)->count();
+ $profile = Auth::user()->profile;
+
+ return self::whereProfileId($profile->id)->whereReblogOfId($this->id)->count();
}
public function parent()
{
- $parent = $this->in_reply_to_id ?? $this->reblog_of_id;
- if(!empty($parent)) {
- return Status::findOrFail($parent);
- }
+ $parent = $this->in_reply_to_id ?? $this->reblog_of_id;
+ if (!empty($parent)) {
+ return self::findOrFail($parent);
+ }
}
public function conversation()
{
- return $this->hasOne(Conversation::class);
+ return $this->hasOne(Conversation::class);
}
public function hashtags()
{
- return $this->hasManyThrough(
+ return $this->hasManyThrough(
Hashtag::class,
StatusHashtag::class,
'status_id',
@@ -146,7 +155,7 @@ class Status extends Model
public function mentions()
{
- return $this->hasManyThrough(
+ return $this->hasManyThrough(
Profile::class,
Mention::class,
'status_id',
@@ -158,45 +167,48 @@ class Status extends Model
public function reportUrl()
{
- return route('report.form') . "?type=post&id={$this->id}";
+ return route('report.form')."?type=post&id={$this->id}";
}
public function toActivityStream()
{
- $media = $this->media;
- $mediaCollection = [];
- foreach($media as $image) {
- $mediaCollection[] = [
- "type" => "Link",
- "href" => $image->url(),
- "mediaType" => $image->mime
+ $media = $this->media;
+ $mediaCollection = [];
+ foreach ($media as $image) {
+ $mediaCollection[] = [
+ 'type' => 'Link',
+ 'href' => $image->url(),
+ 'mediaType' => $image->mime,
];
- }
- $obj = [
- "@context" => "https://www.w3.org/ns/activitystreams",
- "type" => "Image",
- "name" => null,
- "url" => $mediaCollection
+ }
+ $obj = [
+ '@context' => 'https://www.w3.org/ns/activitystreams',
+ 'type' => 'Image',
+ 'name' => null,
+ 'url' => $mediaCollection,
];
- return $obj;
+
+ return $obj;
}
public function replyToText()
{
- $actorName = $this->profile->username;
- return "{$actorName} " . __('notification.commented');
+ $actorName = $this->profile->username;
+
+ return "{$actorName} ".__('notification.commented');
}
public function replyToHtml()
{
- $actorName = $this->profile->username;
- $actorUrl = $this->profile->url();
- return "{$actorName} " .
+ $actorName = $this->profile->username;
+ $actorUrl = $this->profile->url();
+
+ return "{$actorName} ".
__('notification.commented');
}
public function recentComments()
{
- return $this->comments()->orderBy('created_at','desc')->take(3);
+ return $this->comments()->orderBy('created_at', 'desc')->take(3);
}
}
diff --git a/app/Transformer/ActivityPub/ProfileOutbox.php b/app/Transformer/ActivityPub/ProfileOutbox.php
index 02dcb4b65..00e69de95 100644
--- a/app/Transformer/ActivityPub/ProfileOutbox.php
+++ b/app/Transformer/ActivityPub/ProfileOutbox.php
@@ -7,19 +7,18 @@ use League\Fractal;
class ProfileOutbox extends Fractal\TransformerAbstract
{
-
- public function transform(Profile $profile)
- {
- $count = $profile->statuses()->count();
- $statuses = $profile->statuses()->has('media')->orderBy('id','desc')->take(20)->get()->map(function($i, $k) {
- $item = [
+ public function transform(Profile $profile)
+ {
+ $count = $profile->statuses()->count();
+ $statuses = $profile->statuses()->has('media')->orderBy('id', 'desc')->take(20)->get()->map(function ($i, $k) {
+ $item = [
'id' => $i->permalink(),
// TODO: handle other types
- 'type' => 'Create',
- 'actor' => $i->profile->url(),
+ 'type' => 'Create',
+ 'actor' => $i->profile->url(),
'published' => $i->created_at->toISO8601String(),
- 'to' => [
- 'https://www.w3.org/ns/activitystreams#Public'
+ 'to' => [
+ 'https://www.w3.org/ns/activitystreams#Public',
],
'cc' => [
$i->profile->permalink('/followers'),
@@ -31,48 +30,48 @@ class ProfileOutbox extends Fractal\TransformerAbstract
'type' => 'Note',
// XXX: CW Title
- 'summary' => null,
- 'content' => $i->rendered ?? $i->caption,
+ 'summary' => null,
+ 'content' => $i->rendered ?? $i->caption,
'inReplyTo' => null,
// TODO: fix date format
- 'published' => $i->created_at->toAtomString(),
- 'url' => $i->url(),
+ 'published' => $i->created_at->toAtomString(),
+ 'url' => $i->url(),
'attributedTo' => $i->profile->permalink(),
- 'to' => [
+ 'to' => [
// TODO: handle proper scope
- 'https://www.w3.org/ns/activitystreams#Public'
+ 'https://www.w3.org/ns/activitystreams#Public',
],
'cc' => [
// TODO: add cc's
//"{$notice->getProfile()->getUrl()}/subscribers",
],
- 'sensitive' => (bool) $i->is_nsfw,
- 'atomUri' => $i->url(),
+ 'sensitive' => (bool) $i->is_nsfw,
+ 'atomUri' => $i->url(),
'inReplyToAtomUri' => null,
- 'attachment' => [
+ 'attachment' => [
// TODO: support more than 1 attachment
[
- 'type' => 'Document',
+ 'type' => 'Document',
'mediaType' => $i->firstMedia()->mime,
- 'url' => $i->firstMedia()->url(),
- 'name' => null
- ]
+ 'url' => $i->firstMedia()->url(),
+ 'name' => null,
+ ],
],
- 'tag' => []
- ]
+ 'tag' => [],
+ ],
];
- return $item;
- });
- return [
- '@context' => 'https://www.w3.org/ns/activitystreams',
- 'id' => $profile->permalink('/outbox'),
- 'type' => 'OrderedCollection',
- 'totalItems' => $count,
- 'orderedItems' => $statuses
+ return $item;
+ });
+
+ return [
+ '@context' => 'https://www.w3.org/ns/activitystreams',
+ 'id' => $profile->permalink('/outbox'),
+ 'type' => 'OrderedCollection',
+ 'totalItems' => $count,
+ 'orderedItems' => $statuses,
];
- }
-
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Transformer/ActivityPub/ProfileTransformer.php b/app/Transformer/ActivityPub/ProfileTransformer.php
index a41313e42..c576b38b3 100644
--- a/app/Transformer/ActivityPub/ProfileTransformer.php
+++ b/app/Transformer/ActivityPub/ProfileTransformer.php
@@ -7,48 +7,46 @@ use League\Fractal;
class ProfileTransformer extends Fractal\TransformerAbstract
{
-
- public function transform(Profile $profile)
- {
- return [
+ public function transform(Profile $profile)
+ {
+ return [
'@context' => [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
[
- "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
- "featured" => [
- "https://pixelfed.org/ns#featured" => ["@type" => "@id"],
- ]
- ]
+ 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
+ 'featured' => [
+ 'https://pixelfed.org/ns#featured' => ['@type' => '@id'],
+ ],
+ ],
],
- 'id' => $profile->permalink(),
- 'type' => 'Person',
- 'following' => $profile->permalink('/following'),
- 'followers' => $profile->permalink('/followers'),
- 'inbox' => $profile->permalink('/inbox'),
- 'outbox' => $profile->permalink('/outbox'),
- 'featured' => $profile->permalink('/collections/featured'),
- 'preferredUsername' => $profile->username,
- 'name' => $profile->name,
- 'summary' => $profile->bio,
- 'url' => $profile->url(),
+ 'id' => $profile->permalink(),
+ 'type' => 'Person',
+ 'following' => $profile->permalink('/following'),
+ 'followers' => $profile->permalink('/followers'),
+ 'inbox' => $profile->permalink('/inbox'),
+ 'outbox' => $profile->permalink('/outbox'),
+ 'featured' => $profile->permalink('/collections/featured'),
+ 'preferredUsername' => $profile->username,
+ 'name' => $profile->name,
+ 'summary' => $profile->bio,
+ 'url' => $profile->url(),
'manuallyApprovesFollowers' => (bool) $profile->is_private,
// 'follower_count' => $profile->followers()->count(),
// 'following_count' => $profile->following()->count(),
'publicKey' => [
- 'id' => $profile->permalink() . '#main-key',
- 'owner' => $profile->permalink(),
- 'publicKeyPem' => $profile->public_key
+ 'id' => $profile->permalink().'#main-key',
+ 'owner' => $profile->permalink(),
+ 'publicKeyPem' => $profile->public_key,
],
'endpoints' => [
- 'sharedInbox' => config('routes.api.sharedInbox')
+ 'sharedInbox' => config('routes.api.sharedInbox'),
],
'icon' => [
- 'type' => 'Image',
+ 'type' => 'Image',
'mediaType' => 'image/jpeg',
- 'url' => $profile->avatarUrl()
- ]
+ 'url' => $profile->avatarUrl(),
+ ],
];
- }
-
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Transformer/ActivityPub/StatusTransformer.php b/app/Transformer/ActivityPub/StatusTransformer.php
index fb90cbd5a..8cbf1d306 100644
--- a/app/Transformer/ActivityPub/StatusTransformer.php
+++ b/app/Transformer/ActivityPub/StatusTransformer.php
@@ -2,24 +2,23 @@
namespace App\Transformer\ActivityPub;
-use App\{Profile, Status};
+use App\Status;
use League\Fractal;
class StatusTransformer extends Fractal\TransformerAbstract
{
-
- public function transform(Status $status)
- {
- return [
+ public function transform(Status $status)
+ {
+ return [
'@context' => [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
[
- "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
- "featured" => [
- "https://pixelfed.org/ns#featured" => ["@type" => "@id"],
- ]
- ]
+ 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
+ 'featured' => [
+ 'https://pixelfed.org/ns#featured' => ['@type' => '@id'],
+ ],
+ ],
],
'id' => $status->url(),
@@ -27,35 +26,34 @@ class StatusTransformer extends Fractal\TransformerAbstract
'type' => 'Note',
// XXX: CW Title
- 'summary' => null,
- 'content' => $status->rendered ?? $status->caption,
+ 'summary' => null,
+ 'content' => $status->rendered ?? $status->caption,
'inReplyTo' => null,
// TODO: fix date format
- 'published' => $status->created_at->toAtomString(),
- 'url' => $status->url(),
+ 'published' => $status->created_at->toAtomString(),
+ 'url' => $status->url(),
'attributedTo' => $status->profile->permalink(),
- 'to' => [
+ 'to' => [
// TODO: handle proper scope
- 'https://www.w3.org/ns/activitystreams#Public'
+ 'https://www.w3.org/ns/activitystreams#Public',
],
'cc' => [
// TODO: add cc's
$status->profile->permalink('/followers'),
],
- 'sensitive' => (bool) $status->is_nsfw,
- 'atomUri' => $status->url(),
+ 'sensitive' => (bool) $status->is_nsfw,
+ 'atomUri' => $status->url(),
'inReplyToAtomUri' => null,
- 'attachment' => $status->media->map(function($media) {
- return [
- 'type' => 'Document',
+ 'attachment' => $status->media->map(function ($media) {
+ return [
+ 'type' => 'Document',
'mediaType' => $media->mime,
- 'url' => $media->url(),
- 'name' => null
+ 'url' => $media->url(),
+ 'name' => null,
];
}),
- 'tag' => []
+ 'tag' => [],
];
- }
-
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Transformer/Api/AccountTransformer.php b/app/Transformer/Api/AccountTransformer.php
index 1f95c8136..5af4dfd62 100644
--- a/app/Transformer/Api/AccountTransformer.php
+++ b/app/Transformer/Api/AccountTransformer.php
@@ -7,27 +7,27 @@ use League\Fractal;
class AccountTransformer extends Fractal\TransformerAbstract
{
- public function transform(Profile $profile)
- {
- return [
- 'id' => $profile->id,
- 'username' => $profile->username,
- 'acct' => $profile->username,
- 'display_name' => $profile->name,
- 'locked' => (bool) $profile->is_private,
- 'created_at' => $profile->created_at->format('c'),
+ public function transform(Profile $profile)
+ {
+ return [
+ 'id' => $profile->id,
+ 'username' => $profile->username,
+ 'acct' => $profile->username,
+ 'display_name' => $profile->name,
+ 'locked' => (bool) $profile->is_private,
+ 'created_at' => $profile->created_at->format('c'),
'followers_count' => $profile->followerCount(),
'following_count' => $profile->followingCount(),
- 'statuses_count' => $profile->statusCount(),
- 'note' => $profile->bio,
- 'url' => $profile->url(),
- 'avatar' => $profile->avatarUrl(),
- 'avatar_static' => $profile->avatarUrl(),
- 'header' => '',
- 'header_static' => '',
- 'moved' => null,
- 'fields' => null,
- 'bot' => null
+ 'statuses_count' => $profile->statusCount(),
+ 'note' => $profile->bio,
+ 'url' => $profile->url(),
+ 'avatar' => $profile->avatarUrl(),
+ 'avatar_static' => $profile->avatarUrl(),
+ 'header' => '',
+ 'header_static' => '',
+ 'moved' => null,
+ 'fields' => null,
+ 'bot' => null,
];
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Transformer/Api/ApplicationTransformer.php b/app/Transformer/Api/ApplicationTransformer.php
index a0fefcaa5..23e29afd5 100644
--- a/app/Transformer/Api/ApplicationTransformer.php
+++ b/app/Transformer/Api/ApplicationTransformer.php
@@ -6,11 +6,11 @@ use League\Fractal;
class ApplicationTransformer extends Fractal\TransformerAbstract
{
- public function transform()
- {
- return [
- 'name' => '',
- 'website' => null
+ public function transform()
+ {
+ return [
+ 'name' => '',
+ 'website' => null,
];
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Transformer/Api/HashtagTransformer.php b/app/Transformer/Api/HashtagTransformer.php
index 417cc9850..153c311cc 100644
--- a/app/Transformer/Api/HashtagTransformer.php
+++ b/app/Transformer/Api/HashtagTransformer.php
@@ -4,7 +4,6 @@ namespace App\Transformer\Api;
use App\Hashtag;
use League\Fractal;
-use League\Fractal\Serializer\ArraySerializer;
class HashtagTransformer extends Fractal\TransformerAbstract
{
@@ -12,7 +11,7 @@ class HashtagTransformer extends Fractal\TransformerAbstract
{
return [
'name' => $hashtag->name,
- 'url' => $hashtag->url(),
+ 'url' => $hashtag->url(),
];
}
-}
\ No newline at end of file
+}
diff --git a/app/Transformer/Api/MediaTransformer.php b/app/Transformer/Api/MediaTransformer.php
index 959bae65b..81f49d6af 100644
--- a/app/Transformer/Api/MediaTransformer.php
+++ b/app/Transformer/Api/MediaTransformer.php
@@ -4,21 +4,20 @@ namespace App\Transformer\Api;
use App\Media;
use League\Fractal;
-use League\Fractal\Serializer\ArraySerializer;
class MediaTransformer extends Fractal\TransformerAbstract
{
public function transform(Media $media)
{
return [
- 'id' => $media->id,
- 'type' => 'image',
- 'url' => $media->url(),
- 'remote_url' => null,
+ 'id' => $media->id,
+ 'type' => 'image',
+ 'url' => $media->url(),
+ 'remote_url' => null,
'preview_url' => $media->thumbnailUrl(),
- 'text_url' => null,
- 'meta' => null,
- 'description' => null
+ 'text_url' => null,
+ 'meta' => null,
+ 'description' => null,
];
}
-}
\ No newline at end of file
+}
diff --git a/app/Transformer/Api/MentionTransformer.php b/app/Transformer/Api/MentionTransformer.php
index 1d0580afe..ae202b6e8 100644
--- a/app/Transformer/Api/MentionTransformer.php
+++ b/app/Transformer/Api/MentionTransformer.php
@@ -10,10 +10,10 @@ class MentionTransformer extends Fractal\TransformerAbstract
public function transform(Profile $profile)
{
return [
- 'id' => $profile->id,
- 'url' => $profile->url(),
+ 'id' => $profile->id,
+ 'url' => $profile->url(),
'username' => $profile->username,
- 'acct' => $profile->username,
+ 'acct' => $profile->username,
];
}
-}
\ No newline at end of file
+}
diff --git a/app/Transformer/Api/StatusTransformer.php b/app/Transformer/Api/StatusTransformer.php
index ad5129a91..6513abc55 100644
--- a/app/Transformer/Api/StatusTransformer.php
+++ b/app/Transformer/Api/StatusTransformer.php
@@ -11,59 +11,63 @@ class StatusTransformer extends Fractal\TransformerAbstract
'account',
'mentions',
'media_attachments',
- 'tags'
+ 'tags',
];
public function transform(Status $status)
{
return [
- 'id' => $status->id,
- 'uri' => $status->url(),
- 'url' => $status->url(),
- 'in_reply_to_id' => $status->in_reply_to_id,
+ 'id' => $status->id,
+ 'uri' => $status->url(),
+ 'url' => $status->url(),
+ 'in_reply_to_id' => $status->in_reply_to_id,
'in_reply_to_account_id' => $status->in_reply_to_profile_id,
-
+
// TODO: fixme
'reblog' => null,
- 'content' => "
$status->rendered
",
- 'created_at' => $status->created_at->format('c'),
- 'emojis' => [],
- 'reblogs_count' => $status->shares()->count(),
+ 'content' => "$status->rendered
",
+ 'created_at' => $status->created_at->format('c'),
+ 'emojis' => [],
+ 'reblogs_count' => $status->shares()->count(),
'favourites_count' => $status->likes()->count(),
- 'reblogged' => $status->shared(),
- 'favourited' => $status->liked(),
- 'muted' => null,
- 'sensitive' => (bool) $status->is_nsfw,
- 'spoiler_text' => '',
- 'visibility' => $status->visibility,
- 'application' => null,
- 'language' => null,
- 'pinned' => null
+ 'reblogged' => $status->shared(),
+ 'favourited' => $status->liked(),
+ 'muted' => null,
+ 'sensitive' => (bool) $status->is_nsfw,
+ 'spoiler_text' => '',
+ 'visibility' => $status->visibility,
+ 'application' => null,
+ 'language' => null,
+ 'pinned' => null,
];
}
public function includeAccount(Status $status)
{
$account = $status->profile;
- return $this->item($account, new AccountTransformer);
+
+ return $this->item($account, new AccountTransformer());
}
public function includeMentions(Status $status)
{
$mentions = $status->mentions;
- return $this->collection($mentions, new MentionTransformer);
+
+ return $this->collection($mentions, new MentionTransformer());
}
public function includeMediaAttachments(Status $status)
{
$media = $status->media;
- return $this->collection($media, new MediaTransformer);
+
+ return $this->collection($media, new MediaTransformer());
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
- return $this->collection($tags, new HashtagTransformer);
+
+ return $this->collection($tags, new HashtagTransformer());
}
-}
\ No newline at end of file
+}
diff --git a/app/User.php b/app/User.php
index a3fb76fb7..68af7ea38 100644
--- a/app/User.php
+++ b/app/User.php
@@ -2,9 +2,9 @@
namespace App;
-use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
+use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
@@ -42,7 +42,7 @@ class User extends Authenticatable
public function url()
{
- return url(config('app.url') . '/' . $this->username);
+ return url(config('app.url').'/'.$this->username);
}
public function settings()
diff --git a/app/UserFilter.php b/app/UserFilter.php
index 41edd5398..ab5fe321a 100644
--- a/app/UserFilter.php
+++ b/app/UserFilter.php
@@ -7,9 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class UserFilter extends Model
{
protected $fillable = [
- 'user_id',
- 'filterable_id',
- 'filterable_type',
- 'filter_type'
+ 'user_id',
+ 'filterable_id',
+ 'filterable_type',
+ 'filter_type',
];
}
diff --git a/app/Util/ActivityPub/Concern/HTTPSignature.php b/app/Util/ActivityPub/Concern/HTTPSignature.php
index aa4f1fe9a..9e041aa3c 100644
--- a/app/Util/ActivityPub/Concern/HTTPSignature.php
+++ b/app/Util/ActivityPub/Concern/HTTPSignature.php
@@ -4,10 +4,10 @@ namespace App\Util\ActivityPub\Concern;
use Zttp\Zttp;
-class HTTPSignature {
-
+class HTTPSignature
+{
protected $localhosts = [
- '127.0.0.1', 'localhost', '::1'
+ '127.0.0.1', 'localhost', '::1',
];
public $profile;
public $is_url;
@@ -15,20 +15,22 @@ class HTTPSignature {
public function validateUrl()
{
// If the profile exists, assume its valid
- if($this->is_url === false) {
- return true;
+ if ($this->is_url === false) {
+ return true;
}
$url = $this->profile;
+
try {
- $url = filter_var($url, FILTER_VALIDATE_URL);
- $parsed = parse_url($url, PHP_URL_HOST);
- if(!$parsed || in_array($parsed, $this->localhosts)) {
- return false;
- }
+ $url = filter_var($url, FILTER_VALIDATE_URL);
+ $parsed = parse_url($url, PHP_URL_HOST);
+ if (!$parsed || in_array($parsed, $this->localhosts)) {
+ return false;
+ }
} catch (Exception $e) {
- return false;
+ return false;
}
+
return true;
}
@@ -37,22 +39,22 @@ class HTTPSignature {
$this->profile = $profile;
$this->is_url = $is_url;
$valid = $this->validateUrl();
- if(!$valid) {
- throw new \Exception('Invalid URL provided');
+ if (!$valid) {
+ throw new \Exception('Invalid URL provided');
}
- if($is_url && isset($profile->public_key) && $profile->public_key) {
- return $profile->public_key;
+ if ($is_url && isset($profile->public_key) && $profile->public_key) {
+ return $profile->public_key;
}
try {
- $url = $this->profile;
- $res = Zttp::timeout(30)->withHeaders([
- 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
- 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org'
+ $url = $this->profile;
+ $res = Zttp::timeout(30)->withHeaders([
+ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
+ 'User-Agent' => 'PixelFedBot v0.1 - https://pixelfed.org',
])->get($url);
- $actor = json_decode($res->getBody(), true);
+ $actor = json_decode($res->getBody(), true);
} catch (Exception $e) {
- throw new Exception('Unable to fetch public key');
+ throw new Exception('Unable to fetch public key');
}
return $actor['publicKey']['publicKeyPem'];
@@ -62,33 +64,31 @@ class HTTPSignature {
{
$profile = $senderProfile;
$context = new Context([
- 'keys' => [$profile->keyId() => $profile->private_key],
+ 'keys' => [$profile->keyId() => $profile->private_key],
'algorithm' => 'rsa-sha256',
- 'headers' => ['(request-target)', 'Date'],
+ 'headers' => ['(request-target)', 'Date'],
]);
$handlerStack = GuzzleHttpSignatures::defaultHandlerFromContext($context);
$client = new Client(['handler' => $handlerStack]);
$headers = [
- 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
- 'Date' => date('D, d M Y h:i:s') . ' GMT',
+ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
+ 'Date' => date('D, d M Y h:i:s').' GMT',
'Content-Type' => 'application/activity+json',
- 'User-Agent' => 'PixelFedBot - https://pixelfed.org'
+ 'User-Agent' => 'PixelFedBot - https://pixelfed.org',
];
-
+
$response = $client->post($url, [
'options' => [
'allow_redirects' => false,
- 'verify' => true,
- 'timeout' => 30
+ 'verify' => true,
+ 'timeout' => 30,
],
- 'headers' => $headers,
- 'body' => $body
+ 'headers' => $headers,
+ 'body' => $body,
]);
return $response->getBody();
}
-
-
-}
\ No newline at end of file
+}
diff --git a/app/Util/ActivityPub/DiscoverActor.php b/app/Util/ActivityPub/DiscoverActor.php
index 6c81b3d1a..6229519f7 100644
--- a/app/Util/ActivityPub/DiscoverActor.php
+++ b/app/Util/ActivityPub/DiscoverActor.php
@@ -2,48 +2,48 @@
namespace App\Util\ActivityPub;
-use \Zttp\Zttp;
+use Zttp\Zttp;
-class DiscoverActor {
+class DiscoverActor
+{
+ protected $url;
+ protected $response;
- protected $url;
- protected $response;
-
- public function __construct($url)
- {
- $this->url = $url;
- }
-
- public function fetch()
- {
- $res = Zttp::withHeaders([
- 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
- 'User-Agent' => 'PixelFedBot - https://pixelfed.org'
- ])->get($this->url);
- $this->response = $res->body();
- return $this;
- }
-
- public function getResponse()
- {
- return json_decode($this->response, true);
- }
-
- public function getJsonResponse()
- {
- return $this->response;
- }
-
- public function discover()
- {
- $this->fetch();
- $res = $this->getResponse();
-
- if(empty($res) || !in_array('type', $res) || $res['type'] !== 'Person') {
- throw new \Exception('Invalid Actor Object');
+ public function __construct($url)
+ {
+ $this->url = $url;
}
- return $res;
- }
+ public function fetch()
+ {
+ $res = Zttp::withHeaders([
+ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
+ 'User-Agent' => 'PixelFedBot - https://pixelfed.org',
+ ])->get($this->url);
+ $this->response = $res->body();
-}
\ No newline at end of file
+ return $this;
+ }
+
+ public function getResponse()
+ {
+ return json_decode($this->response, true);
+ }
+
+ public function getJsonResponse()
+ {
+ return $this->response;
+ }
+
+ public function discover()
+ {
+ $this->fetch();
+ $res = $this->getResponse();
+
+ if (empty($res) || !in_array('type', $res) || $res['type'] !== 'Person') {
+ throw new \Exception('Invalid Actor Object');
+ }
+
+ return $res;
+ }
+}
diff --git a/app/Util/ActivityPub/Inbox.php b/app/Util/ActivityPub/Inbox.php
index 310c91b84..7a0484d7a 100644
--- a/app/Util/ActivityPub/Inbox.php
+++ b/app/Util/ActivityPub/Inbox.php
@@ -2,11 +2,11 @@
namespace App\Util\ActivityPub;
-use App\Jobs\AvatarPipeline\CreateAvatar;
-use App\{Follower, Like, Profile, Like, Status, User};
-
-class Inbox {
+use App\Like;
+use App\Profile;
+class Inbox
+{
protected $request;
protected $profile;
protected $payload;
@@ -58,12 +58,11 @@ class Inbox {
{
$actor = $this->payload['object'];
$target = $this->profile;
-
}
public function actorFirstOrCreate($actorUrl)
{
- if(Profile::whereRemoteUrl($actorUrl)->count() !== 0) {
+ if (Profile::whereRemoteUrl($actorUrl)->count() !== 0) {
return Profile::whereRemoteUrl($actorUrl)->firstOrFail();
}
@@ -73,7 +72,7 @@ class Inbox {
$username = $res['preferredUsername'];
$remoteUsername = "@{$username}@{$domain}";
- $profile = new Profile;
+ $profile = new Profile();
$profile->user_id = null;
$profile->domain = $domain;
$profile->username = $remoteUsername;
@@ -82,7 +81,5 @@ class Inbox {
$profile->sharedInbox = $res['endpoints']['sharedInbox'];
$profile->remote_url = $res['url'];
$profile->save();
-
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Util/Identicon/Preprocessor/HashPreprocessor.php b/app/Util/Identicon/Preprocessor/HashPreprocessor.php
index 39acb546c..39fc8ceaf 100644
--- a/app/Util/Identicon/Preprocessor/HashPreprocessor.php
+++ b/app/Util/Identicon/Preprocessor/HashPreprocessor.php
@@ -8,14 +8,14 @@ class HashPreprocessor implements \Bitverse\Identicon\Preprocessor\PreprocessorI
public function __construct($algo = 'sha256')
{
- $this->algo = $algo;
+ $this->algo = $algo;
}
/**
- * {@inheritDoc}
+ * {@inheritdoc}
*/
public function process($string)
{
return hash($this->algo, $string);
}
-}
\ No newline at end of file
+}
diff --git a/app/Util/Lexer/Autolink.php b/app/Util/Lexer/Autolink.php
index eb899dfd8..fdd06d9cb 100755
--- a/app/Util/Lexer/Autolink.php
+++ b/app/Util/Lexer/Autolink.php
@@ -5,17 +5,12 @@
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
-use App\Util\Lexer\Regex;
-use App\Util\Lexer\Extractor;
-use App\Util\Lexer\StringUtils;
-
/**
- * Twitter Autolink Class
+ * Twitter Autolink Class.
*
* Parses tweets and generates HTML anchor tags around URLs, usernames,
* username/list pairs and hashtags.
@@ -28,85 +23,83 @@ use App\Util\Lexer\StringUtils;
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
class Autolink extends Regex
{
-
/**
* CSS class for auto-linked URLs.
*
- * @var string
+ * @var string
*/
protected $class_url = '';
/**
* CSS class for auto-linked username URLs.
*
- * @var string
+ * @var string
*/
protected $class_user = 'u-url mention';
/**
* CSS class for auto-linked list URLs.
*
- * @var string
+ * @var string
*/
protected $class_list = 'u-url list-slug';
/**
* CSS class for auto-linked hashtag URLs.
*
- * @var string
+ * @var string
*/
protected $class_hash = 'u-url hashtag';
/**
* CSS class for auto-linked cashtag URLs.
*
- * @var string
+ * @var string
*/
protected $class_cash = 'u-url cashtag';
/**
* URL base for username links (the username without the @ will be appended).
*
- * @var string
+ * @var string
*/
protected $url_base_user = null;
/**
* URL base for list links (the username/list without the @ will be appended).
*
- * @var string
+ * @var string
*/
protected $url_base_list = null;
/**
* URL base for hashtag links (the hashtag without the # will be appended).
*
- * @var string
+ * @var string
*/
protected $url_base_hash = null;
/**
* URL base for cashtag links (the hashtag without the $ will be appended).
*
- * @var string
+ * @var string
*/
protected $url_base_cash = null;
/**
* Whether to include the value 'nofollow' in the 'rel' attribute.
*
- * @var bool
+ * @var bool
*/
protected $nofollow = true;
/**
* Whether to include the value 'noopener' in the 'rel' attribute.
*
- * @var bool
+ * @var bool
*/
protected $noopener = true;
@@ -118,9 +111,9 @@ class Autolink extends Regex
* been undeprecated and thus the 'target' attribute can be used. If this is
* set to false then the 'target' attribute will be output.
*
- * @var bool
+ * @var bool
*/
- protected $external = true;
+ protected $external = true;
/**
* The scope to open the link in.
@@ -129,19 +122,18 @@ class Autolink extends Regex
* since been reinstated in HTML 5. To output the 'target' attribute you
* must disable the adding of the string 'external' to the 'rel' attribute.
*
- * @var string
+ * @var string
*/
protected $target = '_blank';
/**
- * attribute for invisible span tag
+ * attribute for invisible span tag.
*
* @var string
*/
protected $invisibleTagAttrs = "style='position:absolute;left:-9999px;'";
/**
- *
* @var Extractor
*/
protected $extractor = null;
@@ -149,12 +141,12 @@ class Autolink extends Regex
/**
* Provides fluent method chaining.
*
- * @param string $tweet The tweet to be converted.
- * @param bool $full_encode Whether to encode all special characters.
+ * @param string $tweet The tweet to be converted.
+ * @param bool $full_encode Whether to encode all special characters.
*
* @see __construct()
*
- * @return Autolink
+ * @return Autolink
*/
public static function create($tweet = null, $full_encode = false)
{
@@ -169,9 +161,9 @@ class Autolink extends Regex
*
* @see htmlspecialchars()
*
- * @param string $tweet The tweet to be converted.
- * @param bool $escape Whether to escape the tweet (default: true).
- * @param bool $full_encode Whether to encode all special characters.
+ * @param string $tweet The tweet to be converted.
+ * @param bool $escape Whether to escape the tweet (default: true).
+ * @param bool $full_encode Whether to encode all special characters.
*/
public function __construct($tweet = null, $escape = true, $full_encode = false)
{
@@ -185,16 +177,16 @@ class Autolink extends Regex
parent::__construct($tweet);
}
$this->extractor = Extractor::create();
- $this->url_base_user = config('app.url') . '/';
- $this->url_base_list = config('app.url') . '/';
- $this->url_base_hash = config('app.url') . "/discover/tags/";
- $this->url_base_cash = config('app.url') . '/search?q=%24';
+ $this->url_base_user = config('app.url').'/';
+ $this->url_base_list = config('app.url').'/';
+ $this->url_base_hash = config('app.url').'/discover/tags/';
+ $this->url_base_cash = config('app.url').'/search?q=%24';
}
/**
* CSS class for auto-linked URLs.
*
- * @return string CSS class for URL links.
+ * @return string CSS class for URL links.
*/
public function getURLClass()
{
@@ -204,20 +196,21 @@ class Autolink extends Regex
/**
* CSS class for auto-linked URLs.
*
- * @param string $v CSS class for URL links.
+ * @param string $v CSS class for URL links.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setURLClass($v)
{
$this->class_url = trim($v);
+
return $this;
}
/**
* CSS class for auto-linked username URLs.
*
- * @return string CSS class for username links.
+ * @return string CSS class for username links.
*/
public function getUsernameClass()
{
@@ -227,20 +220,21 @@ class Autolink extends Regex
/**
* CSS class for auto-linked username URLs.
*
- * @param string $v CSS class for username links.
+ * @param string $v CSS class for username links.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setUsernameClass($v)
{
$this->class_user = trim($v);
+
return $this;
}
/**
* CSS class for auto-linked username/list URLs.
*
- * @return string CSS class for username/list links.
+ * @return string CSS class for username/list links.
*/
public function getListClass()
{
@@ -250,20 +244,21 @@ class Autolink extends Regex
/**
* CSS class for auto-linked username/list URLs.
*
- * @param string $v CSS class for username/list links.
+ * @param string $v CSS class for username/list links.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setListClass($v)
{
$this->class_list = trim($v);
+
return $this;
}
/**
* CSS class for auto-linked hashtag URLs.
*
- * @return string CSS class for hashtag links.
+ * @return string CSS class for hashtag links.
*/
public function getHashtagClass()
{
@@ -273,20 +268,21 @@ class Autolink extends Regex
/**
* CSS class for auto-linked hashtag URLs.
*
- * @param string $v CSS class for hashtag links.
+ * @param string $v CSS class for hashtag links.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setHashtagClass($v)
{
$this->class_hash = trim($v);
+
return $this;
}
/**
* CSS class for auto-linked cashtag URLs.
*
- * @return string CSS class for cashtag links.
+ * @return string CSS class for cashtag links.
*/
public function getCashtagClass()
{
@@ -296,20 +292,21 @@ class Autolink extends Regex
/**
* CSS class for auto-linked cashtag URLs.
*
- * @param string $v CSS class for cashtag links.
+ * @param string $v CSS class for cashtag links.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setCashtagClass($v)
{
$this->class_cash = trim($v);
+
return $this;
}
/**
* Whether to include the value 'nofollow' in the 'rel' attribute.
*
- * @return bool Whether to add 'nofollow' to the 'rel' attribute.
+ * @return bool Whether to add 'nofollow' to the 'rel' attribute.
*/
public function getNoFollow()
{
@@ -319,13 +316,14 @@ class Autolink extends Regex
/**
* Whether to include the value 'nofollow' in the 'rel' attribute.
*
- * @param bool $v The value to add to the 'target' attribute.
+ * @param bool $v The value to add to the 'target' attribute.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setNoFollow($v)
{
$this->nofollow = $v;
+
return $this;
}
@@ -337,7 +335,7 @@ class Autolink extends Regex
* been undeprecated and thus the 'target' attribute can be used. If this is
* set to false then the 'target' attribute will be output.
*
- * @return bool Whether to add 'external' to the 'rel' attribute.
+ * @return bool Whether to add 'external' to the 'rel' attribute.
*/
public function getExternal()
{
@@ -352,13 +350,14 @@ class Autolink extends Regex
* been undeprecated and thus the 'target' attribute can be used. If this is
* set to false then the 'target' attribute will be output.
*
- * @param bool $v The value to add to the 'target' attribute.
+ * @param bool $v The value to add to the 'target' attribute.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setExternal($v)
{
$this->external = $v;
+
return $this;
}
@@ -369,7 +368,7 @@ class Autolink extends Regex
* since been reinstated in HTML 5. To output the 'target' attribute you
* must disable the adding of the string 'external' to the 'rel' attribute.
*
- * @return string The value to add to the 'target' attribute.
+ * @return string The value to add to the 'target' attribute.
*/
public function getTarget()
{
@@ -383,22 +382,25 @@ class Autolink extends Regex
* since been reinstated in HTML 5. To output the 'target' attribute you
* must disable the adding of the string 'external' to the 'rel' attribute.
*
- * @param string $v The value to add to the 'target' attribute.
+ * @param string $v The value to add to the 'target' attribute.
*
- * @return Autolink Fluid method chaining.
+ * @return Autolink Fluid method chaining.
*/
public function setTarget($v)
{
$this->target = trim($v);
+
return $this;
}
/**
- * Autolink with entities
+ * Autolink with entities.
*
* @param string $tweet
- * @param array $entities
+ * @param array $entities
+ *
* @return string
+ *
* @since 1.1.0
*/
public function autoLinkEntities($tweet = null, $entities = null)
@@ -428,6 +430,7 @@ class Autolink extends Regex
$beginIndex = $entity['indices'][1];
}
$text .= StringUtils::substr($tweet, $beginIndex, StringUtils::strlen($tweet));
+
return $text;
}
@@ -436,13 +439,15 @@ class Autolink extends Regex
*
* @param string The tweet to be converted
* @param mixed The entities info
+ *
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLinkWithJson($tweet = null, $json = null)
{
// concatenate entities
- $entities = array();
+ $entities = [];
if (is_object($json)) {
$json = $this->object2array($json);
}
@@ -460,13 +465,15 @@ class Autolink extends Regex
}
$entities = $this->extractor->removeOverlappingEntities($entities);
+
return $this->autoLinkEntities($tweet, $entities);
}
/**
- * convert Object to Array
+ * convert Object to Array.
*
* @param mixed $obj
+ *
* @return array
*/
protected function object2array($obj)
@@ -477,6 +484,7 @@ class Autolink extends Regex
$array[$key] = $this->object2array($var);
}
}
+
return $array;
}
@@ -484,7 +492,9 @@ class Autolink extends Regex
* Auto-link hashtags, URLs, usernames and lists.
*
* @param string The tweet to be converted
+ *
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLink($tweet = null)
@@ -493,6 +503,7 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$entities = $this->extractor->extractURLWithoutProtocol(false)->extractEntitiesWithIndices($tweet);
+
return $this->autoLinkEntities($tweet, $entities);
}
@@ -502,6 +513,7 @@ class Autolink extends Regex
* added.
*
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLinkUsernamesAndLists($tweet = null)
@@ -510,6 +522,7 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$entities = $this->extractor->extractMentionsOrListsWithIndices($tweet);
+
return $this->autoLinkEntities($tweet, $entities);
}
@@ -518,6 +531,7 @@ class Autolink extends Regex
* added.
*
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLinkHashtags($tweet = null)
@@ -526,6 +540,7 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$entities = $this->extractor->extractHashtagsWithIndices($tweet);
+
return $this->autoLinkEntities($tweet, $entities);
}
@@ -535,6 +550,7 @@ class Autolink extends Regex
* This only auto-links URLs with protocol.
*
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLinkURLs($tweet = null)
@@ -543,6 +559,7 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$entities = $this->extractor->extractURLWithoutProtocol(false)->extractURLsWithIndices($tweet);
+
return $this->autoLinkEntities($tweet, $entities);
}
@@ -551,6 +568,7 @@ class Autolink extends Regex
* added.
*
* @return string that auto-link HTML added
+ *
* @since 1.1.0
*/
public function autoLinkCashtags($tweet = null)
@@ -559,6 +577,7 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$entities = $this->extractor->extractCashtagsWithIndices($tweet);
+
return $this->autoLinkEntities($tweet, $entities);
}
@@ -639,10 +658,11 @@ class Autolink extends Regex
}
/**
- *
* @param array $entity
* @param string $tweet
+ *
* @return string
+ *
* @since 1.1.0
*/
public function linkToHashtag($entity, $tweet = null)
@@ -651,13 +671,13 @@ class Autolink extends Regex
$tweet = $this->tweet;
}
$this->target = false;
- $attributes = array();
- $class = array();
+ $attributes = [];
+ $class = [];
$hash = StringUtils::substr($tweet, $entity['indices'][0], 1);
- $linkText = $hash . $entity['hashtag'];
+ $linkText = $hash.$entity['hashtag'];
- $attributes['href'] = $this->url_base_hash . $entity['hashtag'] . '?src=hash';
- $attributes['title'] = '#' . $entity['hashtag'];
+ $attributes['href'] = $this->url_base_hash.$entity['hashtag'].'?src=hash';
+ $attributes['title'] = '#'.$entity['hashtag'];
if (!empty($this->class_hash)) {
$class[] = $this->class_hash;
}
@@ -665,32 +685,33 @@ class Autolink extends Regex
$class[] = 'rtl';
}
if (!empty($class)) {
- $attributes['class'] = join(' ', $class);
+ $attributes['class'] = implode(' ', $class);
}
return $this->linkToText($entity, $linkText, $attributes);
}
/**
+ * @param array $entity
*
- * @param array $entity
* @return string
+ *
* @since 1.1.0
*/
public function linkToMentionAndList($entity)
{
- $attributes = array();
+ $attributes = [];
if (!empty($entity['list_slug'])) {
- # Replace the list and username
- $linkText = $entity['screen_name'] . $entity['list_slug'];
+ // Replace the list and username
+ $linkText = $entity['screen_name'].$entity['list_slug'];
$class = $this->class_list;
- $url = $this->url_base_list . $linkText;
+ $url = $this->url_base_list.$linkText;
} else {
- # Replace the username
+ // Replace the username
$linkText = $entity['screen_name'];
$class = $this->class_user;
- $url = $this->url_base_user . $linkText;
+ $url = $this->url_base_user.$linkText;
}
if (!empty($class)) {
$attributes['class'] = $class;
@@ -701,10 +722,11 @@ class Autolink extends Regex
}
/**
- *
* @param array $entity
* @param string $tweet
+ *
* @return string
+ *
* @since 1.1.0
*/
public function linkToCashtag($entity, $tweet = null)
@@ -712,10 +734,10 @@ class Autolink extends Regex
if (is_null($tweet)) {
$tweet = $this->tweet;
}
- $attributes = array();
+ $attributes = [];
$doller = StringUtils::substr($tweet, $entity['indices'][0], 1);
- $linkText = $doller . $entity['cashtag'];
- $attributes['href'] = $this->url_base_cash . $entity['cashtag'];
+ $linkText = $doller.$entity['cashtag'];
+ $attributes['href'] = $this->url_base_cash.$entity['cashtag'];
$attributes['title'] = $linkText;
if (!empty($this->class_cash)) {
$attributes['class'] = $this->class_cash;
@@ -725,16 +747,17 @@ class Autolink extends Regex
}
/**
- *
- * @param array $entity
+ * @param array $entity
* @param string $text
- * @param array $attributes
+ * @param array $attributes
+ *
* @return string
+ *
* @since 1.1.0
*/
- public function linkToText(array $entity, $text, $attributes = array())
+ public function linkToText(array $entity, $text, $attributes = [])
{
- $rel = array();
+ $rel = [];
if ($this->external) {
$rel[] = 'external';
}
@@ -745,23 +768,25 @@ class Autolink extends Regex
$rel[] = 'noopener';
}
if (!empty($rel)) {
- $attributes['rel'] = join(' ', $rel);
+ $attributes['rel'] = implode(' ', $rel);
}
if ($this->target) {
$attributes['target'] = $this->target;
}
$link = ' $val) {
- $link .= ' ' . $key . '="' . $this->escapeHTML($val) . '"';
+ $link .= ' '.$key.'="'.$this->escapeHTML($val).'"';
}
- $link .= '>' . $text . '';
+ $link .= '>'.$text.'';
+
return $link;
}
/**
- * html escape
+ * html escape.
*
* @param string $text
+ *
* @return string
*/
protected function escapeHTML($text)
diff --git a/app/Util/Lexer/Extractor.php b/app/Util/Lexer/Extractor.php
index 5a066985e..ee2d01ae5 100755
--- a/app/Util/Lexer/Extractor.php
+++ b/app/Util/Lexer/Extractor.php
@@ -5,16 +5,12 @@
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
-use App\Util\Lexer\Regex;
-use App\Util\Lexer\StringUtils;
-
/**
- * Twitter Extractor Class
+ * Twitter Extractor Class.
*
* Parses tweets and extracts URLs, usernames, username/list pairs and
* hashtags.
@@ -27,24 +23,22 @@ use App\Util\Lexer\StringUtils;
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
class Extractor extends Regex
{
-
/**
- * @var boolean
+ * @var bool
*/
protected $extractURLWithoutProtocol = true;
/**
* Provides fluent method chaining.
*
- * @param string $tweet The tweet to be converted.
+ * @param string $tweet The tweet to be converted.
*
* @see __construct()
*
- * @return Extractor
+ * @return Extractor
*/
public static function create($tweet = null)
{
@@ -56,7 +50,7 @@ class Extractor extends Regex
*
* Extracts various parts of a tweet including URLs, usernames, hashtags...
*
- * @param string $tweet The tweet to extract.
+ * @param string $tweet The tweet to extract.
*/
public function __construct($tweet = null)
{
@@ -67,29 +61,32 @@ class Extractor extends Regex
* Extracts all parts of a tweet and returns an associative array containing
* the extracted elements.
*
- * @param string $tweet The tweet to extract.
- * @return array The elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The elements in the tweet.
*/
public function extract($tweet = null)
{
if (is_null($tweet)) {
$tweet = $this->tweet;
}
- return array(
- 'hashtags' => $this->extractHashtags($tweet),
- 'urls' => $this->extractURLs($tweet),
- 'mentions' => $this->extractMentionedUsernames($tweet),
- 'replyto' => $this->extractRepliedUsernames($tweet),
+
+ return [
+ 'hashtags' => $this->extractHashtags($tweet),
+ 'urls' => $this->extractURLs($tweet),
+ 'mentions' => $this->extractMentionedUsernames($tweet),
+ 'replyto' => $this->extractRepliedUsernames($tweet),
'hashtags_with_indices' => $this->extractHashtagsWithIndices($tweet),
- 'urls_with_indices' => $this->extractURLsWithIndices($tweet),
+ 'urls_with_indices' => $this->extractURLsWithIndices($tweet),
'mentions_with_indices' => $this->extractMentionedUsernamesWithIndices($tweet),
- );
+ ];
}
/**
* Extract URLs, @mentions, lists and #hashtag from a given text/tweet.
*
- * @param string $tweet The tweet to extract.
+ * @param string $tweet The tweet to extract.
+ *
* @return array list of extracted entities
*/
public function extractEntitiesWithIndices($tweet = null)
@@ -97,63 +94,70 @@ class Extractor extends Regex
if (is_null($tweet)) {
$tweet = $this->tweet;
}
- $entities = array();
+ $entities = [];
$entities = array_merge($entities, $this->extractURLsWithIndices($tweet));
$entities = array_merge($entities, $this->extractHashtagsWithIndices($tweet, false));
$entities = array_merge($entities, $this->extractMentionsOrListsWithIndices($tweet));
$entities = array_merge($entities, $this->extractCashtagsWithIndices($tweet));
$entities = $this->removeOverlappingEntities($entities);
+
return $entities;
}
/**
* Extracts all the hashtags from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The hashtag elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The hashtag elements in the tweet.
*/
public function extractHashtags($tweet = null)
{
- $hashtagsOnly = array();
+ $hashtagsOnly = [];
$hashtagsWithIndices = $this->extractHashtagsWithIndices($tweet);
foreach ($hashtagsWithIndices as $hashtagWithIndex) {
$hashtagsOnly[] = $hashtagWithIndex['hashtag'];
}
+
return $hashtagsOnly;
}
/**
* Extracts all the cashtags from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The cashtag elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The cashtag elements in the tweet.
*/
public function extractCashtags($tweet = null)
{
- $cashtagsOnly = array();
+ $cashtagsOnly = [];
$cashtagsWithIndices = $this->extractCashtagsWithIndices($tweet);
foreach ($cashtagsWithIndices as $cashtagWithIndex) {
$cashtagsOnly[] = $cashtagWithIndex['cashtag'];
}
+
return $cashtagsOnly;
}
/**
* Extracts all the URLs from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The URL elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The URL elements in the tweet.
*/
public function extractURLs($tweet = null)
{
- $urlsOnly = array();
+ $urlsOnly = [];
$urlsWithIndices = $this->extractURLsWithIndices($tweet);
foreach ($urlsWithIndices as $urlWithIndex) {
$urlsOnly[] = $urlWithIndex['url'];
}
+
return $urlsOnly;
}
@@ -162,21 +166,23 @@ class Extractor extends Regex
*
* A mention is an occurrence of a username anywhere in a tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The usernames elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The usernames elements in the tweet.
*/
public function extractMentionedScreennames($tweet = null)
{
- $usernamesOnly = array();
+ $usernamesOnly = [];
$mentionsWithIndices = $this->extractMentionsOrListsWithIndices($tweet);
foreach ($mentionsWithIndices as $mentionWithIndex) {
$screen_name = mb_strtolower($mentionWithIndex['screen_name']);
- if (empty($screen_name) OR in_array($screen_name, $usernamesOnly)) {
+ if (empty($screen_name) or in_array($screen_name, $usernamesOnly)) {
continue;
}
$usernamesOnly[] = $screen_name;
}
+
return $usernamesOnly;
}
@@ -185,12 +191,14 @@ class Extractor extends Regex
*
* A mention is an occurrence of a username anywhere in a tweet.
*
- * @return array The usernames elements in the tweet.
+ * @return array The usernames elements in the tweet.
+ *
* @deprecated since version 1.1.0
*/
public function extractMentionedUsernames($tweet)
{
$this->tweet = $tweet;
+
return $this->extractMentionedScreennames($tweet);
}
@@ -199,8 +207,9 @@ class Extractor extends Regex
*
* A reply is an occurrence of a username at the beginning of a tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The usernames replied to in a tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The usernames replied to in a tweet.
*/
public function extractReplyScreenname($tweet = null)
{
@@ -208,10 +217,11 @@ class Extractor extends Regex
$tweet = $this->tweet;
}
$matched = preg_match(self::$patterns['valid_reply'], $tweet, $matches);
- # Check username ending in
+ // Check username ending in
if ($matched && preg_match(self::$patterns['end_mention_match'], $matches[2])) {
$matched = false;
}
+
return $matched ? $matches[1] : null;
}
@@ -220,7 +230,8 @@ class Extractor extends Regex
*
* A reply is an occurrence of a username at the beginning of a tweet.
*
- * @return array The usernames replied to in a tweet.
+ * @return array The usernames replied to in a tweet.
+ *
* @deprecated since version 1.1.0
*/
public function extractRepliedUsernames()
@@ -231,9 +242,10 @@ class Extractor extends Regex
/**
* Extracts all the hashtags and the indices they occur at from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @param boolean $checkUrlOverlap if true, check if extracted hashtags overlap URLs and remove overlapping ones
- * @return array The hashtag elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ * @param bool $checkUrlOverlap if true, check if extracted hashtags overlap URLs and remove overlapping ones
+ *
+ * @return array The hashtag elements in the tweet.
*/
public function extractHashtagsWithIndices($tweet = null, $checkUrlOverlap = true)
{
@@ -242,36 +254,36 @@ class Extractor extends Regex
}
if (!preg_match('/[##]/iu', $tweet)) {
- return array();
+ return [];
}
preg_match_all(self::$patterns['valid_hashtag'], $tweet, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
- $tags = array();
+ $tags = [];
foreach ($matches as $match) {
- list($all, $before, $hash, $hashtag, $outer) = array_pad($match, 3, array('', 0));
+ list($all, $before, $hash, $hashtag, $outer) = array_pad($match, 3, ['', 0]);
$start_position = $hash[1] > 0 ? StringUtils::strlen(substr($tweet, 0, $hash[1])) : $hash[1];
- $end_position = $start_position + StringUtils::strlen($hash[0] . $hashtag[0]);
+ $end_position = $start_position + StringUtils::strlen($hash[0].$hashtag[0]);
if (preg_match(self::$patterns['end_hashtag_match'], $outer[0])) {
continue;
}
- $tags[] = array(
+ $tags[] = [
'hashtag' => $hashtag[0],
- 'indices' => array($start_position, $end_position)
- );
+ 'indices' => [$start_position, $end_position],
+ ];
}
if (!$checkUrlOverlap) {
return $tags;
}
- # check url overlap
+ // check url overlap
$urls = $this->extractURLsWithIndices($tweet);
$entities = $this->removeOverlappingEntities(array_merge($tags, $urls));
- $validTags = array();
+ $validTags = [];
foreach ($entities as $entity) {
if (empty($entity['hashtag'])) {
continue;
@@ -285,8 +297,9 @@ class Extractor extends Regex
/**
* Extracts all the cashtags and the indices they occur at from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The cashtag elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The cashtag elements in the tweet.
*/
public function extractCashtagsWithIndices($tweet = null)
{
@@ -295,25 +308,25 @@ class Extractor extends Regex
}
if (!preg_match('/\$/iu', $tweet)) {
- return array();
+ return [];
}
preg_match_all(self::$patterns['valid_cashtag'], $tweet, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
- $tags = array();
+ $tags = [];
foreach ($matches as $match) {
- list($all, $before, $dollar, $cash_text, $outer) = array_pad($match, 3, array('', 0));
+ list($all, $before, $dollar, $cash_text, $outer) = array_pad($match, 3, ['', 0]);
$start_position = $dollar[1] > 0 ? StringUtils::strlen(substr($tweet, 0, $dollar[1])) : $dollar[1];
- $end_position = $start_position + StringUtils::strlen($dollar[0] . $cash_text[0]);
+ $end_position = $start_position + StringUtils::strlen($dollar[0].$cash_text[0]);
if (preg_match(self::$patterns['end_hashtag_match'], $outer[0])) {
continue;
}
- $tags[] = array(
+ $tags[] = [
'cashtag' => $cash_text[0],
- 'indices' => array($start_position, $end_position)
- );
+ 'indices' => [$start_position, $end_position],
+ ];
}
return $tags;
@@ -322,8 +335,9 @@ class Extractor extends Regex
/**
* Extracts all the URLs and the indices they occur at from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The URLs elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The URLs elements in the tweet.
*/
public function extractURLsWithIndices($tweet = null)
{
@@ -333,14 +347,14 @@ class Extractor extends Regex
$needle = $this->extractURLWithoutProtocol() ? '.' : ':';
if (strpos($tweet, $needle) === false) {
- return array();
+ return [];
}
- $urls = array();
+ $urls = [];
preg_match_all(self::$patterns['valid_url'], $tweet, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
foreach ($matches as $match) {
- list($all, $before, $url, $protocol, $domain, $port, $path, $query) = array_pad($match, 8, array(''));
+ list($all, $before, $url, $protocol, $domain, $port, $path, $query) = array_pad($match, 8, ['']);
$start_position = $url[1] > 0 ? StringUtils::strlen(substr($tweet, 0, $url[1])) : $url[1];
$end_position = $start_position + StringUtils::strlen($url[0]);
@@ -364,13 +378,13 @@ class Extractor extends Regex
$ascii_end_position = 0;
if (preg_match(self::$patterns['valid_ascii_domain'], $domain, $asciiDomain)) {
- $asciiDomain[0] = preg_replace('/' . preg_quote($domain, '/') . '/u', $asciiDomain[0], $url);
+ $asciiDomain[0] = preg_replace('/'.preg_quote($domain, '/').'/u', $asciiDomain[0], $url);
$ascii_start_position = StringUtils::strpos($domain, $asciiDomain[0], $ascii_end_position);
$ascii_end_position = $ascii_start_position + StringUtils::strlen($asciiDomain[0]);
- $last_url = array(
- 'url' => $asciiDomain[0],
- 'indices' => array($start_position + $ascii_start_position, $start_position + $ascii_end_position),
- );
+ $last_url = [
+ 'url' => $asciiDomain[0],
+ 'indices' => [$start_position + $ascii_start_position, $start_position + $ascii_end_position],
+ ];
if (!empty($path)
|| preg_match(self::$patterns['valid_special_short_domain'], $asciiDomain[0])
|| !preg_match(self::$patterns['invalid_short_domain'], $asciiDomain[0])) {
@@ -386,7 +400,7 @@ class Extractor extends Regex
// $last_url only contains domain. Need to add path and query if they exist.
if (!empty($path)) {
// last_url was not added. Add it to urls here.
- $last_url['url'] = preg_replace('/' . preg_quote($domain, '/') . '/u', $last_url['url'], $url);
+ $last_url['url'] = preg_replace('/'.preg_quote($domain, '/').'/u', $last_url['url'], $url);
$last_url['indices'][1] = $end_position;
}
} else {
@@ -395,10 +409,10 @@ class Extractor extends Regex
$url = $tcoUrlMatches[0];
$end_position = $start_position + StringUtils::strlen($url);
}
- $urls[] = array(
- 'url' => $url,
- 'indices' => array($start_position, $end_position),
- );
+ $urls[] = [
+ 'url' => $url,
+ 'indices' => [$start_position, $end_position],
+ ];
}
}
@@ -408,8 +422,9 @@ class Extractor extends Regex
/**
* Extracts all the usernames and the indices they occur at from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The username elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The username elements in the tweet.
*/
public function extractMentionedScreennamesWithIndices($tweet = null)
{
@@ -417,7 +432,7 @@ class Extractor extends Regex
$tweet = $this->tweet;
}
- $usernamesOnly = array();
+ $usernamesOnly = [];
$mentions = $this->extractMentionsOrListsWithIndices($tweet);
foreach ($mentions as $mention) {
if (isset($mention['list_slug'])) {
@@ -425,13 +440,15 @@ class Extractor extends Regex
}
$usernamesOnly[] = $mention;
}
+
return $usernamesOnly;
}
/**
* Extracts all the usernames and the indices they occur at from the tweet.
*
- * @return array The username elements in the tweet.
+ * @return array The username elements in the tweet.
+ *
* @deprecated since version 1.1.0
*/
public function extractMentionedUsernamesWithIndices()
@@ -442,8 +459,9 @@ class Extractor extends Regex
/**
* Extracts all the usernames and the indices they occur at from the tweet.
*
- * @param string $tweet The tweet to extract.
- * @return array The username elements in the tweet.
+ * @param string $tweet The tweet to extract.
+ *
+ * @return array The username elements in the tweet.
*/
public function extractMentionsOrListsWithIndices($tweet = null)
{
@@ -452,21 +470,21 @@ class Extractor extends Regex
}
if (!preg_match('/[@@]/iu', $tweet)) {
- return array();
+ return [];
}
preg_match_all(self::$patterns['valid_mentions_or_lists'], $tweet, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
- $results = array();
+ $results = [];
foreach ($matches as $match) {
- list($all, $before, $at, $username, $list_slug, $outer) = array_pad($match, 6, array('', 0));
+ list($all, $before, $at, $username, $list_slug, $outer) = array_pad($match, 6, ['', 0]);
$start_position = $at[1] > 0 ? StringUtils::strlen(substr($tweet, 0, $at[1])) : $at[1];
$end_position = $start_position + StringUtils::strlen($at[0]) + StringUtils::strlen($username[0]);
- $entity = array(
+ $entity = [
'screen_name' => $username[0],
- 'list_slug' => $list_slug[0],
- 'indices' => array($start_position, $end_position),
- );
+ 'list_slug' => $list_slug[0],
+ 'indices' => [$start_position, $end_position],
+ ];
if (preg_match(self::$patterns['end_mention_match'], $outer[0])) {
continue;
@@ -485,7 +503,8 @@ class Extractor extends Regex
/**
* Extracts all the usernames and the indices they occur at from the tweet.
*
- * @return array The username elements in the tweet.
+ * @return array The username elements in the tweet.
+ *
* @deprecated since version 1.1.0
*/
public function extractMentionedUsernamesOrListsWithIndices()
@@ -494,9 +513,10 @@ class Extractor extends Regex
}
/**
- * setter/getter for extractURLWithoutProtocol
+ * setter/getter for extractURLWithoutProtocol.
+ *
+ * @param bool $flag
*
- * @param boolean $flag
* @return Extractor
*/
public function extractURLWithoutProtocol($flag = null)
@@ -505,6 +525,7 @@ class Extractor extends Regex
return $this->extractURLWithoutProtocol;
}
$this->extractURLWithoutProtocol = (bool) $flag;
+
return $this;
}
@@ -513,12 +534,13 @@ class Extractor extends Regex
* This returns a new array with no overlapping entities.
*
* @param array $entities
+ *
* @return array
*/
public function removeOverlappingEntities($entities)
{
- $result = array();
- usort($entities, array($this, 'sortEntites'));
+ $result = [];
+ usort($entities, [$this, 'sortEntites']);
$prev = null;
foreach ($entities as $entity) {
@@ -528,14 +550,16 @@ class Extractor extends Regex
$prev = $entity;
$result[] = $entity;
}
+
return $result;
}
/**
- * sort by entity start index
+ * sort by entity start index.
*
* @param array $a
* @param array $b
+ *
* @return int
*/
protected function sortEntites($a, $b)
@@ -543,6 +567,7 @@ class Extractor extends Regex
if ($a['indices'][0] == $b['indices'][0]) {
return 0;
}
+
return ($a['indices'][0] < $b['indices'][0]) ? -1 : 1;
}
}
diff --git a/app/Util/Lexer/Hashtag.php b/app/Util/Lexer/Hashtag.php
index 3b27f0dd7..ec8cebe59 100644
--- a/app/Util/Lexer/Hashtag.php
+++ b/app/Util/Lexer/Hashtag.php
@@ -2,35 +2,36 @@
namespace App\Util\Lexer;
-class Hashtag {
-
- public static function getHashtags($status)
- {
- $hashtags = false;
- preg_match_all("/(?{$hashtag}";
- $rendered = str_replace($hashtag, $href, $rendered);
+ return $hashtags;
}
- return $rendered;
+ public static function replaceHashtagsWithLinks($status)
+ {
+ $hashtags = self::getHashtags($status);
+ if (!$hashtags) {
+ return false;
+ }
- }
+ $rendered = $status;
-}
\ No newline at end of file
+ foreach ($hashtags as $hashtag) {
+ $tag = substr($hashtag, 1);
+ $link = config('routes.hashtag.search').$tag;
+ $href = "{$hashtag}";
+ $rendered = str_replace($hashtag, $href, $rendered);
+ }
+
+ return $rendered;
+ }
+}
diff --git a/app/Util/Lexer/HitHighlighter.php b/app/Util/Lexer/HitHighlighter.php
index 77b56157a..d27bbc58f 100755
--- a/app/Util/Lexer/HitHighlighter.php
+++ b/app/Util/Lexer/HitHighlighter.php
@@ -4,16 +4,12 @@
* @author Nick Pope
* @copyright Copyright © 2010, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
-use App\Util\Lexer\Regex;
-use App\Util\Lexer\StringUtils;
-
/**
- * Twitter HitHighlighter Class
+ * Twitter HitHighlighter Class.
*
* Performs "hit highlighting" on tweets that have been auto-linked already.
* Useful with the results returned from the search API.
@@ -25,27 +21,25 @@ use App\Util\Lexer\StringUtils;
* @author Nick Pope
* @copyright Copyright © 2010, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
class HitHighlighter extends Regex
{
-
/**
* The tag to surround hits with.
*
- * @var string
+ * @var string
*/
protected $tag = 'em';
/**
* Provides fluent method chaining.
*
- * @param string $tweet The tweet to be hit highlighted.
- * @param bool $full_encode Whether to encode all special characters.
+ * @param string $tweet The tweet to be hit highlighted.
+ * @param bool $full_encode Whether to encode all special characters.
*
* @see __construct()
*
- * @return HitHighlighter
+ * @return HitHighlighter
*/
public static function create($tweet = null, $full_encode = false)
{
@@ -59,9 +53,9 @@ class HitHighlighter extends Regex
*
* @see htmlspecialchars()
*
- * @param string $tweet The tweet to be hit highlighted.
- * @param bool $escape Whether to escape the tweet (default: true).
- * @param bool $full_encode Whether to encode all special characters.
+ * @param string $tweet The tweet to be hit highlighted.
+ * @param bool $escape Whether to escape the tweet (default: true).
+ * @param bool $full_encode Whether to encode all special characters.
*/
public function __construct($tweet = null, $escape = true, $full_encode = false)
{
@@ -79,7 +73,7 @@ class HitHighlighter extends Regex
/**
* Set the highlighting tag to surround hits with. The default tag is 'em'.
*
- * @return string The tag name.
+ * @return string The tag name.
*/
public function getTag()
{
@@ -89,26 +83,27 @@ class HitHighlighter extends Regex
/**
* Set the highlighting tag to surround hits with. The default tag is 'em'.
*
- * @param string $v The tag name.
+ * @param string $v The tag name.
*
- * @return HitHighlighter Fluid method chaining.
+ * @return HitHighlighter Fluid method chaining.
*/
public function setTag($v)
{
$this->tag = $v;
+
return $this;
}
/**
* Hit highlights the tweet.
*
- * @param string $tweet The tweet to be hit highlighted.
- * @param array $hits An array containing the start and end index pairs
- * for the highlighting.
+ * @param string $tweet The tweet to be hit highlighted.
+ * @param array $hits An array containing the start and end index pairs
+ * for the highlighting.
* @param bool $escape Whether to escape the tweet (default: true).
- * @param bool $full_encode Whether to encode all special characters.
+ * @param bool $full_encode Whether to encode all special characters.
*
- * @return string The hit highlighted tweet.
+ * @return string The hit highlighted tweet.
*/
public function highlight($tweet = null, array $hits = null)
{
@@ -119,8 +114,8 @@ class HitHighlighter extends Regex
return $tweet;
}
$highlightTweet = '';
- $tags = array('<' . $this->tag . '>', '' . $this->tag . '>');
- # Check whether we can simply replace or whether we need to chunk...
+ $tags = ['<'.$this->tag.'>', ''.$this->tag.'>'];
+ // Check whether we can simply replace or whether we need to chunk...
if (strpos($tweet, '<') === false) {
$ti = 0; // tag increment (for added tags)
$highlightTweet = $tweet;
@@ -137,12 +132,12 @@ class HitHighlighter extends Regex
$chunk_cursor = 0;
$offset = 0;
$start_in_chunk = false;
- # Flatten the multidimensional hits array:
- $hits_flat = array();
+ // Flatten the multidimensional hits array:
+ $hits_flat = [];
foreach ($hits as $hit) {
$hits_flat = array_merge($hits_flat, $hit);
}
- # Loop over the hit indices:
+ // Loop over the hit indices:
for ($index = 0; $index < count($hits_flat); $index++) {
$hit = $hits_flat[$index];
$tag = $tags[$index % 2];
@@ -154,7 +149,7 @@ class HitHighlighter extends Regex
$placed = true;
}
if (isset($chunks[$chunk_index + 1])) {
- $highlightTweet .= '<' . $chunks[$chunk_index + 1] . '>';
+ $highlightTweet .= '<'.$chunks[$chunk_index + 1].'>';
}
$offset += StringUtils::strlen($chunk);
$chunk_cursor = 0;
@@ -164,12 +159,12 @@ class HitHighlighter extends Regex
}
if (!$placed && $chunk !== null) {
$hit_spot = $hit - $offset;
- $highlightTweet .= StringUtils::substr($chunk, $chunk_cursor, $hit_spot - $chunk_cursor) . $tag;
+ $highlightTweet .= StringUtils::substr($chunk, $chunk_cursor, $hit_spot - $chunk_cursor).$tag;
$chunk_cursor = $hit_spot;
$start_in_chunk = ($index % 2 === 0);
$placed = true;
}
- # Ultimate fallback - hits that run off the end get a closing tag:
+ // Ultimate fallback - hits that run off the end get a closing tag:
if (!$placed) {
$highlightTweet .= $tag;
}
@@ -179,20 +174,22 @@ class HitHighlighter extends Regex
$highlightTweet .= StringUtils::substr($chunk, $chunk_cursor);
}
for ($index = $chunk_index + 1; $index < count($chunks); $index++) {
- $highlightTweet .= ($index % 2 === 0 ? $chunks[$index] : '<' . $chunks[$index] . '>');
+ $highlightTweet .= ($index % 2 === 0 ? $chunks[$index] : '<'.$chunks[$index].'>');
}
}
}
+
return $highlightTweet;
}
/**
* Hit highlights the tweet.
*
- * @param array $hits An array containing the start and end index pairs
- * for the highlighting.
+ * @param array $hits An array containing the start and end index pairs
+ * for the highlighting.
+ *
+ * @return string The hit highlighted tweet.
*
- * @return string The hit highlighted tweet.
* @deprecated since version 1.1.0
*/
public function addHitHighlighting(array $hits)
diff --git a/app/Util/Lexer/LooseAutolink.php b/app/Util/Lexer/LooseAutolink.php
index 979b0d0b0..6e047ab1e 100755
--- a/app/Util/Lexer/LooseAutolink.php
+++ b/app/Util/Lexer/LooseAutolink.php
@@ -6,15 +6,12 @@
* @author Takashi Nojima
* @copyright Copyright 2014 Mike Cochrane, Nick Pope, Takashi Nojima
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
-use App\Util\Lexer\Autolink;
-
/**
- * Twitter LooseAutolink Class
+ * Twitter LooseAutolink Class.
*
* Parses tweets and generates HTML anchor tags around URLs, usernames,
* username/list pairs and hashtags.
@@ -28,18 +25,19 @@ use App\Util\Lexer\Autolink;
* @author Takashi Nojima
* @copyright Copyright 2014 Mike Cochrane, Nick Pope, Takashi Nojima
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
+ *
* @since 1.8.0
* @deprecated since version 1.9.0
*/
class LooseAutolink extends Autolink
{
-
/**
* Auto-link hashtags, URLs, usernames and lists.
*
* @param string The tweet to be converted
+ *
* @return string that auto-link HTML added
+ *
* @deprecated since version 1.9.0
*/
public function autoLink($tweet = null)
@@ -47,6 +45,7 @@ class LooseAutolink extends Autolink
if (!is_null($tweet)) {
$this->tweet = $tweet;
}
+
return $this->addLinks();
}
@@ -62,6 +61,7 @@ class LooseAutolink extends Autolink
if (!is_null($tweet)) {
$this->tweet = $tweet;
}
+
return $this->addLinksToUsernamesAndLists();
}
@@ -76,6 +76,7 @@ class LooseAutolink extends Autolink
if (!is_null($tweet)) {
$this->tweet = $tweet;
}
+
return $this->addLinksToHashtags();
}
@@ -91,6 +92,7 @@ class LooseAutolink extends Autolink
if (!is_null($tweet)) {
$this->tweet = $tweet;
}
+
return $this->addLinksToURLs();
}
@@ -105,13 +107,15 @@ class LooseAutolink extends Autolink
if (!is_null($tweet)) {
$this->tweet = $tweet;
}
+
return $this->addLinksToCashtags();
}
/**
* Adds links to all elements in the tweet.
*
- * @return string The modified tweet.
+ * @return string The modified tweet.
+ *
* @deprecated since version 1.9.0
*/
public function addLinks()
@@ -123,19 +127,20 @@ class LooseAutolink extends Autolink
$this->tweet = $this->addLinksToUsernamesAndLists();
$modified = $this->tweet;
$this->tweet = $original;
+
return $modified;
}
/**
* Adds links to hashtag elements in the tweet.
*
- * @return string The modified tweet.
+ * @return string The modified tweet.
*/
public function addLinksToHashtags()
{
return preg_replace_callback(
self::$patterns['valid_hashtag'],
- array($this, '_addLinksToHashtags'),
+ [$this, '_addLinksToHashtags'],
$this->tweet
);
}
@@ -143,13 +148,13 @@ class LooseAutolink extends Autolink
/**
* Adds links to cashtag elements in the tweet.
*
- * @return string The modified tweet.
+ * @return string The modified tweet.
*/
public function addLinksToCashtags()
{
return preg_replace_callback(
self::$patterns['valid_cashtag'],
- array($this, '_addLinksToCashtags'),
+ [$this, '_addLinksToCashtags'],
$this->tweet
);
}
@@ -157,23 +162,23 @@ class LooseAutolink extends Autolink
/**
* Adds links to URL elements in the tweet.
*
- * @return string The modified tweet
+ * @return string The modified tweet
*/
public function addLinksToURLs()
{
- return preg_replace_callback(self::$patterns['valid_url'], array($this, '_addLinksToURLs'), $this->tweet);
+ return preg_replace_callback(self::$patterns['valid_url'], [$this, '_addLinksToURLs'], $this->tweet);
}
/**
* Adds links to username/list elements in the tweet.
*
- * @return string The modified tweet.
+ * @return string The modified tweet.
*/
public function addLinksToUsernamesAndLists()
{
return preg_replace_callback(
self::$patterns['valid_mentions_or_lists'],
- array($this, '_addLinksToUsernamesAndLists'),
+ [$this, '_addLinksToUsernamesAndLists'],
$this->tweet
);
}
@@ -183,21 +188,22 @@ class LooseAutolink extends Autolink
*
* This is a helper function to perform the generation of the link.
*
- * @param string $url The URL to use as the href.
- * @param string $class The CSS class(es) to apply (space separated).
- * @param string $element The tweet element to wrap.
+ * @param string $url The URL to use as the href.
+ * @param string $class The CSS class(es) to apply (space separated).
+ * @param string $element The tweet element to wrap.
+ *
+ * @return string The tweet element with a link applied.
*
- * @return string The tweet element with a link applied.
* @deprecated since version 1.1.0
*/
protected function wrap($url, $class, $element)
{
$link = 'external) {
$rel[] = 'external';
}
@@ -205,12 +211,13 @@ class LooseAutolink extends Autolink
$rel[] = 'nofollow';
}
if (!empty($rel)) {
- $link .= ' rel="' . implode(' ', $rel) . '"';
+ $link .= ' rel="'.implode(' ', $rel).'"';
}
if ($this->target) {
- $link .= ' target="' . $this->target . '"';
+ $link .= ' target="'.$this->target.'"';
}
- $link .= '>' . $element . '';
+ $link .= '>'.$element.'';
+
return $link;
}
@@ -219,22 +226,22 @@ class LooseAutolink extends Autolink
*
* This is a helper function to perform the generation of the hashtag link.
*
- * @param string $url The URL to use as the href.
- * @param string $class The CSS class(es) to apply (space separated).
- * @param string $element The tweet element to wrap.
+ * @param string $url The URL to use as the href.
+ * @param string $class The CSS class(es) to apply (space separated).
+ * @param string $element The tweet element to wrap.
*
- * @return string The tweet element with a link applied.
+ * @return string The tweet element with a link applied.
*/
protected function wrapHash($url, $class, $element)
{
$title = preg_replace('/#/u', '#', $element);
$link = 'external) {
$rel[] = 'external';
}
@@ -242,12 +249,13 @@ class LooseAutolink extends Autolink
$rel[] = 'nofollow';
}
if (!empty($rel)) {
- $link .= ' rel="' . implode(' ', $rel) . '"';
+ $link .= ' rel="'.implode(' ', $rel).'"';
}
if ($this->target) {
- $link .= ' target="' . $this->target . '"';
+ $link .= ' target="'.$this->target.'"';
}
- $link .= '>' . $element . '';
+ $link .= '>'.$element.'';
+
return $link;
}
@@ -255,8 +263,10 @@ class LooseAutolink extends Autolink
* Callback used by the method that adds links to hashtags.
*
* @see addLinksToHashtags()
- * @param array $matches The regular expression matches.
- * @return string The link-wrapped hashtag.
+ *
+ * @param array $matches The regular expression matches.
+ *
+ * @return string The link-wrapped hashtag.
*/
protected function _addLinksToHashtags($matches)
{
@@ -266,13 +276,14 @@ class LooseAutolink extends Autolink
return $all;
}
$replacement = $before;
- $element = $hash . $tag;
- $url = $this->url_base_hash . $tag;
+ $element = $hash.$tag;
+ $url = $this->url_base_hash.$tag;
$class_hash = $this->class_hash;
if (preg_match(self::$patterns['rtl_chars'], $element)) {
$class_hash .= ' rtl';
}
$replacement .= $this->wrapHash($url, $class_hash, $element);
+
return $replacement;
}
@@ -280,8 +291,10 @@ class LooseAutolink extends Autolink
* Callback used by the method that adds links to cashtags.
*
* @see addLinksToCashtags()
- * @param array $matches The regular expression matches.
- * @return string The link-wrapped cashtag.
+ *
+ * @param array $matches The regular expression matches.
+ *
+ * @return string The link-wrapped cashtag.
*/
protected function _addLinksToCashtags($matches)
{
@@ -291,9 +304,10 @@ class LooseAutolink extends Autolink
return $all;
}
$replacement = $before;
- $element = $cash . $tag;
- $url = $this->url_base_cash . $tag;
+ $element = $cash.$tag;
+ $url = $this->url_base_cash.$tag;
$replacement .= $this->wrapHash($url, $this->class_cash, $element);
+
return $replacement;
}
@@ -301,8 +315,10 @@ class LooseAutolink extends Autolink
* Callback used by the method that adds links to URLs.
*
* @see addLinksToURLs()
- * @param array $matches The regular expression matches.
- * @return string The link-wrapped URL.
+ *
+ * @param array $matches The regular expression matches.
+ *
+ * @return string The link-wrapped URL.
*/
protected function _addLinksToURLs($matches)
{
@@ -311,38 +327,41 @@ class LooseAutolink extends Autolink
if (!$protocol) {
return $all;
}
- return $before . $this->wrap($url, $this->class_url, $url);
+
+ return $before.$this->wrap($url, $this->class_url, $url);
}
/**
* Callback used by the method that adds links to username/list pairs.
*
* @see addLinksToUsernamesAndLists()
- * @param array $matches The regular expression matches.
- * @return string The link-wrapped username/list pair.
+ *
+ * @param array $matches The regular expression matches.
+ *
+ * @return string The link-wrapped username/list pair.
*/
protected function _addLinksToUsernamesAndLists($matches)
{
list($all, $before, $at, $username, $slash_listname, $after) = array_pad($matches, 6, '');
- # If $after is not empty, there is an invalid character.
+ // If $after is not empty, there is an invalid character.
if (!empty($slash_listname)) {
- # Replace the list and username
- $element = $username . $slash_listname;
+ // Replace the list and username
+ $element = $username.$slash_listname;
$class = $this->class_list;
- $url = $this->url_base_list . $element;
+ $url = $this->url_base_list.$element;
} else {
if (preg_match(self::$patterns['end_mention_match'], $after)) {
return $all;
}
- # Replace the username
+ // Replace the username
$element = $username;
$class = $this->class_user;
- $url = $this->url_base_user . $element;
+ $url = $this->url_base_user.$element;
}
- # XXX: Due to use of preg_replace_callback() for multiple replacements in a
- # single tweet and also as only the match is replaced and we have to
- # use a look-ahead for $after because there is no equivalent for the
- # $' (dollar apostrophe) global from Ruby, we MUST NOT append $after.
- return $before . $at . $this->wrap($url, $class, $element);
+ // XXX: Due to use of preg_replace_callback() for multiple replacements in a
+ // single tweet and also as only the match is replaced and we have to
+ // use a look-ahead for $after because there is no equivalent for the
+ // $' (dollar apostrophe) global from Ruby, we MUST NOT append $after.
+ return $before.$at.$this->wrap($url, $class, $element);
}
}
diff --git a/app/Util/Lexer/Nickname.php b/app/Util/Lexer/Nickname.php
index 4c7124d67..809605abf 100644
--- a/app/Util/Lexer/Nickname.php
+++ b/app/Util/Lexer/Nickname.php
@@ -2,41 +2,41 @@
namespace App\Util\Lexer;
-class Nickname {
-
+class Nickname
+{
public static function normalizeProfileUrl($url)
{
- if(starts_with($url, 'acct:')) {
- $url = str_replace('acct:', '', $url);
- }
+ if (starts_with($url, 'acct:')) {
+ $url = str_replace('acct:', '', $url);
+ }
- if(!str_contains($url, '@') && filter_var($url, FILTER_VALIDATE_URL)) {
- $parsed = parse_url($url);
- $username = str_replace(['/','\\','@'], '', $parsed['path']);
- return ['domain' => $parsed['host'], 'username' => $username];
- }
- $parts = explode('@', $url);
- $username = null;
- $domain = null;
+ if (!str_contains($url, '@') && filter_var($url, FILTER_VALIDATE_URL)) {
+ $parsed = parse_url($url);
+ $username = str_replace(['/', '\\', '@'], '', $parsed['path']);
- foreach ($parts as $part) {
+ return ['domain' => $parsed['host'], 'username' => $username];
+ }
+ $parts = explode('@', $url);
+ $username = null;
+ $domain = null;
+
+ foreach ($parts as $part) {
// skip empty array slices
- if(empty($part)) {
- continue;
- }
+ if (empty($part)) {
+ continue;
+ }
- // if slice contains . assume its a domain
- if(str_contains($part, '.')) {
- $domain = filter_var($part, FILTER_VALIDATE_URL) ?
- parse_url($part, PHP_URL_HOST) :
+ // if slice contains . assume its a domain
+ if (str_contains($part, '.')) {
+ $domain = filter_var($part, FILTER_VALIDATE_URL) ?
+ parse_url($part, PHP_URL_HOST) :
$part;
- } else {
- $username = $part;
+ } else {
+ $username = $part;
+ }
}
- }
- return ['domain' => $domain, 'username' => $username];
+ return ['domain' => $domain, 'username' => $username];
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Util/Lexer/PrettyNumber.php b/app/Util/Lexer/PrettyNumber.php
index 23d7ab267..2dfa86e6c 100644
--- a/app/Util/Lexer/PrettyNumber.php
+++ b/app/Util/Lexer/PrettyNumber.php
@@ -2,35 +2,38 @@
namespace App\Util\Lexer;
-class PrettyNumber {
+class PrettyNumber
+{
+ public static function convert($expression)
+ {
+ $abbrevs = [12 => 'T', 9 => 'B', 6 => 'M', 3 => 'K', 0 => ''];
+ foreach ($abbrevs as $exponent => $abbrev) {
+ if ($expression >= pow(10, $exponent)) {
+ $display_num = $expression / pow(10, $exponent);
+ $num = number_format($display_num, 0).$abbrev;
- public static function convert($expression)
- {
- $abbrevs = array(12 => "T", 9 => "B", 6 => "M", 3 => "K", 0 => "");
- foreach($abbrevs as $exponent => $abbrev) {
- if($expression >= pow(10, $exponent)) {
- $display_num = $expression / pow(10, $exponent);
- $num = number_format($display_num,0) . $abbrev;
- return $num;
- }
- }
- return $expression;
- }
+ return $num;
+ }
+ }
- public static function size($expression, $kb = false)
- {
- if($kb) {
- $expression = $expression * 1024;
- }
- $size = intval($expression);
- $precision = 0;
- $short = true;
- $units = $short ?
- ['B','k','M','G','T','P','E','Z','Y'] :
- ['B','kB','MB','GB','TB','PB','EB','ZB','YB'];
- for($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {}
- $res = round($size, $precision).$units[$i];
- return $res;
- }
+ return $expression;
+ }
-}
\ No newline at end of file
+ public static function size($expression, $kb = false)
+ {
+ if ($kb) {
+ $expression = $expression * 1024;
+ }
+ $size = intval($expression);
+ $precision = 0;
+ $short = true;
+ $units = $short ?
+ ['B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] :
+ ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+ for ($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {
+ }
+ $res = round($size, $precision).$units[$i];
+
+ return $res;
+ }
+}
diff --git a/app/Util/Lexer/Regex.php b/app/Util/Lexer/Regex.php
index 7c1f0627b..2b65fb326 100755
--- a/app/Util/Lexer/Regex.php
+++ b/app/Util/Lexer/Regex.php
@@ -5,13 +5,12 @@
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
/**
- * Twitter Regex Abstract Class
+ * Twitter Regex Abstract Class.
*
* Used by subclasses that need to parse tweets.
*
@@ -23,30 +22,28 @@ namespace App\Util\Lexer;
* @author Nick Pope
* @copyright Copyright © 2010, Mike Cochrane, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter
*/
abstract class Regex
{
-
/**
* Contains all generated regular expressions.
*
- * @var string The regex patterns.
+ * @var string The regex patterns.
*/
- protected static $patterns = array();
+ protected static $patterns = [];
/**
* The tweet to be used in parsing. This should be populated by the
* constructor of all subclasses.
*
- * @var string
+ * @var string
*/
protected $tweet = '';
/**
* This constructor is used to populate some variables.
*
- * @param string $tweet The tweet to parse.
+ * @param string $tweet The tweet to parse.
*/
protected function __construct($tweet = null)
{
@@ -58,280 +55,280 @@ abstract class Regex
*/
public static function __static()
{
- # Check whether we have initialized the regular expressions:
+ // Check whether we have initialized the regular expressions:
static $initialized = false;
if ($initialized) {
return;
}
- # Get a shorter reference to the regular expression array:
- $re = & self::$patterns;
- # Initialise local storage arrays:
- $tmp = array();
+ // Get a shorter reference to the regular expression array:
+ $re = &self::$patterns;
+ // Initialise local storage arrays:
+ $tmp = [];
- # Expression to match whitespace characters.
- #
- # 0x0009-0x000D Cc # ..
- # 0x0020 Zs # SPACE
- # 0x0085 Cc #
- # 0x00A0 Zs # NO-BREAK SPACE
- # 0x1680 Zs # OGHAM SPACE MARK
- # 0x180E Zs # MONGOLIAN VOWEL SEPARATOR
- # 0x2000-0x200A Zs # EN QUAD..HAIR SPACE
- # 0x2028 Zl # LINE SEPARATOR
- # 0x2029 Zp # PARAGRAPH SEPARATOR
- # 0x202F Zs # NARROW NO-BREAK SPACE
- # 0x205F Zs # MEDIUM MATHEMATICAL SPACE
- # 0x3000 Zs # IDEOGRAPHIC SPACE
+ // Expression to match whitespace characters.
+ //
+ // 0x0009-0x000D Cc # ..
+ // 0x0020 Zs # SPACE
+ // 0x0085 Cc #
+ // 0x00A0 Zs # NO-BREAK SPACE
+ // 0x1680 Zs # OGHAM SPACE MARK
+ // 0x180E Zs # MONGOLIAN VOWEL SEPARATOR
+ // 0x2000-0x200A Zs # EN QUAD..HAIR SPACE
+ // 0x2028 Zl # LINE SEPARATOR
+ // 0x2029 Zp # PARAGRAPH SEPARATOR
+ // 0x202F Zs # NARROW NO-BREAK SPACE
+ // 0x205F Zs # MEDIUM MATHEMATICAL SPACE
+ // 0x3000 Zs # IDEOGRAPHIC SPACE
$tmp['spaces'] = '\x{0009}-\x{000D}\x{0020}\x{0085}\x{00a0}\x{1680}\x{180E}\x{2000}-\x{200a}\x{2028}\x{2029}\x{202f}\x{205f}\x{3000}';
- # Invalid Characters:
- # 0xFFFE,0xFEFF # BOM
- # 0xFFFF # Special
- # 0x202A-0x202E # Directional change
+ // Invalid Characters:
+ // 0xFFFE,0xFEFF # BOM
+ // 0xFFFF # Special
+ // 0x202A-0x202E # Directional change
$tmp['invalid_characters'] = '\x{202a}-\x{202e}\x{feff}\x{fffe}\x{ffff}';
- # Expression to match at and hash sign characters:
+ // Expression to match at and hash sign characters:
$tmp['at_signs'] = '@@';
$tmp['hash_signs'] = '##';
- # Expression to match latin accented characters.
- #
- # 0x00C0-0x00D6
- # 0x00D8-0x00F6
- # 0x00F8-0x00FF
- # 0x0100-0x024f
- # 0x0253-0x0254
- # 0x0256-0x0257
- # 0x0259
- # 0x025b
- # 0x0263
- # 0x0268
- # 0x026f
- # 0x0272
- # 0x0289
- # 0x028b
- # 0x02bb
- # 0x0300-0x036f
- # 0x1e00-0x1eff
- #
- # Excludes 0x00D7 - multiplication sign (confusable with 'x').
- # Excludes 0x00F7 - division sign.
+ // Expression to match latin accented characters.
+ //
+ // 0x00C0-0x00D6
+ // 0x00D8-0x00F6
+ // 0x00F8-0x00FF
+ // 0x0100-0x024f
+ // 0x0253-0x0254
+ // 0x0256-0x0257
+ // 0x0259
+ // 0x025b
+ // 0x0263
+ // 0x0268
+ // 0x026f
+ // 0x0272
+ // 0x0289
+ // 0x028b
+ // 0x02bb
+ // 0x0300-0x036f
+ // 0x1e00-0x1eff
+ //
+ // Excludes 0x00D7 - multiplication sign (confusable with 'x').
+ // Excludes 0x00F7 - division sign.
$tmp['latin_accents'] = '\x{00c0}-\x{00d6}\x{00d8}-\x{00f6}\x{00f8}-\x{00ff}';
$tmp['latin_accents'] .= '\x{0100}-\x{024f}\x{0253}-\x{0254}\x{0256}-\x{0257}';
$tmp['latin_accents'] .= '\x{0259}\x{025b}\x{0263}\x{0268}\x{026f}\x{0272}\x{0289}\x{028b}\x{02bb}\x{0300}-\x{036f}\x{1e00}-\x{1eff}';
- # Expression to match RTL characters.
- #
- # 0x0600-0x06FF Arabic
- # 0x0750-0x077F Arabic Supplement
- # 0x08A0-0x08FF Arabic Extended-A
- # 0x0590-0x05FF Hebrew
- # 0xFB50-0xFDFF Arabic Presentation Forms-A
- # 0xFE70-0xFEFF Arabic Presentation Forms-B
+ // Expression to match RTL characters.
+ //
+ // 0x0600-0x06FF Arabic
+ // 0x0750-0x077F Arabic Supplement
+ // 0x08A0-0x08FF Arabic Extended-A
+ // 0x0590-0x05FF Hebrew
+ // 0xFB50-0xFDFF Arabic Presentation Forms-A
+ // 0xFE70-0xFEFF Arabic Presentation Forms-B
$tmp['rtl_chars'] = '\x{0600}-\x{06ff}\x{0750}-\x{077f}\x{08a0}-\x{08ff}\x{0590}-\x{05ff}\x{fb50}-\x{fdff}\x{fe70}-\x{feff}';
$tmp['hashtag_letters'] = '\p{L}\p{M}';
$tmp['hashtag_numerals'] = '\p{Nd}';
- # Hashtag special chars
- #
- # _ underscore
- # 0x200c ZERO WIDTH NON-JOINER (ZWNJ)
- # 0x200d ZERO WIDTH JOINER (ZWJ)
- # 0xa67e CYRILLIC KAVYKA
- # 0x05be HEBREW PUNCTUATION MAQAF
- # 0x05f3 HEBREW PUNCTUATION GERESH
- # 0x05f4 HEBREW PUNCTUATION GERSHAYIM
- # 0xff5e FULLWIDTH TILDE
- # 0x301c WAVE DASH
- # 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK
- # 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
- # 0x30a0 KATAKANA-HIRAGANA DOUBLE HYPHEN
- # 0x30fb KATAKANA MIDDLE DOT
- # 0x3003 DITTO MARK
- # 0x0f0b TIBETAN MARK INTERSYLLABIC TSHEG
- # 0x0f0c TIBETAN MARK DELIMITER TSHEG BSTAR
- # 0x00b7 MIDDLE DOT
+ // Hashtag special chars
+ //
+ // _ underscore
+ // 0x200c ZERO WIDTH NON-JOINER (ZWNJ)
+ // 0x200d ZERO WIDTH JOINER (ZWJ)
+ // 0xa67e CYRILLIC KAVYKA
+ // 0x05be HEBREW PUNCTUATION MAQAF
+ // 0x05f3 HEBREW PUNCTUATION GERESH
+ // 0x05f4 HEBREW PUNCTUATION GERSHAYIM
+ // 0xff5e FULLWIDTH TILDE
+ // 0x301c WAVE DASH
+ // 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK
+ // 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
+ // 0x30a0 KATAKANA-HIRAGANA DOUBLE HYPHEN
+ // 0x30fb KATAKANA MIDDLE DOT
+ // 0x3003 DITTO MARK
+ // 0x0f0b TIBETAN MARK INTERSYLLABIC TSHEG
+ // 0x0f0c TIBETAN MARK DELIMITER TSHEG BSTAR
+ // 0x00b7 MIDDLE DOT
$tmp['hashtag_special_chars'] = '_\x{200c}\x{200d}\x{a67e}\x{05be}\x{05f3}\x{05f4}\x{ff5e}\x{301c}\x{309b}\x{309c}\x{30a0}\x{30fb}\x{3003}\x{0f0b}\x{0f0c}\x{00b7}';
- $tmp['hashtag_letters_numerals_set'] = '[' . $tmp['hashtag_letters'] . $tmp['hashtag_numerals'] . $tmp['hashtag_special_chars'] . ']';
- $tmp['hashtag_letters_set'] = '[' . $tmp['hashtag_letters'] . ']';
- $tmp['hashtag_boundary'] = '(?:\A|\x{fe0e}|\x{fe0f}|[^&' . $tmp['hashtag_letters'] . $tmp['hashtag_numerals'] . $tmp['hashtag_special_chars'] . '])';
- $tmp['hashtag'] = '(' . $tmp['hashtag_boundary'] . ')(#|\x{ff03})(?!\x{fe0f}|\x{20e3})(' . $tmp['hashtag_letters_numerals_set'] . '*' . $tmp['hashtag_letters_set'] . $tmp['hashtag_letters_numerals_set'] . '*)';
+ $tmp['hashtag_letters_numerals_set'] = '['.$tmp['hashtag_letters'].$tmp['hashtag_numerals'].$tmp['hashtag_special_chars'].']';
+ $tmp['hashtag_letters_set'] = '['.$tmp['hashtag_letters'].']';
+ $tmp['hashtag_boundary'] = '(?:\A|\x{fe0e}|\x{fe0f}|[^&'.$tmp['hashtag_letters'].$tmp['hashtag_numerals'].$tmp['hashtag_special_chars'].'])';
+ $tmp['hashtag'] = '('.$tmp['hashtag_boundary'].')(#|\x{ff03})(?!\x{fe0f}|\x{20e3})('.$tmp['hashtag_letters_numerals_set'].'*'.$tmp['hashtag_letters_set'].$tmp['hashtag_letters_numerals_set'].'*)';
- $re['valid_hashtag'] = '/' . $tmp['hashtag'] . '(?=(.*|$))/iu';
- $re['end_hashtag_match'] = '/\A(?:[' . $tmp['hash_signs'] . ']|:\/\/)/u';
+ $re['valid_hashtag'] = '/'.$tmp['hashtag'].'(?=(.*|$))/iu';
+ $re['end_hashtag_match'] = '/\A(?:['.$tmp['hash_signs'].']|:\/\/)/u';
- # XXX: PHP doesn't have Ruby's $' (dollar apostrophe) so we have to capture
- # $after in the following regular expression. Note that we only use a
- # look-ahead capture here and don't append $after when we return.
+ // XXX: PHP doesn't have Ruby's $' (dollar apostrophe) so we have to capture
+ // $after in the following regular expression. Note that we only use a
+ // look-ahead capture here and don't append $after when we return.
$tmp['valid_mention_preceding_chars'] = '([^a-zA-Z0-9_!#\$%&*@@\/]|^|(?:^|[^a-z0-9_+~.-])RT:?)';
- $re['valid_mentions_or_lists'] = '/' . $tmp['valid_mention_preceding_chars'] . '([' . $tmp['at_signs'] . '])([a-z0-9_]{1,20})(\/[a-z][a-z0-9_\-]{0,24})?(?=(.*|$))/iu';
- $re['valid_reply'] = '/^(?:[' . $tmp['spaces'] . '])*[' . $tmp['at_signs'] . ']([a-z0-9_]{1,20})(?=(.*|$))/iu';
- $re['end_mention_match'] = '/\A(?:[' . $tmp['at_signs'] . ']|[' . $tmp['latin_accents'] . ']|:\/\/)/iu';
+ $re['valid_mentions_or_lists'] = '/'.$tmp['valid_mention_preceding_chars'].'(['.$tmp['at_signs'].'])([a-z0-9_]{1,20})(\/[a-z][a-z0-9_\-]{0,24})?(?=(.*|$))/iu';
+ $re['valid_reply'] = '/^(?:['.$tmp['spaces'].'])*['.$tmp['at_signs'].']([a-z0-9_]{1,20})(?=(.*|$))/iu';
+ $re['end_mention_match'] = '/\A(?:['.$tmp['at_signs'].']|['.$tmp['latin_accents'].']|:\/\/)/iu';
- # URL related hash regex collection
+ // URL related hash regex collection
- $tmp['valid_url_preceding_chars'] = '(?:[^A-Z0-9_@@\$##\.' . $tmp['invalid_characters'] . ']|^)';
+ $tmp['valid_url_preceding_chars'] = '(?:[^A-Z0-9_@@\$##\.'.$tmp['invalid_characters'].']|^)';
- $tmp['domain_valid_chars'] = '0-9a-z' . $tmp['latin_accents'];
- $tmp['valid_subdomain'] = '(?>(?:[' . $tmp['domain_valid_chars'] . '][' . $tmp['domain_valid_chars'] . '\-_]*)?[' . $tmp['domain_valid_chars'] . ']\.)';
- $tmp['valid_domain_name'] = '(?:(?:[' . $tmp['domain_valid_chars'] . '][' . $tmp['domain_valid_chars'] . '\-]*)?[' . $tmp['domain_valid_chars'] . ']\.)';
- $tmp['domain_valid_unicode_chars'] = '[^\p{P}\p{Z}\p{C}' . $tmp['invalid_characters'] . $tmp['spaces'] . ']';
+ $tmp['domain_valid_chars'] = '0-9a-z'.$tmp['latin_accents'];
+ $tmp['valid_subdomain'] = '(?>(?:['.$tmp['domain_valid_chars'].']['.$tmp['domain_valid_chars'].'\-_]*)?['.$tmp['domain_valid_chars'].']\.)';
+ $tmp['valid_domain_name'] = '(?:(?:['.$tmp['domain_valid_chars'].']['.$tmp['domain_valid_chars'].'\-]*)?['.$tmp['domain_valid_chars'].']\.)';
+ $tmp['domain_valid_unicode_chars'] = '[^\p{P}\p{Z}\p{C}'.$tmp['invalid_characters'].$tmp['spaces'].']';
$gTLD = 'abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active|actor|ads|adult|aeg|aero|afl|agency|aig|airforce|airtel|allfinanz|alsace|amsterdam|android|apartments|app|aquarelle|archi|army|arpa|asia|associates|attorney|auction|audio|auto|autos|axa|azure|band|bank|bar|barcelona|barclaycard|barclays|bargains|bauhaus|bayern|bbc|bbva|bcn|beer|bentley|berlin|best|bet|bharti|bible|bid|bike|bing|bingo|bio|biz|black|blackfriday|bloomberg|blue|bmw|bnl|bnpparibas|boats|bond|boo|boots|boutique|bradesco|bridgestone|broker|brother|brussels|budapest|build|builders|business|buzz|bzh|cab|cafe|cal|camera|camp|cancerresearch|canon|capetown|capital|caravan|cards|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cba|cbn|ceb|center|ceo|cern|cfa|cfd|chanel|channel|chat|cheap|chloe|christmas|chrome|church|cisco|citic|city|claims|cleaning|click|clinic|clothing|cloud|club|coach|codes|coffee|college|cologne|com|commbank|community|company|computer|condos|construction|consulting|contractors|cooking|cool|coop|corsica|country|coupons|courses|credit|creditcard|cricket|crown|crs|cruises|cuisinella|cymru|cyou|dabur|dad|dance|date|dating|datsun|day|dclk|deals|degree|delivery|delta|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory|discount|dnp|docs|dog|doha|domains|doosan|download|drive|durban|dvag|earth|eat|edu|education|email|emerck|energy|engineer|engineering|enterprises|epson|equipment|erni|esq|estate|eurovision|eus|events|everbank|exchange|expert|exposed|express|fage|fail|faith|family|fan|fans|farm|fashion|feedback|film|finance|financial|firmdale|fish|fishing|fit|fitness|flights|florist|flowers|flsmidth|fly|foo|football|forex|forsale|forum|foundation|frl|frogans|fund|furniture|futbol|fyi|gal|gallery|game|garden|gbiz|gdn|gent|genting|ggee|gift|gifts|gives|giving|glass|gle|global|globo|gmail|gmo|gmx|gold|goldpoint|golf|goo|goog|google|gop|gov|graphics|gratis|green|gripe|group|guge|guide|guitars|guru|hamburg|hangout|haus|healthcare|help|here|hermes|hiphop|hitachi|hiv|hockey|holdings|holiday|homedepot|homes|honda|horse|host|hosting|hoteles|hotmail|house|how|hsbc|ibm|icbc|ice|icu|ifm|iinet|immo|immobilien|industries|infiniti|info|ing|ink|institute|insure|int|international|investments|ipiranga|irish|ist|istanbul|itau|iwc|java|jcb|jetzt|jewelry|jlc|jll|jobs|joburg|jprs|juegos|kaufen|kddi|kim|kitchen|kiwi|koeln|komatsu|krd|kred|kyoto|lacaixa|lancaster|land|lasalle|lat|latrobe|law|lawyer|lds|lease|leclerc|legal|lexus|lgbt|liaison|lidl|life|lighting|limited|limo|link|live|lixil|loan|loans|lol|london|lotte|lotto|love|ltda|lupin|luxe|luxury|madrid|maif|maison|man|management|mango|market|marketing|markets|marriott|mba|media|meet|melbourne|meme|memorial|men|menu|miami|microsoft|mil|mini|mma|mobi|moda|moe|mom|monash|money|montblanc|mormon|mortgage|moscow|motorcycles|mov|movie|movistar|mtn|mtpc|museum|nadex|nagoya|name|navy|nec|net|netbank|network|neustar|new|news|nexus|ngo|nhk|nico|ninja|nissan|nokia|nra|nrw|ntt|nyc|office|okinawa|omega|one|ong|onl|online|ooo|oracle|orange|org|organic|osaka|otsuka|ovh|page|panerai|paris|partners|parts|party|pet|pharmacy|philips|photo|photography|photos|physio|piaget|pics|pictet|pictures|pink|pizza|place|play|plumbing|plus|pohl|poker|porn|post|praxi|press|pro|prod|productions|prof|properties|property|pub|qpon|quebec|racing|realtor|realty|recipes|red|redstone|rehab|reise|reisen|reit|ren|rent|rentals|repair|report|republican|rest|restaurant|review|reviews|rich|ricoh|rio|rip|rocks|rodeo|rsvp|ruhr|run|ryukyu|saarland|sakura|sale|samsung|sandvik|sandvikcoromant|sanofi|sap|sarl|saxo|sca|scb|schmidt|scholarships|school|schule|schwarz|science|scor|scot|seat|seek|sener|services|sew|sex|sexy|shiksha|shoes|show|shriram|singles|site|ski|sky|skype|sncf|soccer|social|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting|srl|starhub|statoil|studio|study|style|sucks|supplies|supply|support|surf|surgery|suzuki|swatch|swiss|sydney|systems|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica|temasek|tennis|thd|theater|tickets|tienda|tips|tires|tirol|today|tokyo|tools|top|toray|toshiba|tours|town|toyota|toys|trade|trading|training|travel|trust|tui|ubs|university|uno|uol|vacations|vegas|ventures|vermögensberater|vermögensberatung|versicherung|vet|viajes|video|villas|vin|vision|vista|vistaprint|vlaanderen|vodka|vote|voting|voto|voyage|wales|walter|wang|watch|webcam|website|wed|wedding|weir|whoswho|wien|wiki|williamhill|win|windows|wine|wme|work|works|world|wtc|wtf|xbox|xerox|xin|xperia|xxx|xyz|yachts|yandex|yodobashi|yoga|yokohama|youtube|zip|zone|zuerich|дети|ком|москва|онлайн|орг|рус|сайт|קום|بازار|شبكة|كوم|موقع|कॉम|नेट|संगठन|คอม|みんな|グーグル|コム|世界|中信|中文网|企业|佛山|信息|健康|八卦|公司|公益|商城|商店|商标|在线|大拿|娱乐|工行|广东|慈善|我爱你|手机|政务|政府|新闻|时尚|机构|淡马锡|游戏|点看|移动|组织机构|网址|网店|网络|谷歌|集团|飞利浦|餐厅|닷넷|닷컴|삼성|onion';
$ccTLD = '한국|香港|澳門|新加坡|台灣|台湾|中國|中国|გე|ไทย|ලංකා|ഭാരതം|ಭಾರತ|భారత్|சிங்கப்பூர்|இலங்கை|இந்தியா|ଭାରତ|ભારત|ਭਾਰਤ|ভাৰত|ভারত|বাংলা|भारोत|भारतम्|भारत|ڀارت|پاکستان|مليسيا|مصر|قطر|فلسطين|عمان|عراق|سورية|سودان|تونس|بھارت|بارت|ایران|امارات|المغرب|السعودية|الجزائر|الاردن|հայ|қаз|укр|срб|рф|мон|мкд|ею|бел|бг|ελ|zw|zm|za|yt|ye|ws|wf|vu|vn|vi|vg|ve|vc|va|uz|uy|us|um|uk|ug|ua|tz|tw|tv|tt|tr|tp|to|tn|tm|tl|tk|tj|th|tg|tf|td|tc|sz|sy|sx|sv|su|st|ss|sr|so|sn|sm|sl|sk|sj|si|sh|sg|se|sd|sc|sb|sa|rw|ru|rs|ro|re|qa|py|pw|pt|ps|pr|pn|pm|pl|pk|ph|pg|pf|pe|pa|om|nz|nu|nr|np|no|nl|ni|ng|nf|ne|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|mn|mm|ml|mk|mh|mg|mf|me|md|mc|ma|ly|lv|lu|lt|ls|lr|lk|li|lc|lb|la|kz|ky|kw|kr|kp|kn|km|ki|kh|kg|ke|jp|jo|jm|je|it|is|ir|iq|io|in|im|il|ie|id|hu|ht|hr|hn|hm|hk|gy|gw|gu|gt|gs|gr|gq|gp|gn|gm|gl|gi|gh|gg|gf|ge|gd|gb|ga|fr|fo|fm|fk|fj|fi|eu|et|es|er|eh|eg|ee|ec|dz|do|dm|dk|dj|de|cz|cy|cx|cw|cv|cu|cr|co|cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|bz|by|bw|bv|bt|bs|br|bq|bo|bn|bm|bl|bj|bi|bh|bg|bf|be|bd|bb|ba|az|ax|aw|au|at|as|ar|aq|ao|an|am|al|ai|ag|af|ae|ad|ac';
- $tmp['valid_gTLD'] = '(?:(?:' . $gTLD . ')(?=[^0-9a-z@]|$))';
- $tmp['valid_ccTLD'] = '(?:(?:' . $ccTLD . ')(?=[^0-9a-z@]|$))';
- $tmp['valid_special_ccTLD'] = '(?:(?:' . 'co|tv' . ')(?=[^0-9a-z@]|$))';
+ $tmp['valid_gTLD'] = '(?:(?:'.$gTLD.')(?=[^0-9a-z@]|$))';
+ $tmp['valid_ccTLD'] = '(?:(?:'.$ccTLD.')(?=[^0-9a-z@]|$))';
+ $tmp['valid_special_ccTLD'] = '(?:(?:'.'co|tv'.')(?=[^0-9a-z@]|$))';
$tmp['valid_punycode'] = '(?:xn--[0-9a-z]+)';
$tmp['valid_domain'] = '(?:' // subdomains + domain + TLD
- . $tmp['valid_subdomain'] . '+' . $tmp['valid_domain_name'] // e.g. www.twitter.com, foo.co.jp, bar.co.uk
- . '(?:' . $tmp['valid_gTLD'] . '|' . $tmp['valid_ccTLD'] . '|' . $tmp['valid_punycode'] . '))'
- . '|(?:' // domain + gTLD | some ccTLD
- . $tmp['valid_domain_name'] // e.g. twitter.com
- . '(?:' . $tmp['valid_gTLD'] . '|' . $tmp['valid_punycode'] . '|' . $tmp['valid_special_ccTLD'] . ')'
- . ')'
- . '|(?:(?:(?<=http:\/\/)|(?<=https:\/\/))'
- . '(?:'
- . '(?:' . $tmp['valid_domain_name'] . $tmp['valid_ccTLD'] . ')' // protocol + domain + ccTLD
- . '|(?:' // protocol + unicode domain + TLD
- . $tmp['domain_valid_unicode_chars'] . '+\.'
- . '(?:' . $tmp['valid_gTLD'] . '|' . $tmp['valid_ccTLD'] . ')'
- . ')'
- . ')'
- . ')'
- . '|(?:' // domain + ccTLD + '/'
- . $tmp['valid_domain_name'] . $tmp['valid_ccTLD'] . '(?=\/)' // e.g. t.co/
- . ')';
- # Used by the extractor:
- $re['valid_ascii_domain'] = '/' . $tmp['valid_subdomain'] . '*' . $tmp['valid_domain_name'] . '(?:' . $tmp['valid_gTLD'] . '|' . $tmp['valid_ccTLD'] . '|' . $tmp['valid_punycode'] . ')/iu';
+ .$tmp['valid_subdomain'].'+'.$tmp['valid_domain_name'] // e.g. www.twitter.com, foo.co.jp, bar.co.uk
+ .'(?:'.$tmp['valid_gTLD'].'|'.$tmp['valid_ccTLD'].'|'.$tmp['valid_punycode'].'))'
+ .'|(?:' // domain + gTLD | some ccTLD
+ .$tmp['valid_domain_name'] // e.g. twitter.com
+ .'(?:'.$tmp['valid_gTLD'].'|'.$tmp['valid_punycode'].'|'.$tmp['valid_special_ccTLD'].')'
+ .')'
+ .'|(?:(?:(?<=http:\/\/)|(?<=https:\/\/))'
+ .'(?:'
+ .'(?:'.$tmp['valid_domain_name'].$tmp['valid_ccTLD'].')' // protocol + domain + ccTLD
+ .'|(?:' // protocol + unicode domain + TLD
+ .$tmp['domain_valid_unicode_chars'].'+\.'
+ .'(?:'.$tmp['valid_gTLD'].'|'.$tmp['valid_ccTLD'].')'
+ .')'
+ .')'
+ .')'
+ .'|(?:' // domain + ccTLD + '/'
+ .$tmp['valid_domain_name'].$tmp['valid_ccTLD'].'(?=\/)' // e.g. t.co/
+ .')';
+ // Used by the extractor:
+ $re['valid_ascii_domain'] = '/'.$tmp['valid_subdomain'].'*'.$tmp['valid_domain_name'].'(?:'.$tmp['valid_gTLD'].'|'.$tmp['valid_ccTLD'].'|'.$tmp['valid_punycode'].')/iu';
- # Used by the extractor for stricter t.co URL extraction:
+ // Used by the extractor for stricter t.co URL extraction:
$re['valid_tco_url'] = '/^https?:\/\/t\.co\/[a-z0-9]+/iu';
- # Used by the extractor to filter out unwanted URLs:
- $re['invalid_short_domain'] = '/\A' . $tmp['valid_domain_name'] . $tmp['valid_ccTLD'] . '\Z/iu';
- $re['valid_special_short_domain'] = '/\A' . $tmp['valid_domain_name'] . $tmp['valid_special_ccTLD'] . '\Z/iu';
+ // Used by the extractor to filter out unwanted URLs:
+ $re['invalid_short_domain'] = '/\A'.$tmp['valid_domain_name'].$tmp['valid_ccTLD'].'\Z/iu';
+ $re['valid_special_short_domain'] = '/\A'.$tmp['valid_domain_name'].$tmp['valid_special_ccTLD'].'\Z/iu';
$re['invalid_url_without_protocol_preceding_chars'] = '/[\-_.\/]\z/iu';
$tmp['valid_port_number'] = '[0-9]+';
- $tmp['valid_general_url_path_chars'] = '[a-z\p{Cyrillic}0-9!\*;:=\+\,\.\$\/%#\[\]\-_~&|@' . $tmp['latin_accents'] . ']';
- # Allow URL paths to contain up to two nested levels of balanced parentheses:
- # 1. Used in Wikipedia URLs, e.g. /Primer_(film)
- # 2. Used in IIS sessions, e.g. /S(dfd346)/
- # 3. Used in Rdio URLs like /track/We_Up_(Album_Version_(Edited))/
+ $tmp['valid_general_url_path_chars'] = '[a-z\p{Cyrillic}0-9!\*;:=\+\,\.\$\/%#\[\]\-_~&|@'.$tmp['latin_accents'].']';
+ // Allow URL paths to contain up to two nested levels of balanced parentheses:
+ // 1. Used in Wikipedia URLs, e.g. /Primer_(film)
+ // 2. Used in IIS sessions, e.g. /S(dfd346)/
+ // 3. Used in Rdio URLs like /track/We_Up_(Album_Version_(Edited))/
$tmp['valid_url_balanced_parens'] = '(?:\('
- . '(?:' . $tmp['valid_general_url_path_chars'] . '+'
- . '|'
+ .'(?:'.$tmp['valid_general_url_path_chars'].'+'
+ .'|'
// allow one nested level of balanced parentheses
- . '(?:'
- . $tmp['valid_general_url_path_chars'] . '*'
- . '\(' . $tmp['valid_general_url_path_chars'] . '+' . '\)'
- . $tmp['valid_general_url_path_chars'] . '*'
- . ')'
- . ')'
- . '\))';
- # Valid end-of-path characters (so /foo. does not gobble the period).
- # 1. Allow = for empty URL parameters and other URL-join artifacts.
- $tmp['valid_url_path_ending_chars'] = '[a-z\p{Cyrillic}0-9=_#\/\+\-' . $tmp['latin_accents'] . ']|(?:' . $tmp['valid_url_balanced_parens'] . ')';
+ .'(?:'
+ .$tmp['valid_general_url_path_chars'].'*'
+ .'\('.$tmp['valid_general_url_path_chars'].'+'.'\)'
+ .$tmp['valid_general_url_path_chars'].'*'
+ .')'
+ .')'
+ .'\))';
+ // Valid end-of-path characters (so /foo. does not gobble the period).
+ // 1. Allow = for empty URL parameters and other URL-join artifacts.
+ $tmp['valid_url_path_ending_chars'] = '[a-z\p{Cyrillic}0-9=_#\/\+\-'.$tmp['latin_accents'].']|(?:'.$tmp['valid_url_balanced_parens'].')';
$tmp['valid_url_path'] = '(?:(?:'
- . $tmp['valid_general_url_path_chars'] . '*(?:'
- . $tmp['valid_url_balanced_parens'] . ' '
- . $tmp['valid_general_url_path_chars'] . '*)*'
- . $tmp['valid_url_path_ending_chars'] . ')|(?:@'
- . $tmp['valid_general_url_path_chars'] . '+\/))';
+ .$tmp['valid_general_url_path_chars'].'*(?:'
+ .$tmp['valid_url_balanced_parens'].' '
+ .$tmp['valid_general_url_path_chars'].'*)*'
+ .$tmp['valid_url_path_ending_chars'].')|(?:@'
+ .$tmp['valid_general_url_path_chars'].'+\/))';
$tmp['valid_url_query_chars'] = '[a-z0-9!?\*\'\(\);:&=\+\$\/%#\[\]\-_\.,~|@]';
$tmp['valid_url_query_ending_chars'] = '[a-z0-9_&=#\/\-]';
- $re['valid_url'] = '/(?:' # $1 Complete match (preg_match() already matches everything.)
- . '(' . $tmp['valid_url_preceding_chars'] . ')' # $2 Preceding characters
- . '(' # $3 Complete URL
- . '(https?:\/\/)?' # $4 Protocol (optional)
- . '(' . $tmp['valid_domain'] . ')' # $5 Domain(s)
- . '(?::(' . $tmp['valid_port_number'] . '))?' # $6 Port number (optional)
- . '(\/' . $tmp['valid_url_path'] . '*)?' # $7 URL Path
- . '(\?' . $tmp['valid_url_query_chars'] . '*' . $tmp['valid_url_query_ending_chars'] . ')?' # $8 Query String
- . ')'
- . ')/iux';
+ $re['valid_url'] = '/(?:' // $1 Complete match (preg_match() already matches everything.)
+ .'('.$tmp['valid_url_preceding_chars'].')' // $2 Preceding characters
+ .'(' // $3 Complete URL
+ .'(https?:\/\/)?' // $4 Protocol (optional)
+ .'('.$tmp['valid_domain'].')' // $5 Domain(s)
+ .'(?::('.$tmp['valid_port_number'].'))?' // $6 Port number (optional)
+ .'(\/'.$tmp['valid_url_path'].'*)?' // $7 URL Path
+ .'(\?'.$tmp['valid_url_query_chars'].'*'.$tmp['valid_url_query_ending_chars'].')?' // $8 Query String
+ .')'
+ .')/iux';
$tmp['cash_signs'] = '\$';
$tmp['cashtag'] = '[a-z]{1,6}(?:[._][a-z]{1,2})?';
- $re['valid_cashtag'] = '/(^|[' . $tmp['spaces'] . '])([' . $tmp['cash_signs'] . '])(' . $tmp['cashtag'] . ')(?=($|\s|[[:punct:]]))/iu';
- $re['end_cashtag_match'] = '/\A(?:[' . $tmp['cash_signs'] . ']|:\/\/)/u';
+ $re['valid_cashtag'] = '/(^|['.$tmp['spaces'].'])(['.$tmp['cash_signs'].'])('.$tmp['cashtag'].')(?=($|\s|[[:punct:]]))/iu';
+ $re['end_cashtag_match'] = '/\A(?:['.$tmp['cash_signs'].']|:\/\/)/u';
- # These URL validation pattern strings are based on the ABNF from RFC 3986
+ // These URL validation pattern strings are based on the ABNF from RFC 3986
$tmp['validate_url_unreserved'] = '[a-z\p{Cyrillic}0-9\-._~]';
$tmp['validate_url_pct_encoded'] = '(?:%[0-9a-f]{2})';
$tmp['validate_url_sub_delims'] = '[!$&\'()*+,;=]';
- $tmp['validate_url_pchar'] = '(?:' . $tmp['validate_url_unreserved'] . '|' . $tmp['validate_url_pct_encoded'] . '|' . $tmp['validate_url_sub_delims'] . '|[:\|@])'; #/iox
+ $tmp['validate_url_pchar'] = '(?:'.$tmp['validate_url_unreserved'].'|'.$tmp['validate_url_pct_encoded'].'|'.$tmp['validate_url_sub_delims'].'|[:\|@])'; ///iox
- $tmp['validate_url_userinfo'] = '(?:' . $tmp['validate_url_unreserved'] . '|' . $tmp['validate_url_pct_encoded'] . '|' . $tmp['validate_url_sub_delims'] . '|:)*'; #/iox
+ $tmp['validate_url_userinfo'] = '(?:'.$tmp['validate_url_unreserved'].'|'.$tmp['validate_url_pct_encoded'].'|'.$tmp['validate_url_sub_delims'].'|:)*'; ///iox
- $tmp['validate_url_dec_octet'] = '(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'; #/i
- $tmp['validate_url_ipv4'] = '(?:' . $tmp['validate_url_dec_octet'] . '(?:\.' . $tmp['validate_url_dec_octet'] . '){3})'; #/iox
- # Punting on real IPv6 validation for now
- $tmp['validate_url_ipv6'] = '(?:\[[a-f0-9:\.]+\])'; #/i
- # Also punting on IPvFuture for now
- $tmp['validate_url_ip'] = '(?:' . $tmp['validate_url_ipv4'] . '|' . $tmp['validate_url_ipv6'] . ')'; #/iox
- # This is more strict than the rfc specifies
- $tmp['validate_url_subdomain_segment'] = '(?:[a-z0-9](?:[a-z0-9_\-]*[a-z0-9])?)'; #/i
- $tmp['validate_url_domain_segment'] = '(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)'; #/i
- $tmp['validate_url_domain_tld'] = '(?:[a-z](?:[a-z0-9\-]*[a-z0-9])?)'; #/i
- $tmp['validate_url_domain'] = '(?:(?:' . $tmp['validate_url_subdomain_segment'] . '\.)*(?:' . $tmp['validate_url_domain_segment'] . '\.)' . $tmp['validate_url_domain_tld'] . ')'; #/iox
+ $tmp['validate_url_dec_octet'] = '(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'; ///i
+ $tmp['validate_url_ipv4'] = '(?:'.$tmp['validate_url_dec_octet'].'(?:\.'.$tmp['validate_url_dec_octet'].'){3})'; ///iox
+ // Punting on real IPv6 validation for now
+ $tmp['validate_url_ipv6'] = '(?:\[[a-f0-9:\.]+\])'; ///i
+ // Also punting on IPvFuture for now
+ $tmp['validate_url_ip'] = '(?:'.$tmp['validate_url_ipv4'].'|'.$tmp['validate_url_ipv6'].')'; ///iox
+ // This is more strict than the rfc specifies
+ $tmp['validate_url_subdomain_segment'] = '(?:[a-z0-9](?:[a-z0-9_\-]*[a-z0-9])?)'; ///i
+ $tmp['validate_url_domain_segment'] = '(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)'; ///i
+ $tmp['validate_url_domain_tld'] = '(?:[a-z](?:[a-z0-9\-]*[a-z0-9])?)'; ///i
+ $tmp['validate_url_domain'] = '(?:(?:'.$tmp['validate_url_subdomain_segment'].'\.)*(?:'.$tmp['validate_url_domain_segment'].'\.)'.$tmp['validate_url_domain_tld'].')'; ///iox
- $tmp['validate_url_host'] = '(?:' . $tmp['validate_url_ip'] . '|' . $tmp['validate_url_domain'] . ')'; #/iox
- # Unencoded internationalized domains - this doesn't check for invalid UTF-8 sequences
- $tmp['validate_url_unicode_subdomain_segment'] = '(?:(?:[a-z0-9]|[^\x00-\x7f])(?:(?:[a-z0-9_\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; #/ix
- $tmp['validate_url_unicode_domain_segment'] = '(?:(?:[a-z0-9]|[^\x00-\x7f])(?:(?:[a-z0-9\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; #/ix
- $tmp['validate_url_unicode_domain_tld'] = '(?:(?:[a-z]|[^\x00-\x7f])(?:(?:[a-z0-9\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; #/ix
- $tmp['validate_url_unicode_domain'] = '(?:(?:' . $tmp['validate_url_unicode_subdomain_segment'] . '\.)*(?:' . $tmp['validate_url_unicode_domain_segment'] . '\.)' . $tmp['validate_url_unicode_domain_tld'] . ')'; #/iox
+ $tmp['validate_url_host'] = '(?:'.$tmp['validate_url_ip'].'|'.$tmp['validate_url_domain'].')'; ///iox
+ // Unencoded internationalized domains - this doesn't check for invalid UTF-8 sequences
+ $tmp['validate_url_unicode_subdomain_segment'] = '(?:(?:[a-z0-9]|[^\x00-\x7f])(?:(?:[a-z0-9_\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; ///ix
+ $tmp['validate_url_unicode_domain_segment'] = '(?:(?:[a-z0-9]|[^\x00-\x7f])(?:(?:[a-z0-9\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; ///ix
+ $tmp['validate_url_unicode_domain_tld'] = '(?:(?:[a-z]|[^\x00-\x7f])(?:(?:[a-z0-9\-]|[^\x00-\x7f])*(?:[a-z0-9]|[^\x00-\x7f]))?)'; ///ix
+ $tmp['validate_url_unicode_domain'] = '(?:(?:'.$tmp['validate_url_unicode_subdomain_segment'].'\.)*(?:'.$tmp['validate_url_unicode_domain_segment'].'\.)'.$tmp['validate_url_unicode_domain_tld'].')'; ///iox
- $tmp['validate_url_unicode_host'] = '(?:' . $tmp['validate_url_ip'] . '|' . $tmp['validate_url_unicode_domain'] . ')'; #/iox
+ $tmp['validate_url_unicode_host'] = '(?:'.$tmp['validate_url_ip'].'|'.$tmp['validate_url_unicode_domain'].')'; ///iox
$tmp['validate_url_port'] = '[0-9]{1,5}';
$re['validate_url_unicode_authority'] = '/'
- . '(?:(' . $tmp['validate_url_userinfo'] . ')@)?' # $1 userinfo
- . '(' . $tmp['validate_url_unicode_host'] . ')' # $2 host
- . '(?::(' . $tmp['validate_url_port'] . '))?' # $3 port
- . '/iux';
+ .'(?:('.$tmp['validate_url_userinfo'].')@)?' // $1 userinfo
+ .'('.$tmp['validate_url_unicode_host'].')' // $2 host
+ .'(?::('.$tmp['validate_url_port'].'))?' // $3 port
+ .'/iux';
$re['validate_url_authority'] = '/'
- . '(?:(' . $tmp['validate_url_userinfo'] . ')@)?' # $1 userinfo
- . '(' . $tmp['validate_url_host'] . ')' # $2 host
- . '(?::(' . $tmp['validate_url_port'] . '))?' # $3 port
- . '/ix';
+ .'(?:('.$tmp['validate_url_userinfo'].')@)?' // $1 userinfo
+ .'('.$tmp['validate_url_host'].')' // $2 host
+ .'(?::('.$tmp['validate_url_port'].'))?' // $3 port
+ .'/ix';
$re['validate_url_scheme'] = '/(?:[a-z][a-z0-9+\-.]*)/i';
- $re['validate_url_path'] = '/(\/' . $tmp['validate_url_pchar'] . '*)*/iu';
- $re['validate_url_query'] = '/(' . $tmp['validate_url_pchar'] . '|\/|\?)*/iu';
- $re['validate_url_fragment'] = '/(' . $tmp['validate_url_pchar'] . '|\/|\?)*/iu';
+ $re['validate_url_path'] = '/(\/'.$tmp['validate_url_pchar'].'*)*/iu';
+ $re['validate_url_query'] = '/('.$tmp['validate_url_pchar'].'|\/|\?)*/iu';
+ $re['validate_url_fragment'] = '/('.$tmp['validate_url_pchar'].'|\/|\?)*/iu';
- # Modified version of RFC 3986 Appendix B
- $re['validate_url_unencoded'] = '/^' # Full URL
- . '(?:'
- . '([^:\/?#]+):\/\/' # $1 Scheme
- . ')?'
- . '([^\/?#]*)' # $2 Authority
- . '([^?#]*)' # $3 Path
- . '(?:'
- . '\?([^#]*)' # $4 Query
- . ')?'
- . '(?:'
- . '\#(.*)' # $5 Fragment
- . ')?$/iux';
+ // Modified version of RFC 3986 Appendix B
+ $re['validate_url_unencoded'] = '/^' // Full URL
+ .'(?:'
+ .'([^:\/?#]+):\/\/' // $1 Scheme
+ .')?'
+ .'([^\/?#]*)' // $2 Authority
+ .'([^?#]*)' // $3 Path
+ .'(?:'
+ .'\?([^#]*)' // $4 Query
+ .')?'
+ .'(?:'
+ .'\#(.*)' // $5 Fragment
+ .')?$/iux';
- $re['invalid_characters'] = '/[' . $tmp['invalid_characters'] . ']/u';
+ $re['invalid_characters'] = '/['.$tmp['invalid_characters'].']/u';
- $re['rtl_chars'] = '/[' . $tmp['rtl_chars'] . ']/iu';
+ $re['rtl_chars'] = '/['.$tmp['rtl_chars'].']/iu';
- # Flag that initialization is complete:
+ // Flag that initialization is complete:
$initialized = true;
}
}
-# Cause regular expressions to be initialized as soon as this file is loaded:
+// Cause regular expressions to be initialized as soon as this file is loaded:
Regex::__static();
diff --git a/app/Util/Lexer/RestrictedNames.php b/app/Util/Lexer/RestrictedNames.php
index c2a851b1b..1bd67e81f 100644
--- a/app/Util/Lexer/RestrictedNames.php
+++ b/app/Util/Lexer/RestrictedNames.php
@@ -2,180 +2,179 @@
namespace App\Util\Lexer;
-class RestrictedNames {
-
- static $blacklist = [
- "about",
- "abuse",
- "administrator",
- "app",
- "autoconfig",
- "blog",
- "broadcasthost",
- "community",
- "contact",
- "contact-us",
- "contact_us",
- "copyright",
- "d",
- "dashboard",
- "dev",
- "developer",
- "developers",
- "discover",
- "discovers",
- "doc",
- "docs",
- "download",
- "domainadmin",
- "domainadministrator",
- "email",
- "errors",
- "events",
- "example",
- "faq",
- "faqs",
- "features",
- "ftp",
- "guest",
- "guests",
- "help",
- "hostmaster",
- "hostmaster",
- "image",
- "images",
- "imap",
- "img",
- "info",
- "info",
- "is",
- "isatap",
- "it",
- "localdomain",
- "localhost",
- "mail",
- "mailer-daemon",
- "mailerdaemon",
- "marketing",
- "me",
- "media",
- "mis",
- "mx",
- "new",
- "news",
- "news",
- "no-reply",
- "nobody",
- "noc",
- "noreply",
- "ns0",
- "ns1",
- "ns2",
- "ns3",
- "ns4",
- "ns5",
- "ns6",
- "ns7",
- "ns8",
- "ns9",
- "owner",
- "pop",
- "pop3",
- "postmaster",
- "pricing",
- "privacy",
- "root",
- "sales",
- "security",
- "signin",
- "signout",
- "smtp",
- "src",
- "ssladmin",
- "ssladministrator",
- "sslwebmaster",
- "status",
- "support",
- "support",
- "sys",
- "sysadmin",
- "system",
- "terms",
- "tutorial",
- "tutorials",
- "usenet",
- "uucp",
- "webmaster",
- "wpad",
- "www"
+class RestrictedNames
+{
+ public static $blacklist = [
+ 'about',
+ 'abuse',
+ 'administrator',
+ 'app',
+ 'autoconfig',
+ 'blog',
+ 'broadcasthost',
+ 'community',
+ 'contact',
+ 'contact-us',
+ 'contact_us',
+ 'copyright',
+ 'd',
+ 'dashboard',
+ 'dev',
+ 'developer',
+ 'developers',
+ 'discover',
+ 'discovers',
+ 'doc',
+ 'docs',
+ 'download',
+ 'domainadmin',
+ 'domainadministrator',
+ 'email',
+ 'errors',
+ 'events',
+ 'example',
+ 'faq',
+ 'faqs',
+ 'features',
+ 'ftp',
+ 'guest',
+ 'guests',
+ 'help',
+ 'hostmaster',
+ 'hostmaster',
+ 'image',
+ 'images',
+ 'imap',
+ 'img',
+ 'info',
+ 'info',
+ 'is',
+ 'isatap',
+ 'it',
+ 'localdomain',
+ 'localhost',
+ 'mail',
+ 'mailer-daemon',
+ 'mailerdaemon',
+ 'marketing',
+ 'me',
+ 'media',
+ 'mis',
+ 'mx',
+ 'new',
+ 'news',
+ 'news',
+ 'no-reply',
+ 'nobody',
+ 'noc',
+ 'noreply',
+ 'ns0',
+ 'ns1',
+ 'ns2',
+ 'ns3',
+ 'ns4',
+ 'ns5',
+ 'ns6',
+ 'ns7',
+ 'ns8',
+ 'ns9',
+ 'owner',
+ 'pop',
+ 'pop3',
+ 'postmaster',
+ 'pricing',
+ 'privacy',
+ 'root',
+ 'sales',
+ 'security',
+ 'signin',
+ 'signout',
+ 'smtp',
+ 'src',
+ 'ssladmin',
+ 'ssladministrator',
+ 'sslwebmaster',
+ 'status',
+ 'support',
+ 'support',
+ 'sys',
+ 'sysadmin',
+ 'system',
+ 'terms',
+ 'tutorial',
+ 'tutorials',
+ 'usenet',
+ 'uucp',
+ 'webmaster',
+ 'wpad',
+ 'www',
];
- static $reserved = [
+ public static $reserved = [
// Reserved for instance admin
- "admin",
+ 'admin',
// Static Assets
- "assets",
- "storage",
+ 'assets',
+ 'storage',
// Laravel Horizon
- "horizon",
+ 'horizon',
// Reserved routes
- "account",
- "api",
- "auth",
- "css",
- "c",
- "i",
- "dashboard",
- "deck",
- "discover",
- "docs",
- "fonts",
- "home",
- "img",
- "js",
- "login",
- "logout",
- "media",
- "p",
- "password",
- "report",
- "reports",
- "search",
- "settings",
- "statuses",
- "site",
- "sites",
- "timeline",
- "timelines",
- "tour",
- "user",
- "users",
- "vendor",
- "400",
- "401",
- "403",
- "404",
- "500",
- "503",
- "504",
+ 'account',
+ 'api',
+ 'auth',
+ 'css',
+ 'c',
+ 'i',
+ 'dashboard',
+ 'deck',
+ 'discover',
+ 'docs',
+ 'fonts',
+ 'home',
+ 'img',
+ 'js',
+ 'login',
+ 'logout',
+ 'media',
+ 'p',
+ 'password',
+ 'report',
+ 'reports',
+ 'search',
+ 'settings',
+ 'statuses',
+ 'site',
+ 'sites',
+ 'timeline',
+ 'timelines',
+ 'tour',
+ 'user',
+ 'users',
+ 'vendor',
+ '400',
+ '401',
+ '403',
+ '404',
+ '500',
+ '503',
+ '504',
];
- public static function get()
- {
-
- $reserved = $blacklist = [];
+ public static function get()
+ {
+ $reserved = $blacklist = [];
- if(true == config('pixelfed.restricted_names.use_blacklist')) {
- $blacklist = self::$blacklist;
- }
+ if (true == config('pixelfed.restricted_names.use_blacklist')) {
+ $blacklist = self::$blacklist;
+ }
- if(true == config('pixelfed.restricted_names.reserved_routes')) {
- $reserved = self::$reserved;
- }
- return array_merge($blacklist, $reserved);
- }
+ if (true == config('pixelfed.restricted_names.reserved_routes')) {
+ $reserved = self::$reserved;
+ }
-}
\ No newline at end of file
+ return array_merge($blacklist, $reserved);
+ }
+}
diff --git a/app/Util/Lexer/StringUtils.php b/app/Util/Lexer/StringUtils.php
index 88722d158..b7d99cf40 100755
--- a/app/Util/Lexer/StringUtils.php
+++ b/app/Util/Lexer/StringUtils.php
@@ -4,29 +4,27 @@
* @author Takashi Nojima
* @copyright Copyright 2014, Takashi Nojima
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
/**
- * String utility
+ * String utility.
*
* @author Takashi Nojima
* @copyright Copyright 2014, Takashi Nojima
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter
*/
class StringUtils
{
-
/**
- * alias of mb_substr
+ * alias of mb_substr.
*
* @param string $str
- * @param integer $start
- * @param integer $length
+ * @param int $start
+ * @param int $length
* @param string $encoding
+ *
* @return string
*/
public static function substr($str, $start, $length = null, $encoding = 'UTF-8')
@@ -35,15 +33,17 @@ class StringUtils
// for PHP <= 5.4.7
$length = mb_strlen($str, $encoding);
}
+
return mb_substr($str, $start, $length, $encoding);
}
/**
- * alias of mb_strlen
+ * alias of mb_strlen.
*
* @param string $str
* @param string $encoding
- * @return integer
+ *
+ * @return int
*/
public static function strlen($str, $encoding = 'UTF-8')
{
@@ -51,13 +51,14 @@ class StringUtils
}
/**
- * alias of mb_strpos
+ * alias of mb_strpos.
*
* @param string $haystack
* @param string $needle
- * @param integer $offset
+ * @param int $offset
* @param string $encoding
- * @return integer
+ *
+ * @return int
*/
public static function strpos($haystack, $needle, $offset = 0, $encoding = 'UTF-8')
{
@@ -67,13 +68,13 @@ class StringUtils
/**
* A multibyte-aware substring replacement function.
*
- * @param string $string The string to modify.
- * @param string $replacement The replacement string.
- * @param int $start The start of the replacement.
- * @param int $length The number of characters to replace.
- * @param string $encoding The encoding of the string.
+ * @param string $string The string to modify.
+ * @param string $replacement The replacement string.
+ * @param int $start The start of the replacement.
+ * @param int $length The number of characters to replace.
+ * @param string $encoding The encoding of the string.
*
- * @return string The modified string.
+ * @return string The modified string.
*
* @see http://www.php.net/manual/en/function.substr-replace.php#90146
*/
@@ -97,8 +98,10 @@ class StringUtils
$suffixOffset = $start + $length;
$suffixLength = $string_length - $start - $length;
- return static::substr($string, 0, $start, $encoding) . $replacement . static::substr($string, $suffixOffset, $suffixLength, $encoding);
+
+ return static::substr($string, 0, $start, $encoding).$replacement.static::substr($string, $suffixOffset, $suffixLength, $encoding);
}
+
return (is_null($length) === true) ? substr_replace($string, $replacement, $start) : substr_replace($string, $replacement, $start, $length);
}
}
diff --git a/app/Util/Lexer/Validator.php b/app/Util/Lexer/Validator.php
index ddfb2c5f6..a4a07efd7 100755
--- a/app/Util/Lexer/Validator.php
+++ b/app/Util/Lexer/Validator.php
@@ -4,17 +4,12 @@
* @author Nick Pope
* @copyright Copyright © 2010, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
namespace App\Util\Lexer;
-use App\Util\Lexer\Regex;
-use App\Util\Lexer\Extractor;
-use App\Util\Lexer\StringUtils;
-
/**
- * Twitter Validator Class
+ * Twitter Validator Class.
*
* Performs "validation" on tweets.
*
@@ -25,34 +20,31 @@ use App\Util\Lexer\StringUtils;
* @author Nick Pope
* @copyright Copyright © 2010, Nick Pope
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0
- * @package Twitter.Text
*/
class Validator extends Regex
{
-
/**
* The maximum length of a tweet.
*
- * @var int
+ * @var int
*/
const MAX_LENGTH = 140;
/**
- * The length of a short URL beginning with http:
+ * The length of a short URL beginning with http:.
*
- * @var int
+ * @var int
*/
protected $short_url_length = 23;
/**
- * The length of a short URL beginning with http:
+ * The length of a short URL beginning with http:.
*
- * @var int
+ * @var int
*/
protected $short_url_length_https = 23;
/**
- *
* @var Extractor
*/
protected $extractor = null;
@@ -60,12 +52,12 @@ class Validator extends Regex
/**
* Provides fluent method chaining.
*
- * @param string $tweet The tweet to be validated.
- * @param mixed $config Setup short URL length from Twitter API /help/configuration response.
+ * @param string $tweet The tweet to be validated.
+ * @param mixed $config Setup short URL length from Twitter API /help/configuration response.
*
* @see __construct()
*
- * @return Validator
+ * @return Validator
*/
public static function create($tweet = null, $config = null)
{
@@ -75,7 +67,7 @@ class Validator extends Regex
/**
* Reads in a tweet to be parsed and validates it.
*
- * @param string $tweet The tweet to validate.
+ * @param string $tweet The tweet to validate.
*/
public function __construct($tweet = null, $config = null)
{
@@ -87,10 +79,12 @@ class Validator extends Regex
}
/**
- * Setup short URL length from Twitter API /help/configuration response
+ * Setup short URL length from Twitter API /help/configuration response.
*
* @param mixed $config
+ *
* @return Validator
+ *
* @link https://dev.twitter.com/docs/api/1/get/help/configuration
*/
public function setConfiguration($config)
@@ -117,19 +111,21 @@ class Validator extends Regex
}
/**
- * Set the length of a short URL beginning with http:
+ * Set the length of a short URL beginning with http:.
*
* @param mixed $length
+ *
* @return Validator
*/
public function setShortUrlLength($length)
{
$this->short_url_length = intval($length);
+
return $this;
}
/**
- * Get the length of a short URL beginning with http:
+ * Get the length of a short URL beginning with http:.
*
* @return int
*/
@@ -139,19 +135,21 @@ class Validator extends Regex
}
/**
- * Set the length of a short URL beginning with https:
+ * Set the length of a short URL beginning with https:.
*
* @param mixed $length
+ *
* @return Validator
*/
public function setShortUrlLengthHttps($length)
{
$this->short_url_length_https = intval($length);
+
return $this;
}
/**
- * Get the length of a short URL beginning with https:
+ * Get the length of a short URL beginning with https:.
*
* @return int
*/
@@ -164,7 +162,8 @@ class Validator extends Regex
* Check whether a tweet is valid.
*
* @param string $tweet The tweet to validate.
- * @return boolean Whether the tweet is valid.
+ *
+ * @return bool Whether the tweet is valid.
*/
public function isValidTweetText($tweet = null)
{
@@ -181,13 +180,15 @@ class Validator extends Regex
if (preg_match(self::$patterns['invalid_characters'], $tweet)) {
return false;
}
+
return true;
}
/**
* Check whether a tweet is valid.
*
- * @return boolean Whether the tweet is valid.
+ * @return bool Whether the tweet is valid.
+ *
* @deprecated since version 1.1.0
*/
public function validateTweet()
@@ -199,7 +200,8 @@ class Validator extends Regex
* Check whether a username is valid.
*
* @param string $username The username to validate.
- * @return boolean Whether the username is valid.
+ *
+ * @return bool Whether the username is valid.
*/
public function isValidUsername($username = null)
{
@@ -211,13 +213,15 @@ class Validator extends Regex
return false;
}
$extracted = $this->extractor->extractMentionedScreennames($username);
+
return count($extracted) === 1 && $extracted[0] === substr($username, 1);
}
/**
* Check whether a username is valid.
*
- * @return boolean Whether the username is valid.
+ * @return bool Whether the username is valid.
+ *
* @deprecated since version 1.1.0
*/
public function validateUsername()
@@ -229,7 +233,8 @@ class Validator extends Regex
* Check whether a list is valid.
*
* @param string $list The list name to validate.
- * @return boolean Whether the list is valid.
+ *
+ * @return bool Whether the list is valid.
*/
public function isValidList($list = null)
{
@@ -242,13 +247,15 @@ class Validator extends Regex
}
preg_match(self::$patterns['valid_mentions_or_lists'], $list, $matches);
$matches = array_pad($matches, 5, '');
+
return isset($matches) && $matches[1] === '' && $matches[4] && !empty($matches[4]) && $matches[5] === '';
}
/**
* Check whether a list is valid.
*
- * @return boolean Whether the list is valid.
+ * @return bool Whether the list is valid.
+ *
* @deprecated since version 1.1.0
*/
public function validateList()
@@ -260,7 +267,8 @@ class Validator extends Regex
* Check whether a hashtag is valid.
*
* @param string $hashtag The hashtag to validate.
- * @return boolean Whether the hashtag is valid.
+ *
+ * @return bool Whether the hashtag is valid.
*/
public function isValidHashtag($hashtag = null)
{
@@ -272,13 +280,15 @@ class Validator extends Regex
return false;
}
$extracted = $this->extractor->extractHashtags($hashtag);
+
return count($extracted) === 1 && $extracted[0] === substr($hashtag, 1);
}
/**
* Check whether a hashtag is valid.
*
- * @return boolean Whether the hashtag is valid.
+ * @return bool Whether the hashtag is valid.
+ *
* @deprecated since version 1.1.0
*/
public function validateHashtag()
@@ -289,11 +299,11 @@ class Validator extends Regex
/**
* Check whether a URL is valid.
*
- * @param string $url The url to validate.
- * @param boolean $unicode_domains Consider the domain to be unicode.
- * @param boolean $require_protocol Require a protocol for valid domain?
+ * @param string $url The url to validate.
+ * @param bool $unicode_domains Consider the domain to be unicode.
+ * @param bool $require_protocol Require a protocol for valid domain?
*
- * @return boolean Whether the URL is valid.
+ * @return bool Whether the URL is valid.
*/
public function isValidURL($url = null, $unicode_domains = true, $require_protocol = true)
{
@@ -310,25 +320,27 @@ class Validator extends Regex
return false;
}
list($scheme, $authority, $path, $query, $fragment) = array_pad($matches, 5, '');
- # Check scheme, path, query, fragment:
+ // Check scheme, path, query, fragment:
if (($require_protocol && !(
self::isValidMatch($scheme, self::$patterns['validate_url_scheme']) && preg_match('/^https?$/i', $scheme))
) || !self::isValidMatch($path, self::$patterns['validate_url_path']) || !self::isValidMatch($query, self::$patterns['validate_url_query'], true)
|| !self::isValidMatch($fragment, self::$patterns['validate_url_fragment'], true)) {
return false;
}
- # Check authority:
+ // Check authority:
$authority_pattern = $unicode_domains ? 'validate_url_unicode_authority' : 'validate_url_authority';
+
return self::isValidMatch($authority, self::$patterns[$authority_pattern]);
}
/**
* Check whether a URL is valid.
*
- * @param boolean $unicode_domains Consider the domain to be unicode.
- * @param boolean $require_protocol Require a protocol for valid domain?
+ * @param bool $unicode_domains Consider the domain to be unicode.
+ * @param bool $require_protocol Require a protocol for valid domain?
+ *
+ * @return bool Whether the URL is valid.
*
- * @return boolean Whether the URL is valid.
* @deprecated since version 1.1.0
*/
public function validateURL($unicode_domains = true, $require_protocol = true)
@@ -340,7 +352,8 @@ class Validator extends Regex
* Determines the length of a tweet. Takes shortening of URLs into account.
*
* @param string $tweet The tweet to validate.
- * @return int the length of a tweet.
+ *
+ * @return int the length of a tweet.
*/
public function getTweetLength($tweet = null)
{
@@ -353,13 +366,15 @@ class Validator extends Regex
$length += $x['indices'][0] - $x['indices'][1];
$length += stripos($x['url'], 'https://') === 0 ? $this->short_url_length_https : $this->short_url_length;
}
+
return $length;
}
/**
* Determines the length of a tweet. Takes shortening of URLs into account.
*
- * @return int the length of a tweet.
+ * @return int the length of a tweet.
+ *
* @deprecated since version 1.1.0
*/
public function getLength()
@@ -370,17 +385,17 @@ class Validator extends Regex
/**
* A helper function to check for a valid match. Used in URL validation.
*
- * @param string $string The subject string to test.
- * @param string $pattern The pattern to match against.
- * @param boolean $optional Whether a match is compulsory or not.
+ * @param string $string The subject string to test.
+ * @param string $pattern The pattern to match against.
+ * @param bool $optional Whether a match is compulsory or not.
*
- * @return boolean Whether an exact match was found.
+ * @return bool Whether an exact match was found.
*/
protected static function isValidMatch($string, $pattern, $optional = false)
{
$found = preg_match($pattern, $string, $matches);
if (!$optional) {
- return (($string || $string === '') && $found && $matches[0] === $string);
+ return ($string || $string === '') && $found && $matches[0] === $string;
} else {
return !(($string || $string === '') && (!$found || $matches[0] !== $string));
}
diff --git a/app/Util/Media/Image.php b/app/Util/Media/Image.php
index 236fc5c42..a0a16f522 100644
--- a/app/Util/Media/Image.php
+++ b/app/Util/Media/Image.php
@@ -2,151 +2,145 @@
namespace App\Util\Media;
-use Storage;
use App\Media;
use Image as Intervention;
+use Storage;
-class Image {
+class Image
+{
+ public $square;
+ public $landscape;
+ public $portrait;
+ public $thumbnail;
+ public $orientation;
- public $square;
- public $landscape;
- public $portrait;
- public $thumbnail;
- public $orientation;
+ public function __construct()
+ {
+ ini_set('memory_limit', config('pixelfed.memory_limit', '1024M'));
-
- public function __construct()
- {
- ini_set('memory_limit', config('pixelfed.memory_limit', '1024M'));
-
- $this->square = $this->orientations()['square'];
- $this->landscape = $this->orientations()['landscape'];
- $this->portrait = $this->orientations()['portrait'];
- $this->thumbnail = [
- 'width' => 293,
- 'height' => 293
+ $this->square = $this->orientations()['square'];
+ $this->landscape = $this->orientations()['landscape'];
+ $this->portrait = $this->orientations()['portrait'];
+ $this->thumbnail = [
+ 'width' => 293,
+ 'height' => 293,
];
- $this->orientation = null;
- }
+ $this->orientation = null;
+ }
- public function orientations()
- {
- return [
+ public function orientations()
+ {
+ return [
'square' => [
- 'width' => 1080,
- 'height' => 1080
+ 'width' => 1080,
+ 'height' => 1080,
],
'landscape' => [
- 'width' => 1920,
- 'height' => 1080
+ 'width' => 1920,
+ 'height' => 1080,
],
'portrait' => [
- 'width' => 1080,
- 'height' => 1350
- ]
+ 'width' => 1080,
+ 'height' => 1350,
+ ],
];
- }
-
- public function getAspectRatio($mediaPath, $thumbnail = false)
- {
- if(!is_file($mediaPath)) {
- throw new \Exception('Invalid Media Path');
- }
- if($thumbnail) {
- return [
- 'dimensions' => $this->thumbnail,
- 'orientation' => 'thumbnail'
- ];
}
- list($width, $height) = getimagesize($mediaPath);
- $aspect = $width / $height;
- $orientation = $aspect === 1 ? 'square' :
- ($aspect > 1 ? 'landscape' : 'portrait');
- $this->orientation = $orientation;
- return [
- 'dimensions' => $this->orientations()[$orientation],
- 'orientation' => $orientation
- ];
- }
-
- public function resizeImage(Media $media)
- {
- $basePath = storage_path('app/' . $media->media_path);
-
- $this->handleResizeImage($media);
- return;
- }
-
- public function resizeThumbnail(Media $media)
- {
- $basePath = storage_path('app/' . $media->media_path);
-
- $this->handleThumbnailImage($media);
- return;
- }
-
- public function handleResizeImage(Media $media)
- {
- $this->handleImageTransform($media, false);
- }
-
- public function handleThumbnailImage(Media $media)
- {
- $this->handleImageTransform($media, true);
- }
-
- public function handleImageTransform(Media $media, $thumbnail = false)
- {
- $path = $media->media_path;
- $file = storage_path('app/'.$path);
- $ratio = $this->getAspectRatio($file, $thumbnail);
- $aspect = $ratio['dimensions'];
- $orientation = $ratio['orientation'];
- if($media->mime === 'image/gif' && !$thumbnail)
+ public function getAspectRatio($mediaPath, $thumbnail = false)
{
- return;
+ if (!is_file($mediaPath)) {
+ throw new \Exception('Invalid Media Path');
+ }
+ if ($thumbnail) {
+ return [
+ 'dimensions' => $this->thumbnail,
+ 'orientation' => 'thumbnail',
+ ];
+ }
+
+ list($width, $height) = getimagesize($mediaPath);
+ $aspect = $width / $height;
+ $orientation = $aspect === 1 ? 'square' :
+ ($aspect > 1 ? 'landscape' : 'portrait');
+ $this->orientation = $orientation;
+
+ return [
+ 'dimensions' => $this->orientations()[$orientation],
+ 'orientation' => $orientation,
+ ];
}
- try {
- $img = Intervention::make($file)->orientate();
- $img->resize($aspect['width'], $aspect['height'], function ($constraint) {
- $constraint->aspectRatio();
- });
- $converted = $this->setBaseName($path, $thumbnail, $img->extension);
- $newPath = storage_path('app/'.$converted['path']);
-
- $quality = config('pixelfed.image_quality');
- $img->save($newPath, $quality);
-
- if(!$thumbnail) {
- $media->orientation = $orientation;
- }
+ public function resizeImage(Media $media)
+ {
+ $basePath = storage_path('app/'.$media->media_path);
- if($thumbnail == true) {
- $media->thumbnail_path = $converted['path'];
- $media->thumbnail_url = url(Storage::url($converted['path']));
- } else {
- $media->media_path = $converted['path'];
- $media->mime = $img->mime;
- }
-
- $media->save();
-
- } catch (Exception $e) {
-
+ $this->handleResizeImage($media);
}
- }
- public function setBaseName($basePath, $thumbnail = false, $extension)
- {
- $png = false;
- $path = explode('.', $basePath);
- $name = ($thumbnail == true) ? $path[0] . '_thumb' : $path[0];
- $ext = last($path);
- $basePath = "{$name}.{$ext}";
+ public function resizeThumbnail(Media $media)
+ {
+ $basePath = storage_path('app/'.$media->media_path);
- return ['path' => $basePath, 'png' => $png];
- }
+ $this->handleThumbnailImage($media);
+ }
-}
\ No newline at end of file
+ public function handleResizeImage(Media $media)
+ {
+ $this->handleImageTransform($media, false);
+ }
+
+ public function handleThumbnailImage(Media $media)
+ {
+ $this->handleImageTransform($media, true);
+ }
+
+ public function handleImageTransform(Media $media, $thumbnail = false)
+ {
+ $path = $media->media_path;
+ $file = storage_path('app/'.$path);
+ $ratio = $this->getAspectRatio($file, $thumbnail);
+ $aspect = $ratio['dimensions'];
+ $orientation = $ratio['orientation'];
+ if ($media->mime === 'image/gif' && !$thumbnail) {
+ return;
+ }
+
+ try {
+ $img = Intervention::make($file)->orientate();
+ $img->resize($aspect['width'], $aspect['height'], function ($constraint) {
+ $constraint->aspectRatio();
+ });
+ $converted = $this->setBaseName($path, $thumbnail, $img->extension);
+ $newPath = storage_path('app/'.$converted['path']);
+
+ $quality = config('pixelfed.image_quality');
+ $img->save($newPath, $quality);
+
+ if (!$thumbnail) {
+ $media->orientation = $orientation;
+ }
+
+ if ($thumbnail == true) {
+ $media->thumbnail_path = $converted['path'];
+ $media->thumbnail_url = url(Storage::url($converted['path']));
+ } else {
+ $media->media_path = $converted['path'];
+ $media->mime = $img->mime;
+ }
+
+ $media->save();
+ } catch (Exception $e) {
+ }
+ }
+
+ public function setBaseName($basePath, $thumbnail, $extension)
+ {
+ $png = false;
+ $path = explode('.', $basePath);
+ $name = ($thumbnail == true) ? $path[0].'_thumb' : $path[0];
+ $ext = last($path);
+ $basePath = "{$name}.{$ext}";
+
+ return ['path' => $basePath, 'png' => $png];
+ }
+}
diff --git a/app/Util/Webfinger/Webfinger.php b/app/Util/Webfinger/Webfinger.php
index cae3108a1..e8f10c31c 100644
--- a/app/Util/Webfinger/Webfinger.php
+++ b/app/Util/Webfinger/Webfinger.php
@@ -2,79 +2,76 @@
namespace App\Util\Webfinger;
-use App\User;
-use App\Util\Lexer\Nickname;
+class Webfinger
+{
+ public $user;
+ public $subject;
+ public $aliases;
+ public $links;
-class Webfinger {
+ public function __construct($user)
+ {
+ $this->user = $user;
+ $this->subject = '';
+ $this->aliases = [];
+ $this->links = [];
+ }
- public $user;
- public $subject;
- public $aliases;
- public $links;
+ public function setSubject()
+ {
+ $host = parse_url(config('app.url'), PHP_URL_HOST);
+ $username = $this->user->username;
- public function __construct($user)
- {
- $this->user = $user;
- $this->subject = '';
- $this->aliases = array();
- $this->links = array();
- }
+ $this->subject = 'acct:'.$username.'@'.$host;
- public function setSubject()
- {
- $host = parse_url(config('app.url'), PHP_URL_HOST);
- $username = $this->user->username;
+ return $this;
+ }
- $this->subject = 'acct:'.$username.'@'.$host;
- return $this;
- }
-
- public function generateAliases()
- {
- $this->aliases = [
+ public function generateAliases()
+ {
+ $this->aliases = [
$this->user->url(),
- $this->user->permalink()
+ $this->user->permalink(),
];
- return $this;
- }
- public function generateLinks()
- {
- $user = $this->user;
+ return $this;
+ }
- $this->links = [
+ public function generateLinks()
+ {
+ $user = $this->user;
+
+ $this->links = [
[
- 'rel' => 'http://webfinger.net/rel/profile-page',
+ 'rel' => 'http://webfinger.net/rel/profile-page',
'type' => 'text/html',
- 'href' => $user->url()
+ 'href' => $user->url(),
],
[
- 'rel' => 'http://schemas.google.com/g/2010#updates-from',
+ 'rel' => 'http://schemas.google.com/g/2010#updates-from',
'type' => 'application/atom+xml',
- 'href' => $user->permalink('.atom')
+ 'href' => $user->permalink('.atom'),
],
[
- 'rel' => 'self',
+ 'rel' => 'self',
'type' => 'application/activity+json',
- 'href' => $user->permalink()
- ]
+ 'href' => $user->permalink(),
+ ],
];
- return $this;
- }
- public function generate()
- {
- $this->setSubject();
- $this->generateAliases();
- $this->generateLinks();
+ return $this;
+ }
- return [
+ public function generate()
+ {
+ $this->setSubject();
+ $this->generateAliases();
+ $this->generateLinks();
+
+ return [
'subject' => $this->subject,
'aliases' => $this->aliases,
- 'links' => $this->links
+ 'links' => $this->links,
];
- }
-
-
-
-}
\ No newline at end of file
+ }
+}
diff --git a/app/Util/Webfinger/WebfingerUrl.php b/app/Util/Webfinger/WebfingerUrl.php
index 2eb21c3b8..ede4e4942 100644
--- a/app/Util/Webfinger/WebfingerUrl.php
+++ b/app/Util/Webfinger/WebfingerUrl.php
@@ -2,18 +2,17 @@
namespace App\Util\Webfinger;
-use App\User;
use App\Util\Lexer\Nickname;
-class WebfingerUrl {
+class WebfingerUrl
+{
+ public static function generateWebfingerUrl($url)
+ {
+ $url = Nickname::normalizeProfileUrl($url);
+ $domain = $url['domain'];
+ $username = $url['username'];
+ $path = "https://{$domain}/.well-known/webfinger?resource={$username}@{$domain}";
- public static function generateWebfingerUrl($url)
- {
- $url = Nickname::normalizeProfileUrl($url);
- $domain = $url['domain'];
- $username = $url['username'];
- $path = "https://{$domain}/.well-known/webfinger?resource={$username}@{$domain}";
- return $path;
- }
-
-}
\ No newline at end of file
+ return $path;
+ }
+}
diff --git a/config/app.php b/config/app.php
index b426fa531..52e27a3c1 100644
--- a/config/app.php
+++ b/config/app.php
@@ -177,41 +177,41 @@ return [
'aliases' => [
- 'App' => Illuminate\Support\Facades\App::class,
- 'Artisan' => Illuminate\Support\Facades\Artisan::class,
- 'Auth' => Illuminate\Support\Facades\Auth::class,
- 'Blade' => Illuminate\Support\Facades\Blade::class,
- 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
- 'Bus' => Illuminate\Support\Facades\Bus::class,
- 'Cache' => Illuminate\Support\Facades\Cache::class,
- 'Config' => Illuminate\Support\Facades\Config::class,
- 'Cookie' => Illuminate\Support\Facades\Cookie::class,
- 'Crypt' => Illuminate\Support\Facades\Crypt::class,
- 'DB' => Illuminate\Support\Facades\DB::class,
- 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
- 'Event' => Illuminate\Support\Facades\Event::class,
- 'File' => Illuminate\Support\Facades\File::class,
- 'Gate' => Illuminate\Support\Facades\Gate::class,
- 'Hash' => Illuminate\Support\Facades\Hash::class,
- 'Lang' => Illuminate\Support\Facades\Lang::class,
- 'Log' => Illuminate\Support\Facades\Log::class,
- 'Mail' => Illuminate\Support\Facades\Mail::class,
+ 'App' => Illuminate\Support\Facades\App::class,
+ 'Artisan' => Illuminate\Support\Facades\Artisan::class,
+ 'Auth' => Illuminate\Support\Facades\Auth::class,
+ 'Blade' => Illuminate\Support\Facades\Blade::class,
+ 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
+ 'Bus' => Illuminate\Support\Facades\Bus::class,
+ 'Cache' => Illuminate\Support\Facades\Cache::class,
+ 'Config' => Illuminate\Support\Facades\Config::class,
+ 'Cookie' => Illuminate\Support\Facades\Cookie::class,
+ 'Crypt' => Illuminate\Support\Facades\Crypt::class,
+ 'DB' => Illuminate\Support\Facades\DB::class,
+ 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
+ 'Event' => Illuminate\Support\Facades\Event::class,
+ 'File' => Illuminate\Support\Facades\File::class,
+ 'Gate' => Illuminate\Support\Facades\Gate::class,
+ 'Hash' => Illuminate\Support\Facades\Hash::class,
+ 'Lang' => Illuminate\Support\Facades\Lang::class,
+ 'Log' => Illuminate\Support\Facades\Log::class,
+ 'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
- 'Password' => Illuminate\Support\Facades\Password::class,
- 'Queue' => Illuminate\Support\Facades\Queue::class,
- 'Redirect' => Illuminate\Support\Facades\Redirect::class,
- 'Redis' => Illuminate\Support\Facades\Redis::class,
- 'Request' => Illuminate\Support\Facades\Request::class,
- 'Response' => Illuminate\Support\Facades\Response::class,
- 'Route' => Illuminate\Support\Facades\Route::class,
- 'Schema' => Illuminate\Support\Facades\Schema::class,
- 'Session' => Illuminate\Support\Facades\Session::class,
- 'Storage' => Illuminate\Support\Facades\Storage::class,
- 'URL' => Illuminate\Support\Facades\URL::class,
- 'Validator' => Illuminate\Support\Facades\Validator::class,
- 'View' => Illuminate\Support\Facades\View::class,
+ 'Password' => Illuminate\Support\Facades\Password::class,
+ 'Queue' => Illuminate\Support\Facades\Queue::class,
+ 'Redirect' => Illuminate\Support\Facades\Redirect::class,
+ 'Redis' => Illuminate\Support\Facades\Redis::class,
+ 'Request' => Illuminate\Support\Facades\Request::class,
+ 'Response' => Illuminate\Support\Facades\Response::class,
+ 'Route' => Illuminate\Support\Facades\Route::class,
+ 'Schema' => Illuminate\Support\Facades\Schema::class,
+ 'Session' => Illuminate\Support\Facades\Session::class,
+ 'Storage' => Illuminate\Support\Facades\Storage::class,
+ 'URL' => Illuminate\Support\Facades\URL::class,
+ 'Validator' => Illuminate\Support\Facades\Validator::class,
+ 'View' => Illuminate\Support\Facades\View::class,
- 'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
+ 'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class,
'DotenvEditor' => Jackiedo\DotenvEditor\Facades\DotenvEditor::class,
],
diff --git a/config/auth.php b/config/auth.php
index 781750102..a9264b4a2 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -14,7 +14,7 @@ return [
*/
'defaults' => [
- 'guard' => 'web',
+ 'guard' => 'web',
'passwords' => 'users',
],
@@ -37,12 +37,12 @@ return [
'guards' => [
'web' => [
- 'driver' => 'session',
+ 'driver' => 'session',
'provider' => 'users',
],
'api' => [
- 'driver' => 'token',
+ 'driver' => 'token',
'provider' => 'users',
],
],
@@ -67,7 +67,7 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
- 'model' => App\User::class,
+ 'model' => App\User::class,
],
// 'users' => [
@@ -94,8 +94,8 @@ return [
'passwords' => [
'users' => [
'provider' => 'users',
- 'table' => 'password_resets',
- 'expire' => 60,
+ 'table' => 'password_resets',
+ 'expire' => 60,
],
],
diff --git a/config/backup.php b/config/backup.php
index a1fc9bd98..802a2ed76 100644
--- a/config/backup.php
+++ b/config/backup.php
@@ -117,9 +117,9 @@ return [
*/
'monitorBackups' => [
[
- 'name' => config('app.name'),
- 'disks' => ['local'],
- 'newestBackupsShouldNotBeOlderThanDays' => 1,
+ 'name' => config('app.name'),
+ 'disks' => ['local'],
+ 'newestBackupsShouldNotBeOlderThanDays' => 1,
'storageUsedMayNotBeHigherThanMegabytes' => 5000,
],
diff --git a/config/broadcasting.php b/config/broadcasting.php
index 3ca45eaa8..1e0044fed 100644
--- a/config/broadcasting.php
+++ b/config/broadcasting.php
@@ -31,18 +31,18 @@ return [
'connections' => [
'pusher' => [
- 'driver' => 'pusher',
- 'key' => env('PUSHER_APP_KEY'),
- 'secret' => env('PUSHER_APP_SECRET'),
- 'app_id' => env('PUSHER_APP_ID'),
+ 'driver' => 'pusher',
+ 'key' => env('PUSHER_APP_KEY'),
+ 'secret' => env('PUSHER_APP_SECRET'),
+ 'app_id' => env('PUSHER_APP_ID'),
'options' => [
- 'cluster' => env('PUSHER_APP_CLUSTER'),
+ 'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
'redis' => [
- 'driver' => 'redis',
+ 'driver' => 'redis',
'connection' => 'default',
],
diff --git a/config/cache.php b/config/cache.php
index 7045c4f30..93190d5bb 100644
--- a/config/cache.php
+++ b/config/cache.php
@@ -39,20 +39,20 @@ return [
],
'database' => [
- 'driver' => 'database',
- 'table' => 'cache',
+ 'driver' => 'database',
+ 'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
- 'path' => storage_path('framework/cache/data'),
+ 'path' => storage_path('framework/cache/data'),
],
'memcached' => [
- 'driver' => 'memcached',
+ 'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
- 'sasl' => [
+ 'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
@@ -61,8 +61,8 @@ return [
],
'servers' => [
[
- 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
- 'port' => env('MEMCACHED_PORT', 11211),
+ 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
+ 'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
@@ -73,9 +73,9 @@ return [
'client' => 'predis',
'default' => [
- 'host' => env('REDIS_HOST', 'localhost'),
+ 'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
- 'port' => env('REDIS_PORT', 6379),
+ 'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE', 0),
],
diff --git a/config/database.php b/config/database.php
index cab5d068f..2d4e8f818 100644
--- a/config/database.php
+++ b/config/database.php
@@ -34,48 +34,48 @@ return [
'connections' => [
'sqlite' => [
- 'driver' => 'sqlite',
+ 'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
- 'prefix' => '',
+ 'prefix' => '',
],
'mysql' => [
- 'driver' => 'mysql',
- 'host' => env('DB_HOST', '127.0.0.1'),
- 'port' => env('DB_PORT', '3306'),
- 'database' => env('DB_DATABASE', 'forge'),
- 'username' => env('DB_USERNAME', 'forge'),
- 'password' => env('DB_PASSWORD', ''),
+ 'driver' => 'mysql',
+ 'host' => env('DB_HOST', '127.0.0.1'),
+ 'port' => env('DB_PORT', '3306'),
+ 'database' => env('DB_DATABASE', 'forge'),
+ 'username' => env('DB_USERNAME', 'forge'),
+ 'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
- 'charset' => 'utf8mb4',
- 'collation' => 'utf8mb4_unicode_ci',
- 'prefix' => '',
- 'strict' => true,
- 'engine' => null,
+ 'charset' => 'utf8mb4',
+ 'collation' => 'utf8mb4_unicode_ci',
+ 'prefix' => '',
+ 'strict' => true,
+ 'engine' => null,
],
'pgsql' => [
- 'driver' => 'pgsql',
- 'host' => env('DB_HOST', '127.0.0.1'),
- 'port' => env('DB_PORT', '5432'),
+ 'driver' => 'pgsql',
+ 'host' => env('DB_HOST', '127.0.0.1'),
+ 'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
- 'charset' => 'utf8',
- 'prefix' => '',
- 'schema' => 'public',
- 'sslmode' => 'prefer',
+ 'charset' => 'utf8',
+ 'prefix' => '',
+ 'schema' => 'public',
+ 'sslmode' => 'prefer',
],
'sqlsrv' => [
- 'driver' => 'sqlsrv',
- 'host' => env('DB_HOST', 'localhost'),
- 'port' => env('DB_PORT', '1433'),
+ 'driver' => 'sqlsrv',
+ 'host' => env('DB_HOST', 'localhost'),
+ 'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
- 'charset' => 'utf8',
- 'prefix' => '',
+ 'charset' => 'utf8',
+ 'prefix' => '',
],
],
@@ -109,9 +109,9 @@ return [
'client' => 'predis',
'default' => [
- 'host' => env('REDIS_HOST', '127.0.0.1'),
+ 'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
- 'port' => env('REDIS_PORT', 6379),
+ 'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
diff --git a/config/debugbar.php b/config/debugbar.php
index 4fada2da2..589c18916 100644
--- a/config/debugbar.php
+++ b/config/debugbar.php
@@ -9,13 +9,13 @@ return [
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
- |
+ |
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
'enabled' => env('DEBUGBAR_ENABLED', false),
- 'except' => [
+ 'except' => [
//
],
@@ -36,7 +36,7 @@ return [
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
- 'provider' => '' // Instance of StorageInterface for custom driver
+ 'provider' => '', // Instance of StorageInterface for custom driver
],
/*
@@ -66,7 +66,7 @@ return [
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
- 'capture_ajax' => true,
+ 'capture_ajax' => true,
'add_ajax_timing' => false,
/*
@@ -79,7 +79,7 @@ return [
|
*/
'error_handler' => false,
-
+
/*
|--------------------------------------------------------------------------
| Clockwork integration
@@ -141,26 +141,26 @@ return [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
- 'explain' => [ // Show EXPLAIN output on queries
+ 'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
- 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
+ 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
'mail' => [
- 'full_log' => false
+ 'full_log' => false,
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
- 'label' => true // show complete route on bar
+ 'label' => true, // show complete route on bar
],
'logs' => [
- 'file' => null
+ 'file' => null,
],
'cache' => [
- 'values' => true // collect cache values
+ 'values' => true, // collect cache values
],
],
diff --git a/config/dotenv-editor.php b/config/dotenv-editor.php
index 583039c63..fb7ea4e34 100644
--- a/config/dotenv-editor.php
+++ b/config/dotenv-editor.php
@@ -1,6 +1,6 @@
base_path('storage/dotenv-editor/backups/')
+ 'backupPath' => base_path('storage/dotenv-editor/backups/'),
-);
+];
diff --git a/config/filesystems.php b/config/filesystems.php
index 77fa5ded1..ab75dc28b 100644
--- a/config/filesystems.php
+++ b/config/filesystems.php
@@ -45,23 +45,23 @@ return [
'local' => [
'driver' => 'local',
- 'root' => storage_path('app'),
+ 'root' => storage_path('app'),
],
'public' => [
- 'driver' => 'local',
- 'root' => storage_path('app/public'),
- 'url' => env('APP_URL').'/storage',
+ 'driver' => 'local',
+ 'root' => storage_path('app/public'),
+ 'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
- 'key' => env('AWS_ACCESS_KEY_ID'),
+ 'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
- 'url' => env('AWS_URL'),
+ 'url' => env('AWS_URL'),
],
],
diff --git a/config/hashids.php b/config/hashids.php
index b77c4853c..ae2857556 100644
--- a/config/hashids.php
+++ b/config/hashids.php
@@ -40,12 +40,12 @@ return [
'connections' => [
'main' => [
- 'salt' => env("APP_HASHID_SALT", "v3MsJ1Hgnlma8YPrD3f4sW6vAn6zLnkuh6vOpKnR5IKkLqDGIk7TCADS2igpEN4ADrtXkkzV2E8HBfzpz7BreDzQqVOYDMeb4cJ1xhDhDwDeicZVUPyrxihHDaMWpTsP"),
+ 'salt' => env('APP_HASHID_SALT', 'v3MsJ1Hgnlma8YPrD3f4sW6vAn6zLnkuh6vOpKnR5IKkLqDGIk7TCADS2igpEN4ADrtXkkzV2E8HBfzpz7BreDzQqVOYDMeb4cJ1xhDhDwDeicZVUPyrxihHDaMWpTsP'),
'length' => '24',
],
'alternative' => [
- 'salt' => 'your-salt-string',
+ 'salt' => 'your-salt-string',
'length' => 'your-length-integer',
],
diff --git a/config/hashing.php b/config/hashing.php
index f3332edea..6ea081a61 100644
--- a/config/hashing.php
+++ b/config/hashing.php
@@ -44,9 +44,9 @@ return [
*/
'argon' => [
- 'memory' => 1024,
+ 'memory' => 1024,
'threads' => 2,
- 'time' => 2,
+ 'time' => 2,
],
];
diff --git a/config/horizon.php b/config/horizon.php
index 68fbf60b8..1b150d9f4 100644
--- a/config/horizon.php
+++ b/config/horizon.php
@@ -74,20 +74,20 @@ return [
'production' => [
'supervisor-1' => [
'connection' => 'redis',
- 'queue' => ['default'],
- 'balance' => 'simple',
- 'processes' => 20,
- 'tries' => 3,
+ 'queue' => ['default'],
+ 'balance' => 'simple',
+ 'processes' => 20,
+ 'tries' => 3,
],
],
'local' => [
'supervisor-1' => [
'connection' => 'redis',
- 'queue' => ['default'],
- 'balance' => 'simple',
- 'processes' => 10,
- 'tries' => 3,
+ 'queue' => ['default'],
+ 'balance' => 'simple',
+ 'processes' => 10,
+ 'tries' => 3,
],
],
],
diff --git a/config/image-optimizer.php b/config/image-optimizer.php
index 6e97d8eff..dbbacad8f 100644
--- a/config/image-optimizer.php
+++ b/config/image-optimizer.php
@@ -1,10 +1,10 @@
'gd'
+ 'driver' => 'gd',
];
diff --git a/config/logging.php b/config/logging.php
index 400bc7f46..e09f049e2 100644
--- a/config/logging.php
+++ b/config/logging.php
@@ -34,47 +34,47 @@ return [
'channels' => [
'stack' => [
- 'driver' => 'stack',
+ 'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
- 'path' => storage_path('logs/laravel.log'),
- 'level' => 'debug',
+ 'path' => storage_path('logs/laravel.log'),
+ 'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
- 'path' => storage_path('logs/laravel.log'),
- 'level' => 'debug',
- 'days' => 7,
+ 'path' => storage_path('logs/laravel.log'),
+ 'level' => 'debug',
+ 'days' => 7,
],
'slack' => [
- 'driver' => 'slack',
- 'url' => env('LOG_SLACK_WEBHOOK_URL'),
+ 'driver' => 'slack',
+ 'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
- 'emoji' => ':boom:',
- 'level' => 'critical',
+ 'emoji' => ':boom:',
+ 'level' => 'critical',
],
'stderr' => [
- 'driver' => 'monolog',
+ 'driver' => 'monolog',
'handler' => StreamHandler::class,
- 'with' => [
+ 'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
- 'level' => 'debug',
+ 'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
- 'level' => 'debug',
+ 'level' => 'debug',
],
],
diff --git a/config/mail.php b/config/mail.php
index bb92224c5..0951a33fd 100644
--- a/config/mail.php
+++ b/config/mail.php
@@ -57,7 +57,7 @@ return [
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
- 'name' => env('MAIL_FROM_NAME', 'Example'),
+ 'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
diff --git a/config/partialcache.php b/config/partialcache.php
index b51517cf8..7dce620b0 100644
--- a/config/partialcache.php
+++ b/config/partialcache.php
@@ -11,7 +11,7 @@ return [
// The base key that used for cache items
'key' => 'partialcache',
- // The default cache duration in minutes, set null to remember forever
- 'default_duration' => null
+ // The default cache duration in minutes, set null to remember forever
+ 'default_duration' => null,
];
diff --git a/config/pixelfed.php b/config/pixelfed.php
index 775b0bd3b..196571661 100644
--- a/config/pixelfed.php
+++ b/config/pixelfed.php
@@ -12,7 +12,7 @@ return [
*/
'domain' => [
'admin' => env('ADMIN_DOMAIN'),
- 'app' => env('APP_DOMAIN'),
+ 'app' => env('APP_DOMAIN'),
],
/*
@@ -34,7 +34,7 @@ return [
|
*/
'nodeinfo' => [
- 'url' => config('app.url') . '/' . 'api/nodeinfo/2.0.json'
+ 'url' => config('app.url').'/'.'api/nodeinfo/2.0.json',
],
/*
@@ -59,9 +59,9 @@ return [
*/
'restricted_names' => [
'reserved_routes' => true,
- 'use_blacklist' => false
+ 'use_blacklist' => false,
],
-
+
/*
|--------------------------------------------------------------------------
| Allow New Registrations
@@ -71,7 +71,7 @@ return [
|
*/
'open_registration' => env('OPEN_REGISTRATION', true),
- 'recaptcha' => env('RECAPTCHA_ENABLED', false),
+ 'recaptcha' => env('RECAPTCHA_ENABLED', false),
'remote_follow_enabled' => env('REMOTE_FOLLOW', false),
@@ -159,5 +159,5 @@ return [
'image_quality' => (int) env('IMAGE_QUALITY', 80),
'media_types' => env('MEDIA_TYPES', 'jpeg,png,gif'),
-
+
];
diff --git a/config/queue.php b/config/queue.php
index 391304f36..37117b5a8 100644
--- a/config/queue.php
+++ b/config/queue.php
@@ -35,34 +35,34 @@ return [
],
'database' => [
- 'driver' => 'database',
- 'table' => 'jobs',
- 'queue' => 'default',
+ 'driver' => 'database',
+ 'table' => 'jobs',
+ 'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
- 'driver' => 'beanstalkd',
- 'host' => 'localhost',
- 'queue' => 'default',
+ 'driver' => 'beanstalkd',
+ 'host' => 'localhost',
+ 'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
- 'key' => env('SQS_KEY', 'your-public-key'),
+ 'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
- 'queue' => env('SQS_QUEUE', 'your-queue-name'),
+ 'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
- 'driver' => 'redis',
- 'connection' => 'default',
- 'queue' => 'default',
+ 'driver' => 'redis',
+ 'connection' => 'default',
+ 'queue' => 'default',
'retry_after' => 90,
- 'block_for' => null,
+ 'block_for' => null,
],
],
@@ -80,7 +80,7 @@ return [
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
- 'table' => 'failed_jobs',
+ 'table' => 'failed_jobs',
],
];
diff --git a/config/recaptcha.php b/config/recaptcha.php
index 5caa2c413..049af6d52 100644
--- a/config/recaptcha.php
+++ b/config/recaptcha.php
@@ -48,7 +48,7 @@ return [
'options' => [
'curl_timeout' => 1,
- 'curl_verify' => true,
+ 'curl_verify' => true,
],
diff --git a/config/routes.php b/config/routes.php
index 3b6e5e162..ab355cf22 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -3,14 +3,14 @@
return [
'api' => [
- 'base' => config('app.url') . '/api/1/',
- 'sharedInbox' => config('app.url') . '/api/sharedInbox',
- 'search' => config('app.url') . env('MIX_API_SEARCH'),
+ 'base' => config('app.url').'/api/1/',
+ 'sharedInbox' => config('app.url').'/api/sharedInbox',
+ 'search' => config('app.url').env('MIX_API_SEARCH'),
],
'hashtag' => [
- 'base' => config('app.url') . '/discover/tags/',
- 'search' => config('app.url') . '/discover/tags/',
+ 'base' => config('app.url').'/discover/tags/',
+ 'search' => config('app.url').'/discover/tags/',
],
-];
\ No newline at end of file
+];
diff --git a/config/services.php b/config/services.php
index aa1f7f82c..58db77fe5 100644
--- a/config/services.php
+++ b/config/services.php
@@ -20,7 +20,7 @@ return [
],
'ses' => [
- 'key' => env('SES_KEY'),
+ 'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => env('SES_REGION', 'us-east-1'),
],
@@ -30,8 +30,8 @@ return [
],
'stripe' => [
- 'model' => App\User::class,
- 'key' => env('STRIPE_KEY'),
+ 'model' => App\User::class,
+ 'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php
index facf2337b..91221f7b4 100644
--- a/database/factories/UserFactory.php
+++ b/database/factories/UserFactory.php
@@ -15,9 +15,9 @@ use Faker\Generator as Faker;
$factory->define(App\User::class, function (Faker $faker) {
return [
- 'name' => $faker->name,
- 'email' => $faker->unique()->safeEmail,
- 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
+ 'name' => $faker->name,
+ 'email' => $faker->unique()->safeEmail,
+ 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});
diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php
index c249292b6..fb6de95e4 100644
--- a/database/migrations/2014_10_12_000000_create_users_table.php
+++ b/database/migrations/2014_10_12_000000_create_users_table.php
@@ -1,8 +1,8 @@
bigIncrements('id');
- $table->string('uri')->nullable();
+ $table->string('uri')->nullable();
$table->string('caption')->nullable();
$table->text('rendered')->nullable();
$table->bigInteger('profile_id')->unsigned()->nullable();
diff --git a/database/migrations/2018_04_16_011918_create_media_table.php b/database/migrations/2018_04_16_011918_create_media_table.php
index 8c2602488..209064b91 100644
--- a/database/migrations/2018_04_16_011918_create_media_table.php
+++ b/database/migrations/2018_04_16_011918_create_media_table.php
@@ -1,8 +1,8 @@
timestamps();
});
diff --git a/database/migrations/2018_08_12_042648_update_status_table_change_caption_to_text.php b/database/migrations/2018_08_12_042648_update_status_table_change_caption_to_text.php
index caad9472b..34d67e8c4 100644
--- a/database/migrations/2018_08_12_042648_update_status_table_change_caption_to_text.php
+++ b/database/migrations/2018_08_12_042648_update_status_table_change_caption_to_text.php
@@ -1,8 +1,7 @@
dropColumn('show_profile_followers');
$table->dropColumn('show_profile_follower_count');
$table->dropColumn('show_profile_following');
diff --git a/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php b/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php
index 2071ba3b1..68ff5a5cd 100644
--- a/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php
+++ b/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php
@@ -1,8 +1,8 @@
string('original_sha256')->nullable()->index()->after('user_id');
$table->string('optimized_sha256')->nullable()->index()->after('original_sha256');
$table->string('caption')->nullable()->after('thumbnail_url');
@@ -21,7 +21,7 @@ class UpdateMediaTableAddAltText extends Migration
$table->timestamp('hls_transcoded_at')->nullable()->after('processed_at');
$table->string('key')->nullable();
$table->json('metadata')->nullable();
- });
+ });
}
/**
@@ -31,7 +31,7 @@ class UpdateMediaTableAddAltText extends Migration
*/
public function down()
{
- Schema::table('media', function (Blueprint $table) {
+ Schema::table('media', function (Blueprint $table) {
$table->dropColumn('original_sha256');
$table->dropColumn('optimized_sha256');
$table->dropColumn('caption');
@@ -39,6 +39,6 @@ class UpdateMediaTableAddAltText extends Migration
$table->dropColumn('hls_transcoded_at');
$table->dropColumn('key');
$table->dropColumn('metadata');
- });
+ });
}
}
diff --git a/public/index.php b/public/index.php
index 4584cbcd6..2b5641b4c 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,12 +1,10 @@
*/
-
define('LARAVEL_START', microtime(true));
/*
diff --git a/resources/lang/da/auth.php b/resources/lang/da/auth.php
index 4a14729fd..9d690c216 100644
--- a/resources/lang/da/auth.php
+++ b/resources/lang/da/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Disse oplysninger stemmer ikke overens med nogen konto.',
+ 'failed' => 'Disse oplysninger stemmer ikke overens med nogen konto.',
'throttle' => 'For mange loginforsøg. Vær venlig at prøve igen om :seconds sekunder.',
];
diff --git a/resources/lang/da/notification.php b/resources/lang/da/notification.php
index 6024d9b16..5410a77e6 100644
--- a/resources/lang/da/notification.php
+++ b/resources/lang/da/notification.php
@@ -4,4 +4,4 @@ return [
'likedPhoto' => 'syntes om dit billede.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/da/pagination.php b/resources/lang/da/pagination.php
index c4d70ab5b..dc38877e5 100644
--- a/resources/lang/da/pagination.php
+++ b/resources/lang/da/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« forrige',
- 'next' => 'næste »',
+ 'next' => 'næste »',
];
diff --git a/resources/lang/da/passwords.php b/resources/lang/da/passwords.php
index ee117c41e..ad5175012 100644
--- a/resources/lang/da/passwords.php
+++ b/resources/lang/da/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Adgangskode skal være mindst 6 tegn og skal matche bekræftelsen.',
- 'reset' => 'Din adgangskode er blevet nulstillet!',
- 'sent' => 'Vi har sendt dig en email med et link, hvor du kan nulstille din adgangskode!',
- 'token' => 'Dette nulstillingslink er ikke længere gyldigt.',
- 'user' => "Vi kan ikke finde en bruger med den emailadresse.",
+ 'reset' => 'Din adgangskode er blevet nulstillet!',
+ 'sent' => 'Vi har sendt dig en email med et link, hvor du kan nulstille din adgangskode!',
+ 'token' => 'Dette nulstillingslink er ikke længere gyldigt.',
+ 'user' => 'Vi kan ikke finde en bruger med den emailadresse.',
];
diff --git a/resources/lang/da/profile.php b/resources/lang/da/profile.php
index e19ae40ab..a8d80212c 100644
--- a/resources/lang/da/profile.php
+++ b/resources/lang/da/profile.php
@@ -2,4 +2,4 @@
return [
'emptyTimeline' => 'Denne bruger har ikke postet noget endnu!',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/de/auth.php b/resources/lang/de/auth.php
index c0a62f918..1acf3a92f 100644
--- a/resources/lang/de/auth.php
+++ b/resources/lang/de/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Diese Daten stimmen nicht mit unserem Register überein.',
+ 'failed' => 'Diese Daten stimmen nicht mit unserem Register überein.',
'throttle' => 'Zu viele Login-Versuche. Versuche es in :seconds Sekunden erneut.',
];
diff --git a/resources/lang/de/navmenu.php b/resources/lang/de/navmenu.php
index 7b983aa42..d9bbdd4a8 100644
--- a/resources/lang/de/navmenu.php
+++ b/resources/lang/de/navmenu.php
@@ -2,13 +2,13 @@
return [
- 'viewMyProfile' => 'Mein Profil anschauen',
- 'myTimeline' => 'Meine Timeline',
+ 'viewMyProfile' => 'Mein Profil anschauen',
+ 'myTimeline' => 'Meine Timeline',
'publicTimeline' => 'Öffentliche Timeline',
- 'remoteFollow' => 'Aus der Ferne folgen',
- 'settings' => 'Einstellungen',
- 'admin' => 'Administration',
- 'logout' => 'Abmelden',
+ 'remoteFollow' => 'Aus der Ferne folgen',
+ 'settings' => 'Einstellungen',
+ 'admin' => 'Administration',
+ 'logout' => 'Abmelden',
'directMessages' => 'Privatnachrichten',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/de/notification.php b/resources/lang/de/notification.php
index 4f2040552..823a54200 100644
--- a/resources/lang/de/notification.php
+++ b/resources/lang/de/notification.php
@@ -2,9 +2,9 @@
return [
- 'likedPhoto' => 'gefällt dein Foto.',
+ 'likedPhoto' => 'gefällt dein Foto.',
'startedFollowingYou' => 'folgt dir nun.',
- 'commented' => 'hat deinen Post kommentiert.',
- 'mentionedYou' => 'hat dich erwähnt.'
+ 'commented' => 'hat deinen Post kommentiert.',
+ 'mentionedYou' => 'hat dich erwähnt.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/de/pagination.php b/resources/lang/de/pagination.php
index 9120d892c..a3bf7c8c8 100644
--- a/resources/lang/de/pagination.php
+++ b/resources/lang/de/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Vorherige',
- 'next' => 'Nächste »',
+ 'next' => 'Nächste »',
];
diff --git a/resources/lang/de/passwords.php b/resources/lang/de/passwords.php
index 343e79d28..e7446ad2b 100644
--- a/resources/lang/de/passwords.php
+++ b/resources/lang/de/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Passwörter müssen mindestens 6 Zeichen sein und die Bestätigung muss übereinstimmen.',
- 'reset' => 'Dein Passwort wurde zurückgesetzt!',
- 'sent' => 'Wir haben die eine Password-Rücksetzungs-E-Mail gesendet!',
- 'token' => 'Dieser Passwort-Rücksetzungs-Code ist nicht gültig.',
- 'user' => "Wir konnten keinen Nutzer mit dieser E-Mail-Adresse finden.",
+ 'reset' => 'Dein Passwort wurde zurückgesetzt!',
+ 'sent' => 'Wir haben die eine Password-Rücksetzungs-E-Mail gesendet!',
+ 'token' => 'Dieser Passwort-Rücksetzungs-Code ist nicht gültig.',
+ 'user' => 'Wir konnten keinen Nutzer mit dieser E-Mail-Adresse finden.',
];
diff --git a/resources/lang/de/profile.php b/resources/lang/de/profile.php
index db3a3c26c..9463c5f14 100644
--- a/resources/lang/de/profile.php
+++ b/resources/lang/de/profile.php
@@ -1,8 +1,8 @@
'Dieser Benutzer hat noch nichts gepostet!',
+ 'emptyTimeline' => 'Dieser Benutzer hat noch nichts gepostet!',
'emptyFollowers' => 'Diesem Benutzer folgt noch niemand!',
'emptyFollowing' => 'Dieser Benutzer folgt noch niemanden!',
- 'savedWarning' => 'Nur du kannst sehen was du gespeichert hast',
+ 'savedWarning' => 'Nur du kannst sehen was du gespeichert hast',
];
diff --git a/resources/lang/de/timeline.php b/resources/lang/de/timeline.php
index af5521bdd..7ed971f0d 100644
--- a/resources/lang/de/timeline.php
+++ b/resources/lang/de/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Deine Timeline ist leer.'
+ 'emptyPersonalTimeline' => 'Deine Timeline ist leer.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/el/auth.php b/resources/lang/el/auth.php
index 9d1cd7f4a..7da817191 100644
--- a/resources/lang/el/auth.php
+++ b/resources/lang/el/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Αυτά τα στοιχεία δεν υπάρχουν στα κατάστιχά μας.',
+ 'failed' => 'Αυτά τα στοιχεία δεν υπάρχουν στα κατάστιχά μας.',
'throttle' => 'Λόγω πολλαπλών δοκιμών, παρακαλώ δοκιμάστε ξανά σε :seconds δευτερόλεπτα.',
];
diff --git a/resources/lang/el/notification.php b/resources/lang/el/notification.php
index 3af597daa..d80385a34 100644
--- a/resources/lang/el/notification.php
+++ b/resources/lang/el/notification.php
@@ -5,9 +5,9 @@ return [
'likedPhoto' => 'έδειξε προτίμηση στη φωτογραφία σου.', //'preferred your photo'
//'likedPhoto' => 'αγάπησε τη φωτογραφία σου.', //'loved your photo' (this is too much, we don't use 'love' like that)
//'likedPhoto' => 'έκανε like στη φωτογραφία σου.', //'did a like on your photo' (this sounds cheesy)
-
+
//In greek "like" is only passive (i.e. you can say "Your photo was liked by user" but not "user liked your photo").
// So we either can use "loved", use the english word ("performed a 'like' on your photo"), or (the one I chose) say
// "user preferred your photo"
-];
\ No newline at end of file
+];
diff --git a/resources/lang/el/pagination.php b/resources/lang/el/pagination.php
index 32e04a901..6ffccd8c3 100644
--- a/resources/lang/el/pagination.php
+++ b/resources/lang/el/pagination.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'previous' => '« Προηγούμενο',
- 'next' => 'Επόμενο »',
+ 'previous' => '« Προηγούμενο',
+ 'next' => 'Επόμενο »',
];
diff --git a/resources/lang/el/passwords.php b/resources/lang/el/passwords.php
index 475f290f5..2c94c845e 100644
--- a/resources/lang/el/passwords.php
+++ b/resources/lang/el/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Ο κωδικός πρέπει να έχει τουλάχιστον 6 χαρακτήρες και να είναι ίδιος με την επιβεβαίωση.',
- 'reset' => 'Έγινε επαναφορά του κωδικού σας',
- 'sent' => 'Ο σύνδεσμος για την επαναφορά του κωδικού έφυγε με e-mail.',
- 'token' => 'Ο σύνδεσμος επαναφοράς κωδικού δεν είναι έγκυρος.',
- 'user' => "Δεν υπάρχει χρήστης με αυτό το e-mail στη βάση δεδομένων.",
+ 'reset' => 'Έγινε επαναφορά του κωδικού σας',
+ 'sent' => 'Ο σύνδεσμος για την επαναφορά του κωδικού έφυγε με e-mail.',
+ 'token' => 'Ο σύνδεσμος επαναφοράς κωδικού δεν είναι έγκυρος.',
+ 'user' => 'Δεν υπάρχει χρήστης με αυτό το e-mail στη βάση δεδομένων.',
];
diff --git a/resources/lang/el/profile.php b/resources/lang/el/profile.php
index b47b2f7bd..a67276f09 100644
--- a/resources/lang/el/profile.php
+++ b/resources/lang/el/profile.php
@@ -2,4 +2,4 @@
return [
'emptyTimeline' => 'Αυτός ο χρήστης δεν έχει δημοσιεύσει τίποτα ακόμη!',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php
index e5506df29..6ef1a7330 100644
--- a/resources/lang/en/auth.php
+++ b/resources/lang/en/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'These credentials do not match our records.',
+ 'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
diff --git a/resources/lang/en/navmenu.php b/resources/lang/en/navmenu.php
index 3c6d2ebbb..5ea33ea56 100644
--- a/resources/lang/en/navmenu.php
+++ b/resources/lang/en/navmenu.php
@@ -2,13 +2,13 @@
return [
- 'viewMyProfile' => 'View my profile',
- 'myTimeline' => 'My Timeline',
+ 'viewMyProfile' => 'View my profile',
+ 'myTimeline' => 'My Timeline',
'publicTimeline' => 'Public Timeline',
- 'remoteFollow' => 'Remote Follow',
- 'settings' => 'Settings',
- 'admin' => 'Admin',
- 'logout' => 'Logout',
+ 'remoteFollow' => 'Remote Follow',
+ 'settings' => 'Settings',
+ 'admin' => 'Admin',
+ 'logout' => 'Logout',
'directMessages' => 'Direct Messages',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/en/notification.php b/resources/lang/en/notification.php
index 71d87a131..b85785d6a 100644
--- a/resources/lang/en/notification.php
+++ b/resources/lang/en/notification.php
@@ -2,9 +2,9 @@
return [
- 'likedPhoto' => 'liked your photo.',
+ 'likedPhoto' => 'liked your photo.',
'startedFollowingYou' => 'started following you.',
- 'commented' => 'commented on your post.',
- 'mentionedYou' => 'mentioned you.'
+ 'commented' => 'commented on your post.',
+ 'mentionedYou' => 'mentioned you.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php
index d48141187..fcab34b25 100644
--- a/resources/lang/en/pagination.php
+++ b/resources/lang/en/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Previous',
- 'next' => 'Next »',
+ 'next' => 'Next »',
];
diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php
index e5544d201..ffa19ba40 100644
--- a/resources/lang/en/passwords.php
+++ b/resources/lang/en/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
- 'reset' => 'Your password has been reset!',
- 'sent' => 'We have e-mailed your password reset link!',
- 'token' => 'This password reset token is invalid.',
- 'user' => "We can't find a user with that e-mail address.",
+ 'reset' => 'Your password has been reset!',
+ 'sent' => 'We have e-mailed your password reset link!',
+ 'token' => 'This password reset token is invalid.',
+ 'user' => "We can't find a user with that e-mail address.",
];
diff --git a/resources/lang/en/profile.php b/resources/lang/en/profile.php
index 24278aba8..73e4e3207 100644
--- a/resources/lang/en/profile.php
+++ b/resources/lang/en/profile.php
@@ -1,12 +1,12 @@
'This user has no posts yet!',
- 'emptyFollowers' => 'This user has no followers yet!',
- 'emptyFollowing' => 'This user is not following anyone yet!',
- 'emptySaved' => 'You haven’t saved any post yet!',
- 'savedWarning' => 'Only you can see what you’ve saved',
+ 'emptyTimeline' => 'This user has no posts yet!',
+ 'emptyFollowers' => 'This user has no followers yet!',
+ 'emptyFollowing' => 'This user is not following anyone yet!',
+ 'emptySaved' => 'You haven’t saved any post yet!',
+ 'savedWarning' => 'Only you can see what you’ve saved',
'privateProfileWarning' => 'This Account is Private',
- 'alreadyFollow' => 'Already follow :username?',
- 'loginToSeeProfile' => 'to see their photos and videos.',
+ 'alreadyFollow' => 'Already follow :username?',
+ 'loginToSeeProfile' => 'to see their photos and videos.',
];
diff --git a/resources/lang/en/timeline.php b/resources/lang/en/timeline.php
index 26e329678..4c39a42cf 100644
--- a/resources/lang/en/timeline.php
+++ b/resources/lang/en/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Your timeline is empty.'
+ 'emptyPersonalTimeline' => 'Your timeline is empty.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/es/auth.php b/resources/lang/es/auth.php
index 8723dd3d2..c0d26842f 100644
--- a/resources/lang/es/auth.php
+++ b/resources/lang/es/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Los datos introducidos no son válidos.',
+ 'failed' => 'Los datos introducidos no son válidos.',
'throttle' => 'Demasiados intentos de iniciar sesión. Por favor, inténtalo de nuevo en :seconds segundos.',
];
diff --git a/resources/lang/es/notification.php b/resources/lang/es/notification.php
index 96b07e5f4..599a0ab09 100644
--- a/resources/lang/es/notification.php
+++ b/resources/lang/es/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => 'le gustó tu foto.',
+ 'likedPhoto' => 'le gustó tu foto.',
'startedFollowingYou' => 'empezó a seguirte.',
];
diff --git a/resources/lang/es/pagination.php b/resources/lang/es/pagination.php
index f8f044e19..325916dc3 100644
--- a/resources/lang/es/pagination.php
+++ b/resources/lang/es/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Anterior',
- 'next' => 'Siguiente »',
+ 'next' => 'Siguiente »',
];
diff --git a/resources/lang/es/passwords.php b/resources/lang/es/passwords.php
index f2b66f57f..f4f045736 100644
--- a/resources/lang/es/passwords.php
+++ b/resources/lang/es/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'La contraseña debe tener al menos seis caracteres y coincidir con la de confirmación.',
- 'reset' => '¡Tu contraseña se ha cambiado!',
- 'sent' => 'Te hemos enviado a tu correo un enlace para cambiar tu contraseña.',
- 'token' => 'El "token" para canbiar la contraseña no es válido.',
- 'user' => "No hemos podido encontrar a ningún usuario con esa contraseña.",
+ 'reset' => '¡Tu contraseña se ha cambiado!',
+ 'sent' => 'Te hemos enviado a tu correo un enlace para cambiar tu contraseña.',
+ 'token' => 'El "token" para canbiar la contraseña no es válido.',
+ 'user' => 'No hemos podido encontrar a ningún usuario con esa contraseña.',
];
diff --git a/resources/lang/es/profile.php b/resources/lang/es/profile.php
index 88105ced9..ffe58b53f 100644
--- a/resources/lang/es/profile.php
+++ b/resources/lang/es/profile.php
@@ -1,8 +1,8 @@
'¡Este usuario todavía no ha publicado nada!',
+ 'emptyTimeline' => '¡Este usuario todavía no ha publicado nada!',
'emptyFollowers' => '¡Este usuario todavía no tiene seguidores!',
'emptyFollowing' => '¡Este usuario todavía no está siguiendo a nadie!',
- 'savedWarning' => 'Solamente tú puedes ver lo que has guardado',
+ 'savedWarning' => 'Solamente tú puedes ver lo que has guardado',
];
diff --git a/resources/lang/es/timeline.php b/resources/lang/es/timeline.php
index 1b1e23266..8a3735223 100644
--- a/resources/lang/es/timeline.php
+++ b/resources/lang/es/timeline.php
@@ -2,4 +2,4 @@
return [
'emptyPersonalTimeline' => 'Tu línea temporal está vacía.',
-];
+];
diff --git a/resources/lang/fi/auth.php b/resources/lang/fi/auth.php
index 77de9921a..e0f1c20c1 100644
--- a/resources/lang/fi/auth.php
+++ b/resources/lang/fi/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Nämä kirjautumistiedot eivät vastaa tallennettuja',
+ 'failed' => 'Nämä kirjautumistiedot eivät vastaa tallennettuja',
'throttle' => 'Liian monta kirjautumisyritystä. Yrityä uudelleen :seconds sekuntin kuluttua.',
];
diff --git a/resources/lang/fi/notification.php b/resources/lang/fi/notification.php
index 5bbae72a8..f577f4cd0 100644
--- a/resources/lang/fi/notification.php
+++ b/resources/lang/fi/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => 'tykkäsi kuvastasi.',
+ 'likedPhoto' => 'tykkäsi kuvastasi.',
'startedFollowingYou' => 'alkoi seuraamaan sinua.',
];
diff --git a/resources/lang/fi/pagination.php b/resources/lang/fi/pagination.php
index 1650dd370..b0776abb9 100644
--- a/resources/lang/fi/pagination.php
+++ b/resources/lang/fi/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Edellinen',
- 'next' => 'Seuraava »',
+ 'next' => 'Seuraava »',
];
diff --git a/resources/lang/fi/passwords.php b/resources/lang/fi/passwords.php
index 44c5a9d69..a7b2aa616 100644
--- a/resources/lang/fi/passwords.php
+++ b/resources/lang/fi/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Salasanan täytyy olla vähintään kuusi merkkiä ja vastata vahvistusta.',
- 'reset' => 'Salasanasi on nollattu!',
- 'sent' => 'Olemme lähettäneet salasanan nollauslinkin sähköpostitse!',
- 'token' => 'Tämä salasanan nollauslinkki ei ole toimiva.',
- 'user' => "Emme löydä käyttäjää tuolla sähköpostiosoitteella.",
+ 'reset' => 'Salasanasi on nollattu!',
+ 'sent' => 'Olemme lähettäneet salasanan nollauslinkin sähköpostitse!',
+ 'token' => 'Tämä salasanan nollauslinkki ei ole toimiva.',
+ 'user' => 'Emme löydä käyttäjää tuolla sähköpostiosoitteella.',
];
diff --git a/resources/lang/fi/profile.php b/resources/lang/fi/profile.php
index 9199b77ef..96d98c98a 100644
--- a/resources/lang/fi/profile.php
+++ b/resources/lang/fi/profile.php
@@ -1,9 +1,9 @@
'Tällä käyttäjällä ei ole vielä päivityksiä!',
+ 'emptyTimeline' => 'Tällä käyttäjällä ei ole vielä päivityksiä!',
'emptyFollowers' => 'Tällä käyttäjällä ei ole vielä seuraajia!',
'emptyFollowing' => 'Tämä käyttäjä ei vielä seuraa ketään!',
- 'savedWarning' => 'Only you can see what you\'ve saved',
- 'savedWarning' => 'Vain sinä voit nähdä, mitä olet tallentanut',
+ 'savedWarning' => 'Only you can see what you\'ve saved',
+ 'savedWarning' => 'Vain sinä voit nähdä, mitä olet tallentanut',
];
diff --git a/resources/lang/fi/timeline.php b/resources/lang/fi/timeline.php
index 98b6fe3cd..f903cfbb7 100644
--- a/resources/lang/fi/timeline.php
+++ b/resources/lang/fi/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Aikajanasi on tyhjä.'
+ 'emptyPersonalTimeline' => 'Aikajanasi on tyhjä.',
];
diff --git a/resources/lang/fr/auth.php b/resources/lang/fr/auth.php
index c9b0458b9..3abe159d3 100644
--- a/resources/lang/fr/auth.php
+++ b/resources/lang/fr/auth.php
@@ -1,4 +1,5 @@
'Ces informations ne correspondent pas à nos dossiers.',
+ 'failed' => 'Ces informations ne correspondent pas à nos dossiers.',
'throttle' => 'Trop de tentatives de connexion. Veuillez réessayer dans :seconds secondes.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/fr/navmenu.php b/resources/lang/fr/navmenu.php
index b6ab1f608..768513182 100644
--- a/resources/lang/fr/navmenu.php
+++ b/resources/lang/fr/navmenu.php
@@ -1,10 +1,11 @@
'Voir mon profil',
- 'myTimeline' => 'Ma chronologie',
+ 'viewMyProfile' => 'Voir mon profil',
+ 'myTimeline' => 'Ma chronologie',
'publicTimeline' => 'Chronologie publique',
- 'remoteFollow' => 'Suivre à distance',
- 'settings' => 'Paramètres',
- 'admin' => 'Admin',
- 'logout' => ' Se déconnecter',
+ 'remoteFollow' => 'Suivre à distance',
+ 'settings' => 'Paramètres',
+ 'admin' => 'Admin',
+ 'logout' => ' Se déconnecter',
];
diff --git a/resources/lang/fr/notification.php b/resources/lang/fr/notification.php
index b89456855..bcb30ff23 100644
--- a/resources/lang/fr/notification.php
+++ b/resources/lang/fr/notification.php
@@ -1,7 +1,8 @@
'a aimé votre photo.',
+ 'likedPhoto' => 'a aimé votre photo.',
'startedFollowingYou' => 'a commencé à vous suivre.',
- 'commented' => 'commenté sur votre post.',
- 'mentionedYou' => 'vous à mentionné.'
+ 'commented' => 'commenté sur votre post.',
+ 'mentionedYou' => 'vous à mentionné.',
];
diff --git a/resources/lang/fr/pagination.php b/resources/lang/fr/pagination.php
index 53981d01a..0377c0e99 100644
--- a/resources/lang/fr/pagination.php
+++ b/resources/lang/fr/pagination.php
@@ -1,4 +1,5 @@
'« Précédent',
- 'next' => 'Suivant »',
+ 'next' => 'Suivant »',
];
diff --git a/resources/lang/fr/passwords.php b/resources/lang/fr/passwords.php
index 6ec889e70..1659d1b4f 100644
--- a/resources/lang/fr/passwords.php
+++ b/resources/lang/fr/passwords.php
@@ -1,4 +1,5 @@
'Les mots de passe doivent compter au moins six caractères et correspondre à la confirmation.',
- 'reset' => 'Votre mot de passe a été réinitialisé !',
- 'sent' => 'Nous vous avons envoyé un e-mail avec un lien de réinitialisation de mot de passe !',
- 'token' => 'Ce jeton de réinitialisation de mot de passe est invalide.',
- 'user' => "Aucun utilisateur n'est inscrit avec cette adresse e-mail.",
+ 'reset' => 'Votre mot de passe a été réinitialisé !',
+ 'sent' => 'Nous vous avons envoyé un e-mail avec un lien de réinitialisation de mot de passe !',
+ 'token' => 'Ce jeton de réinitialisation de mot de passe est invalide.',
+ 'user' => 'Aucun utilisateur n'est inscrit avec cette adresse e-mail.',
];
diff --git a/resources/lang/fr/profile.php b/resources/lang/fr/profile.php
index 02ac1ae87..fb85ee717 100644
--- a/resources/lang/fr/profile.php
+++ b/resources/lang/fr/profile.php
@@ -1,7 +1,8 @@
'Cet utilisateur n\'a pas encore de messages !',
+ 'emptyTimeline' => 'Cet utilisateur n\'a pas encore de messages !',
'emptyFollowers' => 'Cet utilisateur n`\'a pas encore d\'abonné-e-s!',
'emptyFollowing' => 'Cet utilisateur ne suit pas encore quelqu\'un!',
- 'savedWarning' => 'Vous seul pouvez voir ce que vous avez enregistré',
+ 'savedWarning' => 'Vous seul pouvez voir ce que vous avez enregistré',
];
diff --git a/resources/lang/fr/timeline.php b/resources/lang/fr/timeline.php
index 90af02f24..b82e69fb2 100644
--- a/resources/lang/fr/timeline.php
+++ b/resources/lang/fr/timeline.php
@@ -1,4 +1,5 @@
'Votre chronologie est vide.'
+ 'emptyPersonalTimeline' => 'Votre chronologie est vide.',
];
diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php
index 74090789b..cfad8a7ec 100644
--- a/resources/lang/fr/validation.php
+++ b/resources/lang/fr/validation.php
@@ -1,4 +1,5 @@
'As credenciais non constan nos nosos rexistros.',
+ 'failed' => 'As credenciais non constan nos nosos rexistros.',
'throttle' => 'Demasiados intentos de conexión. Por favor, inténteo de novo en :seconds seconds.',
];
diff --git a/resources/lang/gl/navmenu.php b/resources/lang/gl/navmenu.php
index 1e427d5cc..4461d0ec9 100644
--- a/resources/lang/gl/navmenu.php
+++ b/resources/lang/gl/navmenu.php
@@ -2,12 +2,12 @@
return [
- 'viewMyProfile' => 'Ver perfil',
- 'myTimeline' => 'A miña liña temporal',
+ 'viewMyProfile' => 'Ver perfil',
+ 'myTimeline' => 'A miña liña temporal',
'publicTimeline' => 'Liña temporal pública',
- 'remoteFollow' => 'Seguimento remoto',
- 'settings' => 'Axustes',
- 'admin' => 'Admin',
- 'logout' => 'Saír',
+ 'remoteFollow' => 'Seguimento remoto',
+ 'settings' => 'Axustes',
+ 'admin' => 'Admin',
+ 'logout' => 'Saír',
];
diff --git a/resources/lang/gl/notification.php b/resources/lang/gl/notification.php
index f4d1e51fb..5a70d5648 100644
--- a/resources/lang/gl/notification.php
+++ b/resources/lang/gl/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => 'gustoulle a súa foto.',
+ 'likedPhoto' => 'gustoulle a súa foto.',
'startedFollowingYou' => 'comezou a seguila.',
];
diff --git a/resources/lang/gl/pagination.php b/resources/lang/gl/pagination.php
index afe74398c..4134ec001 100644
--- a/resources/lang/gl/pagination.php
+++ b/resources/lang/gl/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Anterior',
- 'next' => 'Seguinte »',
+ 'next' => 'Seguinte »',
];
diff --git a/resources/lang/gl/passwords.php b/resources/lang/gl/passwords.php
index 236daa688..5df2d9051 100644
--- a/resources/lang/gl/passwords.php
+++ b/resources/lang/gl/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Os contrasinais deben ser ao menos de seis caracteres e concordar na confirmación.',
- 'reset' => 'Restableceuse o seu contrasinal!',
- 'sent' => 'Acabamos de enviarlle unha ligazón para restablecer o contrasinal!',
- 'token' => 'Este testemuño de restablecemento de contrasinal non é válido.',
- 'user' => "Non atopamos unha usuaria con ese enderezo de correo.",
+ 'reset' => 'Restableceuse o seu contrasinal!',
+ 'sent' => 'Acabamos de enviarlle unha ligazón para restablecer o contrasinal!',
+ 'token' => 'Este testemuño de restablecemento de contrasinal non é válido.',
+ 'user' => 'Non atopamos unha usuaria con ese enderezo de correo.',
];
diff --git a/resources/lang/gl/profile.php b/resources/lang/gl/profile.php
index 321682294..2b39d9e62 100644
--- a/resources/lang/gl/profile.php
+++ b/resources/lang/gl/profile.php
@@ -1,8 +1,8 @@
'Esta usuaria aínda non publicou!',
+ 'emptyTimeline' => 'Esta usuaria aínda non publicou!',
'emptyFollowers' => 'Esta usuaria aínda non ten seguidoras!',
'emptyFollowing' => 'Esta usuaria aínda non segue a ninguén!',
- 'savedWarning' => 'Só vostede pode ver o que gardou',
+ 'savedWarning' => 'Só vostede pode ver o que gardou',
];
diff --git a/resources/lang/gl/timeline.php b/resources/lang/gl/timeline.php
index 2024b2029..25f07194a 100644
--- a/resources/lang/gl/timeline.php
+++ b/resources/lang/gl/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'A súa liña temporal está baldeira.'
+ 'emptyPersonalTimeline' => 'A súa liña temporal está baldeira.',
];
diff --git a/resources/lang/he/auth.php b/resources/lang/he/auth.php
index a3f5f101d..152218ebe 100644
--- a/resources/lang/he/auth.php
+++ b/resources/lang/he/auth.php
@@ -12,8 +12,8 @@ return [
| these language lines according to your application's requirements.
|
*/
-
- 'failed' => 'פרטים אלו אינם תואמים לרשימותינו.',
+
+ 'failed' => 'פרטים אלו אינם תואמים לרשימותינו.',
'throttle' => 'יותר מדי ניסיונות כניסה. אנא נסה שוב בעוד :seconds שניות.',
];
diff --git a/resources/lang/he/navmenu.php b/resources/lang/he/navmenu.php
index 87c0f12a0..d57fbbc41 100644
--- a/resources/lang/he/navmenu.php
+++ b/resources/lang/he/navmenu.php
@@ -1,14 +1,14 @@
'צפה בפרופיל שלי',
- 'myTimeline' => 'ציר הזמן שלי',
+
+ 'viewMyProfile' => 'צפה בפרופיל שלי',
+ 'myTimeline' => 'ציר הזמן שלי',
'publicTimeline' => 'ציר הזמן הציבורי',
- 'remoteFollow' => 'עקיבה מרחוק',
- 'settings' => 'הגדרות',
- 'admin' => 'מנהל',
- 'logout' => 'התנתק',
+ 'remoteFollow' => 'עקיבה מרחוק',
+ 'settings' => 'הגדרות',
+ 'admin' => 'מנהל',
+ 'logout' => 'התנתק',
'directMessages' => 'הודעות ישירות',
];
diff --git a/resources/lang/he/notification.php b/resources/lang/he/notification.php
index 40b51127d..51eabb86e 100644
--- a/resources/lang/he/notification.php
+++ b/resources/lang/he/notification.php
@@ -1,10 +1,11 @@
- 'אהבו את התמונה שלך.',
+
+ 'likedPhoto' => 'אהבו את התמונה שלך.',
'startedFollowingYou' => 'התחיל לעקוב אחריך.',
- 'commented' => 'הגיב על הפוסט שלך.',
- 'mentionedYou' => 'הזכיר אותך.'
-
+ 'commented' => 'הגיב על הפוסט שלך.',
+ 'mentionedYou' => 'הזכיר אותך.',
+
];
diff --git a/resources/lang/he/pagination.php b/resources/lang/he/pagination.php
index 82eb0d2af..7a1b16a17 100644
--- a/resources/lang/he/pagination.php
+++ b/resources/lang/he/pagination.php
@@ -12,8 +12,8 @@ return [
| you want to customize your views to better match your application.
|
*/
-
+
'previous' => '« הקודם',
- 'next' => 'הבא »',
+ 'next' => 'הבא »',
];
diff --git a/resources/lang/he/passwords.php b/resources/lang/he/passwords.php
index 706876765..4383e0d0e 100644
--- a/resources/lang/he/passwords.php
+++ b/resources/lang/he/passwords.php
@@ -11,13 +11,12 @@ return [
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
- */
-
+ */
+
'password' => 'סיסמאות צריכות לכלול לפחות שש אותיות ולהתאים לאישור סיסמה.',
- 'reset' => 'סיסמאתך אופסה!',
- 'sent' => 'קישור איפוס הסיסמה נשלח לך לאימייל!',
- 'token' => 'אסימון איפוס סיסמה זה אינו תקין.',
- 'user' => "איננו יכולים למצוא משתמש בעל אימייל זה.",
+ 'reset' => 'סיסמאתך אופסה!',
+ 'sent' => 'קישור איפוס הסיסמה נשלח לך לאימייל!',
+ 'token' => 'אסימון איפוס סיסמה זה אינו תקין.',
+ 'user' => 'איננו יכולים למצוא משתמש בעל אימייל זה.',
];
-
diff --git a/resources/lang/he/profile.php b/resources/lang/he/profile.php
index 6211907e1..13da8041b 100644
--- a/resources/lang/he/profile.php
+++ b/resources/lang/he/profile.php
@@ -1,9 +1,9 @@
'למשתמש זה עדיין אין פוסטים!',
+
+return [
+ 'emptyTimeline' => 'למשתמש זה עדיין אין פוסטים!',
'emptyFollowers' => 'למשתמש זה עדיין אין עוקבים!',
'emptyFollowing' => 'משתמש זה עדיין אינו עוקב אחרי אף אחד!',
- 'emptySaved' => 'עדיין לא שמרת שום פוסט!',
- 'savedWarning' => 'רק אתם יכולים לראות את מה ששמרתם',
+ 'emptySaved' => 'עדיין לא שמרת שום פוסט!',
+ 'savedWarning' => 'רק אתם יכולים לראות את מה ששמרתם',
];
diff --git a/resources/lang/he/timeline.php b/resources/lang/he/timeline.php
index 2a60fb7b5..7ef600a40 100644
--- a/resources/lang/he/timeline.php
+++ b/resources/lang/he/timeline.php
@@ -1,7 +1,7 @@
'ציר הזמן שלך ריק.'
-
+
+ 'emptyPersonalTimeline' => 'ציר הזמן שלך ריק.',
+
];
diff --git a/resources/lang/ja/auth.php b/resources/lang/ja/auth.php
index c3ad779e5..e6601bf9f 100644
--- a/resources/lang/ja/auth.php
+++ b/resources/lang/ja/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'これらの認証情報は正しくありません。',
+ 'failed' => 'これらの認証情報は正しくありません。',
'throttle' => 'ログイン試行回数が多すぎます。 :seconds 秒後にもう一度お試しください。',
];
diff --git a/resources/lang/ja/notification.php b/resources/lang/ja/notification.php
index 2195ca8c7..742579c47 100644
--- a/resources/lang/ja/notification.php
+++ b/resources/lang/ja/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => '写真がお気に入りされました。',
+ 'likedPhoto' => '写真がお気に入りされました。',
'startedFollowingYou' => 'フォローされました。',
];
diff --git a/resources/lang/ja/pagination.php b/resources/lang/ja/pagination.php
index c6265c94f..8b5da0c5b 100644
--- a/resources/lang/ja/pagination.php
+++ b/resources/lang/ja/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« 戻る',
- 'next' => '次へ »',
+ 'next' => '次へ »',
];
diff --git a/resources/lang/ja/passwords.php b/resources/lang/ja/passwords.php
index 70cddcd37..4170c32e3 100644
--- a/resources/lang/ja/passwords.php
+++ b/resources/lang/ja/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'パスワードは6文字以上で、確認と一致している必要があります。',
- 'reset' => 'パスワードをリセットしました!',
- 'sent' => 'パスワードリセットのためのリンクをメールで送信しました!',
- 'token' => 'このパスワードリセットトークンは無効です。',
- 'user' => "このメールアドレスと一致するユーザーを見つけることが出来ません。",
+ 'reset' => 'パスワードをリセットしました!',
+ 'sent' => 'パスワードリセットのためのリンクをメールで送信しました!',
+ 'token' => 'このパスワードリセットトークンは無効です。',
+ 'user' => 'このメールアドレスと一致するユーザーを見つけることが出来ません。',
];
diff --git a/resources/lang/ja/profile.php b/resources/lang/ja/profile.php
index 4d9192259..78af6354b 100644
--- a/resources/lang/ja/profile.php
+++ b/resources/lang/ja/profile.php
@@ -1,8 +1,8 @@
'このユーザーはまだ何も投稿していません!',
+ 'emptyTimeline' => 'このユーザーはまだ何も投稿していません!',
'emptyFollowers' => 'このユーザーにはまだフォロワーがいません!',
'emptyFollowing' => 'このユーザーはまだ誰もフォローしていません!',
- 'savedWarning' => 'あなたが保存したものはあなただけが見ることが出来ます。',
+ 'savedWarning' => 'あなたが保存したものはあなただけが見ることが出来ます。',
];
diff --git a/resources/lang/ja/timeline.php b/resources/lang/ja/timeline.php
index c3fee3c9f..0c1d27dc2 100644
--- a/resources/lang/ja/timeline.php
+++ b/resources/lang/ja/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'あなたのタイムラインには何もありません。'
+ 'emptyPersonalTimeline' => 'あなたのタイムラインには何もありません。',
];
diff --git a/resources/lang/ms/auth.php b/resources/lang/ms/auth.php
index 5de259d52..fc7f1d9c7 100644
--- a/resources/lang/ms/auth.php
+++ b/resources/lang/ms/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Butiran ini tidak sepadan dengan rekod kami ',
+ 'failed' => 'Butiran ini tidak sepadan dengan rekod kami ',
'throttle' => 'Terlalu banyak cubaan log masuk. Cuba lagi dalam :seconds saat.',
];
diff --git a/resources/lang/ms/pagination.php b/resources/lang/ms/pagination.php
index 4b4345efe..88de63c6c 100644
--- a/resources/lang/ms/pagination.php
+++ b/resources/lang/ms/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Sebelum',
- 'next' => 'Seterusnya »',
+ 'next' => 'Seterusnya »',
];
diff --git a/resources/lang/ms/passwords.php b/resources/lang/ms/passwords.php
index f2394969d..b1b93bca8 100644
--- a/resources/lang/ms/passwords.php
+++ b/resources/lang/ms/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Kata laluan mesti mempunyai sekurang-kurangnya enam askara dan sepadan dengan pengesahan.',
- 'reset' => 'Kata laluan anda sudah ditetap semula!',
- 'sent' => 'Kami sudah emel pautan penetapan semula kata laluan anda!',
- 'token' => 'Token penetapan semula kata laluan ini tidak sah.',
- 'user' => "Kami tidak menjumpai pengguna dengan alamat emel tersebut.",
+ 'reset' => 'Kata laluan anda sudah ditetap semula!',
+ 'sent' => 'Kami sudah emel pautan penetapan semula kata laluan anda!',
+ 'token' => 'Token penetapan semula kata laluan ini tidak sah.',
+ 'user' => 'Kami tidak menjumpai pengguna dengan alamat emel tersebut.',
];
diff --git a/resources/lang/oc/auth.php b/resources/lang/oc/auth.php
index 4423e4348..7fedfd4b8 100644
--- a/resources/lang/oc/auth.php
+++ b/resources/lang/oc/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Aqueles identificants correspondon pas a nòstres enregistraments.',
+ 'failed' => 'Aqueles identificants correspondon pas a nòstres enregistraments.',
'throttle' => 'Tròp d’ensages de connexion. Tornatz ensajar dins :seconds segondas.',
];
diff --git a/resources/lang/oc/navmenu.php b/resources/lang/oc/navmenu.php
index ccfe0f70d..b66af7640 100644
--- a/resources/lang/oc/navmenu.php
+++ b/resources/lang/oc/navmenu.php
@@ -2,13 +2,13 @@
return [
- 'viewMyProfile' => 'Veire mon perfil',
- 'myTimeline' => 'Ma cronologia',
+ 'viewMyProfile' => 'Veire mon perfil',
+ 'myTimeline' => 'Ma cronologia',
'publicTimeline' => 'Cronologia publica',
- 'remoteFollow' => 'Seguir a distància',
- 'settings' => 'Paramètres',
- 'admin' => 'Admin',
- 'logout' => 'Desconnexion',
+ 'remoteFollow' => 'Seguir a distància',
+ 'settings' => 'Paramètres',
+ 'admin' => 'Admin',
+ 'logout' => 'Desconnexion',
'directMessages' => 'Messatges dirèctes',
];
diff --git a/resources/lang/oc/notification.php b/resources/lang/oc/notification.php
index acffb33e9..d1222360c 100644
--- a/resources/lang/oc/notification.php
+++ b/resources/lang/oc/notification.php
@@ -2,9 +2,9 @@
return [
- 'likedPhoto' => 'a aimat vòstra fòto.',
+ 'likedPhoto' => 'a aimat vòstra fòto.',
'startedFollowingYou' => 'a començat de vos seguir.',
- 'commented' => 'a comentat vòstra publicacion.',
- 'mentionedYou' => 'vos a mencionat.'
+ 'commented' => 'a comentat vòstra publicacion.',
+ 'mentionedYou' => 'vos a mencionat.',
];
diff --git a/resources/lang/oc/pagination.php b/resources/lang/oc/pagination.php
index c306f97ff..9edf47353 100644
--- a/resources/lang/oc/pagination.php
+++ b/resources/lang/oc/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Predecent',
- 'next' => 'Seguent »',
+ 'next' => 'Seguent »',
];
diff --git a/resources/lang/oc/passwords.php b/resources/lang/oc/passwords.php
index 8395ebb6b..e1c55a566 100644
--- a/resources/lang/oc/passwords.php
+++ b/resources/lang/oc/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Los senhals devon almens fa sièis caractèrs e correspondre a la confirmacion.',
- 'reset' => 'Vòstre senhal es estat reïnicializat !',
- 'sent' => 'Avèm mandat vòstre ligam de reïnicializacion de senhal !',
- 'token' => 'Aqueste geton de reïnicializacion es invalid.',
- 'user' => "Trobam pas cap d’utilizaire amb aquesta adreça de corrièl.",
+ 'reset' => 'Vòstre senhal es estat reïnicializat !',
+ 'sent' => 'Avèm mandat vòstre ligam de reïnicializacion de senhal !',
+ 'token' => 'Aqueste geton de reïnicializacion es invalid.',
+ 'user' => 'Trobam pas cap d’utilizaire amb aquesta adreça de corrièl.',
];
diff --git a/resources/lang/oc/profile.php b/resources/lang/oc/profile.php
index a6d2ec8d5..5761f873c 100644
--- a/resources/lang/oc/profile.php
+++ b/resources/lang/oc/profile.php
@@ -1,9 +1,9 @@
'Aqueste utilizaire a pas encara de publicacion !',
+ 'emptyTimeline' => 'Aqueste utilizaire a pas encara de publicacion !',
'emptyFollowers' => 'Aqueste utilizaire a pas encara pas seguidors !',
'emptyFollowing' => 'Aqueste utilizaire sèc degun pel moment !',
- 'emptySaved' => 'Avètz cap de publicacion salvagardas pel moment !',
- 'savedWarning' => 'Solament vos vesètz çò que salvagardatz',
+ 'emptySaved' => 'Avètz cap de publicacion salvagardas pel moment !',
+ 'savedWarning' => 'Solament vos vesètz çò que salvagardatz',
];
diff --git a/resources/lang/oc/timeline.php b/resources/lang/oc/timeline.php
index dee3660c3..f937b8092 100644
--- a/resources/lang/oc/timeline.php
+++ b/resources/lang/oc/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Vòstre cronologia es voida.'
+ 'emptyPersonalTimeline' => 'Vòstre cronologia es voida.',
];
diff --git a/resources/lang/oc/validation.php b/resources/lang/oc/validation.php
index 41e9f6fc0..66ba3f37a 100644
--- a/resources/lang/oc/validation.php
+++ b/resources/lang/oc/validation.php
@@ -1,4 +1,4 @@
- 'Wprowadzone dane logowania nie są zgodne z naszą bazą danych.',
+ 'failed' => 'Wprowadzone dane logowania nie są zgodne z naszą bazą danych.',
'throttle' => 'Zbyt wiele nieudanych prób logowania. Spróbuj ponownie za :seconds sekund.',
];
diff --git a/resources/lang/pl/navmenu.php b/resources/lang/pl/navmenu.php
index dda1fbdd9..56e5faafa 100644
--- a/resources/lang/pl/navmenu.php
+++ b/resources/lang/pl/navmenu.php
@@ -2,13 +2,13 @@
return [
- 'viewMyProfile' => 'Pokaż mój profil',
- 'myTimeline' => 'Moja oś czasu',
+ 'viewMyProfile' => 'Pokaż mój profil',
+ 'myTimeline' => 'Moja oś czasu',
'publicTimeline' => 'Publiczna oś czasu',
- 'remoteFollow' => 'Zdalne śledzenie',
- 'settings' => 'Ustawienia',
- 'admin' => 'Administrator',
- 'logout' => 'Wyloguj się',
+ 'remoteFollow' => 'Zdalne śledzenie',
+ 'settings' => 'Ustawienia',
+ 'admin' => 'Administrator',
+ 'logout' => 'Wyloguj się',
'directMessages' => 'Wiadomości bezpośrednie',
];
diff --git a/resources/lang/pl/notification.php b/resources/lang/pl/notification.php
index d24e0b9e0..bf2b15c20 100644
--- a/resources/lang/pl/notification.php
+++ b/resources/lang/pl/notification.php
@@ -2,9 +2,9 @@
return [
- 'likedPhoto' => 'polubił(a) Twoje zdjęcie.',
+ 'likedPhoto' => 'polubił(a) Twoje zdjęcie.',
'startedFollowingYou' => 'zaczął(-ęła) Cię obserwować.',
- 'commented' => 'skomentował(a) Twój wpis',
- 'mentionedYou' => 'wspomniał(a) o Tobie.'
+ 'commented' => 'skomentował(a) Twój wpis',
+ 'mentionedYou' => 'wspomniał(a) o Tobie.',
];
diff --git a/resources/lang/pl/pagination.php b/resources/lang/pl/pagination.php
index 1b91e77ef..f30e5f77d 100644
--- a/resources/lang/pl/pagination.php
+++ b/resources/lang/pl/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => 'Wstecz',
- 'next' => 'Dalej »',
+ 'next' => 'Dalej »',
];
diff --git a/resources/lang/pl/passwords.php b/resources/lang/pl/passwords.php
index aa1320dc2..0d6d1f2d1 100644
--- a/resources/lang/pl/passwords.php
+++ b/resources/lang/pl/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Hasło musi składać się z przynajmniej 6 znaków i być równe powtórzonemu.',
- 'reset' => 'Twoje hasło zostało zresetowane!',
- 'sent' => 'Wysłaliśmy Ci link resetujący hasło mailem!',
- 'token' => 'This password reset token is invalid.',
- 'user' => "Nie znaleziono użytkownika z tym adresem e-mail.",
+ 'reset' => 'Twoje hasło zostało zresetowane!',
+ 'sent' => 'Wysłaliśmy Ci link resetujący hasło mailem!',
+ 'token' => 'This password reset token is invalid.',
+ 'user' => 'Nie znaleziono użytkownika z tym adresem e-mail.',
];
diff --git a/resources/lang/pl/profile.php b/resources/lang/pl/profile.php
index 74dd75da0..bbe60c1ee 100644
--- a/resources/lang/pl/profile.php
+++ b/resources/lang/pl/profile.php
@@ -1,9 +1,9 @@
'Ten użytkownik nie opublikował jeszcze niczego!',
+ 'emptyTimeline' => 'Ten użytkownik nie opublikował jeszcze niczego!',
'emptyFollowers' => 'Nikt nie obserwuje tego użytkownika!',
'emptyFollowing' => 'Ten użytkownik nie obserwuje nikogo!',
- 'emptySaved' => 'Nie zapisałeś(-aś) jeszcze niczego!',
- 'savedWarning' => 'Tylko Ty widzisz to, co zapisałeś(-aś)',
+ 'emptySaved' => 'Nie zapisałeś(-aś) jeszcze niczego!',
+ 'savedWarning' => 'Tylko Ty widzisz to, co zapisałeś(-aś)',
];
diff --git a/resources/lang/pl/timeline.php b/resources/lang/pl/timeline.php
index 2d4897cf0..0421fd3ee 100644
--- a/resources/lang/pl/timeline.php
+++ b/resources/lang/pl/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Twoja oś czasu jest pusta.'
+ 'emptyPersonalTimeline' => 'Twoja oś czasu jest pusta.',
];
diff --git a/resources/lang/pl/validation.php b/resources/lang/pl/validation.php
index e70ede2f3..271f64dd5 100644
--- a/resources/lang/pl/validation.php
+++ b/resources/lang/pl/validation.php
@@ -71,7 +71,7 @@ return [
'regex' => 'Format :attribute jest nieprawidłowy.',
'required' => 'Pole :attribute jest wymagane.',
'required_if' => 'Pole :attribute musi być wypełnione, jeżeli wartość :other to :value.',
- 'required_unless' => 'Pole :attribute musi być wypełnione, jeżeli wartość :other nie jest jedną z :values.',
+ 'required_unless' => 'Pole :attribute musi być wypełnione, jeżeli wartość :other nie jest jedną z :values.',
'required_with' => 'Pole :attribute musi być wypełnione, jeżeli :values jest obecne.',
'required_with_all' => 'Pole :attribute musi być wypełnione, jeżeli :values są obecne.',
'required_without' => 'Pole :attribute hest wymagane, jeżeli :values nie są obecne.',
diff --git a/resources/lang/ru/auth.php b/resources/lang/ru/auth.php
index 7b28546e8..0bfbfb2bb 100644
--- a/resources/lang/ru/auth.php
+++ b/resources/lang/ru/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Учётные данные не совпадают с нашими записями.',
+ 'failed' => 'Учётные данные не совпадают с нашими записями.',
'throttle' => 'Слишком много попыток входа. Пожалуйста, попробуйте снова через :seconds сек.',
];
diff --git a/resources/lang/ru/notification.php b/resources/lang/ru/notification.php
index 4cde9cd7e..f503d8040 100644
--- a/resources/lang/ru/notification.php
+++ b/resources/lang/ru/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => 'оценил(а) Ваше фото.',
+ 'likedPhoto' => 'оценил(а) Ваше фото.',
'startedFollowingYou' => 'теперь подписан(а) на Вас.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/ru/pagination.php b/resources/lang/ru/pagination.php
index 36c5eb54f..9f3d9d5a2 100644
--- a/resources/lang/ru/pagination.php
+++ b/resources/lang/ru/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Назад',
- 'next' => 'Вперёд »',
+ 'next' => 'Вперёд »',
];
diff --git a/resources/lang/ru/passwords.php b/resources/lang/ru/passwords.php
index c6ebb269f..39b4b85fb 100644
--- a/resources/lang/ru/passwords.php
+++ b/resources/lang/ru/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Пароль должен содержать не менее 6 символов и должен совпадать с подтверждением пароля.',
- 'reset' => 'Ваш пароль был сброшен!',
- 'sent' => 'Мы отправили ссылку для сброса пароля по e-mail!',
- 'token' => 'Этот токен для сброса пароля некорректен.',
- 'user' => "Мы не можем найти пользователя с таким e-mail.",
+ 'reset' => 'Ваш пароль был сброшен!',
+ 'sent' => 'Мы отправили ссылку для сброса пароля по e-mail!',
+ 'token' => 'Этот токен для сброса пароля некорректен.',
+ 'user' => 'Мы не можем найти пользователя с таким e-mail.',
];
diff --git a/resources/lang/ru/profile.php b/resources/lang/ru/profile.php
index ef538b8e3..581a0b0a1 100644
--- a/resources/lang/ru/profile.php
+++ b/resources/lang/ru/profile.php
@@ -1,8 +1,8 @@
'У этого пользователя пока нет ни одного поста!',
+ 'emptyTimeline' => 'У этого пользователя пока нет ни одного поста!',
'emptyFollowers' => 'У этого пользователя пока нет подписчиков!',
'emptyFollowing' => 'Этот пользователь пока ни на кого не подписан!',
- 'savedWarning' => 'Только можете видеть то, что сохранили',
-];
\ No newline at end of file
+ 'savedWarning' => 'Только можете видеть то, что сохранили',
+];
diff --git a/resources/lang/ru/timeline.php b/resources/lang/ru/timeline.php
index b7ab17cd5..3afae346e 100644
--- a/resources/lang/ru/timeline.php
+++ b/resources/lang/ru/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Ваша лента записей пуста.'
+ 'emptyPersonalTimeline' => 'Ваша лента записей пуста.',
-];
\ No newline at end of file
+];
diff --git a/resources/lang/sv/auth.php b/resources/lang/sv/auth.php
index 2494b43ce..da34106a3 100644
--- a/resources/lang/sv/auth.php
+++ b/resources/lang/sv/auth.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'failed' => 'Dessa autentiseringsuppgifter matchar inte vårt register.',
+ 'failed' => 'Dessa autentiseringsuppgifter matchar inte vårt register.',
'throttle' => 'För många inloggningsförsök. Var god försök igen om :seconds sekunder.',
];
diff --git a/resources/lang/sv/notification.php b/resources/lang/sv/notification.php
index bbd658bce..36da5c263 100644
--- a/resources/lang/sv/notification.php
+++ b/resources/lang/sv/notification.php
@@ -2,7 +2,7 @@
return [
- 'likedPhoto' => 'gillade ditt foto.',
+ 'likedPhoto' => 'gillade ditt foto.',
'startedFollowingYou' => 'började följa dig.',
];
diff --git a/resources/lang/sv/pagination.php b/resources/lang/sv/pagination.php
index f48366d47..aa12db17c 100644
--- a/resources/lang/sv/pagination.php
+++ b/resources/lang/sv/pagination.php
@@ -14,6 +14,6 @@ return [
*/
'previous' => '« Föregående',
- 'next' => 'Nästa »',
+ 'next' => 'Nästa »',
];
diff --git a/resources/lang/sv/passwords.php b/resources/lang/sv/passwords.php
index 2c334d4cf..8f9bfc911 100644
--- a/resources/lang/sv/passwords.php
+++ b/resources/lang/sv/passwords.php
@@ -14,9 +14,9 @@ return [
*/
'password' => 'Lösenord måste vara minst sex tecken långa, och matcha bekräftelsen.',
- 'reset' => 'Ditt lösenord har återställts!',
- 'sent' => 'Vi har skickat återställningslänken till ditt e-postkonto!',
- 'token' => 'Denna lösenords-token är ogiltig.',
- 'user' => "Vi kan inte hitta en användare med den e-postadressen.",
+ 'reset' => 'Ditt lösenord har återställts!',
+ 'sent' => 'Vi har skickat återställningslänken till ditt e-postkonto!',
+ 'token' => 'Denna lösenords-token är ogiltig.',
+ 'user' => 'Vi kan inte hitta en användare med den e-postadressen.',
];
diff --git a/resources/lang/sv/profile.php b/resources/lang/sv/profile.php
index c7dda1d4d..26891208c 100644
--- a/resources/lang/sv/profile.php
+++ b/resources/lang/sv/profile.php
@@ -1,8 +1,8 @@
'Den här användaren har inga inlägg än!',
+ 'emptyTimeline' => 'Den här användaren har inga inlägg än!',
'emptyFollowers' => 'Den här användaren har inga följare än!',
'emptyFollowing' => 'Den här användaren följer inte någon än!',
- 'savedWarning' => 'Du är den enda som kan se vad du har sparat',
+ 'savedWarning' => 'Du är den enda som kan se vad du har sparat',
];
diff --git a/resources/lang/sv/timeline.php b/resources/lang/sv/timeline.php
index 9c1c8bae8..ca99d78e4 100644
--- a/resources/lang/sv/timeline.php
+++ b/resources/lang/sv/timeline.php
@@ -2,6 +2,6 @@
return [
- 'emptyPersonalTimeline' => 'Din tidslinje är tom.'
+ 'emptyPersonalTimeline' => 'Din tidslinje är tom.',
];
diff --git a/routes/web.php b/routes/web.php
index 9fa4f9f25..9ce4b213a 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1,146 +1,142 @@
prefix('i/admin')->group(function() {
- Route::redirect('/', '/dashboard');
- Route::redirect('timeline', config('app.url').'/timeline');
- Route::get('dashboard', 'AdminController@home')->name('admin.home');
- Route::redirect('statuses', '/statuses/list');
- Route::get('statuses/list', 'AdminController@statuses')->name('admin.statuses');
- Route::get('statuses/show/{id}', 'AdminController@showStatus');
- Route::redirect('users', '/users/list');
- Route::get('users/list', 'AdminController@users')->name('admin.users');
- Route::redirect('media', '/media/list');
- Route::get('media/list', 'AdminController@media')->name('admin.media');
+Route::domain(config('pixelfed.domain.admin'))->prefix('i/admin')->group(function () {
+ Route::redirect('/', '/dashboard');
+ Route::redirect('timeline', config('app.url').'/timeline');
+ Route::get('dashboard', 'AdminController@home')->name('admin.home');
+ Route::redirect('statuses', '/statuses/list');
+ Route::get('statuses/list', 'AdminController@statuses')->name('admin.statuses');
+ Route::get('statuses/show/{id}', 'AdminController@showStatus');
+ Route::redirect('users', '/users/list');
+ Route::get('users/list', 'AdminController@users')->name('admin.users');
+ Route::redirect('media', '/media/list');
+ Route::get('media/list', 'AdminController@media')->name('admin.media');
});
-Route::domain(config('pixelfed.domain.app'))->middleware('validemail')->group(function() {
+Route::domain(config('pixelfed.domain.app'))->middleware('validemail')->group(function () {
+ Route::get('/', 'SiteController@home')->name('timeline.personal');
+ Route::post('/', 'StatusController@store');
- Route::get('/', 'SiteController@home')->name('timeline.personal');
- Route::post('/', 'StatusController@store');
+ Auth::routes();
- Auth::routes();
+ Route::get('.well-known/webfinger', 'FederationController@webfinger');
+ Route::get('.well-known/nodeinfo', 'FederationController@nodeinfoWellKnown');
- Route::get('.well-known/webfinger', 'FederationController@webfinger');
- Route::get('.well-known/nodeinfo', 'FederationController@nodeinfoWellKnown');
+ Route::get('/home', 'HomeController@index')->name('home');
- Route::get('/home', 'HomeController@index')->name('home');
+ Route::get('discover', 'DiscoverController@home')->name('discover');
+ Route::get('search/hashtag/{tag}', function ($tag) {
+ return redirect('/discover/tags/'.$tag);
+ });
- Route::get('discover', 'DiscoverController@home')->name('discover');
-
- Route::get('search/hashtag/{tag}', function($tag) {
- return redirect('/discover/tags/'.$tag);
- });
-
- Route::group(['prefix' => 'api'], function() {
- Route::get('search/{tag}', 'SearchController@searchAPI')
+ Route::group(['prefix' => 'api'], function () {
+ Route::get('search/{tag}', 'SearchController@searchAPI')
->where('tag', '[A-Za-z0-9]+');
- Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
+ Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
- Route::group(['prefix' => 'v1'], function() {
- Route::post('avatar/update', 'ApiController@avatarUpdate');
- Route::get('likes', 'ApiController@hydrateLikes');
- });
- Route::group(['prefix' => 'local'], function() {
- Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
- Route::post('i/more-comments', 'ApiController@loadMoreComments');
- });
- });
-
- Route::get('discover/tags/{hashtag}', 'DiscoverController@showTags');
-
- Route::group(['prefix' => 'i'], function() {
- Route::redirect('/', '/');
- Route::get('compose', 'StatusController@compose')->name('compose');
- Route::get('remote-follow', 'FederationController@remoteFollow')->name('remotefollow');
- Route::post('remote-follow', 'FederationController@remoteFollowStore');
- Route::post('comment', 'CommentController@store');
- Route::post('delete', 'StatusController@delete');
- Route::post('like', 'LikeController@store');
- Route::post('share', 'StatusController@storeShare');
- Route::post('follow', 'FollowerController@store');
- Route::post('bookmark', 'BookmarkController@store');
- Route::get('lang/{locale}', 'SiteController@changeLocale');
- Route::get('verify-email', 'AccountController@verifyEmail');
- Route::post('verify-email', 'AccountController@sendVerifyEmail');
- Route::get('confirm-email/{userToken}/{randomToken}', 'AccountController@confirmVerifyEmail');
-
- Route::group(['prefix' => 'report'], function() {
- Route::get('/', 'ReportController@showForm')->name('report.form');
- Route::post('/', 'ReportController@formStore');
- Route::get('not-interested', 'ReportController@notInterestedForm')->name('report.not-interested');
- Route::get('spam', 'ReportController@spamForm')->name('report.spam');
- Route::get('spam/comment', 'ReportController@spamCommentForm')->name('report.spam.comment');
- Route::get('spam/post', 'ReportController@spamPostForm')->name('report.spam.post');
- Route::get('spam/profile', 'ReportController@spamProfileForm')->name('report.spam.profile');
- Route::get('sensitive/comment', 'ReportController@sensitiveCommentForm')->name('report.sensitive.comment');
- Route::get('sensitive/post', 'ReportController@sensitivePostForm')->name('report.sensitive.post');
- Route::get('sensitive/profile', 'ReportController@sensitiveProfileForm')->name('report.sensitive.profile');
- Route::get('abusive/comment', 'ReportController@abusiveCommentForm')->name('report.abusive.comment');
- Route::get('abusive/post', 'ReportController@abusivePostForm')->name('report.abusive.post');
- Route::get('abusive/profile', 'ReportController@abusiveProfileForm')->name('report.abusive.profile');
+ Route::group(['prefix' => 'v1'], function () {
+ Route::post('avatar/update', 'ApiController@avatarUpdate');
+ Route::get('likes', 'ApiController@hydrateLikes');
+ });
+ Route::group(['prefix' => 'local'], function () {
+ Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
+ Route::post('i/more-comments', 'ApiController@loadMoreComments');
+ });
});
- });
+ Route::get('discover/tags/{hashtag}', 'DiscoverController@showTags');
- Route::group(['prefix' => 'account'], function() {
- Route::redirect('/', '/');
- Route::get('activity', 'AccountController@notifications')->name('notifications');
- });
+ Route::group(['prefix' => 'i'], function () {
+ Route::redirect('/', '/');
+ Route::get('compose', 'StatusController@compose')->name('compose');
+ Route::get('remote-follow', 'FederationController@remoteFollow')->name('remotefollow');
+ Route::post('remote-follow', 'FederationController@remoteFollowStore');
+ Route::post('comment', 'CommentController@store');
+ Route::post('delete', 'StatusController@delete');
+ Route::post('like', 'LikeController@store');
+ Route::post('share', 'StatusController@storeShare');
+ Route::post('follow', 'FollowerController@store');
+ Route::post('bookmark', 'BookmarkController@store');
+ Route::get('lang/{locale}', 'SiteController@changeLocale');
+ Route::get('verify-email', 'AccountController@verifyEmail');
+ Route::post('verify-email', 'AccountController@sendVerifyEmail');
+ Route::get('confirm-email/{userToken}/{randomToken}', 'AccountController@confirmVerifyEmail');
- Route::group(['prefix' => 'settings'], function() {
- Route::redirect('/', '/settings/home');
- Route::get('home', 'SettingsController@home')->name('settings');
- Route::post('home', 'SettingsController@homeUpdate');
- Route::get('avatar', 'SettingsController@avatar')->name('settings.avatar');
- Route::post('avatar', 'AvatarController@store');
- Route::get('password', 'SettingsController@password')->name('settings.password');
- Route::post('password', 'SettingsController@passwordUpdate');
- Route::get('email', 'SettingsController@email')->name('settings.email');
- Route::get('notifications', 'SettingsController@notifications')->name('settings.notifications');
- Route::get('privacy', 'SettingsController@privacy')->name('settings.privacy');
- Route::post('privacy', 'SettingsController@privacyStore');
- Route::get('security', 'SettingsController@security')->name('settings.security');
- Route::get('applications', 'SettingsController@applications')->name('settings.applications');
- Route::get('data-export', 'SettingsController@dataExport')->name('settings.dataexport');
- Route::get('developers', 'SettingsController@developers')->name('settings.developers');
- });
+ Route::group(['prefix' => 'report'], function () {
+ Route::get('/', 'ReportController@showForm')->name('report.form');
+ Route::post('/', 'ReportController@formStore');
+ Route::get('not-interested', 'ReportController@notInterestedForm')->name('report.not-interested');
+ Route::get('spam', 'ReportController@spamForm')->name('report.spam');
+ Route::get('spam/comment', 'ReportController@spamCommentForm')->name('report.spam.comment');
+ Route::get('spam/post', 'ReportController@spamPostForm')->name('report.spam.post');
+ Route::get('spam/profile', 'ReportController@spamProfileForm')->name('report.spam.profile');
+ Route::get('sensitive/comment', 'ReportController@sensitiveCommentForm')->name('report.sensitive.comment');
+ Route::get('sensitive/post', 'ReportController@sensitivePostForm')->name('report.sensitive.post');
+ Route::get('sensitive/profile', 'ReportController@sensitiveProfileForm')->name('report.sensitive.profile');
+ Route::get('abusive/comment', 'ReportController@abusiveCommentForm')->name('report.abusive.comment');
+ Route::get('abusive/post', 'ReportController@abusivePostForm')->name('report.abusive.post');
+ Route::get('abusive/profile', 'ReportController@abusiveProfileForm')->name('report.abusive.profile');
+ });
+ });
- Route::group(['prefix' => 'site'], function() {
- Route::redirect('/', '/');
- Route::get('about', 'SiteController@about')->name('site.about');
- Route::view('help', 'site.help')->name('site.help');
- Route::view('developer-api', 'site.developer')->name('site.developers');
- Route::view('fediverse', 'site.fediverse')->name('site.fediverse');
- Route::view('open-source', 'site.opensource')->name('site.opensource');
- Route::view('banned-instances', 'site.bannedinstances')->name('site.bannedinstances');
- Route::view('terms', 'site.terms')->name('site.terms');
- Route::view('privacy', 'site.privacy')->name('site.privacy');
- Route::view('platform', 'site.platform')->name('site.platform');
- Route::view('language', 'site.language')->name('site.language');
- });
+ Route::group(['prefix' => 'account'], function () {
+ Route::redirect('/', '/');
+ Route::get('activity', 'AccountController@notifications')->name('notifications');
+ });
- Route::group(['prefix' => 'timeline'], function() {
- Route::redirect('/', '/');
- Route::get('public', 'TimelineController@local')->name('timeline.public');
- Route::post('public', 'StatusController@store');
- });
+ Route::group(['prefix' => 'settings'], function () {
+ Route::redirect('/', '/settings/home');
+ Route::get('home', 'SettingsController@home')->name('settings');
+ Route::post('home', 'SettingsController@homeUpdate');
+ Route::get('avatar', 'SettingsController@avatar')->name('settings.avatar');
+ Route::post('avatar', 'AvatarController@store');
+ Route::get('password', 'SettingsController@password')->name('settings.password');
+ Route::post('password', 'SettingsController@passwordUpdate');
+ Route::get('email', 'SettingsController@email')->name('settings.email');
+ Route::get('notifications', 'SettingsController@notifications')->name('settings.notifications');
+ Route::get('privacy', 'SettingsController@privacy')->name('settings.privacy');
+ Route::post('privacy', 'SettingsController@privacyStore');
+ Route::get('security', 'SettingsController@security')->name('settings.security');
+ Route::get('applications', 'SettingsController@applications')->name('settings.applications');
+ Route::get('data-export', 'SettingsController@dataExport')->name('settings.dataexport');
+ Route::get('developers', 'SettingsController@developers')->name('settings.developers');
+ });
- Route::group(['prefix' => 'users'], function() {
- Route::redirect('/', '/');
- Route::get('{user}.atom', 'ProfileController@showAtomFeed');
- Route::get('{username}/outbox', 'FederationController@userOutbox');
- Route::get('{username}', 'ProfileController@permalinkRedirect');
- });
+ Route::group(['prefix' => 'site'], function () {
+ Route::redirect('/', '/');
+ Route::get('about', 'SiteController@about')->name('site.about');
+ Route::view('help', 'site.help')->name('site.help');
+ Route::view('developer-api', 'site.developer')->name('site.developers');
+ Route::view('fediverse', 'site.fediverse')->name('site.fediverse');
+ Route::view('open-source', 'site.opensource')->name('site.opensource');
+ Route::view('banned-instances', 'site.bannedinstances')->name('site.bannedinstances');
+ Route::view('terms', 'site.terms')->name('site.terms');
+ Route::view('privacy', 'site.privacy')->name('site.privacy');
+ Route::view('platform', 'site.platform')->name('site.platform');
+ Route::view('language', 'site.language')->name('site.language');
+ });
- Route::get('p/{username}/{id}/c/{cid}', 'CommentController@show');
- Route::get('p/{username}/{id}/c', 'CommentController@showAll');
- Route::get('p/{username}/{id}/edit', 'StatusController@edit');
- Route::post('p/{username}/{id}/edit', 'StatusController@editStore');
- Route::get('p/{username}/{id}', 'StatusController@show');
- Route::get('{username}/saved', 'ProfileController@savedBookmarks');
- Route::get('{username}/followers', 'ProfileController@followers');
- Route::get('{username}/following', 'ProfileController@following');
- Route::get('{username}', 'ProfileController@show');
+ Route::group(['prefix' => 'timeline'], function () {
+ Route::redirect('/', '/');
+ Route::get('public', 'TimelineController@local')->name('timeline.public');
+ Route::post('public', 'StatusController@store');
+ });
-});
\ No newline at end of file
+ Route::group(['prefix' => 'users'], function () {
+ Route::redirect('/', '/');
+ Route::get('{user}.atom', 'ProfileController@showAtomFeed');
+ Route::get('{username}/outbox', 'FederationController@userOutbox');
+ Route::get('{username}', 'ProfileController@permalinkRedirect');
+ });
+
+ Route::get('p/{username}/{id}/c/{cid}', 'CommentController@show');
+ Route::get('p/{username}/{id}/c', 'CommentController@showAll');
+ Route::get('p/{username}/{id}/edit', 'StatusController@edit');
+ Route::post('p/{username}/{id}/edit', 'StatusController@editStore');
+ Route::get('p/{username}/{id}', 'StatusController@show');
+ Route::get('{username}/saved', 'ProfileController@savedBookmarks');
+ Route::get('{username}/followers', 'ProfileController@followers');
+ Route::get('{username}/following', 'ProfileController@following');
+ Route::get('{username}', 'ProfileController@show');
+});
diff --git a/server.php b/server.php
index 5fb6379e7..20bc389f0 100644
--- a/server.php
+++ b/server.php
@@ -1,12 +1,10 @@
*/
-
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php
index ff133fb4d..60a3e8ca2 100644
--- a/tests/CreatesApplication.php
+++ b/tests/CreatesApplication.php
@@ -2,8 +2,8 @@
namespace Tests;
-use Illuminate\Support\Facades\Hash;
use Illuminate\Contracts\Console\Kernel;
+use Illuminate\Support\Facades\Hash;
trait CreatesApplication
{
diff --git a/tests/Feature/InstalledTest.php b/tests/Feature/InstalledTest.php
index 0f9aa6d6b..c64567743 100644
--- a/tests/Feature/InstalledTest.php
+++ b/tests/Feature/InstalledTest.php
@@ -3,8 +3,6 @@
namespace Tests\Feature;
use Tests\TestCase;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithoutMiddleware;
class InstalledTest extends TestCase
{
@@ -22,8 +20,8 @@ class InstalledTest extends TestCase
$response
->assertStatus(200)
->assertJson([
- "links" => [
- ["rel" => "http://nodeinfo.diaspora.software/ns/schema/2.0"]
- ]]);
+ 'links' => [
+ ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0'],
+ ], ]);
}
}
diff --git a/tests/Unit/CryptoTest.php b/tests/Unit/CryptoTest.php
index 15ecac713..57f68f1f7 100644
--- a/tests/Unit/CryptoTest.php
+++ b/tests/Unit/CryptoTest.php
@@ -3,8 +3,6 @@
namespace Tests\Unit;
use Tests\TestCase;
-use Illuminate\Foundation\Testing\WithFaker;
-use Illuminate\Foundation\Testing\RefreshDatabase;
class CryptoTest extends TestCase
{
diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php
index e9fe19c66..06ece2c2c 100644
--- a/tests/Unit/ExampleTest.php
+++ b/tests/Unit/ExampleTest.php
@@ -3,7 +3,6 @@
namespace Tests\Unit;
use Tests\TestCase;
-use Illuminate\Foundation\Testing\RefreshDatabase;
class ExampleTest extends TestCase
{