Plugin Directory


Ignore:
Timestamp:
04/28/2020 02:28:16 PM (5 years ago)
Author:
tschutter
Message:

trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codepress-admin-columns/trunk/classes/Helper/Html.php

    r2246221r2293580 
    2626     */
    2727    public function get_attributes_as_string( array $attributes ) {
    28         $output = array();
     28        $output = [];
    2929
    3030        foreach ( $attributes as $key => $value ) {
     
    4242     * @return string|false HTML Anchor element
    4343     */
    44     public function link( $url, $label = null, $attributes = array() ) {
     44    public function link( $url, $label = null, $attributes = [] ) {
    4545        if ( false === $label ) {
    4646            return $label;
     
    102102     * @return string
    103103     */
    104     public function tooltip( $label, $tooltip, $attributes = array() ) {
     104    public function tooltip( $label, $tooltip, $attributes = [] ) {
    105105        if ( ac_helper()->string->is_not_empty( $label ) && $tooltip ) {
    106106            $label = '<span ' . $this->get_tooltip_attr( $tooltip ) . $this->get_attributes( $attributes ) . '>' . $label . '</span>';
     
    139139     * @return string
    140140     */
    141     public function get_ajax_toggle_box_link( $id, $label, $column_name ) {
    142         return ac_helper()->html->link( '#', $label . '<div class="spinner"></div>', array(
     141    public function get_ajax_toggle_box_link( $id, $label, $column_name, $label_close = null ) {
     142        return ac_helper()->html->link( '#', $label . '<div class="spinner"></div>', [
    143143            'class'              => 'ac-toggle-box-link',
    144144            'data-column'        => $column_name,
    145145            'data-item-id'       => $id,
    146146            'data-ajax-populate' => 1,
    147         ) );
     147            'data-label'         => $label,
     148            'data-label-close'   => $label_close,
     149        ] );
    148150    }
    149151
     
    168170     */
    169171    private function get_attributes( $attributes ) {
    170         $_attributes = array();
     172        $_attributes = [];
    171173
    172174        foreach ( $attributes as $attribute => $value ) {
    173             if ( in_array( $attribute, array( 'title', 'id', 'class', 'style', 'target', 'rel', 'download' ) ) || 'data-' === substr( $attribute, 0, 5 ) ) {
     175            if ( in_array( $attribute, [ 'title', 'id', 'class', 'style', 'target', 'rel', 'download' ] ) || 'data-' === substr( $attribute, 0, 5 ) ) {
    174176                $_attributes[] = $this->get_attribute_as_string( $attribute, $value );
    175177            }
     
    187189     * @return false|array [ internal | external ]
    188190     */
    189     public function get_internal_external_links( $string, $internal_domains = array() ) {
     191    public function get_internal_external_links( $string, $internal_domains = [] ) {
    190192        if ( ! class_exists( 'DOMDocument' ) ) {
    191193            return false;
     
    198200
    199201        if ( ! $internal_domains ) {
    200             $internal_domains = array( home_url() );
    201         }
    202 
    203         $internal_links = array();
    204         $external_links = array();
     202            $internal_domains = [ home_url() ];
     203        }
     204
     205        $internal_links = [];
     206        $external_links = [];
    205207
    206208        $dom = new DOMDocument();
     
    236238        }
    237239
    238         return array(
     240        return [
    239241            $internal_links, $external_links,
    240         );
     242        ];
    241243    }
    242244
     
    286288
    287289    public function remove_empty( $array ) {
    288         return array_filter( $array, array( ac_helper()->string, 'is_not_empty' ) );
     290        return array_filter( $array, [ ac_helper()->string, 'is_not_empty' ] );
    289291    }
    290292
     
    315317     */
    316318    public function small_block( $items ) {
    317         $blocks = array();
     319        $blocks = [];
    318320
    319321        foreach ( (array) $items as $item ) {
     
    331333     * @return string
    332334     */
    333     public function progress_bar( $args = array() ) {
    334         $defaults = array(
     335    public function progress_bar( $args = [] ) {
     336        $defaults = [
    335337            'current'     => 0,
    336338            'total'       => 100, // -1 is infinitive
     
    338340            'label_right' => '',
    339341            'label_main'  => '',
    340         );
     342        ];
    341343
    342344        $args = wp_parse_args( $args, $defaults );
     
    404406            $first = sprintf( '<span class="ac-show-more__part -first">%s</span>', implode( $glue, $first_set ) );
    405407            $more = $last_set ? sprintf( '<span class="ac-show-more__part -more">%s%s</span>', $glue, implode( $glue, $last_set ) ) : '';
    406             $content = sprintf('<span class="ac-show-more__content">%s%s</span>', $first, $more );
     408            $content = sprintf( '<span class="ac-show-more__content">%s%s</span>', $first, $more );
    407409            $toggler = $last_set ? sprintf( '<span class="ac-show-more__divider">|</span><a class="ac-show-more__toggle" data-show-more-toggle data-more="%1$s" data-less="%2$s">%1$s</a>', sprintf( __( '%s more', 'codepress-admin-columns' ), count( $last_set ) ), strtolower( __( 'Hide', 'codepress-admin-columns' ) ) ) : '';
    408410
     
    433435     */
    434436    public function stars( $count, $max = 0 ) {
    435         $stars = array(
     437        $stars = [
    436438            'filled' => floor( $count ),
    437439            'half'   => floor( round( ( $count * 2 ) ) - ( floor( $count ) * 2 ) ) ? 1 : 0,
    438440            'empty'  => 0,
    439         );
     441        ];
    440442
    441443        $max = absint( $max );
     
    452454        }
    453455
    454         $icons = array();
     456        $icons = [];
    455457
    456458        foreach ( $stars as $type => $_count ) {
    457459            for ( $i = 1; $i <= $_count; $i++ ) {
    458                 $icons[] = ac_helper()->icon->dashicon( array( 'icon' => 'star-' . $type, 'class' => 'ac-value-star' ) );
     460                $icons[] = ac_helper()->icon->dashicon( [ 'icon' => 'star-' . $type, 'class' => 'ac-value-star' ] );
    459461            }
    460462        }
Note: See TracChangeset for help on using the changeset viewer.