Plugin Directory

Changeset 3269009


Ignore:
Timestamp:
04/08/2025 03:11:54 PM (12 months ago)
Author:
Tarosky
Message:

Update to version 1.3.4 from GitHub

Location:
taro-ad-fields
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • taro-ad-fields/tags/1.3.4/includes/context.php

    r3268298 r3269009  
    2424                'new_item_name' => __( 'New Context', 'taf' ),
    2525            ),
     26            'public'            => false,
     27            'show_ui'           => true,
    2628            'show_admin_column' => true,
    2729            'hierarchical'      => true,
    28             'meta_box_cb'       => function ( $post ) {
    29                 $terms    = get_the_terms( $post, 'ad-context' );
    30                 $selected = array();
    31                 if ( is_array( $terms ) && ! is_wp_error( $terms ) ) {
    32                     foreach ( $terms as $term ) {
    33                         $selected[] = $term->term_id;
    34                     }
    35                 }
    36                 $all_parents = get_terms( 'ad-context', array(
    37                     'hide_empty' => false,
    38                     'parent'     => 0, // Only parents.
    39                 ) );
    40                 if ( empty( $all_parents ) || is_wp_error( $all_parents ) ) {
    41                     // No parent found.
    42                     printf( '<p class="description">%s</p>', esc_html__( 'No context found.', 'taf' ) );
    43                     return;
    44                 }
    45                 foreach ( $all_parents as $parent ) {
    46                     $children = get_terms( 'ad-context', array(
    47                         'hide_empty' => false,
    48                         'parent'     => $parent->term_id,
    49                     ) );
    50                     if ( empty( $children ) || is_wp_error( $children ) ) {
    51                         // No child found.
    52                         printf( '<p class="description">%s %s</p>', __( 'No item for the context:', 'taf' ), esc_html( $parent->name ) );
    53                         continue;
    54                     }
    55                     echo '<div class="ad-context__container">';
    56                     printf( '<h3 class="ad-context__heading">%s</h3>', esc_html( $parent->name ) );
    57                     if ( trim( $parent->description ) ) {
    58                         // Description exists.
    59                         printf( '<p class="description">%s</p>', nl2br( esc_html( $parent->description ) ) );
    60                     }
    61                     foreach ( $children as $child ) {
    62                         printf(
    63                             '<p class="ad-context__item"><label><input type="checkbox" name="tax_input[%s][]" value="%d" %s /> %s</label></p>',
    64                             esc_attr( $child->taxonomy ),
    65                             esc_attr( $child->term_id ),
    66                             checked( in_array( $child->term_id, $selected, true ), true, false ),
    67                             esc_html( $child->name )
    68                         );
    69                     }
    70                     echo '</div> <!-- //ad-context__container -->';
    71                 }
    72                 ?>
    73                 <p class="ad-context__info">
    74                     <?php esc_html_e( 'Context is defined by theme or plugin.', 'taf' ); ?>
    75                 </p>
    76                 <?php
    77             },
     30            'meta_box_cb'       => 'taf_context_meta_box_callback',
    7831        )
    7932    );
    8033}, 11 );
    8134
     35/**
     36 * Render context meta box.
     37 *
     38 * @param WP_Post$post
     39 * @return void
     40 */
     41function taf_context_meta_box_callback( $post ) {
     42    $terms    = get_the_terms( $post, 'ad-context' );
     43    $selected = array();
     44    if ( is_array( $terms ) && ! is_wp_error( $terms ) ) {
     45        foreach ( $terms as $term ) {
     46            $selected[] = $term->term_id;
     47        }
     48    }
     49    $all_parents = get_terms( 'ad-context', array(
     50        'hide_empty' => false,
     51        'parent'     => 0, // Only parents.
     52    ) );
     53    if ( empty( $all_parents ) || is_wp_error( $all_parents ) ) {
     54        // No parent found.
     55        printf( '<p class="description">%s</p>', esc_html__( 'No context found.', 'taf' ) );
     56        return;
     57    }
     58    foreach ( $all_parents as $parent ) {
     59        $children = get_terms( 'ad-context', array(
     60            'hide_empty' => false,
     61            'parent'     => $parent->term_id,
     62        ) );
     63        if ( empty( $children ) || is_wp_error( $children ) ) {
     64            // No child found.
     65            printf( '<p class="description">%s %s</p>', __( 'No item for the context:', 'taf' ), esc_html( $parent->name ) );
     66            continue;
     67        }
     68        echo '<div class="ad-context__container">';
     69        printf( '<h3 class="ad-context__heading">%s</h3>', esc_html( $parent->name ) );
     70        if ( trim( $parent->description ) ) {
     71            // Description exists.
     72            printf( '<p class="description">%s</p>', nl2br( esc_html( $parent->description ) ) );
     73        }
     74        foreach ( $children as $child ) {
     75            printf(
     76                '<p class="ad-context__item"><label><input type="checkbox" name="tax_input[%s][]" value="%d" %s /> %s</label></p>',
     77                esc_attr( $child->taxonomy ),
     78                esc_attr( $child->term_id ),
     79                checked( in_array( $child->term_id, $selected, true ), true, false ),
     80                esc_html( $child->name )
     81            );
     82        }
     83        echo '</div> <!-- //ad-context__container -->';
     84    }
     85    ?>
     86    <p class="ad-context__info">
     87        <?php esc_html_e( 'Context is defined by theme or plugin.', 'taf' ); ?>
     88    </p>
     89    <?php
     90}
    8291
    8392/**
  • taro-ad-fields/tags/1.3.4/readme.txt

    r3268937 r3269009  
    33Contributors: tarosky, Takahashi_Fumiki, yocchi161 
    44Tags: advertisement 
    5 Stable tag: 1.3.3
     5Stable tag: 1.3.4
    66License: GPLv3 or later 
    77License URI: http://www.gnu.org/licenses/gpl-3.0.txt
  • taro-ad-fields/tags/1.3.4/taro-ad-fields.php

    r3268937 r3269009  
    1212Domain Path: /languages/
    1313License: GPL v3 or later.
    14 Version: 1.3.3
     14Version: 1.3.4
    1515*/
    1616
  • taro-ad-fields/tags/1.3.4/vendor/composer/installed.php

    r3268937 r3269009  
    22    'root' => array(
    33        'name' => 'tarosky/taro-ad-fields',
    4         'pretty_version' => '1.3.3',
    5         'version' => '1.3.3.0',
    6         'reference' => 'cb322b1aca95dfbeb5103b10f2bc1d375f69ee3a',
     4        'pretty_version' => '1.3.4',
     5        'version' => '1.3.4.0',
     6        'reference' => 'ea743641a149109307d2d82868f312d595c38821',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'tarosky/taro-ad-fields' => array(
    14             'pretty_version' => '1.3.3',
    15             'version' => '1.3.3.0',
    16             'reference' => 'cb322b1aca95dfbeb5103b10f2bc1d375f69ee3a',
     14            'pretty_version' => '1.3.4',
     15            'version' => '1.3.4.0',
     16            'reference' => 'ea743641a149109307d2d82868f312d595c38821',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • taro-ad-fields/trunk/includes/context.php

    r3268298 r3269009  
    2424                'new_item_name' => __( 'New Context', 'taf' ),
    2525            ),
     26            'public'            => false,
     27            'show_ui'           => true,
    2628            'show_admin_column' => true,
    2729            'hierarchical'      => true,
    28             'meta_box_cb'       => function ( $post ) {
    29                 $terms    = get_the_terms( $post, 'ad-context' );
    30                 $selected = array();
    31                 if ( is_array( $terms ) && ! is_wp_error( $terms ) ) {
    32                     foreach ( $terms as $term ) {
    33                         $selected[] = $term->term_id;
    34                     }
    35                 }
    36                 $all_parents = get_terms( 'ad-context', array(
    37                     'hide_empty' => false,
    38                     'parent'     => 0, // Only parents.
    39                 ) );
    40                 if ( empty( $all_parents ) || is_wp_error( $all_parents ) ) {
    41                     // No parent found.
    42                     printf( '<p class="description">%s</p>', esc_html__( 'No context found.', 'taf' ) );
    43                     return;
    44                 }
    45                 foreach ( $all_parents as $parent ) {
    46                     $children = get_terms( 'ad-context', array(
    47                         'hide_empty' => false,
    48                         'parent'     => $parent->term_id,
    49                     ) );
    50                     if ( empty( $children ) || is_wp_error( $children ) ) {
    51                         // No child found.
    52                         printf( '<p class="description">%s %s</p>', __( 'No item for the context:', 'taf' ), esc_html( $parent->name ) );
    53                         continue;
    54                     }
    55                     echo '<div class="ad-context__container">';
    56                     printf( '<h3 class="ad-context__heading">%s</h3>', esc_html( $parent->name ) );
    57                     if ( trim( $parent->description ) ) {
    58                         // Description exists.
    59                         printf( '<p class="description">%s</p>', nl2br( esc_html( $parent->description ) ) );
    60                     }
    61                     foreach ( $children as $child ) {
    62                         printf(
    63                             '<p class="ad-context__item"><label><input type="checkbox" name="tax_input[%s][]" value="%d" %s /> %s</label></p>',
    64                             esc_attr( $child->taxonomy ),
    65                             esc_attr( $child->term_id ),
    66                             checked( in_array( $child->term_id, $selected, true ), true, false ),
    67                             esc_html( $child->name )
    68                         );
    69                     }
    70                     echo '</div> <!-- //ad-context__container -->';
    71                 }
    72                 ?>
    73                 <p class="ad-context__info">
    74                     <?php esc_html_e( 'Context is defined by theme or plugin.', 'taf' ); ?>
    75                 </p>
    76                 <?php
    77             },
     30            'meta_box_cb'       => 'taf_context_meta_box_callback',
    7831        )
    7932    );
    8033}, 11 );
    8134
     35/**
     36 * Render context meta box.
     37 *
     38 * @param WP_Post$post
     39 * @return void
     40 */
     41function taf_context_meta_box_callback( $post ) {
     42    $terms    = get_the_terms( $post, 'ad-context' );
     43    $selected = array();
     44    if ( is_array( $terms ) && ! is_wp_error( $terms ) ) {
     45        foreach ( $terms as $term ) {
     46            $selected[] = $term->term_id;
     47        }
     48    }
     49    $all_parents = get_terms( 'ad-context', array(
     50        'hide_empty' => false,
     51        'parent'     => 0, // Only parents.
     52    ) );
     53    if ( empty( $all_parents ) || is_wp_error( $all_parents ) ) {
     54        // No parent found.
     55        printf( '<p class="description">%s</p>', esc_html__( 'No context found.', 'taf' ) );
     56        return;
     57    }
     58    foreach ( $all_parents as $parent ) {
     59        $children = get_terms( 'ad-context', array(
     60            'hide_empty' => false,
     61            'parent'     => $parent->term_id,
     62        ) );
     63        if ( empty( $children ) || is_wp_error( $children ) ) {
     64            // No child found.
     65            printf( '<p class="description">%s %s</p>', __( 'No item for the context:', 'taf' ), esc_html( $parent->name ) );
     66            continue;
     67        }
     68        echo '<div class="ad-context__container">';
     69        printf( '<h3 class="ad-context__heading">%s</h3>', esc_html( $parent->name ) );
     70        if ( trim( $parent->description ) ) {
     71            // Description exists.
     72            printf( '<p class="description">%s</p>', nl2br( esc_html( $parent->description ) ) );
     73        }
     74        foreach ( $children as $child ) {
     75            printf(
     76                '<p class="ad-context__item"><label><input type="checkbox" name="tax_input[%s][]" value="%d" %s /> %s</label></p>',
     77                esc_attr( $child->taxonomy ),
     78                esc_attr( $child->term_id ),
     79                checked( in_array( $child->term_id, $selected, true ), true, false ),
     80                esc_html( $child->name )
     81            );
     82        }
     83        echo '</div> <!-- //ad-context__container -->';
     84    }
     85    ?>
     86    <p class="ad-context__info">
     87        <?php esc_html_e( 'Context is defined by theme or plugin.', 'taf' ); ?>
     88    </p>
     89    <?php
     90}
    8291
    8392/**
  • taro-ad-fields/trunk/readme.txt

    r3268937 r3269009  
    33Contributors: tarosky, Takahashi_Fumiki, yocchi161 
    44Tags: advertisement 
    5 Stable tag: 1.3.3
     5Stable tag: 1.3.4
    66License: GPLv3 or later 
    77License URI: http://www.gnu.org/licenses/gpl-3.0.txt
  • taro-ad-fields/trunk/taro-ad-fields.php

    r3268937 r3269009  
    1212Domain Path: /languages/
    1313License: GPL v3 or later.
    14 Version: 1.3.3
     14Version: 1.3.4
    1515*/
    1616
  • taro-ad-fields/trunk/vendor/composer/installed.php

    r3268937 r3269009  
    22    'root' => array(
    33        'name' => 'tarosky/taro-ad-fields',
    4         'pretty_version' => '1.3.3',
    5         'version' => '1.3.3.0',
    6         'reference' => 'cb322b1aca95dfbeb5103b10f2bc1d375f69ee3a',
     4        'pretty_version' => '1.3.4',
     5        'version' => '1.3.4.0',
     6        'reference' => 'ea743641a149109307d2d82868f312d595c38821',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'tarosky/taro-ad-fields' => array(
    14             'pretty_version' => '1.3.3',
    15             'version' => '1.3.3.0',
    16             'reference' => 'cb322b1aca95dfbeb5103b10f2bc1d375f69ee3a',
     14            'pretty_version' => '1.3.4',
     15            'version' => '1.3.4.0',
     16            'reference' => 'ea743641a149109307d2d82868f312d595c38821',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.