Skip to content

Commit

Permalink
Change is_callable to method_exists for Laravel 8
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStack committed May 24, 2021
1 parent bad5c16 commit a2cd09d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,13 @@ composer require alexstack/laravel-cms && php artisan laravelcms --locale=en --t
- Local: Create a github repository for the laravelcms folder. eg. cd cms && git init && git remote add origin https://github.com/xxx.git
- Local: Enable gd exif for heroku php: composer require ext-exif ext-gd
- On HeroKu: create a new app from this github repository, enable automatically deploy
- HeroKu: add Dyno formation: web vendor/bin/heroku-php-apache2 public/
- HeroKu: add .env variables to settings -> Config Vars
- Local: to use Nginx together with PHP, add a file named Procfile on folder cms with content below:
- Local: to use Nginx/apache together with PHP, add a file named Procfile on folder cms with content below:
```php
web: vendor/bin/heroku-php-nginx
web: vendor/bin/heroku-php-apache2 public/
```
- HeroKu: add Dyno formation: web vendor/bin/heroku-php-apache2 public/
- HeroKu: add .env variables to settings -> Config Vars
- Done

## License

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/LaravelCmsPluginAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function customPluginFunc($action = 'return_options', $form_data = null,
{
$plugin_settings = $this->helper->s('plugin.'.$this->plugin->param_name);
$plugin_class = trim($plugin_settings['php_class'] ?? '');
if ('' != $plugin_class && class_exists($plugin_class) && is_callable($plugin_class.'::'.$action)) {
if ('' != $plugin_class && class_exists($plugin_class) && method_exists($plugin_class, $action)) {
//echo $plugin_class . '::' . $action . ' --- ';

return call_user_func([new $plugin_class(), $action], $form_data, $plugin, $plugin_settings);
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/LaravelCmsPageAdminRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function extraPageTabs($action = 'return_options', $form_data = null, $pa
$callback_ary = collect([]);
foreach ($option_ary as $plugin) {
$plugin_class = trim($plugin['php_class'] ?? '');
if ('' != $plugin_class && class_exists($plugin_class) && is_callable($plugin_class.'::'.$action)) {
if ('' != $plugin_class && class_exists($plugin_class) && method_exists($plugin_class, $action)) {
//echo $plugin_class . '::' . $action . ' --- ';

$s = call_user_func([new $plugin_class(), $action], $form_data, $page, $plugin);
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/LaravelCmsPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function show($id)
$user_class = $special_json->php_class;
$class_method = $special_json->class_method ?? 'index';
$parameters = $special_json->parameters ?? null;
if ('' != $user_class && class_exists($user_class) && is_callable($user_class.'::'.$class_method)) {
if ('' != $user_class && class_exists($user_class) && method_exists($user_class, $class_method)) {
$data = call_user_func([new $user_class(), $class_method], $data, $parameters);
} else {
$data['call_user_func_error'] = $user_class.' class not exists or class_method not callable ';
Expand Down

0 comments on commit a2cd09d

Please sign in to comment.