• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/advanced-custom-fields/includes/locations/class-acf-location-post-format.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
    ​x
     
    1
    <?php 
    2
    ​
    3
    if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    4
    ​
    5
    if( ! class_exists('ACF_Location_Post_Format') ) :
    6
    ​
    7
    class ACF_Location_Post_Format extends ACF_Location {
    8
        
    9
        /**
    10
         * Initializes props.
    11
         *
    12
         * @date    5/03/2014
    13
         * @since   5.0.0
    14
         *
    15
         * @param   void
    16
         * @return  void
    17
         */
    18
        public function initialize() {
    19
            $this->name = 'post_format';
    20
            $this->label = __( "Post Format", 'acf' );
    21
            $this->category = 'post';
    22
            $this->object_type = 'post';
    23
        }
    24
        
    25
        /**
    26
         * Matches the provided rule against the screen args returning a bool result.
    27
         *
    28
         * @date    9/4/20
    29
         * @since   5.9.0
    30
         *
    31
         * @param   array $rule The location rule.
    32
         * @param   array $screen The screen args.
    33
         * @param   array $field_group The field group settings.
    34
         * @return  bool
    35
         */
    36
        public function match( $rule, $screen, $field_group ) {
    37
            
    38
            // Check screen args.
    39
            if( isset($screen['post_format']) ) {
    40
                $post_format = $screen['post_format'];
    41
            } elseif( isset($screen['post_id']) ) {
    42
                $post_type = get_post_type( $screen['post_id'] );
    43
                $post_format = get_post_format( $screen['post_id'] );
    44
                
    45
                // Treat new posts (that support post-formats) without a saved format as "standard".
    46
                if( !$post_format && post_type_supports($post_type, 'post-formats') ) {
    47
                    $post_format = 'standard';
    48
                }
    49
            } else {
    50
                return false;
    51
            }
    52
            
    53
            // Compare rule against $post_format.
    54
            return $this->compare_to_rule( $post_format, $rule );
    55
        }
    56
        
    57
        /**
    58
         * Returns an array of possible values for this rule type.
    59
         *
    60
         * @date    9/4/20
    61
         * @since   5.9.0
    62
         *
    63
         * @param   array $rule A location rule.
    64
         * @return  array
    65
         */
    66
        public function get_values( $rule ) {
    67
            return get_post_format_strings();
    68
        }
    69
    }
    70
    ​
    71
    // initialize
    72
    acf_register_location_type( 'ACF_Location_Post_Format' );
    73
    ​
    74
    endif; // class_exists check
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.