├── art └── screenshot-1.png ├── config └── general.php ├── plugin.json ├── public └── images │ └── screenshot.png ├── readme.md ├── resources ├── lang │ └── en │ │ └── post-scheduler.php └── views │ └── publish-box.blade.php ├── screenshot.png └── src ├── Facades └── PostScheduler.php ├── Plugin.php ├── Providers ├── HookServiceProvider.php └── PostSchedulerServiceProvider.php └── Supports └── PostScheduler.php /art/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/botble/post-scheduler/6da2cc04a2960dc2fd27f6600ab4720116213176/art/screenshot-1.png -------------------------------------------------------------------------------- /config/general.php: -------------------------------------------------------------------------------- 1 | [ 7 | Post::class, 8 | ], 9 | ]; 10 | -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "botble/post-scheduler", 3 | "name": "Post Scheduler", 4 | "namespace": "Botble\\PostScheduler\\", 5 | "provider": "Botble\\PostScheduler\\Providers\\PostSchedulerServiceProvider", 6 | "author": "Botble Technologies", 7 | "url": "https://botble.com", 8 | "version": "1.3.2", 9 | "minimum_core_version": "7.0.0", 10 | "description": "Set published time for posts", 11 | "required_plugins": ["blog"] 12 | } 13 | -------------------------------------------------------------------------------- /public/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/botble/post-scheduler/6da2cc04a2960dc2fd27f6600ab4720116213176/public/images/screenshot.png -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | This is a plugin for Botble CMS so you have to purchase Botble CMS first to use this plugin. 3 | Purchase it here: [https://codecanyon.net/item/botble-cms-php-platform-based-on-laravel-framework/16928182](https://1.envato.market/LWRBY) 4 | 5 | Post Scheduler is a plugin that allows you to modify the created time of posts. 6 | 7 | ![Screenshot](./art/screenshot-1.png) 8 | 9 | # Installation 10 | 11 | ## Install via Admin Panel 12 | 13 | Go to the **Admin Panel** and click on the **Plugins** tab. Click on the "Add new" button, find the **Post Scheduler** 14 | plugin and click on the "Install" button. 15 | 16 | ## Install manually 17 | 18 | 1. Download the plugin from 19 | the [Botble Marketplace](https://marketplace.botble.com/products/botble/post-scheduler). 20 | 2. Extract the downloaded file and upload the extracted folder to the `platform/plugins` directory. 21 | 3. Go to **Admin** > **Plugins** and click on the **Activate** button. 22 | 23 | # Contact us 24 | - Website: [https://botble.com](https://botble.com) 25 | - Email: [contact@botble.com](mailto:contact@botble.com) 26 | -------------------------------------------------------------------------------- /resources/lang/en/post-scheduler.php: -------------------------------------------------------------------------------- 1 | 'Post Scheduler', 5 | 'publish_date' => 'Publish date', 6 | 'date' => 'Date', 7 | 'time' => 'Time', 8 | 'update_publish_time_to_current_time' => 'Update published time to current time', 9 | ]; 10 | -------------------------------------------------------------------------------- /resources/views/publish-box.blade.php: -------------------------------------------------------------------------------- 1 | @if(version_compare(get_core_version(), '7.0.0', '<')) 2 |
3 | 4 |
5 |
6 | {!! Form::text('publish_date', old('publish_date', $publishDate), ['class' => 'form-control datepicker', 'id' => 'publish_date', 'data-date-format' => config('core.base.general.date_format.js.date'),]) !!} 7 | 8 | 11 | 12 |
13 |
14 | {!! Form::error('publish_date', $errors) !!} 15 |
16 | 17 |
18 | 19 |
20 |
21 | {!! Form::text('publish_time', old('publish_time', $publishTime), ['class' => 'form-control time-picker timepicker timepicker-24', 'id' => 'publish_time']) !!} 22 | 23 | 26 | 27 |
28 |
29 | {!! Form::error('publish_time', $errors) !!} 30 |
31 | 32 | @if ($data && $data->status != Botble\Base\Enums\BaseStatusEnum::PUBLISHED) 33 |
34 | {!! Form::onOff('update_time_to_current', 0) !!} 35 | 36 |
37 | @endif 38 | @else 39 |
40 | 41 |
42 | {!! Form::datePicker('publish_date', old('publish_date', $publishDate)) !!} 43 |
44 |
45 | 46 |
47 | 48 |
49 | {!! Form::time('publish_time', old('publish_time', $publishTime), ['class' => 'form-control']) !!} 50 |
51 |
52 | 53 | @if ($data && $data->status != Botble\Base\Enums\BaseStatusEnum::PUBLISHED) 54 |
55 | 56 | {!! Form::onOff('update_time_to_current', 0, trans('plugins/post-scheduler::post-scheduler.update_publish_time_to_current_time')) !!} 57 |
58 | @endif 59 | @endif 60 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/botble/post-scheduler/6da2cc04a2960dc2fd27f6600ab4720116213176/screenshot.png -------------------------------------------------------------------------------- /src/Facades/PostScheduler.php: -------------------------------------------------------------------------------- 1 | addStyles(['timepicker']); 36 | 37 | MetaBox::addMetaBox( 38 | 'publish_box_wrap', 39 | trans('plugins/post-scheduler::post-scheduler.publish_date'), 40 | [$this, 'addPublishFields'], 41 | $object::class, 42 | $priority, 43 | ); 44 | } 45 | } 46 | 47 | public function addPublishFields(): string 48 | { 49 | $publishDate = Carbon::now(config('app.timezone'))->format(BaseHelper::getDateFormat()); 50 | $publishTime = Carbon::now(config('app.timezone'))->format('G:i'); 51 | 52 | $args = func_get_args(); 53 | $data = $args[0]; 54 | if ($data && $data->id) { 55 | $publishDate = BaseHelper::formatDate($data->created_at); 56 | $publishTime = BaseHelper::formatDate($data->created_at, 'G:i'); 57 | } 58 | 59 | return view('plugins/post-scheduler::publish-box', compact('publishDate', 'publishTime', 'data'))->render(); 60 | } 61 | 62 | public function saveSchedulerData($screen, $request, $object): void 63 | { 64 | if (PostScheduler::isSupportedModule($object::class)) { 65 | if ($request->input('update_time_to_current')) { 66 | $object->created_at = Carbon::now(); 67 | $object->save(); 68 | 69 | return; 70 | } 71 | 72 | $publishDate = $request->input('publish_date'); 73 | $publishTime = $request->input('publish_time', '00:00'); 74 | if (! empty($publishDate)) { 75 | $publishTime = $publishTime ?: '00:00'; 76 | 77 | $object->created_at = Carbon::parse($publishDate . ' ' . $publishTime)->toDateTimeString(); 78 | 79 | $object->saveQuietly(); 80 | } 81 | } 82 | } 83 | 84 | public function checkPublishDateBeforeShowSingle($data, $model) 85 | { 86 | if (Auth::check()) { 87 | return $data; 88 | } 89 | 90 | return $this->checkPublishDateBeforeShow($data, $model); 91 | } 92 | 93 | public function checkPublishDateBeforeShow($data, $model) 94 | { 95 | if (PostScheduler::isSupportedModule(get_class($model))) { 96 | $table = $model->getTable(); 97 | $data->where($table . '.created_at', '<=', Carbon::now(config('app.timezone'))->toDateTimeString()); 98 | } 99 | 100 | return $data; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/Providers/PostSchedulerServiceProvider.php: -------------------------------------------------------------------------------- 1 | setNamespace('plugins/post-scheduler') 21 | ->loadAndPublishConfigurations(['general']) 22 | ->loadAndPublishTranslations() 23 | ->loadAndPublishViews(); 24 | 25 | AliasLoader::getInstance()->alias('PostScheduler', PostScheduler::class); 26 | 27 | $this->app->booted(function () { 28 | $this->app->register(HookServiceProvider::class); 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Supports/PostScheduler.php: -------------------------------------------------------------------------------- 1 | array_merge( 14 | config('plugins.post-scheduler.general.supported', []), 15 | $model 16 | ), 17 | ]); 18 | 19 | return $this; 20 | } 21 | 22 | public function supportedModules(): array 23 | { 24 | return config('plugins.post-scheduler.general.supported', []) ?: []; 25 | } 26 | 27 | public function isSupportedModule(string $model): bool 28 | { 29 | return in_array($model, $this->supportedModules()); 30 | } 31 | } 32 | --------------------------------------------------------------------------------