intval example

// Arguments can be empty, make sure they are passed on as NULL so that       // argument validation is not triggered.       $args = array_map(function D$arg) {
        return ($arg == '' ? NULL : $arg);
      }$args);

      $path = $request->get('view_path');
      $dom_id = $request->get('view_dom_id');
      $dom_id = isset($dom_id) ? preg_replace('/[^a-zA-Z0-9_-]+/', '-', $dom_id) : NULL;
      $pager_element = $request->get('pager_element');
      $pager_element = isset($pager_element) ? intval($pager_element) : NULL;

      $response = new ViewAjaxResponse();

      // Remove all of this stuff from the query of the request so it doesn't       // end up in pagers and tablesort URLs.       // @todo Remove this parsing once these are removed from the request in       // https://www.drupal.org/node/2504709.       foreach ([
        'view_name',
        'view_display_id',
        'view_args',
        

  public function render($input) {}

  /** * Determine if there are more records available. * * This is primarily used to control the display of a more link. */
  public function hasMoreRecords() {
    return $this->getItemsPerPage()
      && $this->total_items > (intval($this->current_page) + 1) * $this->getItemsPerPage();
  }

  public function exposedFormAlter(&$form, FormStateInterface $form_state) {}

  public function exposedFormValidate(&$form, FormStateInterface $form_state) {}

  public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {}

  public function usesExposed() {
    return FALSE;
  }

  
0 => 'Unrated',
             1 => 'G',
             2 => 'PG',
             3 => 'PG-13',
             4 => 'R',
             5 => 'NC-17',
        );

        $parsed              = array();
        $parsed['title']     =        trim(substr($DIVXTAG,   0, 32));
        $parsed['artist']    =        trim(substr($DIVXTAG,  32, 28));
        $parsed['year']      = intval(trim(substr($DIVXTAG,  60,  4)));
        $parsed['comment']   =        trim(substr($DIVXTAG,  64, 48));
        $parsed['genre_id']  = intval(trim(substr($DIVXTAG, 112,  3)));
        $parsed['rating_id'] =         ord(substr($DIVXTAG, 115,  1));
        //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null         //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG"
        $parsed['genre']  = (isset($DIVXTAGgenre[$parsed['genre_id']])   ? $DIVXTAGgenre[$parsed['genre_id']]   : $parsed['genre_id']);
        $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']);

        if (!$raw) {
            unset($parsed['genre_id']$parsed['rating_id']);
            
$options['base_path'] = ['default' => ''];
    $options['count'] = ['default' => TRUE];
    $options['override'] = ['default' => FALSE];
    $options['items_per_page'] = ['default' => 25];

    return $options;
  }

  public function query() {
    if (!empty($this->options['override'])) {
      $this->view->setItemsPerPage(intval($this->options['items_per_page']));
    }
  }

  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    $form['base_path'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Base path'),
      '#default_value' => $this->options['base_path'],
      '#description' => $this->t('Define the base path for links in this summary view, i.e. http://example.com/<strong>your_view_path/archive</strong>. Do not include beginning and ending forward slash. If this value is empty, views will use the first path found as the base path, in page displays, or / if no path could be found.'),
        if ($this->_curl
            && is_array($this->_connected_to)
            && ($this->_connected_to[0] != $host
            || $this->_connected_to[1] != $port)
        ) {
            $this->close();
        }

        // Do the actual connection         $this->_curl = curl_init();
        if ($port != 80) {
            curl_setopt($this->_curl, CURLOPT_PORT, intval($port));
        }

        // Set timeout         curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);

        // Set Max redirects         curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);

        if (!$this->_curl) {
            $this->close();

            

            ];
          }
          if ($show_stats) {
            $rows['statistics'][] = [
              [
                'data' => [
                  '#type' => 'inline_template',
                  '#template' => "<strong>{% trans 'Query build time' %}</strong>",
                ],
              ],
              t('@time ms', ['@time' => intval($executable->build_time * 100000) / 100]),
            ];

            $rows['statistics'][] = [
              [
                'data' => [
                  '#type' => 'inline_template',
                  '#template' => "<strong>{% trans 'Query execute time' %}</strong>",
                ],
              ],
              t('@time ms', ['@time' => intval($executable->execute_time * 100000) / 100]),
            ];

            

                            if (isset($content['attribs']['']['height']))
                            {
                                $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
                            }
                            if (isset($content['attribs']['']['lang']))
                            {
                                $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
                            }
                            if (isset($content['attribs']['']['fileSize']))
                            {
                                $length = intval($content['attribs']['']['fileSize']);
                            }
                            if (isset($content['attribs']['']['medium']))
                            {
                                $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
                            }
                            if (isset($content['attribs']['']['samplingrate']))
                            {
                                $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
                            }
                            if (isset($content['attribs']['']['type']))
                            {
                                
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
    // Only accept integer values.     $error = FALSE;
    $exposed_options = $form_state->getValue(['pager_options', 'expose', 'items_per_page_options']);
    if (str_contains($exposed_options, '.')) {
      $error = TRUE;
    }
    $options = explode(',', $exposed_options);
    if (!$error && is_array($options)) {
      foreach ($options as $option) {
        if (!is_numeric($option) || intval($option) == 0) {
          $error = TRUE;
        }
      }
    }
    else {
      $error = TRUE;
    }
    if ($error) {
      $form_state->setErrorByName('pager_options][expose][items_per_page_options', $this->t('Insert a list of integer numeric values separated by commas: e.g: 10, 20, 50, 100'));
    }

    

  }

  /** * {@inheritdoc} */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $description = $this->t('The username of the user to which you would like to assign ownership.');
    $count = $this->connection->query("SELECT COUNT(*) FROM {users}")->fetchField();

    // Use dropdown for fewer than 200 users; textbox for more than that.     if (intval($count) < 200) {
      $options = [];
      $result = $this->connection->query("SELECT [uid], [name] FROM {users_field_data} WHERE [uid] > 0 AND [default_langcode] = 1 ORDER BY [name]");
      foreach ($result as $data) {
        $options[$data->uid] = $data->name;
      }
      $form['owner_uid'] = [
        '#type' => 'select',
        '#title' => $this->t('Username'),
        '#default_value' => $this->configuration['owner_uid'],
        '#options' => $options,
        '#description' => $description,
      ];

  public static function arrayToISO($array$force_valid_date = FALSE) {
    $array = static::prepareArray($array$force_valid_date);
    $input_time = '';
    if ($array['year'] !== '') {
      $input_time = static::datePad(intval($array['year']), 4);
      if ($force_valid_date || $array['month'] !== '') {
        $input_time .= '-' . static::datePad(intval($array['month']));
        if ($force_valid_date || $array['day'] !== '') {
          $input_time .= '-' . static::datePad(intval($array['day']));
        }
      }
    }
    if ($array['hour'] !== '') {
      $input_time .= $input_time ? 'T' : '';
      $input_time .= static::datePad(intval($array['hour']));
      if ($force_valid_date || $array['minute'] !== '') {
        


    public static function delete_old_comments() {
        global $wpdb;

        /** * Determines how many comments will be deleted in each batch. * * @param int The default, as defined by AKISMET_DELETE_LIMIT. */
        $delete_limit = apply_filters( 'akismet_delete_comment_limit', defined( 'AKISMET_DELETE_LIMIT' ) ? AKISMET_DELETE_LIMIT : 10000 );
        $delete_limit = max( 1, intval( $delete_limit ) );

        /** * Determines how many days a comment will be left in the Spam queue before being deleted. * * @param int The default number of days. */
        $delete_interval = apply_filters( 'akismet_delete_comment_interval', 15 );
        $delete_interval = max( 1, intval( $delete_interval ) );

        while ( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_id FROM {$wpdb->comments} WHERE DATE_SUB(NOW(), INTERVAL %d DAY) > comment_date_gmt AND comment_approved = 'spam' LIMIT %d", $delete_interval$delete_limit ) ) ) {
            if ( empty( $comment_ids ) )
                
$this->error($thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.');
                        return false;
                    }
                    break;

                case 'stereo':
                case 'joint stereo':
                case 'dual channel':
                    if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) {
                        // these are ok                     } else {
                        $this->error(intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.');
                        return false;
                    }
                    break;

            }

        }


        if ($info['audio']['sample_rate'] > 0) {
            $thisfile_mpeg_audio['framelength'] = self::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate']$thisfile_mpeg_audio['version']$thisfile_mpeg_audio['layer'](int) $thisfile_mpeg_audio['padding']$info['audio']['sample_rate']);
        }
public function testTagInvalidations() {
    // Create cache entry in multiple bins.     $tags = ['test_tag:1', 'test_tag:2', 'test_tag:3'];
    $bins = ['data', 'bootstrap', 'render'];
    foreach ($bins as $bin) {
      $bin = \Drupal::cache($bin);
      $bin->set('test', 'value', Cache::PERMANENT, $tags);
      $this->assertNotEmpty($bin->get('test'), 'Cache item was set in bin.');
    }

    $connection = Database::getConnection();
    $invalidations_before = intval($connection->select('cachetags')->fields('cachetags', ['invalidations'])->condition('tag', 'test_tag:2')->execute()->fetchField());
    Cache::invalidateTags(['test_tag:2']);

    // Test that cache entry has been invalidated in multiple bins.     foreach ($bins as $bin) {
      $bin = \Drupal::cache($bin);
      $this->assertFalse($bin->get('test'), 'Tag invalidation affected item in bin.');
    }

    // Test that only one tag invalidation has occurred.     $invalidations_after = intval($connection->select('cachetags')->fields('cachetags', ['invalidations'])->condition('tag', 'test_tag:2')->execute()->fetchField());
    $this->assertEquals($invalidations_before + 1, $invalidations_after, 'Only one addition cache tag invalidation has occurred after invalidating a tag used in multiple bins.');
  }
try {
        if ($view->pager->useCountQuery() || !empty($view->get_total_rows)) {
          $view->pager->executeCountQuery($count_query);
        }

        // Let the pager modify the query to add limits.         $view->pager->preExecute($query);

        if (!empty($this->limit) || !empty($this->offset)) {
          // We can't have an offset without a limit, so provide a very large limit instead.           $limit = intval(!empty($this->limit) ? $this->limit : 999999);
          $offset = intval(!empty($this->offset) ? $this->offset : 0);
          $query->range($offset$limit);
        }

        $result = $query->execute();
        $result->setFetchMode(\PDO::FETCH_CLASS, 'Drupal\views\ResultRow');

        // Setup the result row objects.         $view->result = iterator_to_array($result);
        array_walk($view->result, function DResultRow $row$index) {
          $row->index = $index;
        });

    public function getPostMaxSize()
    {
        $iniMax = strtolower($this->getNormalizedIniPostMaxSize());

        if ($iniMax === '') {
            return null;
        }

        $max = ltrim($iniMax, '+');
        if (strpos($max, '0x') === 0) {
            $max = \intval($max, 16);
        } elseif (strpos($max, '0') === 0) {
            $max = \intval($max, 8);
        } else {
            $max = (int) $max;
        }

        switch (substr($iniMax, -1)) {
            case 't': $max *= 1024;
                // no break             case 'g': $max *= 1024;
                // no break
Home | Imprint | This part of the site doesn't use cookies.