diff --git a/app/Admin/AdminOptions.php b/app/Admin/AdminOptions.php index ccdeaf636c7a2ddad86d26b599928cec314a04cd..e0458f22debf478504dc508870ae7ce3db5dc223 100644 --- a/app/Admin/AdminOptions.php +++ b/app/Admin/AdminOptions.php @@ -24,7 +24,7 @@ class AdminOptions 'gallery', 'search-form', 'script', - 'style' + 'style', ]); remove_theme_support('block-templates'); remove_theme_support('core-block-patterns'); @@ -67,7 +67,7 @@ class AdminOptions wp_localize_script('app', 'data', [ 'ajax_url' => admin_url('admin-ajax.php'), - 'nonce' => wp_create_nonce('ajax-nonce'), + 'nonce' => wp_create_nonce('ajax-nonce'), ]); } diff --git a/app/Controllers/Api/ApiController.php b/app/Controllers/Api/ApiController.php index c6eb22c3b0aee1fc1512a8a99103d1b56310e623..c0be6021943396b3214cbef2be63321471b3d8b5 100644 --- a/app/Controllers/Api/ApiController.php +++ b/app/Controllers/Api/ApiController.php @@ -7,7 +7,7 @@ class ApiController public function index(): array { return [ - 'title' => 'title' + 'title' => 'title', ]; } } diff --git a/app/Controllers/PageController.php b/app/Controllers/PageController.php index 394649ec6c85f1e92f311b59ee48f6ff455dabbd..ade5549be647f18a08b3fa65e6f038f2024400c0 100644 --- a/app/Controllers/PageController.php +++ b/app/Controllers/PageController.php @@ -35,9 +35,9 @@ class PageController extends Controller } $this->data['posts'] = Timber::get_posts([ - 'post_type' => 'post', + 'post_type' => 'post', 'posts_per_page' => 10, - 'paged' => $paged, + 'paged' => $paged, ]); $this->data['categories'] = Timber::get_terms('category'); diff --git a/app/CustomFields/Blocks.php b/app/CustomFields/Blocks.php index 1843fa6c76918ba7328eb6b42148ae0c937a839f..186698d349b761ed477bc1fa9e8163cec0ac47f1 100644 --- a/app/CustomFields/Blocks.php +++ b/app/CustomFields/Blocks.php @@ -4,5 +4,5 @@ * post/page blocks */ add_action('carbon_fields_register_fields', function () { - include __DIR__ . '/Blocks/example.php'; + include __DIR__.'/Blocks/example.php'; }); diff --git a/app/CustomFields/Blocks/example.php b/app/CustomFields/Blocks/example.php index 13fbfb87298a7f12fe094f729b2cdbe90a6c5966..1a11f40e4b0fc4b793c30f05cf5d3431500170b2 100644 --- a/app/CustomFields/Blocks/example.php +++ b/app/CustomFields/Blocks/example.php @@ -5,10 +5,9 @@ use Carbon_Fields\Field; wp_register_style( 'crb-my-shiny-gutenberg-block-stylesheet', - get_stylesheet_directory_uri() . '../app/CustomFields/Blocks/example.css' + get_stylesheet_directory_uri().'../app/CustomFields/Blocks/example.css' ); - Block::make(__('My Gutenberg Block')) ->add_fields([ Field::make('text', 'heading', __('Block Heading')), @@ -18,5 +17,5 @@ Block::make(__('My Gutenberg Block')) ->set_description(__('Description for the block')) ->set_editor_style('crb-my-shiny-gutenberg-block-stylesheet') ->set_render_callback(function ($fields, $attributes, $inner_blocks) { - include(__DIR__ . '/example.view.php'); + include __DIR__.'/example.view.php'; }); diff --git a/app/CustomFields/PostFields.php b/app/CustomFields/PostFields.php index 4c06485de51db4789894fdf1db2d77bc6153cb28..c64ba65bdf89b6ab6c54cd53e9128325d8546734 100644 --- a/app/CustomFields/PostFields.php +++ b/app/CustomFields/PostFields.php @@ -4,8 +4,8 @@ * post/page fields */ add_action('carbon_fields_register_fields', function () { - include __DIR__ . '/Fields/home.php'; - include __DIR__ . '/Fields/about.php'; + include __DIR__.'/Fields/home.php'; + include __DIR__.'/Fields/about.php'; // Container::make( 'comment_meta', 'Comment fields' ) // ->add_fields( array( // Field::make( 'text', 'comment_rating', 'Rating' ), diff --git a/app/Handlers/AjaxHandlers/contact.php b/app/Handlers/AjaxHandlers/contact.php index e468df0eddff9addee01bf606c738fed5a9c9cc4..033f143a757cf42d058fd387f972c9da5c706a00 100644 --- a/app/Handlers/AjaxHandlers/contact.php +++ b/app/Handlers/AjaxHandlers/contact.php @@ -20,15 +20,15 @@ if (!is_email($mail)) { } $isMailSent = send_email('test', [ - 'subject' => 'test form', + 'subject' => 'test form', 'site_name' => get_bloginfo('name'), - 'name' => $name, - 'mail' => $mail, + 'name' => $name, + 'mail' => $mail, ]); if ($isMailSent) { wp_send_json([ - 'type' => 'success', + 'type' => 'success', 'message' => 'Your request has been successfully sent, thank you!', ]); } else { diff --git a/app/Handlers/AjaxHandlers/login.php b/app/Handlers/AjaxHandlers/login.php index bb783360b47870a950faa802f7f87c298ddbecfa..689a35ec10ce24a07a9e966b729d3713f8cd91ed 100644 --- a/app/Handlers/AjaxHandlers/login.php +++ b/app/Handlers/AjaxHandlers/login.php @@ -16,21 +16,21 @@ if (!is_email($email)) { } $credentials = [ - 'user_login' => $email, + 'user_login' => $email, 'user_password' => $password, - 'remember' => true, + 'remember' => true, ]; $user = wp_signon($credentials, false); if (is_wp_error($user)) { wp_send_json([ - 'type' => 'error', + 'type' => 'error', 'message' => json_decode($user->get_error_message()), ]); } wp_send_json([ - 'type' => 'success', + 'type' => 'success', 'message' => 'Your successfully enter', ]); diff --git a/app/helpers.php b/app/helpers.php index 1d0b6cdbd3b6850011d0c30dd2b7997ded154523..9d3625ae30dcd09eb22faad2916b7e0a47f402b6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -5,8 +5,10 @@ use Timber\Timber; if (!function_exists('send_email')) { /** * Send a custom email. + * * @param string $templateFilename - * @param array $templateData + * @param array $templateData + * * @return bool|null */ function send_email(string $templateFilename, array $templateData): ?bool @@ -19,19 +21,23 @@ if (!function_exists('send_email')) { /** * Compile an email template. + * * @param string $filename - * @param array $data + * @param array $data + * * @return string */ function compile_email_template(string $filename, array $data): string { - return Timber::compile('/resources/views/emails/' . $filename . '.twig', $data); + return Timber::compile('/resources/views/emails/'.$filename.'.twig', $data); } /** * Dispatch an email. + * * @param string $subject * @param string $body + * * @return bool */ function dispatch_email(string $subject, string $body): bool @@ -41,7 +47,7 @@ if (!function_exists('send_email')) { $toEmail = $adminEmail; $headers[] = 'Content-type: text/html; charset=utf-8'; - $headers[] = 'From: ' . $fromEmail; + $headers[] = 'From: '.$fromEmail; return wp_mail($toEmail, $subject, $body, $headers); } @@ -50,24 +56,26 @@ if (!function_exists('send_email')) { if (!function_exists('add_ajax_action')) { /** * Registers an AJAX action with WordPress. + * * @param string $name The name of the AJAX action. */ function add_ajax_action(string $name): void { - $action_path = APP_PATH . '/Handlers/AjaxHandlers/' . $name . '.php'; + $action_path = APP_PATH.'/Handlers/AjaxHandlers/'.$name.'.php'; add_ajax_action_impl($name, 'wp_ajax', $action_path); add_ajax_action_impl($name, 'wp_ajax_nopriv', $action_path); } /** * Helper function to implement AJAX action registration. - * @param string $name The name of the AJAX action. - * @param string $hook The WordPress hook to associate with the action. + * + * @param string $name The name of the AJAX action. + * @param string $hook The WordPress hook to associate with the action. * @param string $action_path Path to the PHP file that handles the action. */ function add_ajax_action_impl(string $name, string $hook, string $action_path): void { - add_action($hook . "_$name", function () use ($action_path) { + add_action($hook."_$name", function () use ($action_path) { require $action_path; }); } @@ -76,19 +84,21 @@ if (!function_exists('add_ajax_action')) { if (!function_exists('dd')) { /** * Debug function to dump and die. Outputs the given variable and stops execution. + * * @param mixed $result The variable to be dumped. */ function dd(mixed $result): void { echo '
';
print_r($result);
- die();
+ exit;
}
}
if (!function_exists('crb_get_i18n_suffix')) {
/**
* Get the suffix for internationalization, typically a language code.
+ *
* @return string The suffix for the current language, or an empty string if not set.
*/
function crb_get_i18n_suffix(): string
@@ -97,19 +107,23 @@ if (!function_exists('crb_get_i18n_suffix')) {
if (!defined('ICL_LANGUAGE_CODE')) {
return $suffix;
}
- return '_' . ICL_LANGUAGE_CODE;
+
+ return '_'.ICL_LANGUAGE_CODE;
}
}
if (!function_exists('crb_get_i18n_theme_option')) {
/**
* Retrieves a theme option value with internationalization support.
+ *
* @param string $option_name The name of the theme option.
+ *
* @return mixed The value of the theme option for the current language.
*/
function crb_get_i18n_theme_option(string $option_name): mixed
{
$suffix = crb_get_i18n_suffix();
- return carbon_get_theme_option($option_name . $suffix);
+
+ return carbon_get_theme_option($option_name.$suffix);
}
}
diff --git a/bootstrap/app.php b/bootstrap/app.php
index 170d0ddb47435327b25d683a0f9ea83f53f843de..8ef1d598bfcc1670c45db82a963d6c4a8a3ea757 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -4,7 +4,7 @@ use App\Admin\AdminOptions;
use App\Admin\HiddenData;
use Core\AppConfig;
-$configPath = __DIR__ . '/../config/admin.php';
+$configPath = __DIR__.'/../config/admin.php';
$config = include $configPath;
new AppConfig($config);
diff --git a/config/admin.php b/config/admin.php
index 7202a93a06d4a2f16352a3d8f2b4054b11d4ce46..99eea218ff9acd284995643bd4fa3ede856ac511 100644
--- a/config/admin.php
+++ b/config/admin.php
@@ -4,9 +4,9 @@
* basic admin theme options.
*/
return [
- 'show_posts' => true,
- 'show_pages' => true,
+ 'show_posts' => true,
+ 'show_pages' => true,
'enable_comments' => true,
- 'show_tools' => true,
- 'show_admin_bar' => true,
+ 'show_tools' => true,
+ 'show_admin_bar' => true,
];
diff --git a/resources/functions.php b/resources/functions.php
index 7f084207950a5e41a005341c42bfe06724e8be6e..fc2628fff941818e3e9d9d04f92e162c58855b79 100644
--- a/resources/functions.php
+++ b/resources/functions.php
@@ -2,10 +2,10 @@
use Carbon_Fields\Carbon_Fields;
-const APP_PATH = __DIR__ . '/../app';
-const BASE_PATH = __DIR__ . '/..';
+const APP_PATH = __DIR__.'/../app';
+const BASE_PATH = __DIR__.'/..';
-if (!file_exists($composer = BASE_PATH . '/vendor/autoload.php')) {
+if (!file_exists($composer = BASE_PATH.'/vendor/autoload.php')) {
wp_die('Error locating autoloader. Please run composer install.');
}
diff --git a/resources/index.php b/resources/index.php
index cb0f74f51ccc818d9cf9daa9b8b28f143a2fc4a2..1aa810cbd864d5773157902b6c13fcf8296750bf 100644
--- a/resources/index.php
+++ b/resources/index.php
@@ -1,3 +1,3 @@