Plugin Directory

Changeset 1848632


Ignore:
Timestamp:
03/28/2018 03:29:16 PM (8 years ago)
Author:
Nitay
Message:

fix bug, brought into line with the Coding Standards

Location:
sponsors-carousel/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • sponsors-carousel/trunk/js/sponsors-carousel-admin.js

    r1791978 r1848632  
    1 jQuery(document).ready(function($) {
    2     $.sponsorsCarousel = {
    3         uploader:false,
    4         editor:false,
    5     };
     1jQuery(document).ready( function( $ ) {
     2    $.sponsorsCarousel = {
     3        uploader:false,
     4        editor:false,
     5    };
    66
    7     jQuery.sponsorsCarousel.selectImages = function() {
    8         if ($.sponsorsCarousel.uploader) {
    9             $.sponsorsCarousel.uploader.open();
    10             return;
    11         }
    12         $.sponsorsCarousel.uploader = wp.media({
    13             title: $.sponsorsCarousel.i18("Choose Images"),
    14             button: {
    15                 text: $.sponsorsCarousel.i18("Insert in Carousel")
    16             },
    17             library: { type: 'image' },
    18             multiple: true
    19         });
    20         $.sponsorsCarousel.uploader.on('select', function() {
    21             $.sponsorsCarousel.addImages($.sponsorsCarousel.uploader.state().get('selection').toJSON());
    22         });
    23         $.sponsorsCarousel.uploader.open();
    24         return false;
    25     };
     7    jQuery.sponsorsCarousel.selectImages = function() {
     8        if ( $.sponsorsCarousel.uploader ) {
     9            $.sponsorsCarousel.uploader.open();
     10            return;
     11        }
     12        $.sponsorsCarousel.uploader = wp.media( {
     13            title: $.sponsorsCarousel.i18( "Choose Images" ),
     14            button: {
     15                text: $.sponsorsCarousel.i18( "Insert in Carousel" )
     16            },
     17            library: { type: 'image' },
     18            multiple: true
     19        });
     20        $.sponsorsCarousel.uploader.on( 'select', function() {
     21            $.sponsorsCarousel.addImages( $.sponsorsCarousel.uploader.state().get( 'selection' ).toJSON() );
     22        });
     23        $.sponsorsCarousel.uploader.open();
     24        return false;
     25    };
    2626
    27     $.sponsorsCarousel.addImages = function(images) {
    28         $.each(images, function(i, e) {
    29             var id = e.id + '';
    30             console.log(e.sizes);
    31             if (typeof e.sizes.thumbnail != 'undefined')
    32                 $.sponsorsCarouselImages.push({id:id, link:e.caption, src:e.sizes.thumbnail.url});
    33             else
    34                 $.sponsorsCarouselImages.push({id:id, link:e.caption, src:e.sizes.full.url});
    35         });
    36         $.sponsorsCarousel.showImages();
    37     };
     27    $.sponsorsCarousel.addImages = function( images ) {
     28        $.each( images, function( i, e ) {
     29            var id = e.id + '';
     30            if ( typeof e.sizes.thumbnail != 'undefined' ) {
     31                $.sponsorsCarouselImages.push( {id:id, link:e.caption, src:e.sizes.thumbnail.url} );
     32            } else {
     33                $.sponsorsCarouselImages.push( {id:id, link:e.caption, src:e.sizes.full.url} );
     34            }
     35        });
     36        $.sponsorsCarousel.showImages();
     37    };
    3838
    39     $.sponsorsCarousel.showImages = function() {
    40         var out = '';
    41         if ($.sponsorsCarouselImages.length == 0) return;
    42         $.each($.sponsorsCarouselImages, function(i, e) {
    43             out += '<div class="sponsors_carousel_image" data-id="' + e.id + '">';
    44             out += '<img src="' + e.src + '">';
    45             out += '<div class="sponsors_carousel_link_edit">';
    46             out += '<div class="sponsors_carousel_link_edit_label">' + $.sponsorsCarousel.i18("Custom link:") + '</div>';
    47             out += '<input onchange="jQuery.sponsorsCarousel.changeLink(' + e.id + ', jQuery(this).val())" value="' + e.link + '">';
    48             out += '</div>';
    49             out += '<div class="sponsors_carousel_image_delete dashicons dashicons-dismiss" onclick="jQuery.sponsorsCarousel .deleteImg(this)"></div>';
    50             out += '</div>';
    51         });
    52         $('.sponsors_carousel_images').html(out);
    53         $.sponsorsCarousel.imagesToField();
    54         $( ".sponsors_carousel_images" ).sortable({
    55             stop: function( event, ui ) {
    56                 $.sponsorsCarousel.imagesToField();
    57             }
    58         });
    59         $( ".sponsors_carousel_images" ).disableSelection();
    60     };
     39    $.sponsorsCarousel.showImages = function() {
     40        var out = '';
     41        if ( $.sponsorsCarouselImages.length == 0 ) {
     42            return;
     43        }
     44        $.each( $.sponsorsCarouselImages, function( i, e ) {
     45            out += '<div class="sponsors_carousel_image" data-id="' + e.id + '">';
     46            out += '<img src="' + e.src + '">';
     47            out += '<div class="sponsors_carousel_link_edit">';
     48            out += '<div class="sponsors_carousel_link_edit_label">' + $.sponsorsCarousel.i18( "Custom link:" ) + '</div>';
     49            out += '<input onchange="jQuery.sponsorsCarousel.changeLink( ' + e.id + ', jQuery( this ).val() )" value="' + e.link + '">';
     50            out += '</div>';
     51            out += '<div class="sponsors_carousel_image_delete dashicons dashicons-dismiss" onclick="jQuery.sponsorsCarousel .deleteImg( this )"></div>';
     52            out += '</div>';
     53        });
     54        $('.sponsors_carousel_images').html( out );
     55        $.sponsorsCarousel.imagesToField();
     56        $( ".sponsors_carousel_images" ).sortable({
     57            stop: function( event, ui ) {
     58                $.sponsorsCarousel.imagesToField();
     59            }
     60        });
     61        $( ".sponsors_carousel_images" ).disableSelection();
     62    };
    6163
    62     $.sponsorsCarousel.changeLink = function(id, link) {
    63         var data = {
    64             action: 'sponsors_carousel_change_link',
    65             image_id: id,
    66             link:link
    67         };
    68         jQuery.post( ajaxurl, data, function(response) {
    69             console.log(response);
    70         });
    71     };
     64    $.sponsorsCarousel.changeLink = function( id, link ) {
     65        var data = {
     66            action: 'sponsors_carousel_change_link',
     67            image_id: id,
     68            link:link
     69        };
     70        jQuery.post( ajaxurl, data, function( response ) {
    7271
    73     $.sponsorsCarousel.imagesToField = function() {
    74         var ids = [];
    75         var old = JSON.parse(JSON.stringify($.sponsorsCarouselImages));
    76         $.sponsorsCarouselImages = [];
    77         $(".sponsors_carousel_image").each(function(i, e) {
    78             var id = $(e).data('id');
    79             if(id) {
    80                 ids.push(id);
    81                 var data = {};
    82                 $.each(old, function(i, e) {
    83                     if (e.id == id) data = e;
    84                 });
    85                 $.sponsorsCarouselImages.push(data);
    86             }
    87         });
    88         $('.sponsors-carousel_images_field').val(ids.join(','));
    89     };
     72        });
     73    };
    9074
    91     $.sponsorsCarousel.deleteImg = function(obj) {
    92         $(obj).parent().remove();
    93         $.sponsorsCarousel.imagesToField();
    94     };
     75    $.sponsorsCarousel.imagesToField = function() {
     76        var ids = [];
     77        var old = JSON.parse( JSON.stringify( $.sponsorsCarouselImages ) );
     78        $.sponsorsCarouselImages = [];
     79        $( ".sponsors_carousel_image" ).each( function( i, e ) {
     80            var id = $( e ).data( 'id' );
     81            if ( id ) {
     82                ids.push( id );
     83                var data = {};
     84                $.each( old, function( i, e ) {
     85                    if ( e.id == id ) {
     86                        data = e;
     87                    }
     88                });
     89                $.sponsorsCarouselImages.push( data );
     90            }
     91        });
     92        $('.sponsors-carousel_images_field').val( ids.join( ',' ) );
     93    };
    9594
    96     $.sponsorsCarousel.deleteCarousel = function(id, question) {
    97         if (id > 0 && confirm(question)) {
    98             window.location.href = window.location.href + '&delete=' + id;
    99         }
    100         return false;
    101     };
     95    $.sponsorsCarousel.deleteImg = function( obj ) {
     96        $( obj ).parent().remove();
     97        $.sponsorsCarousel.imagesToField();
     98    };
    10299
    103     $.sponsorsCarousel.i18 = function(s) {
    104         return (typeof $.sponsorsCarouselI18[s] != 'undefined') ? $.sponsorsCarouselI18[s] : s
    105     };
     100    $.sponsorsCarousel.deleteCarousel = function( id, question ) {
     101        if ( id > 0 && confirm( question ) ) {
     102            window.location.href = window.location.href + '&delete=' + id;
     103        }
     104        return false;
     105    };
     106
     107    $.sponsorsCarousel.i18 = function( s ) {
     108        return ( typeof $.sponsorsCarouselI18[s] != 'undefined' ) ? $.sponsorsCarouselI18[ s ] : s
     109    };
    106110
    107111});
  • sponsors-carousel/trunk/js/sponsors-carousel.js

    r1833978 r1848632  
    1 jQuery(document).ready(function($) {
    2     $.sponsorsCarousel = {list:{}};
    3     $('.sponsors_carousel').each(function(i,e) {
    4         var id = parseInt($(e).data('id'));
    5         var speed = parseInt($(e).data('speed'));
    6         $.sponsorsCarousel.list[id] = $(e);
    7         $(e).jcarousel({
    8             wrap: 'circular',
    9             animation: {
    10                 duration: speed
    11             }
    12         });
    13         var autoscroll = parseInt($(e).data('autoscroll'));
    14         var scrollamount = parseInt($(e).data('scrollamount'));
    15         if (autoscroll > 0 ) {
    16             $(e).jcarouselAutoscroll({
    17                 interval: autoscroll*1000,
    18                 target: ('+=' + scrollamount)
    19             });
    20             $(e).mouseenter(function (e) { $(this).jcarouselAutoscroll('stop'); });
    21             $(e).mouseleave(function (e) { $(this).jcarouselAutoscroll('start'); });
    22         }
    23         $(e).find('img').bind("contextmenu", function (e) { e.preventDefault(); });
    24         $(e).find('img').attr('draggable', false);
    25     });
     1jQuery( document ).ready( function( $ ) {
     2    $.sponsorsCarousel = { list: {} };
     3    $( '.sponsors_carousel' ).each( function( i, e ) {
     4        var id = parseInt( $( e ).data( 'id' ) );
     5        var speed = parseInt( $( e ).data( 'speed' ) );
     6        $.sponsorsCarousel.list[ id ] = $( e );
     7        $( e ).jcarousel( {
     8            wrap: 'circular',
     9            animation: {
     10                duration: speed
     11            }
     12        } );
     13        var autoscroll = parseInt( $( e ).data( 'autoscroll' ) );
     14        var scrollamount = parseInt( $( e ).data( 'scrollamount' ) );
     15        if ( autoscroll > 0 ) {
     16            $( e ).jcarouselAutoscroll( {
     17                interval: autoscroll*1000,
     18                target: ( '+=' + scrollamount )
     19            } );
     20            $( e ).mouseenter(function( e ) { $( this ).jcarouselAutoscroll( 'stop' ); } );
     21            $( e ).mouseleave(function( e ) { $( this ).jcarouselAutoscroll( 'start' ); } );
     22        }
     23        $(e).find( 'img' ).bind( "contextmenu", function( e ) { e.preventDefault(); } );
     24        $(e).find( 'img' ).attr( 'draggable', false );
    2625
    27     $.sponsorsCarousel.move = function(id, move) {
    28         $.sponsorsCarousel.list[id].jcarousel('scroll', move);
    29         return false;
    30     }
     26    } );
    3127
    32 
     28    $.sponsorsCarousel.move = function( id, move ) {
     29        $.sponsorsCarousel.list[ id ].jcarousel( 'scroll', move );
     30        return false;
     31    }
    3332});
  • sponsors-carousel/trunk/languages/sponsors-carousel-ru_RU.po

    r1791978 r1848632  
    33"Project-Id-Version: Sponsors carousel 3\n"
    44"Report-Msgid-Bugs-To: http://wordpress.org/tag/sponsors-carousel\n"
    5 "POT-Creation-Date: 2017-12-23 16:45+0200\n"
     5"POT-Creation-Date: 2018-03-28 17:37+0300\n"
    66"PO-Revision-Date: \n"
    77"Last-Translator: Sergey Panasenko <[email protected]>\n"
     
    1212"Content-Transfer-Encoding: 8bit\n"
    1313"X-Generator: Poedit 1.8.7.1\n"
    14 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
     14"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
     15"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
    1516
    16 #: SponsorsCarouselClass.php:115
     17#: class-sponsors-carousel.php:115
    1718msgid "Shortcode:"
    1819msgstr "Короткий код;"
    1920
    20 #: SponsorsCarouselClass.php:118
     21#: class-sponsors-carousel.php:118
    2122#, php-format
    2223msgid "Also you can use %1$s for show this carousel."
    2324msgstr "Вы также можете использовать %1$s для отображения карусели."
    2425
    25 #: SponsorsCarouselClass.php:122
     26#: class-sponsors-carousel.php:122
    2627msgid "Speed:"
    2728msgstr "Скорость:"
    2829
    29 #: SponsorsCarouselClass.php:125
     30#: class-sponsors-carousel.php:125
    3031msgid "The speed of the animation. 0 is instant, 10000 is very slow."
    3132msgstr "Скорость анимации. 0 сразу, 10000 - очень медленно."
    3233
    33 #: SponsorsCarouselClass.php:129
     34#: class-sponsors-carousel.php:129
    3435msgid "Scroll Amount:"
    3536msgstr "Число прокручивающихся:"
    3637
    37 #: SponsorsCarouselClass.php:132
     38#: class-sponsors-carousel.php:132
    3839msgid "How many images should be scrolled in one step"
    3940msgstr "Как много изображений прокручивать за один раз"
    4041
    41 #: SponsorsCarouselClass.php:136
     42#: class-sponsors-carousel.php:136
    4243msgid "Auto scroll:"
    4344msgstr "Автоматическая прокрутка:"
    4445
    45 #: SponsorsCarouselClass.php:139
     46#: class-sponsors-carousel.php:139
    4647msgid "Off"
    4748msgstr "Выключена"
    4849
    49 #: SponsorsCarouselClass.php:140
     50#: class-sponsors-carousel.php:140
    5051msgid "Continuous"
    5152msgstr "Непрерывно"
    5253
    53 #: SponsorsCarouselClass.php:141
     54#: class-sponsors-carousel.php:141
    5455msgid "Fast"
    5556msgstr "Быстрая"
    5657
    57 #: SponsorsCarouselClass.php:142
     58#: class-sponsors-carousel.php:142
    5859msgid "Medium"
    5960msgstr "Средняя"
    6061
    61 #: SponsorsCarouselClass.php:143
     62#: class-sponsors-carousel.php:143
    6263msgid "Slow"
    6364msgstr "Медленная"
    6465
    65 #: SponsorsCarouselClass.php:148
     66#: class-sponsors-carousel.php:148
    6667msgid "Width of Image:"
    6768msgstr "Ширина изображения:"
    6869
    69 #: SponsorsCarouselClass.php:154
     70#: class-sponsors-carousel.php:154
    7071msgid "Height of Image:"
    7172msgstr "Высота изображения:"
    7273
    73 #: SponsorsCarouselClass.php:160
     74#: class-sponsors-carousel.php:160
    7475msgid "Width of Carousel:"
    7576msgstr "Ширина карусели:"
    7677
    77 #: SponsorsCarouselClass.php:166
     78#: class-sponsors-carousel.php:166
    7879msgid "Distance between images:"
    7980msgstr "Расстояние между изображениями:"
    8081
    81 #: SponsorsCarouselClass.php:172
     82#: class-sponsors-carousel.php:172
    8283msgid "Show titles for images:"
    8384msgstr "Отображать заголовки изображений:"
    8485
    85 #: SponsorsCarouselClass.php:175 SponsorsCarouselClass.php:184
     86#: class-sponsors-carousel.php:175 class-sponsors-carousel.php:184
    8687msgid "No"
    8788msgstr "Нет"
    8889
    89 #: SponsorsCarouselClass.php:176 SponsorsCarouselClass.php:185
     90#: class-sponsors-carousel.php:176 class-sponsors-carousel.php:185
    9091msgid "Yes"
    9192msgstr "Да"
    9293
    93 #: SponsorsCarouselClass.php:181
     94#: class-sponsors-carousel.php:181
    9495msgid "Show controls:"
    9596msgstr "Показывать стрелки:"
    9697
    97 #: SponsorsCarouselClass.php:190
     98#: class-sponsors-carousel.php:190
    9899msgid "Open in new window:"
    99100msgstr "Открыть в новом окне:"
    100101
    101 #: SponsorsCarouselClass.php:193
     102#: class-sponsors-carousel.php:193
    102103msgid "No, open in same window"
    103104msgstr "Нет, открыть в том же окне"
    104105
    105 #: SponsorsCarouselClass.php:194
     106#: class-sponsors-carousel.php:194
    106107msgid "Yes, open in new window"
    107108msgstr "Да, открыть в новом окне"
    108109
    109 #: SponsorsCarouselClass.php:199
     110#: class-sponsors-carousel.php:199
    110111msgid "Default link:"
    111112msgstr "Ссылка по-умолчанию:"
    112113
    113 #: SponsorsCarouselClass.php:209
     114#: class-sponsors-carousel.php:209
    114115msgid "Add images"
    115116msgstr "Добавить изображения"
    116117
    117 #: SponsorsCarouselClass.php:210
     118#: class-sponsors-carousel.php:210
    118119msgid "Save Changes"
    119120msgstr "Сохранить изменения"
    120121
    121 #: SponsorsCarouselClass.php:213
     122#: class-sponsors-carousel.php:213
    122123msgid "Delete carousel"
    123124msgstr "Удалить карусель"
    124125
    125 #: SponsorsCarouselClass.php:213
     126#: class-sponsors-carousel.php:213
    126127msgid "Are you sure?"
    127128msgstr "Вы уверены?"
    128129
    129 #: SponsorsCarouselClass.php:322
     130#: class-sponsors-carousel.php:322
    130131msgid "Choose Images"
    131132msgstr "Выбрать изображения"
    132133
    133 #: SponsorsCarouselClass.php:323
     134#: class-sponsors-carousel.php:323
    134135msgid "Insert in Carousel"
    135136msgstr "Добавить в карусель"
    136137
    137 #: SponsorsCarouselClass.php:324
     138#: class-sponsors-carousel.php:324
    138139msgid "Custom link:"
    139140msgstr "Ссылка для этого изображения:"
    140141
    141 #: sponsors-carousel.php:29
     142#: sponsors-carousel.php:31
    142143msgid "Sponsors Carousel"
    143144msgstr "Карусель спонсоров"
    144145
    145 #: sponsors-carousel.php:78
     146#: sponsors-carousel.php:80
    146147msgid "Options updated"
    147148msgstr "Параметры сохранены"
    148149
    149 #: sponsors-carousel.php:88
     150#: sponsors-carousel.php:90
    150151#, php-format
    151152msgid "%s Settings"
  • sponsors-carousel/trunk/languages/sponsors-carousel-uk.po

    r1792009 r1848632  
    55"Project-Id-Version: Sponsors Carousel 3\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/tag/sponsors-carousel\n"
    7 "POT-Creation-Date: 2017-12-23 18:25+0200\n"
     7"POT-Creation-Date: 2018-03-28 17:38+0300\n"
     8"PO-Revision-Date: 2018-03-28 17:38+0300\n"
     9"Last-Translator: Sergey Panasenko <[email protected]>\n"
     10"Language-Team: \n"
     11"Language: uk\n"
    812"MIME-Version: 1.0\n"
    913"Content-Type: text/plain; charset=UTF-8\n"
    1014"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2017-12-23 18:40+0200\n"
    12 "Language-Team: \n"
    1315"X-Generator: Poedit 1.8.7.1\n"
    1416"X-Poedit-KeywordsList: __\n"
    1517"X-Poedit-Basepath: ..\n"
    16 "Last-Translator: Sergey Panasenko <[email protected]>\n"
    17 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
    18 "Language: uk\n"
     18"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
     19"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
    1920"X-Poedit-SearchPath-0: sponsors-carousel.php\n"
    2021"X-Poedit-SearchPath-1: SponsorsCarouselClass.php\n"
    2122
    22 #: SponsorsCarouselClass.php:115
     23#: class-sponsors-carousel.php:115
    2324msgid "Shortcode:"
    2425msgstr "Короткий код:"
    2526
    26 #: SponsorsCarouselClass.php:118
     27#: class-sponsors-carousel.php:118
    2728#, php-format
    2829msgid "Also you can use %1$s for show this carousel."
    2930msgstr "Також ви можете використовувати %1$s для показу цієї каруселі."
    3031
    31 #: SponsorsCarouselClass.php:122
     32#: class-sponsors-carousel.php:122
    3233msgid "Speed:"
    3334msgstr "Швидкість:"
    3435
    35 #: SponsorsCarouselClass.php:125
     36#: class-sponsors-carousel.php:125
    3637msgid "The speed of the animation. 0 is instant, 10000 is very slow."
    3738msgstr "Швидкість анімації. 0 миттєвий, 10000 дуже повільний."
    3839
    39 #: SponsorsCarouselClass.php:129
     40#: class-sponsors-carousel.php:129
    4041msgid "Scroll Amount:"
    4142msgstr "Кількість прокрутки:"
    4243
    43 #: SponsorsCarouselClass.php:132
     44#: class-sponsors-carousel.php:132
    4445msgid "How many images should be scrolled in one step"
    4546msgstr "Скількі зображень буде прокручено за один крок."
    4647
    47 #: SponsorsCarouselClass.php:136
     48#: class-sponsors-carousel.php:136
    4849msgid "Auto scroll:"
    4950msgstr "Автоматична прокрутка:"
    5051
    51 #: SponsorsCarouselClass.php:139
     52#: class-sponsors-carousel.php:139
    5253msgid "Off"
    5354msgstr "Вимкнено"
    5455
    55 #: SponsorsCarouselClass.php:140
     56#: class-sponsors-carousel.php:140
    5657msgid "Continuous"
    5758msgstr "Бесперервно"
    5859
    59 #: SponsorsCarouselClass.php:141
     60#: class-sponsors-carousel.php:141
    6061msgid "Fast"
    6162msgstr "Швидко"
    6263
    63 #: SponsorsCarouselClass.php:142
     64#: class-sponsors-carousel.php:142
    6465msgid "Medium"
    6566msgstr "Середньої швидкості"
    6667
    67 #: SponsorsCarouselClass.php:143
     68#: class-sponsors-carousel.php:143
    6869msgid "Slow"
    6970msgstr "Повільна"
    7071
    71 #: SponsorsCarouselClass.php:148
     72#: class-sponsors-carousel.php:148
    7273msgid "Width of Image:"
    7374msgstr "Ширина зображення:"
    7475
    75 #: SponsorsCarouselClass.php:154
     76#: class-sponsors-carousel.php:154
    7677msgid "Height of Image:"
    7778msgstr "Висота зображення:"
    7879
    79 #: SponsorsCarouselClass.php:160
     80#: class-sponsors-carousel.php:160
    8081msgid "Width of Carousel:"
    8182msgstr "Ширина каруселі:"
    8283
    83 #: SponsorsCarouselClass.php:166
     84#: class-sponsors-carousel.php:166
    8485msgid "Distance between images:"
    8586msgstr "Відстань між зображеннями:"
    8687
    87 #: SponsorsCarouselClass.php:172
     88#: class-sponsors-carousel.php:172
    8889msgid "Show titles for images:"
    8990msgstr "Показати назви для зображень:"
    9091
    91 #: SponsorsCarouselClass.php:175 SponsorsCarouselClass.php:184
     92#: class-sponsors-carousel.php:175 class-sponsors-carousel.php:184
    9293msgid "No"
    9394msgstr "Ні"
    9495
    95 #: SponsorsCarouselClass.php:176 SponsorsCarouselClass.php:185
     96#: class-sponsors-carousel.php:176 class-sponsors-carousel.php:185
    9697msgid "Yes"
    9798msgstr "Так"
    9899
    99 #: SponsorsCarouselClass.php:181
     100#: class-sponsors-carousel.php:181
    100101msgid "Show controls:"
    101102msgstr "Показати елементи управління:"
    102103
    103 #: SponsorsCarouselClass.php:190
     104#: class-sponsors-carousel.php:190
    104105msgid "Open in new window:"
    105106msgstr "Відкрити в новому вікні:"
    106107
    107 #: SponsorsCarouselClass.php:193
     108#: class-sponsors-carousel.php:193
    108109msgid "No, open in same window"
    109110msgstr "Ні, у тому ж вікні"
    110111
    111 #: SponsorsCarouselClass.php:194
     112#: class-sponsors-carousel.php:194
    112113msgid "Yes, open in new window"
    113114msgstr "Так, у новому вікні"
    114115
    115 #: SponsorsCarouselClass.php:199
     116#: class-sponsors-carousel.php:199
    116117msgid "Default link:"
    117118msgstr "Посилання за замовченням:"
    118119
    119 #: SponsorsCarouselClass.php:209
     120#: class-sponsors-carousel.php:209
    120121msgid "Add images"
    121122msgstr "Додати зображення"
    122123
    123 #: SponsorsCarouselClass.php:210
     124#: class-sponsors-carousel.php:210
    124125msgid "Save Changes"
    125126msgstr "Зберегти зміни"
    126127
    127 #: SponsorsCarouselClass.php:213
     128#: class-sponsors-carousel.php:213
    128129msgid "Delete carousel"
    129130msgstr "Видалити карусель"
    130131
    131 #: SponsorsCarouselClass.php:213
     132#: class-sponsors-carousel.php:213
    132133msgid "Are you sure?"
    133134msgstr "Ви впевнені?"
    134135
    135 #: SponsorsCarouselClass.php:322
     136#: class-sponsors-carousel.php:322
    136137msgid "Choose Images"
    137138msgstr "Обрати зображення"
    138139
    139 #: SponsorsCarouselClass.php:323
     140#: class-sponsors-carousel.php:323
    140141msgid "Insert in Carousel"
    141142msgstr "Додати у карусель"
    142143
    143 #: SponsorsCarouselClass.php:324
     144#: class-sponsors-carousel.php:324
    144145msgid "Custom link:"
    145146msgstr "Окреме посилання:"
    146147
    147 #: sponsors-carousel.php:29
     148#: sponsors-carousel.php:31
    148149msgid "Sponsors Carousel"
    149150msgstr "Карусель Спонсорів"
    150151
    151 #: sponsors-carousel.php:78
     152#: sponsors-carousel.php:80
    152153msgid "Options updated"
    153154msgstr "Параметри оновлені"
    154155
    155 #: sponsors-carousel.php:88
     156#: sponsors-carousel.php:90
    156157#, php-format
    157158msgid "%s Settings"
  • sponsors-carousel/trunk/languages/sponsors-carousel.pot

    r1791978 r1848632  
    66"Project-Id-Version: Sponsors Carousel 3\n"
    77"Report-Msgid-Bugs-To: http://wordpress.org/tag/sponsors-carousel\n"
    8 "POT-Creation-Date: 2017-12-23 16:43+0200\n"
     8"POT-Creation-Date: 2018-03-28 17:37+0300\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=UTF-8\n"
     
    1717"X-Poedit-Basepath: ..\n"
    1818"X-Poedit-SearchPath-0: sponsors-carousel.php\n"
    19 "X-Poedit-SearchPath-1: SponsorsCarouselClass.php\n"
     19"X-Poedit-SearchPath-1: class-sponsors-carousel.php\n"
    2020
    21 #: SponsorsCarouselClass.php:115
     21#: class-sponsors-carousel.php:115
    2222msgid "Shortcode:"
    2323msgstr ""
    2424
    25 #: SponsorsCarouselClass.php:118
     25#: class-sponsors-carousel.php:118
    2626#, php-format
    2727msgid "Also you can use %1$s for show this carousel."
    2828msgstr ""
    2929
    30 #: SponsorsCarouselClass.php:122
     30#: class-sponsors-carousel.php:122
    3131msgid "Speed:"
    3232msgstr ""
    3333
    34 #: SponsorsCarouselClass.php:125
     34#: class-sponsors-carousel.php:125
    3535msgid "The speed of the animation. 0 is instant, 10000 is very slow."
    3636msgstr ""
    3737
    38 #: SponsorsCarouselClass.php:129
     38#: class-sponsors-carousel.php:129
    3939msgid "Scroll Amount:"
    4040msgstr ""
    4141
    42 #: SponsorsCarouselClass.php:132
     42#: class-sponsors-carousel.php:132
    4343msgid "How many images should be scrolled in one step"
    4444msgstr ""
    4545
    46 #: SponsorsCarouselClass.php:136
     46#: class-sponsors-carousel.php:136
    4747msgid "Auto scroll:"
    4848msgstr ""
    4949
    50 #: SponsorsCarouselClass.php:139
     50#: class-sponsors-carousel.php:139
    5151msgid "Off"
    5252msgstr ""
    5353
    54 #: SponsorsCarouselClass.php:140
     54#: class-sponsors-carousel.php:140
    5555msgid "Continuous"
    5656msgstr ""
    5757
    58 #: SponsorsCarouselClass.php:141
     58#: class-sponsors-carousel.php:141
    5959msgid "Fast"
    6060msgstr ""
    6161
    62 #: SponsorsCarouselClass.php:142
     62#: class-sponsors-carousel.php:142
    6363msgid "Medium"
    6464msgstr ""
    6565
    66 #: SponsorsCarouselClass.php:143
     66#: class-sponsors-carousel.php:143
    6767msgid "Slow"
    6868msgstr ""
    6969
    70 #: SponsorsCarouselClass.php:148
     70#: class-sponsors-carousel.php:148
    7171msgid "Width of Image:"
    7272msgstr ""
    7373
    74 #: SponsorsCarouselClass.php:154
     74#: class-sponsors-carousel.php:154
    7575msgid "Height of Image:"
    7676msgstr ""
    7777
    78 #: SponsorsCarouselClass.php:160
     78#: class-sponsors-carousel.php:160
    7979msgid "Width of Carousel:"
    8080msgstr ""
    8181
    82 #: SponsorsCarouselClass.php:166
     82#: class-sponsors-carousel.php:166
    8383msgid "Distance between images:"
    8484msgstr ""
    8585
    86 #: SponsorsCarouselClass.php:172
     86#: class-sponsors-carousel.php:172
    8787msgid "Show titles for images:"
    8888msgstr ""
    8989
    90 #: SponsorsCarouselClass.php:175 SponsorsCarouselClass.php:184
     90#: class-sponsors-carousel.php:175 class-sponsors-carousel.php:184
    9191msgid "No"
    9292msgstr ""
    9393
    94 #: SponsorsCarouselClass.php:176 SponsorsCarouselClass.php:185
     94#: class-sponsors-carousel.php:176 class-sponsors-carousel.php:185
    9595msgid "Yes"
    9696msgstr ""
    9797
    98 #: SponsorsCarouselClass.php:181
     98#: class-sponsors-carousel.php:181
    9999msgid "Show controls:"
    100100msgstr ""
    101101
    102 #: SponsorsCarouselClass.php:190
     102#: class-sponsors-carousel.php:190
    103103msgid "Open in new window:"
    104104msgstr ""
    105105
    106 #: SponsorsCarouselClass.php:193
     106#: class-sponsors-carousel.php:193
    107107msgid "No, open in same window"
    108108msgstr ""
    109109
    110 #: SponsorsCarouselClass.php:194
     110#: class-sponsors-carousel.php:194
    111111msgid "Yes, open in new window"
    112112msgstr ""
    113113
    114 #: SponsorsCarouselClass.php:199
     114#: class-sponsors-carousel.php:199
    115115msgid "Default link:"
    116116msgstr ""
    117117
    118 #: SponsorsCarouselClass.php:209
     118#: class-sponsors-carousel.php:209
    119119msgid "Add images"
    120120msgstr ""
    121121
    122 #: SponsorsCarouselClass.php:210
     122#: class-sponsors-carousel.php:210
    123123msgid "Save Changes"
    124124msgstr ""
    125125
    126 #: SponsorsCarouselClass.php:213
     126#: class-sponsors-carousel.php:213
    127127msgid "Delete carousel"
    128128msgstr ""
    129129
    130 #: SponsorsCarouselClass.php:213
     130#: class-sponsors-carousel.php:213
    131131msgid "Are you sure?"
    132132msgstr ""
    133133
    134 #: SponsorsCarouselClass.php:322
     134#: class-sponsors-carousel.php:322
    135135msgid "Choose Images"
    136136msgstr ""
    137137
    138 #: SponsorsCarouselClass.php:323
     138#: class-sponsors-carousel.php:323
    139139msgid "Insert in Carousel"
    140140msgstr ""
    141141
    142 #: SponsorsCarouselClass.php:324
     142#: class-sponsors-carousel.php:324
    143143msgid "Custom link:"
    144144msgstr ""
    145145
    146 #: sponsors-carousel.php:29
     146#: sponsors-carousel.php:31
    147147msgid "Sponsors Carousel"
    148148msgstr ""
    149149
    150 #: sponsors-carousel.php:78
     150#: sponsors-carousel.php:80
    151151msgid "Options updated"
    152152msgstr ""
    153153
    154 #: sponsors-carousel.php:88
     154#: sponsors-carousel.php:90
    155155#, php-format
    156156msgid "%s Settings"
  • sponsors-carousel/trunk/readme.txt

    r1835522 r1848632  
    55Requires at least: 4.6
    66Requires PHP: 5.2
    7 Tested up to: 4.9.1
     7Tested up to: 4.9.4
    88Stable tag: trunk
    99
     
    6161* 3.00: added possibility to make some carousels, added resize images from admin area, new version of jCarousel
    6262* 3.01: made carousel to stop on hover, thanks dadi2404
     63* 3.02: fix bug, brought into line with the Coding Standards
  • sponsors-carousel/trunk/sponsors-carousel.php

    r1833978 r1848632  
    44 * Plugin URI: http://wordpress.org/extend/plugins/sponsors-carousel
    55 * Description: Sponsors logos on javascript carousel.
    6  * Version: 3.01
     6 * Version: 3.02
    77 * Author: Sergey Panasenko <[email protected]>
    88 * Text Domain: sponsors-carousel
     
    1212/*  Copyright 2017  Sergey Panasenko  (email: [email protected])
    1313
    14     This program is free software; you can redistribute it and/or modify
    15     it under the terms of the GNU General Public License as published by
    16     the Free Software Foundation; either version 2 of the License, or
    17     (at your option) any later version.
     14    This program is free software; you can redistribute it and/or modify
     15    it under the terms of the GNU General Public License as published by
     16    the Free Software Foundation; either version 2 of the License, or
     17    (at your option) any later version.
    1818
    19     This program is distributed in the hope that it will be useful,
    20     but WITHOUT ANY WARRANTY; without even the implied warranty of
    21     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22     GNU General Public License for more details.
     19    This program is distributed in the hope that it will be useful,
     20    but WITHOUT ANY WARRANTY; without even the implied warranty of
     21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     22    GNU General Public License for more details.
    2323
    24     You should have received a copy of the GNU General Public License
    25     along with this program; if not, write to the Free Software
    26     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     24    You should have received a copy of the GNU General Public License
     25    along with this program; if not, write to the Free Software
     26    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2727*/
    2828
    29 include_once("SponsorsCarouselClass.php");
     29include_once("class-sponsors-carousel.php");
    3030
    31 $scwp_plugin_name = __("Sponsors Carousel", 'sponsors-carousel');
    32 $scwp_plugin_filename = basename(__FILE__); //"sponsors-carousel.php";
    33 load_plugin_textdomain('sponsors-carousel', NULL, dirname(plugin_basename(__FILE__))."/languages");
     31$scwp_plugin_name = __( "Sponsors Carousel", 'sponsors-carousel' );
     32$scwp_plugin_filename = basename( __FILE__ ); //"sponsors-carousel.php";
     33load_plugin_textdomain( 'sponsors-carousel', NULL, dirname( plugin_basename( __FILE__ ) ) . "/languages" );
    3434
    35 add_shortcode('sponsors_carousel', function($arg) {
    36     return sponsors_carousel(isset($arg['id']) ? $arg['id'] : 0);
     35add_shortcode( 'sponsors_carousel', function( $arg ) {
     36    return sponsors_carousel( isset( $arg['id'] ) ? $arg['id'] : 0 );
    3737});
    3838
    39 add_action('wp_enqueue_scripts',  function () {
    40     wp_enqueue_script('jcarousel', plugins_url('/js/jquery.jcarousel.min.js', __FILE__), ['jquery']);
    41     wp_enqueue_script('jcarousel-autoscroll', plugins_url('/js/jquery.jcarousel-autoscroll.min.js', __FILE__), ['jquery','jcarousel']);
    42     wp_enqueue_script('sponsors-carousel', plugins_url('/js/sponsors-carousel.js', __FILE__), ['jquery','jcarousel','jcarousel-autoscroll']);
    43 });
     39add_action( 'wp_enqueue_scripts',  function () {
     40    wp_enqueue_script( 'jcarousel', plugins_url( '/js/jquery.jcarousel.min.js', __FILE__ ), ['jquery']);
     41    wp_enqueue_script( 'jcarousel-autoscroll', plugins_url( '/js/jquery.jcarousel-autoscroll.min.js', __FILE__ ), ['jquery','jcarousel'] );
     42    wp_enqueue_script( 'sponsors-carousel', plugins_url( '/js/sponsors-carousel.js', __FILE__ ), ['jquery','jcarousel','jcarousel-autoscroll'] );
     43} );
    4444
    4545add_action('wp_print_styles',  function () {
    46     wp_enqueue_style('dashicons');
    47     wp_enqueue_style('sponsors-carousel', plugins_url('/css/sponsors-carousel.css', __FILE__));
    48 });
     46    wp_enqueue_style( 'dashicons' );
     47    wp_enqueue_style( 'sponsors-carousel', plugins_url( '/css/sponsors-carousel.css', __FILE__ ) );
     48} );
    4949
    50 add_action('admin_enqueue_scripts',  function () {
    51     wp_enqueue_script('jquery-ui-core', ['jquery']);
    52     wp_enqueue_script('jquery-ui-sortable', ['jquery', 'jquery-ui-core']);
    53     wp_enqueue_script('sponsors-carousel-admin', plugins_url('/js/sponsors-carousel-admin.js', __FILE__), ['jquery', 'jquery-ui-core', 'jquery-ui-sortable']);
    54     wp_enqueue_style('sponsors-carousel-admin', plugins_url('/css/sponsors-carousel-admin.css', __FILE__));
    55 });
     50add_action( 'admin_enqueue_scripts',  function () {
     51    wp_enqueue_script( 'jquery-ui-core', ['jquery'] );
     52    wp_enqueue_script( 'jquery-ui-sortable', ['jquery', 'jquery-ui-core'] );
     53    wp_enqueue_script( 'sponsors-carousel-admin', plugins_url('/js/sponsors-carousel-admin.js', __FILE__ ), ['jquery', 'jquery-ui-core', 'jquery-ui-sortable'] );
     54    wp_enqueue_style( 'sponsors-carousel-admin', plugins_url('/css/sponsors-carousel-admin.css', __FILE__ ) );
     55} );
    5656
    57 add_action('admin_menu', function () {
    58     global $scwp_plugin_name;
    59     wp_enqueue_media();
    60     add_menu_page($scwp_plugin_name, $scwp_plugin_name, 'manage_options', 'sponsors_carousel', 'scwp_options_page', 'dashicons-format-gallery', 55);
    61 });
     57add_action( 'admin_menu', function () {
     58    global $scwp_plugin_name;
     59    wp_enqueue_media();
     60    add_menu_page( $scwp_plugin_name, $scwp_plugin_name, 'manage_options', 'sponsors_carousel', 'scwp_options_page', 'dashicons-format-gallery', 55 );
     61} );
    6262
    63 add_action('wp_ajax_sponsors_carousel_change_link', function () {
    64     if (!is_admin()) die();
    65     $post = array(
    66         'ID'           => intval($_POST['image_id']),
    67         'post_excerpt'   => $_POST['link'],
    68     );
    69     wp_update_post($post);
    70     echo 'Saved';
    71     wp_die();
    72 });
     63add_action( 'wp_ajax_sponsors_carousel_change_link', function () {
     64    if ( is_admin() ) {
     65        $post = array(
     66            'ID'             => intval($_POST['image_id']),
     67            'post_excerpt'   => $_POST['link'],
     68        );
     69        wp_update_post( $post );
     70        echo 'Saved';
     71    }
     72    wp_die();
     73} );
    7374
    7475// Show options page
    7576function scwp_options_page() {
    7677
    77     if (isset($_POST['save'])) { // Update options
    78         $sponsors_carousel = new SponsorsCarousel($id);
    79         if ($sponsors_carousel->update($_POST)) {
    80             echo "<div class='updated fade'><p><strong>" . __('Options updated', 'sponsors-carousel') . "</strong></p></div>";
    81         }
    82     }
     78    if ( isset( $_POST['save'] ) ) { // Update options
     79        $sponsors_carousel = new SponsorsCarousel( $id );
     80        if ( $sponsors_carousel->update( $_POST ) ) {
     81            echo "<div class='updated fade'><p><strong>" . __( 'Options updated', 'sponsors-carousel' ) . "</strong></p></div>";
     82        }
     83    }
    8384
    84     if (isset($_GET['delete']) && isset($_GET['id']) && intval($_GET['id']) == intval($_GET['delete'])) { // Delete carousel
    85         echo SponsorsCarousel::delete(intval($_GET['delete']));
    86         die();
    87     }
     85    if ( isset( $_GET['delete'] ) && isset( $_GET['id'] ) && intval( $_GET['id'] ) == intval( $_GET['delete'] ) ) { // Delete carousel
     86        echo SponsorsCarousel::delete( intval( $_GET['delete'] ) );
     87        die();
     88    }
    8889
    89     global $scwp_plugin_name;
    90     echo '<h2>' . sprintf(__('%s Settings', 'sponsors-carousel'), $scwp_plugin_name) . '</h2>';
    91     $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
    92     echo SponsorsCarousel::showButtons($id);
    93     $option = get_option('sponsors-carousel-' . $id);
    94     if ($option == false) $sponsors_carousel = new SponsorsCarousel($id);
    95     else $sponsors_carousel = unserialize($option);
    96     echo $sponsors_carousel->getForm();
     90    global $scwp_plugin_name;
     91    echo '<h2>' . sprintf( __( '%s Settings', 'sponsors-carousel' ), $scwp_plugin_name ) . '</h2>';
     92    $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
     93    echo SponsorsCarousel::show_buttons( $id );
     94    $option = get_option( 'sponsors-carousel-' . $id );
     95    if ( false == $option ) {
     96        $sponsors_carousel = new SponsorsCarousel( $id );
     97    }
     98    else $sponsors_carousel = unserialize( $option );
     99    echo $sponsors_carousel->get_form();
    97100}
    98101
    99 function sponsors_carousel($id = 0) {
    100     $id = intval($id);
    101     $option = get_option('sponsors-carousel-' . $id);
    102     if ($option == false) return false;
    103     $sponsors_carousel = unserialize($option);
    104     return $sponsors_carousel->show();
     102function sponsors_carousel( $id = 0 ) {
     103    $id = intval( $id );
     104    $option = get_option( 'sponsors-carousel-' . $id );
     105    if ( false == $option ) {
     106        return false;
     107    }
     108    $sponsors_carousel = unserialize( $option );
     109    return $sponsors_carousel->show();
    105110}
    106111
Note: See TracChangeset for help on using the changeset viewer.