xandeadx

GLM 5.2 (paid)

Jun 25th, 2026 (edited)
41
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.56 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. namespace Drupal\example\Plugin\Block;
  6.  
  7. use Drupal\Component\Datetime\TimeInterface;
  8. use Drupal\Core\Block\Attribute\Block;
  9. use Drupal\Core\Block\BlockBase;
  10. use Drupal\Core\Datetime\DateFormatterInterface;
  11. use Drupal\Core\Entity\EntityTypeManagerInterface;
  12. use Drupal\Core\Form\FormStateInterface;
  13. use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
  14. use Drupal\Core\StringTranslation\TranslatableMarkup;
  15. use Symfony\Component\DependencyInjection\ContainerInterface;
  16.  
  17. /**
  18.  * Provides a block displaying the current date.
  19.  */
  20. #[Block(
  21.  id: self::ID,
  22.   admin_label: new TranslatableMarkup('Current date'),
  23. )]
  24. final class CurrentDateBlock extends BlockBase implements ContainerFactoryPluginInterface {
  25.  
  26.   public const string ID = 'example_current_date';
  27.  
  28.   /**
  29.    * Cache max-age (seconds). The current date is time-dependent.
  30.    */
  31.   private const int CACHE_MAX_AGE = 60;
  32.  
  33.   /**
  34.    * Creates a new CurrentDateBlock instance.
  35.    *
  36.    * @param array $configuration
  37.    *   The plugin configuration.
  38.    * @param string $plugin_id
  39.    *   The plugin ID.
  40.    * @param mixed $plugin_definition
  41.    *   The plugin definition.
  42.    * @param \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter
  43.    *   The date formatter service.
  44.    * @param \Drupal\Component\Datetime\TimeInterface $time
  45.    *   The time service (provides the request time).
  46.    * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
  47.    *   The entity type manager (to load date format entities).
  48.    */
  49.   public function __construct(
  50.     array $configuration,
  51.     $plugin_id,
  52.     $plugin_definition,
  53.     protected DateFormatterInterface $dateFormatter,
  54.     protected TimeInterface $time,
  55.     protected EntityTypeManagerInterface $entityTypeManager,
  56.   ) {
  57.     parent::__construct($configuration, $plugin_id, $plugin_definition);
  58.   }
  59.  
  60.   /**
  61.    * {@inheritdoc}
  62.    */
  63.   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  64.     return new self(
  65.       $configuration,
  66.       $plugin_id,
  67.       $plugin_definition,
  68.       $container->get('date.formatter'),
  69.       $container->get('datetime.time'),
  70.       $container->get('entity_type.manager'),
  71.     );
  72.   }
  73.  
  74.   /**
  75.    * {@inheritdoc}
  76.    */
  77.   public function defaultConfiguration(): array {
  78.     return [
  79.       'date_format' => 'medium',
  80.       'custom_format' => '',
  81.     ] + parent::defaultConfiguration();
  82.   }
  83.  
  84.   /**
  85.    * {@inheritdoc}
  86.    */
  87.   public function blockForm($form, FormStateInterface $form_state): array {
  88.     $formats = [];
  89.     foreach ($this->entityTypeManager->getStorage('date_format')->loadMultiple() as $machine_name => $format) {
  90.       $formats[$machine_name] = $format->label();
  91.     }
  92.  
  93.     $form['date_format'] = [
  94.       '#type' => 'select',
  95.       '#title' => $this->t('Date format'),
  96.       '#description' => $this->t('Choose a date format defined at <a href=":url">Date and time formats</a>.', [
  97.         ':url' => '/admin/config/regional/date-time',
  98.       ]),
  99.       '#options' => $formats,
  100.       '#default_value' => $this->configuration['date_format'],
  101.       '#required' => TRUE,
  102.     ];
  103.     $form['custom_format'] = [
  104.       '#type' => 'textfield',
  105.       '#title' => $this->t('Custom format'),
  106.       '#description' => $this->t('A PHP date format string (e.g. <em>d.m.Y</em>). Used when "Date format" is not applicable. See the <a href=":url">PHP manual</a> for available options.', [
  107.         ':url' => 'https://www.php.net/manual/datetime.format.php',
  108.       ]),
  109.       '#default_value' => $this->configuration['custom_format'],
  110.       '#states' => [
  111.         'visible' => [
  112.           ':input[name="settings[date_format]"]' => ['value' => 'custom'],
  113.         ],
  114.       ],
  115.     ];
  116.  
  117.     return $form;
  118.   }
  119.  
  120.   /**
  121.    * {@inheritdoc}
  122.    */
  123.   public function blockSubmit($form, FormStateInterface $form_state): void {
  124.     $this->configuration['date_format'] = $form_state->getValue('date_format');
  125.     $this->configuration['custom_format'] = $form_state->getValue('custom_format');
  126.   }
  127.  
  128.   /**
  129.    * {@inheritdoc}
  130.    */
  131.   public function build(): array {
  132.     $date_format = $this->configuration['date_format'];
  133.     $format_type = $date_format === 'custom' ? 'custom' : $date_format;
  134.     $formatted = $this->dateFormatter->format(
  135.       $this->time->getRequestTime(),
  136.       $format_type,
  137.       $this->configuration['custom_format'],
  138.     );
  139.  
  140.     return [
  141.       '#plain_text' => $formatted,
  142.       '#cache' => [
  143.         'contexts' => ['timezone'],
  144.         'max-age' => self::CACHE_MAX_AGE,
  145.       ],
  146.     ];
  147.   }
  148.  
  149. }
Advertisement
Comments
  • User was banned
  • ETechSavvies
    2 days
    # CSS 0.82 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://drive.google.com/file/d/1cvQPOZ7JecI0L6lqdIzIHJbHQBiDRT4U/view
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
Add Comment
Please, Sign In to add comment