Plugin Directory

Changeset 1921678


Ignore:
Timestamp:
08/08/2018 02:26:30 PM (8 years ago)
Author:
Sh14
Message:

plugin header correction

Location:
oi-yamaps/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • oi-yamaps/trunk/Readme.md

    r1914834 r1921678  
    4747## Changelog
    4848
     49###  3.1.9 (08.08.2018)
     50* fix: plugin header correction;
    4951###  3.1.8 (25.07.2018)
    5052* fix: custom placemark special attribut added;
  • oi-yamaps/trunk/include/oi-nput.php

    r1885266 r1921678  
    11<?php
    2 /*
    3 Plugin Name: Oi Nput
    4 Plugin URI: http://oiplug.com
    5 Description: Plugin for making HTML forms via array.
    6 Version: 1.4
    7 Author: Alexei Isaenko
    8 Author URI: http://sh14.ru
    9 License: GPL2
    10 Tags: input, textarea, select, option, password, hidden, checkbox, radiobox
    11 GitHub Plugin URI: https://github.com/sh14/oi-nput
    12 */
     2/**
     3 * Plugin Name: Oi Nput
     4 * Plugin URI: http://oiplug.com
     5 * Description: Plugin for making HTML forms via array.
     6 * Version: 1.5
     7 * Author: Alexei Isaenko
     8 * Author URI: http://sh14.ru
     9 * License: GPL2
     10 * Tags: input, textarea, select, option, password, hidden, checkbox, radiobox
     11 * GitHub Plugin URI: https://github.com/sh14/oi-nput
     12 */
    1313
    1414if ( ! function_exists( 'esc_attr' ) ) {
     
    9595            if ( ! empty( $prefix ) ) {
    9696                // формирование и добавление атрибута в массив
    97                 $data[] = $prefix .'-'. $key . '="' . $value . '"';
     97                $data[] =$prefix . '-'. $key . '="' . $value . '"';
    9898            }else{
    99                 // формирование и добавление атрибута в массив
    100                 $data[] =  $key . '="' . $value . '"';
     99                // формирование и добавление атрибутав массив
     100                $data[] = $key . '="' . $value . '"';
    101101            }
    102102        } else {
    103103            $data[] = attributes_to_string( $value, $key );
    104104        }
    105 
    106105    }
    107106
     
    133132    // проход по всем атрибутам
    134133    foreach ( $atts as $key => $value ) {
     134        if ( is_numeric( $value ) || is_bool( $value ) ) {
     135            $value .= '';
     136        }
    135137        if ( is_string( $value ) ) {
    136138            // замена псевдопременной ее значением
     
    146148
    147149if ( ! function_exists( 'oinput' ) ) {
    148 
    149     /*function oinput_array_to_string( $array ) {
    150         if ( is_array( $array ) && ! empty( $array ) ) {
    151             foreach ( $array as $key => $value ) {
    152 
    153             }
    154         }
    155 
    156         return $array;
    157     }*/
    158150
    159151    /*
     
    185177
    186178            // если значение не пустое и оно не массив
    187             if ( isset( $value ) && ! is_array( $value ) && $value != '' ) {
     179            if ( isset( $value ) && ! is_array( $value ) && '' !== $value ) {
    188180
    189181                // делается эскейп для вывода как атрибута
     
    243235
    244236        // exit if don't need to publish that field
    245         if ( $atts['published'] == false ) {
     237        if ( false === $atts['published'] ) {
    246238            return false;
    247239        }
     
    260252
    261253        // если тип поля не select и переменная является строкой
    262         if ( $field_type != 'select' && is_string( $atts['value'] ) ) {
     254        if ( 'select' !== $field_type && is_string( $atts['value'] ) ) {
    263255            // определение новой переменной с эскейпом
    264256            $field_value = esc_attr( $atts['value'] );
     
    271263        }
    272264
    273         if ( $atts['name'] || $field_type == 'submit' || $field_type == 'button' || $field_type == 'html' ) {
     265        if ( $atts['name'] || 'submit' === $field_type || 'button' === $field_type || 'html' === $field_type ) {
    274266            if ( empty( $atts['id'] ) ) {
    275267                $atts['id'] = $atts['name'];
     
    287279
    288280            // list of labels
    289             $attributes = array( 'before', 'after', 'label', );
     281            $attributes = array(
     282                'before',
     283                'after',
     284                'label',
     285            );
     286
    290287            foreach ( $attributes as $key ) {
    291288                if ( ! empty( $atts[ $key ] ) && ! in_array( $atts['type'], array( 'checkbox', 'radio' ) ) ) {
     
    295292
    296293            // list of boolean attributes
    297             $attributes = array( 'checked', 'multiple', 'readonly', 'disabled', 'required', );
     294            $attributes = array(
     295                'checked',
     296                'multiple',
     297                'readonly',
     298                'disabled',
     299                'required',
     300            );
     301
    298302            foreach ( $attributes as $key ) {
    299                 if ( $atts[ $key ] == true ) {
     303                if ( true === $atts[ $key ] ) {
    300304                    $atts[ $key ] = ' ' . esc_attr( $key ) . '="' . esc_attr( $key ) . '"';
    301305                } else {
     
    305309
    306310            // list of boolean non pair attributes
    307             $attributes = array( 'autofocus', );
     311            $attributes = array(
     312                'autofocus',
     313            );
     314
    308315            foreach ( $attributes as $key ) {
    309                 if ( $atts[ $key ] == true ) {
     316                if ( true === $atts[ $key ] ) {
    310317                    $atts[ $key ] = ' ' . esc_attr( $key );
    311318                } else {
     
    314321            }
    315322
    316             if ( $atts['autofocus_at_end'] == true ) {
     323            if ( true === $atts['autofocus_at_end'] ) {
    317324                $atts['autofocus_at_end'] = ' onfocus="this.value = this.value;"';
    318325            } else {
     
    320327            }
    321328
    322             if ( $field_type != 'option' ) {
     329            if ( 'option' !== $field_type ) {
    323330                // list of attributes
    324331                $attributes = array(
     
    341348                        if ( is_array( $atts[ $key ] ) ) {
    342349
    343                             if ( $key == 'class' ) {
     350                            if ( 'class' === $key ) {
    344351
    345352                                // формирование строки, содержащей классы
     
    348355
    349356                                // если проверяется стиль
    350                                 if ( $key == 'style' ) {
     357                                if ( 'style' === $key ) {
    351358
    352359                                    // если атрибут что-то содержит
     
    367374                                    }
    368375                                    // если атрибут data
    369                                 } else if ( $key == 'data' ) {
     376                                } elseif ( 'data' === $key ) {
    370377
    371378                                    // если содержимое что-то содержит
     
    375382                                        $atts[ $key ] = attributes_to_string( $atts[ $key ], $key );
    376383                                    }
    377 
    378                                 } else if ( $key == 'attributes' ) {
     384                                } elseif ( 'attributes' === $key ) {
     385
    379386                                    // если содержимое что-то содержит
    380387                                    if ( ! empty( $atts[ $key ] ) ) {
     
    386393                            }
    387394                        } else {
    388                             if ( $key == 'data' ) {
     395                            if ( 'data' === $key ) {
    389396                                $atts[ $key ] = ' ' . implode( ' ', $atts[ $key ] );
    390397                            } else {
     
    408415                                }*/
    409416
    410                 if ( $field_type != 'option' ) {
     417                if ( 'option' !== $field_type ) {
     418
    411419                    // формирование элемента
    412                     $atts['attributes'] = $atts['placeholder'] .
    413                                           $atts['style'] .
    414                                           $atts['checked'] .
    415                                           $atts['multiple'] .
    416                                           $atts['readonly'] .
    417                                           $atts['disabled'] .
    418                                           $atts['required'] .
    419                                           $atts['autofocus'] .
    420                                           $atts['autofocus_at_end'] .
    421                                           $atts['data'] .
    422                                           $atts['attributes'] .
    423                                           '';
     420                    $atts['attributes'] = $atts['placeholder']
     421                                          . $atts['style']
     422                                          . $atts['checked']
     423                                          . $atts['multiple']
     424                                          . $atts['readonly']
     425                                          . $atts['disabled']
     426                                          . $atts['required']
     427                                          . $atts['autofocus']
     428                                          . $atts['autofocus_at_end']
     429                                          . $atts['data']
     430                                          . $atts['attributes'];
    424431                }
    425432            }
    426 
    427433
    428434            switch ( $field_type ) {
     
    476482                    $out = '';
    477483                    if ( ! empty( $atts['name'] ) && is_array( $atts['name'] ) ) {
    478                         foreach ( $atts['name'] as $k => $v ) {
     484                        foreach ( (array) $atts['name'] as $k => $v ) {
    479485
    480486                            // указание, что элемент пока не является выбранным
     
    514520                    break;
    515521                case 'radio':
    516                     if ( ! empty( $field_value ) ) // if we have a value
    517                     {
    518                         $atts['attributes'] .= ' checked="checked"'; // it means that that radio was checked
     522                    // if we have a value
     523                    if ( ! empty( $field_value ) ) {
     524                        // it means that that radio was checked
     525                        $atts['attributes'] .= ' checked="checked"';
    519526                    }
    520527                    $out = '<' . $tag . $atts['class'] . $atts['type'] . $atts['id'] . $atts['name'] . $atts['attributes'] . $atts['value'] . ' />';
     
    596603
    597604    // если не указано, что метод передачи POST
    598     if ( $atts['method'] != 'post' ) {
     605    if ( 'post' !== $atts['method'] ) {
    599606        // устанавливается метод передачи GET
    600607        $atts['method'] = 'get';
    601608    }
     609
    602610    // trim all none boolean data
    603611    if ( ! empty( $atts ) ) {
     
    611619
    612620    // список атрибутов, которые надо сформировать в правиьном виде: атрибут="значение"
    613     $attributes = array( 'id', 'name', 'method', 'action', );
     621    $attributes = array(
     622        'id',
     623        'name',
     624        'method',
     625        'action',
     626    );
    614627
    615628    // проход по списку атрибутов
     
    625638    }
    626639
    627     if ( $atts['form'] == true ) {
     640    if ( true === $atts['form'] ) {
    628641        $out = '<form ' . $atts['attributes'] . '>' . $out . '</form>';
    629642    }
    630     if ( $atts['echo'] == true ) {
     643    if ( true === $atts['echo'] ) {
    631644        echo $out;
    632645    }
     
    650663            $template = str_replace( '%' . $key . '%', $value, $template );
    651664        }
    652 
    653665    }
    654666
     
    676688 *
    677689 * // bem array
    678  * $user_links = get_html( array(
     690 * $user_links = get_html( [
    679691 * 'tag'     => 'div',
    680  * 'atts'    => array(
     692 * 'atts'    => [
    681693 * 'class' => '&__contacts',
    682  * ),
    683  * 'content' => array(
    684  * array(
     694 * ],
     695 * 'content' => [
     696 * [
    685697 * 'tag'     => 'h3',
    686  * 'atts'    => array('class' => '&__contacts-title',),
     698 * 'atts'    => ['class' => '&__contacts-title',],
    687699 * 'content' => __( 'Bio' ),
    688  * ),
    689  * array(
     700 * ],
     701 * [
    690702 * 'tag'     => 'ul',
    691  * 'atts'    => array('class' => '&__contacts-list',),
     703 * 'atts'    => ['class' => '&__contacts-list',],
    692704 * 'content' => implode( "\n", $user_links ),
    693  * ),
    694  * ),
    695  * ), 'profile' );
     705 * ],
     706 * ],
     707 * ], 'profile' );
    696708 *
    697709 * @param        $atts
     
    701713 */
    702714function get_html( $atts, $base_class = '' ) {
    703     $atts = shortcode_atts( array(
     715    $atts = shortcode_atts( [
    704716        'tag'     => 'div',
    705         'atts'    => array(
     717        'atts'    => [
    706718            'class' => '&',
    707         ),
     719        ],
    708720        'content' => '',
    709     ), $atts );
    710 
    711     $mono   = array(
     721    ], $atts );
     722
     723    $mono   = [
    712724        'br',
    713725        'hr',
     
    716728        'link',
    717729        'img',
    718     );
     730    ];
    719731    $out    = '';
    720     $object = array();
     732    $object = [];
    721733
    722734    // перебор содержимого массива
     
    748760                    // если значение является массивом
    749761                    if ( is_array( $value ) ) {
    750                         $attributes = array();
     762                        $attributes = [];
    751763
    752764                        // атрибуты выстраиваются в строку
     
    770782                    break;
    771783                case 'content':
    772 
    773784                    // если элемент является массивом, вероятно это описание вложенного элемента или набора вложений
    774785                    if ( is_array( $value ) ) {
    775786
    776787                        foreach ( $value as $index => $val ) {
    777                             pr( $val );
     788                            //pr( $val );
    778789                            $object[ $key ][] = get_html( $value, $base_class );
    779790                        }
     
    792803
    793804    if ( empty( $atts['atts'] ) ) {
    794         $atts['atts'] = array();
     805        $atts['atts'] = [];
    795806    }
    796807    // перебор элементов и дописывание закрывающих частей
     
    816827
    817828    // порядок составления элементов
    818     $order = array(
     829    $order = [
    819830        'tag',
    820831        'atts',
    821832        'content',
    822833        'end_tag',
    823     );
     834    ];
    824835    foreach ( $order as $key ) {
    825836        if ( ! empty( $object[ $key ] ) ) {
    826837            $out .= implode( '', $object[ $key ] );
    827838        }
    828 
    829839    }
    830840
     
    832842}
    833843
    834 // eof
     844// eof;
  • oi-yamaps/trunk/oi-yamaps.php

    r1914834 r1921678  
    11<?php
    2 /*
    3 Plugin Name: Oi Yandex.Maps for WordPress
    4 Plugin URI: https://oiplug.com/plugin/oi-yandex-maps-for-wordpress/
    5 Description: The plugin allows you to use Yandex.Maps on your site pages and put the placemarks on the map. Without an API key. <strong>Don't forget to reactivate the plugin!</strong>
    6 Author: Alexei Isaenko
    7 Version: 3.1.8
    8 Author URI: https://oiplug.com/members/isaenkoalexei
    9 Text Domain: oi-yamaps
    10 Domain Path: /language
    11 */
     2/**
     3 * Plugin Name: Oi Yandex.Maps for WordPress
     4 * Plugin URI: https://oiplug.com/plugin/oi-yandex-maps-for-wordpress/
     5 * Description: The plugin allows you to use Yandex.Maps on your site pages and put the placemarks on the map. Without an API key. <strong>Don't forget to reactivate the plugin!</strong>
     6 * Author: Alexei Isaenko
     7 * Version: 3.1.9
     8 * Author URI: https://oiplug.com/members/isaenkoalexei
     9 * Text Domain: oi-yamaps
     10 * Domain Path: /language
     11 * GitHub Plugin URI: https://github.com/sh14/oi-yamaps
     12 */
    1213
    1314
  • oi-yamaps/trunk/readme.txt

    r1914834 r1921678  
    5959== Changelog ==
    6060
    61 3.1.8 (25.07.2018)
     61= 3.1.9 (08.08.2018) =
     62* fix: plugin header correction;
     63= 3.1.8 (25.07.2018) =
    6264* fix: custom placemark special attribut added;
    6365= 3.1.7 (22.06.2018) =
Note: See TracChangeset for help on using the changeset viewer.