This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # WordPress Plugin Release Preparer | |
| # | |
| # This script prepares WordPress plugins for distribution by creating a clean ZIP archive | |
| # suitable for uploading to wordpress.org or other distribution platforms. | |
| # | |
| # Features: | |
| # - Removes development files (tests/, vendor/, .github/, .git*, etc.) | |
| # - Cleans up temporary and backup files (*.bak, *~, backup-*.po*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: ЮКасса: Статус «Выполнен» | |
| Description: Автоматически меняет статус заказа на «Выполнен» после оплаты через ЮКассу. | |
| Version: 1.0 | |
| */ | |
| add_filter( 'woocommerce_payment_complete_order_status', 'ykassa_set_completed_status', 10, 2 ); | |
| function ykassa_set_completed_status( $status, $order_id ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Hold money. | |
| * Hold customer's money in loyalty program. Payment will be process on POS during processing of an order. | |
| * | |
| * Удерживание денег клиентов в программе лояльности. Оплата будет произведена на POS-терминале во время обработки заказа. | |
| * | |
| * @param string $customerId | |
| * @param string $walletId | |
| * @param int|string $sum | |
| * @param string|null $comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Livewire 3 component - TinyMce editor | |
| * | |
| * 1. Add component to LiveWire folder in project | |
| * 2. Register component, for example add node to AppServiceProvider boot method: Blade::component('editor', Editor::class); | |
| * 3. Register route for file uploader : | |
| * Route::middleware(['web', 'auth'])->post('/tinymce/upload', function (Request $request) { | |
| * $disk = $request->disk ?? 'public'; | |
| * $folder = $request->folder ?? 'editor'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function true_logged_in_user_content( $atts, $content = null ) { | |
| if(!class_exists('\iiko\bonuses\Bonuses')){ | |
| return 'Ошибка вывода баланса. woo2iiko не подключен'; | |
| } | |
| $bonuses = \iiko\bonuses\Bonuses::getInstance(); | |
| if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) { | |
| $balance = $bonuses->get_user_balances(); | |
| return 'Ваш бонусный баланс: ' . ($balance ?: '0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Вывод / Удаление файлов из директории по шаблону | |
| */ | |
| // создание | |
| foreach ( array_fill(0, 6, '// silence is golden') as $key => $value) { | |
| if (!file_exists("АВР № $key.php")) { | |
| file_put_contents("АВР № $key.php", $value); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spl_autoload_register(function ($className){ | |
| if ( strpos( $className, __NAMESPACE__ ) !== 0 ) { | |
| return; | |
| } | |
| $className = str_replace(__NAMESPACE__ . '\\', 'includes\\', $className); | |
| $path = realpath(__DIR__) . DIRECTORY_SEPARATOR . strtr($className, '\\', DIRECTORY_SEPARATOR) . '.php'; | |
| if (is_readable($path)) { | |
| require_once $path; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Пример создания и использования атрибутов PHP 8 | |
| */ | |
| // Объявление атрибута | |
| #[Attribute] | |
| final class MyAttribute | |
| { | |
| public $value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('woocommerce_before_thankyou', function ($wc_order_id){ | |
| $wc_order = wc_get_order($wc_order_id); | |
| if (empty($wc_order) || $wc_order->has_status('failed')) { | |
| return; | |
| } | |
| $wc_order->update_meta_data('deliveryDurationInMinutes', ''); | |
| $wc_order->save_meta_data(); | |
| }, 5); |
NewerOlder