elseif example


class ContactFormAccessControlHandler extends EntityAccessControlHandler {

  /** * {@inheritdoc} */
  protected function checkAccess(EntityInterface $entity$operation, AccountInterface $account) {
    if ($operation == 'view') {
      // Do not allow access personal form via site-wide route.       return AccessResult::allowedIfHasPermission($account, 'access site-wide contact form')->andIf(AccessResult::allowedIf($entity->id() !== 'personal'));
    }
    elseif ($operation == 'delete' || $operation == 'update') {
      // Do not allow the 'personal' form to be deleted, as it's used for       // the personal contact form.       return AccessResult::allowedIfHasPermission($account, 'administer contact forms')->andIf(AccessResult::allowedIf($entity->id() !== 'personal'));
    }

    return parent::checkAccess($entity$operation$account);
  }

}
foreach ($conditions as $condition_key => $condition) {
        $operator = $condition['operator'] ?: (is_array($condition['value']) ? 'IN' : '=');
        if (is_string($condition['field']) && ($operator == 'IN' || $operator == '=')) {
          // Special case ID lookups.           if ($condition['field'] == $id_key) {
            $has_added_restrictions = TRUE;
            $ids = (array) $condition['value'];
            $filter_by_names[] = array_map(static function D$id) use ($prefix) {
              return $prefix . $id;
            }$ids);
          }
          elseif (in_array($condition['field']$lookup_keys)) {
            $has_added_restrictions = TRUE;
            // If we don't find anything then there are no matches. No point in             // listing anything.             $keys = (array) $condition['value'];
            $keys = array_map(static function D$value) use ($condition) {
              return $condition['field'] . ':' . $value;
            }$keys);
            foreach ($this->getConfigKeyStore()->getMultiple($keys) as $list) {
              $filter_by_names[] = $list;
            }
          }
        }

  public static function get($name) {
    $configuration = [];
    $overrides = Settings::get('php_storage');
    if (isset($overrides[$name])) {
      $configuration = $overrides[$name];
    }
    elseif (isset($overrides['default'])) {
      $configuration = $overrides['default'];
    }
    // Make sure all the necessary configuration values are set.     $class = $configuration['class'] ?? 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage';
    if (!isset($configuration['secret'])) {
      $configuration['secret'] = Settings::getHashSalt();
    }
    if (!isset($configuration['bin'])) {
      $configuration['bin'] = $name;
    }
    if (!isset($configuration['directory'])) {
      
$bare = $this->getOption('bare');
        $rest = $this->getOption('restful');

        $useStatement = trim(APP_NAMESPACE, '\\') . '\Controllers\BaseController';
        $extends      = 'BaseController';

        // Gets the appropriate parent class to extend.         if ($bare || $rest) {
            if ($bare) {
                $useStatement = Controller::class;
                $extends      = 'Controller';
            } elseif ($rest) {
                $rest = is_string($rest) ? $rest : 'controller';

                if (in_array($rest['controller', 'presenter'], true)) {
                    // @codeCoverageIgnoreStart                     $rest = CLI::prompt(lang('CLI.generator.parentClass')['controller', 'presenter'], 'required');
                    CLI::newLine();
                    // @codeCoverageIgnoreEnd                 }

                if ($rest === 'controller') {
                    $useStatement = ResourceController::class;
                    
$_desc = $term_to_ancestor[ $desc ];
                                unset( $term_to_ancestor[ $desc ] );
                                $desc = $_desc;
                            } else {
                                $desc = 0;
                            }
                        } while ( ! empty( $desc ) );
                    }
                }
            }
        }
    } elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) {
        $term_hierarchy   = _get_term_hierarchy( $queried_object->taxonomy );
        $term_to_ancestor = array();
        foreach ( (array) $term_hierarchy as $anc => $descs ) {
            foreach ( (array) $descs as $desc ) {
                $term_to_ancestor[ $desc ] = $anc;
            }
        }
        $desc = $queried_object->term_id;
        do {
            $possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc;
            if ( isset( $term_to_ancestor[ $desc ] ) ) {
                
$factors = [
            'k' => 1000,
            'ki' => 1 << 10,
            'm' => 1000 * 1000,
            'mi' => 1 << 20,
            'g' => 1000 * 1000 * 1000,
            'gi' => 1 << 30,
        ];
        if (ctype_digit((string) $maxSize)) {
            $this->maxSize = (int) $maxSize;
            $this->binaryFormat ??= false;
        } elseif (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize$matches)) {
            $this->maxSize = $matches[1] * $factors[$unit = strtolower($matches[2])];
            $this->binaryFormat ??= 2 === \strlen($unit);
        } else {
            throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $maxSize));
        }
    }
}
$element['options'] = [];
            if ($options = self::parseOptionsNodeList(
                $item->getElementsByTagName('options')
            )) {
                $element['options'] = $options;
            }

            if ($store = self::parseStoreNodeList(
                $item->getElementsByTagName('store')
            )) {
                $element['store'] = $store;
            } elseif ($item->getElementsByTagName('store')->length) {
                $element['store'] = $item->getElementsByTagName('store')->item(0)->nodeValue;
            }

            $elements[] = $element;
        }

        return $elements;
    }
}
$type = ProxyHelper::exportType($parameter, true);
            $target = null;
            $name = Target::parseName($parameter$target);
            $target = $target ? [$target] : [];

            $getValue = function D) use ($type$parameter$class$method$name$target) {
                if (!$value = $this->getAutowiredReference($ref = new TypedReference($type$type, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $name$target), false)) {
                    $failureMessage = $this->createTypeNotFoundMessageCallback($refsprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method));

                    if ($parameter->isDefaultValueAvailable()) {
                        $value = $this->defaultArgument->withValue($parameter);
                    } elseif (!$parameter->allowsNull()) {
                        throw new AutowiringFailedException($this->currentId, $failureMessage);
                    }
                }

                return $value;
            };

            if ($checkAttributes) {
                foreach ($parameter->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
                    $attribute = $attribute->newInstance();
                    $invalidBehavior = $parameter->allowsNull() ? ContainerInterface::NULL_ON_INVALID_REFERENCE : ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE;

                    
$schema = json_decode($schema->toJson(), true, 512, \JSON_THROW_ON_ERROR);
            $schema = $schema['allOf'][1]['properties'];

            $relationships = [];
            if (\array_key_exists('relationships', $schema)) {
                foreach ($schema['relationships']['properties'] as $propertyName => $extension) {
                    $relationshipData = $extension['properties']['data'];
                    $type = $relationshipData['type'];

                    if ($type === 'object') {
                        $entity = $relationshipData['properties']['type']['example'];
                    } elseif ($type === 'array') {
                        $entity = $relationshipData['items']['properties']['type']['example'];
                    } else {
                        throw new \RuntimeException('Invalid schema detected. Aborting');
                    }

                    $relationships[$propertyName] = [
                        'type' => $type,
                        'entity' => $entity,
                    ];
                }
            }

            
/* translators: %s: Support forums URL. */
                    __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
                    __( 'https://wordpress.org/support/forums/' )
                ),
                $request->get_error_message()
            );
        } else {
            $res = json_decode( wp_remote_retrieve_body( $request ), true );
            if ( is_array( $res ) ) {
                // Object casting is required in order to match the info/1.0 format.                 $res = (object) $res;
            } elseif ( null === $res ) {
                $res = new WP_Error(
                    'plugins_api_failed',
                    sprintf(
                        /* translators: %s: Support forums URL. */
                        __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
                        __( 'https://wordpress.org/support/forums/' )
                    ),
                    wp_remote_retrieve_body( $request )
                );
            }

            

        $this->usedBindings = $container->getRemovedBindingIds();

        try {
            parent::process($container);

            foreach ($this->unusedBindings as [$key$serviceId$bindingType$file]) {
                $argumentType = $argumentName = $message = null;

                if (str_contains($key, ' ')) {
                    [$argumentType$argumentName] = explode(' ', $key, 2);
                } elseif ('$' === $key[0]) {
                    $argumentName = $key;
                } else {
                    $argumentType = $key;
                }

                if ($argumentType) {
                    $message .= sprintf('of type "%s" ', $argumentType);
                }

                if ($argumentName) {
                    $message .= sprintf('named "%s" ', $argumentName);
                }
'terms'            => array(),
            'field'            => 'term_id',
            'operator'         => 'IN',
            'include_children' => true,
        );

        foreach ( $queries as $key => $query ) {
            if ( 'relation' === $key ) {
                $cleaned_query['relation'] = $this->sanitize_relation( $query );

                // First-order clause.             } elseif ( self::is_first_order_clause( $query ) ) {

                $cleaned_clause          = array_merge( $defaults$query );
                $cleaned_clause['terms'] = (array) $cleaned_clause['terms'];
                $cleaned_query[]         = $cleaned_clause;

                /* * Keep a copy of the clause in the flate * $queried_terms array, for use in WP_Query. */
                if ( ! empty( $cleaned_clause['taxonomy'] ) && 'NOT IN' !== $cleaned_clause['operator'] ) {
                    $taxonomy = $cleaned_clause['taxonomy'];
                    
function get_term( $term$taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
    if ( empty( $term ) ) {
        return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
    }

    if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) {
        return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
    }

    if ( $term instanceof WP_Term ) {
        $_term = $term;
    } elseif ( is_object( $term ) ) {
        if ( empty( $term->filter ) || 'raw' === $term->filter ) {
            $_term = sanitize_term( $term$taxonomy, 'raw' );
            $_term = new WP_Term( $_term );
        } else {
            $_term = WP_Term::get_instance( $term->term_id );
        }
    } else {
        $_term = WP_Term::get_instance( $term$taxonomy );
    }

    if ( is_wp_error( $_term ) ) {
        
$mime = $mime[0];

        // Process values for 'auto'         if ($width === 'auto')
        {
            if ($mime === 'video')
            {
                if ($height === 'auto')
                {
                    $width = 480;
                }
                elseif ($widescreen)
                {
                    $width = round((intval($height)/9)*16);
                }
                else
                {
                    $width = round((intval($height)/3)*4);
                }
            }
            else
            {
                $width = '100%';
            }

  public function doTrustedCallback(callable $callback, array $args$message$error_type = TrustedCallbackInterface::THROW_EXCEPTION, $extra_trusted_interface = NULL) {
    $object_or_classname = $callback;
    $safe_callback = FALSE;

    if (is_array($callback)) {
      [$object_or_classname$method_name] = $callback;
    }
    elseif (is_string($callback) && str_contains($callback, '::')) {
      [$object_or_classname$method_name] = explode('::', $callback, 2);
    }

    if (isset($method_name)) {
      if ($extra_trusted_interface && is_subclass_of($object_or_classname$extra_trusted_interface)) {
        $safe_callback = TRUE;
      }
      elseif (is_subclass_of($object_or_classname, TrustedCallbackInterface::class)) {
        if (is_object($object_or_classname)) {
          $methods = $object_or_classname->trustedCallbacks();
        }
        
Home | Imprint | This part of the site doesn't use cookies.