Plugin Directory

Changeset 1791978


Ignore:
Timestamp:
12/24/2017 12:06:18 PM (8 years ago)
Author:
Nitay
Message:

v3.0 added possibility to make some carousels, added resize images from admin area, new version of jCarousel

Location:
sponsors-carousel
Files:
15 added
9 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • sponsors-carousel/trunk/languages/sponsors-carousel-ru_RU.po

    r522963 r1791978  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: Sponsors carousel 0.1\n"
     3"Project-Id-Version: Sponsors carousel 3\n"
    44"Report-Msgid-Bugs-To: http://wordpress.org/tag/sponsors-carousel\n"
    5 "POT-Creation-Date: 2012-03-24 07:01:39+00:00\n"
     5"POT-Creation-Date: 2017-12-23 16:45+0200\n"
    66"PO-Revision-Date: \n"
    77"Last-Translator: Sergey Panasenko <[email protected]>\n"
    88"Language-Team: \n"
     9"Language: ru_RU\n"
    910"MIME-Version: 1.0\n"
    1011"Content-Type: text/plain; charset=UTF-8\n"
    1112"Content-Transfer-Encoding: 8bit\n"
    12 "Language: \n"
    13 "X-Poedit-Language: Russian\n"
    14 "X-Poedit-Country: UKRAINE\n"
     13"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"
    1515
    16 #. #-#-#-#-#  plugin.pot (Sponsors Carousel 2.0)  #-#-#-#-#
    17 #. Plugin Name of the plugin/theme
    18 #: sponsors-carousel.php:35
     16#: SponsorsCarouselClass.php:115
     17msgid "Shortcode:"
     18msgstr "Короткий код;"
     19
     20#: SponsorsCarouselClass.php:118
     21#, php-format
     22msgid "Also you can use %1$s for show this carousel."
     23msgstr "Вы также можете использовать %1$s для отображения карусели."
     24
     25#: SponsorsCarouselClass.php:122
     26msgid "Speed:"
     27msgstr "Скорость:"
     28
     29#: SponsorsCarouselClass.php:125
     30msgid "The speed of the animation. 0 is instant, 10000 is very slow."
     31msgstr "Скорость анимации. 0 сразу, 10000 - очень медленно."
     32
     33#: SponsorsCarouselClass.php:129
     34msgid "Scroll Amount:"
     35msgstr "Число прокручивающихся:"
     36
     37#: SponsorsCarouselClass.php:132
     38msgid "How many images should be scrolled in one step"
     39msgstr "Как много изображений прокручивать за один раз"
     40
     41#: SponsorsCarouselClass.php:136
     42msgid "Auto scroll:"
     43msgstr "Автоматическая прокрутка:"
     44
     45#: SponsorsCarouselClass.php:139
     46msgid "Off"
     47msgstr "Выключена"
     48
     49#: SponsorsCarouselClass.php:140
     50msgid "Continuous"
     51msgstr "Непрерывно"
     52
     53#: SponsorsCarouselClass.php:141
     54msgid "Fast"
     55msgstr "Быстрая"
     56
     57#: SponsorsCarouselClass.php:142
     58msgid "Medium"
     59msgstr "Средняя"
     60
     61#: SponsorsCarouselClass.php:143
     62msgid "Slow"
     63msgstr "Медленная"
     64
     65#: SponsorsCarouselClass.php:148
     66msgid "Width of Image:"
     67msgstr "Ширина изображения:"
     68
     69#: SponsorsCarouselClass.php:154
     70msgid "Height of Image:"
     71msgstr "Высота изображения:"
     72
     73#: SponsorsCarouselClass.php:160
     74msgid "Width of Carousel:"
     75msgstr "Ширина карусели:"
     76
     77#: SponsorsCarouselClass.php:166
     78msgid "Distance between images:"
     79msgstr "Расстояние между изображениями:"
     80
     81#: SponsorsCarouselClass.php:172
     82msgid "Show titles for images:"
     83msgstr "Отображать заголовки изображений:"
     84
     85#: SponsorsCarouselClass.php:175 SponsorsCarouselClass.php:184
     86msgid "No"
     87msgstr "Нет"
     88
     89#: SponsorsCarouselClass.php:176 SponsorsCarouselClass.php:185
     90msgid "Yes"
     91msgstr "Да"
     92
     93#: SponsorsCarouselClass.php:181
     94msgid "Show controls:"
     95msgstr "Показывать стрелки:"
     96
     97#: SponsorsCarouselClass.php:190
     98msgid "Open in new window:"
     99msgstr "Открыть в новом окне:"
     100
     101#: SponsorsCarouselClass.php:193
     102msgid "No, open in same window"
     103msgstr "Нет, открыть в том же окне"
     104
     105#: SponsorsCarouselClass.php:194
     106msgid "Yes, open in new window"
     107msgstr "Да, открыть в новом окне"
     108
     109#: SponsorsCarouselClass.php:199
     110msgid "Default link:"
     111msgstr "Ссылка по-умолчанию:"
     112
     113#: SponsorsCarouselClass.php:209
     114msgid "Add images"
     115msgstr "Добавить изображения"
     116
     117#: SponsorsCarouselClass.php:210
     118msgid "Save Changes"
     119msgstr "Сохранить изменения"
     120
     121#: SponsorsCarouselClass.php:213
     122msgid "Delete carousel"
     123msgstr "Удалить карусель"
     124
     125#: SponsorsCarouselClass.php:213
     126msgid "Are you sure?"
     127msgstr "Вы уверены?"
     128
     129#: SponsorsCarouselClass.php:322
     130msgid "Choose Images"
     131msgstr "Выбрать изображения"
     132
     133#: SponsorsCarouselClass.php:323
     134msgid "Insert in Carousel"
     135msgstr "Добавить в карусель"
     136
     137#: SponsorsCarouselClass.php:324
     138msgid "Custom link:"
     139msgstr "Ссылка для этого изображения:"
     140
     141#: sponsors-carousel.php:29
    19142msgid "Sponsors Carousel"
    20143msgstr "Карусель спонсоров"
    21144
    22 #: sponsors-carousel.php:188
    23 msgid "Advanced"
    24 msgstr "Расширенные"
    25 
    26 #: sponsors-carousel.php:193
    27 msgid "Options"
    28 msgstr "Параметры"
    29 
    30 #: sponsors-carousel.php:245
     145#: sponsors-carousel.php:78
    31146msgid "Options updated"
    32147msgstr "Параметры сохранены"
    33148
    34 #: sponsors-carousel.php:294
     149#: sponsors-carousel.php:88
     150#, php-format
    35151msgid "%s Settings"
    36152msgstr "%s - Настройки"
    37153
    38 #: sponsors-carousel.php:296
    39 msgid "Speed:"
    40 msgstr "Скорость:"
     154#~ msgid "Also you can use function %1$s for show this carousel."
     155#~ msgstr "Вы также можете использовать ф"
    41156
    42 #: sponsors-carousel.php:298
    43 msgid "The speed of the animation. Options: 'fast', 'slow', or a number. 0 is instant, 10000 is very slow."
    44 msgstr "Скорость анимации. Параметры: 'fast', 'slow', или цифра. 0 - моментально, 10000 -очень медленно."
    45 
    46 #: sponsors-carousel.php:300
    47 msgid "Show Titles:"
    48 msgstr "Показывать заголовки"
    49 
    50 #: sponsors-carousel.php:310
    51 msgid "Yes, show image titles."
    52 msgstr "Да, показывать заголовки изображений"
    53 
    54 #: sponsors-carousel.php:322
    55 msgid "No, hide image titles. "
    56 msgstr "Нет, спрятать заголовки изображений"
    57 
    58 #: sponsors-carousel.php:324
    59 msgid "Should the title of each image be shown?"
    60 msgstr "Показывать заголовок каждого изображения?"
    61 
    62 #: sponsors-carousel.php:326
    63 msgid "Scroll Amount:"
    64 msgstr "Число прокручивающихся"
    65 
    66 #: sponsors-carousel.php:328
    67 msgid "How many items should the carousel scroll"
    68 msgstr "Как много элементов прокручивается в карусели"
    69 
    70 #: sponsors-carousel.php:333
    71 msgid "Auto scroll:"
    72 msgstr "Автоматическая прокрутка"
    73 
    74 #: sponsors-carousel.php:335
    75 msgid "Off"
    76 msgstr "Выключена"
    77 
    78 #: sponsors-carousel.php:336
    79 msgid "Fast"
    80 msgstr "Быстрая"
    81 
    82 #: sponsors-carousel.php:337
    83 msgid "Medium"
    84 msgstr "Средняя"
    85 
    86 #: sponsors-carousel.php:338
    87 msgid "Slow"
    88 msgstr "Медленная"
    89 
    90 #: sponsors-carousel.php:340
    91 msgid "Select the auto scrolling speed."
    92 msgstr "Выбрать скорость автоматической прокрутки."
    93 
    94 #: sponsors-carousel.php:345
    95 msgid "Link target:"
    96 msgstr "Открытие ссылки:"
    97 
    98 #: sponsors-carousel.php:347
    99 msgid "New Window or tab"
    100 msgstr "В новом окне или вкладке"
    101 
    102 #: sponsors-carousel.php:348
    103 msgid "Same Window or tab"
    104 msgstr "В том же окне или вкладке"
    105 
    106 #: sponsors-carousel.php:350
    107 msgid "Choose whether the links should open in the current window."
    108 msgstr "Выберите, будет ли ссылка открываться в текущем окне."
    109 
    110 #: sponsors-carousel.php:352
    111 msgid "Default link:"
    112 msgstr "Ссылка по-умолчанию:"
    113 
    114 #: sponsors-carousel.php:354
    115 msgid "Link to sponsors page. You can add custom link in image caption."
    116 msgstr "Ссылка на страницу спонсоров. Вы можете добавить уникальную ссылку в поле подписи к рисунку."
    117 
    118 #: sponsors-carousel.php:356
    119 msgid "New (select *full size* before insert): "
    120 msgstr "Новый (выберете  *full size* перед вставкой)"
    121 
    122 #: sponsors-carousel.php:360
    123 #: sponsors-carousel.php:362
    124 msgid "Add an Image"
    125 msgstr "Добавить изображение"
    126 
    127 #: sponsors-carousel.php:380
    128 msgid "Save Changes"
    129 msgstr "Сохранить изменения"
    130 
    131 #. Plugin URI of the plugin/theme
    132 msgid "http://wordpress.org/extend/plugins/sponsors-carousel"
    133 msgstr "http://wordpress.org/extend/plugins/sponsors-carousel"
    134 
    135 #. Description of the plugin/theme
    136 msgid "Sponsors logos on javascript carousel."
    137 msgstr "Логотипы спонсоров на javascript-карусели."
    138 
    139 #. Author of the plugin/theme
    140 msgid "Sergey Panasenko"
    141 msgstr "Сергей Панасенко"
    142 
    143 #. Author URI of the plugin/theme
    144 msgid "http://nitay.dp.ua"
    145 msgstr "http://nitay.dp.ua"
    146 
     157#~ msgid "Options"
     158#~ msgstr "Параметры"
  • sponsors-carousel/trunk/languages/sponsors-carousel.pot

    r477850 r1791978  
    11# Copyright (C) 2010 Sponsors Carousel
    22# This file is distributed under the same license as the Sponsors Carousel package.
     3#, fuzzy
    34msgid ""
    45msgstr ""
    5 "Project-Id-Version: Sponsors Carousel 0.1\n"
     6"Project-Id-Version: Sponsors Carousel 3\n"
    67"Report-Msgid-Bugs-To: http://wordpress.org/tag/sponsors-carousel\n"
    7 "POT-Creation-Date: 2011-12-20 05:02:48+00:00\n"
     8"POT-Creation-Date: 2017-12-23 16:43+0200\n"
    89"MIME-Version: 1.0\n"
    910"Content-Type: text/plain; charset=UTF-8\n"
     
    1213"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1314"Language-Team: LANGUAGE <[email protected]>\n"
     15"X-Generator: Poedit 1.8.7.1\n"
     16"X-Poedit-KeywordsList: __\n"
     17"X-Poedit-Basepath: ..\n"
     18"X-Poedit-SearchPath-0: sponsors-carousel.php\n"
     19"X-Poedit-SearchPath-1: SponsorsCarouselClass.php\n"
    1420
    15 #. #-#-#-#-#  plugin.pot (Sponsors Carousel 0.1)  #-#-#-#-#
    16 #. Plugin Name of the plugin/theme
    17 #: sponsors-carousel.php:34
     21#: SponsorsCarouselClass.php:115
     22msgid "Shortcode:"
     23msgstr ""
     24
     25#: SponsorsCarouselClass.php:118
     26#, php-format
     27msgid "Also you can use %1$s for show this carousel."
     28msgstr ""
     29
     30#: SponsorsCarouselClass.php:122
     31msgid "Speed:"
     32msgstr ""
     33
     34#: SponsorsCarouselClass.php:125
     35msgid "The speed of the animation. 0 is instant, 10000 is very slow."
     36msgstr ""
     37
     38#: SponsorsCarouselClass.php:129
     39msgid "Scroll Amount:"
     40msgstr ""
     41
     42#: SponsorsCarouselClass.php:132
     43msgid "How many images should be scrolled in one step"
     44msgstr ""
     45
     46#: SponsorsCarouselClass.php:136
     47msgid "Auto scroll:"
     48msgstr ""
     49
     50#: SponsorsCarouselClass.php:139
     51msgid "Off"
     52msgstr ""
     53
     54#: SponsorsCarouselClass.php:140
     55msgid "Continuous"
     56msgstr ""
     57
     58#: SponsorsCarouselClass.php:141
     59msgid "Fast"
     60msgstr ""
     61
     62#: SponsorsCarouselClass.php:142
     63msgid "Medium"
     64msgstr ""
     65
     66#: SponsorsCarouselClass.php:143
     67msgid "Slow"
     68msgstr ""
     69
     70#: SponsorsCarouselClass.php:148
     71msgid "Width of Image:"
     72msgstr ""
     73
     74#: SponsorsCarouselClass.php:154
     75msgid "Height of Image:"
     76msgstr ""
     77
     78#: SponsorsCarouselClass.php:160
     79msgid "Width of Carousel:"
     80msgstr ""
     81
     82#: SponsorsCarouselClass.php:166
     83msgid "Distance between images:"
     84msgstr ""
     85
     86#: SponsorsCarouselClass.php:172
     87msgid "Show titles for images:"
     88msgstr ""
     89
     90#: SponsorsCarouselClass.php:175 SponsorsCarouselClass.php:184
     91msgid "No"
     92msgstr ""
     93
     94#: SponsorsCarouselClass.php:176 SponsorsCarouselClass.php:185
     95msgid "Yes"
     96msgstr ""
     97
     98#: SponsorsCarouselClass.php:181
     99msgid "Show controls:"
     100msgstr ""
     101
     102#: SponsorsCarouselClass.php:190
     103msgid "Open in new window:"
     104msgstr ""
     105
     106#: SponsorsCarouselClass.php:193
     107msgid "No, open in same window"
     108msgstr ""
     109
     110#: SponsorsCarouselClass.php:194
     111msgid "Yes, open in new window"
     112msgstr ""
     113
     114#: SponsorsCarouselClass.php:199
     115msgid "Default link:"
     116msgstr ""
     117
     118#: SponsorsCarouselClass.php:209
     119msgid "Add images"
     120msgstr ""
     121
     122#: SponsorsCarouselClass.php:210
     123msgid "Save Changes"
     124msgstr ""
     125
     126#: SponsorsCarouselClass.php:213
     127msgid "Delete carousel"
     128msgstr ""
     129
     130#: SponsorsCarouselClass.php:213
     131msgid "Are you sure?"
     132msgstr ""
     133
     134#: SponsorsCarouselClass.php:322
     135msgid "Choose Images"
     136msgstr ""
     137
     138#: SponsorsCarouselClass.php:323
     139msgid "Insert in Carousel"
     140msgstr ""
     141
     142#: SponsorsCarouselClass.php:324
     143msgid "Custom link:"
     144msgstr ""
     145
     146#: sponsors-carousel.php:29
    18147msgid "Sponsors Carousel"
    19148msgstr ""
    20149
    21 #: sponsors-carousel.php:170
    22 msgid "Options"
    23 msgstr ""
    24 
    25 #: sponsors-carousel.php:213
     150#: sponsors-carousel.php:78
    26151msgid "Options updated"
    27152msgstr ""
    28153
    29 #: sponsors-carousel.php:262
     154#: sponsors-carousel.php:88
     155#, php-format
    30156msgid "%s Settings"
    31157msgstr ""
    32 
    33 #: sponsors-carousel.php:264
    34 msgid "Speed:"
    35 msgstr ""
    36 
    37 #: sponsors-carousel.php:266
    38 msgid ""
    39 "The speed of the animation. Options: 'fast', 'slow', or a number. 0 is "
    40 "instant, 10000 is very slow."
    41 msgstr ""
    42 
    43 #: sponsors-carousel.php:268
    44 msgid "Show Titles:"
    45 msgstr ""
    46 
    47 #: sponsors-carousel.php:278
    48 msgid "Yes, show image titles."
    49 msgstr ""
    50 
    51 #: sponsors-carousel.php:290
    52 msgid "No, hide image titles. "
    53 msgstr ""
    54 
    55 #: sponsors-carousel.php:292
    56 msgid "Should the title of each image be shown?"
    57 msgstr ""
    58 
    59 #: sponsors-carousel.php:294
    60 msgid "Scroll Amount:"
    61 msgstr ""
    62 
    63 #: sponsors-carousel.php:296
    64 msgid "How many items should the carousel scroll"
    65 msgstr ""
    66 
    67 #: sponsors-carousel.php:298
    68 msgid "Default link:"
    69 msgstr ""
    70 
    71 #: sponsors-carousel.php:300
    72 msgid "Link to sponsors page. You can add custom link in image caption."
    73 msgstr ""
    74 
    75 #: sponsors-carousel.php:302
    76 msgid "New (select *full size* before insert): "
    77 msgstr ""
    78 
    79 #: sponsors-carousel.php:304
    80 msgid "Add an Image"
    81 msgstr ""
    82 
    83 #: sponsors-carousel.php:315
    84 msgid "Save Changes"
    85 msgstr ""
    86 
    87 #. Plugin URI of the plugin/theme
    88 msgid "http://wordpress.org/extend/plugins/sponsors-carousel"
    89 msgstr ""
    90 
    91 #. Description of the plugin/theme
    92 msgid "Sponsors logos on javascript carousel."
    93 msgstr ""
    94 
    95 #. Author of the plugin/theme
    96 msgid "Sergey Panasenko"
    97 msgstr ""
    98 
    99 #. Author URI of the plugin/theme
    100 msgid "http://nitay.dp.ua"
    101 msgstr ""
  • sponsors-carousel/trunk/readme.txt

    r1791976 r1791978  
    11=== Sponsors Carousel ===
    2 Contributors: Sergey Panasenko
     2Contributors: Nitay (Sergey Panasenko)
    33Donate link:
    4 Tags: gallery, images, javascript, jquery, banners, sponsors, jcarousel
    5 Requires at least: 4.0
    6 Tested up to: 4.3.1
     4Tags: gallery, images, banners, sponsors, jcarousel, carousel, slider
     5Requires at least: 4.3
     6Tested up to: 4.9.1
    77Stable tag: trunk
    88
     
    1616You can set internal link for all image or custom link for any image.
    1717
    18 New functionality: Autoscroll!
     18New functionality: Some carousels!
    1919
    20 The plugin uses the shortcode [sponsors_carousel].
    21 
    22 It is is designed to be styled with CSS. Sample images for next/prev arrows are provided.
     20The plugin uses the shortcode [sponsors_carousel], [sponsors_carousel id=1] ...
    2321
    2422The plugin uses jQuery, and if your site doesn't already use jQuery, it'll add the script for you.
    2523
    2624It was inspired by jCarousel by Jan Sorgalla.
    27 
    28 In future release:
    29 
    30 * resize from admin panel.
    3125
    3226
     
    36302. Activate the plugin through the 'Plugins' menu in WordPress
    37313. Add <code><?php echo sponsors_carousel(); ?></code> in theme or [sponsors_carousel] on page.
    38 4. Add image on Settings->Sponsor Carousel page
    39 5. Set custom link in image *Caption* field
     324. Add images on Sponsors Carousel admin page
     335. Enjoy
    4034
    4135== Frequently Asked Questions ==
     
    6155* 2.02: Continuous Mode (Thanks for Sebastián Valerio G.)
    6256* 2.03: fixed media upload
     57* 3.00: added possibility to make some carousels, added resize images from admin area, new version of jCarousel
  • sponsors-carousel/trunk/sponsors-carousel.php

    r1268492 r1791978  
    44Plugin URI: http://wordpress.org/extend/plugins/sponsors-carousel
    55Description: Sponsors logos on javascript carousel.
    6 Version: 2.03
    7 Author: Sergey Panasenko
    8 Author URI: http://nitay.dp.ua
     6Version: 3.00
     7Author: Sergey Panasenko [email protected]
    98*/
    109
    11 /*  Copyright 2011  Sergey Panasenko  (email: [email protected])
    12     Copyright 2012  elija (http://wordpress.org/support/profile/elija)
     10/*  Copyright 2017  Sergey Panasenko  (email: [email protected])
    1311
    1412    This program is free software; you can redistribute it and/or modify
     
    2725*/
    2826
     27include_once("SponsorsCarouselClass.php");
    2928
    30 /*****************************
    31 * Options Page
    32 */
    33 
    34 // Options
    3529$scwp_plugin_name = __("Sponsors Carousel", 'sponsors-carousel');
    3630$scwp_plugin_filename = basename(__FILE__); //"sponsors-carousel.php";
    37 
    3831load_plugin_textdomain('sponsors-carousel', NULL, dirname(plugin_basename(__FILE__))."/languages");
    3932
    40 add_shortcode('sponsors_carousel', 'sponsors_carousel');
    41 add_action('wp_head', 'sponsors_carousel_header');
     33add_shortcode('sponsors_carousel', function($arg) {
     34    return sponsors_carousel(isset($arg['id']) ? $arg['id'] : 0);
     35});
    4236
    43 add_action('admin_init', 'scwp_admin_init');
    44 add_action('admin_menu', 'add_scwp_option_page');
     37add_action('wp_enqueue_scripts',  function () {
     38    wp_enqueue_script('jcarousel', plugins_url('/js/jquery.jcarousel.min.js', __FILE__), ['jquery']);
     39    wp_enqueue_script('jcarousel-autoscroll', plugins_url('/js/jquery.jcarousel-autoscroll.min.js', __FILE__), ['jquery','jcarousel']);
     40    wp_enqueue_script('sponsors-carousel', plugins_url('/js/sponsors-carousel.js', __FILE__), ['jquery','jcarousel','jcarousel-autoscroll']);
     41});
    4542
     43add_action('wp_print_styles',  function () {
     44    wp_enqueue_style('dashicons');
     45    wp_enqueue_style('sponsors-carousel', plugins_url('/css/sponsors-carousel.css', __FILE__));
     46});
    4647
    47 add_option("scwp_animation_speed", "fast", "", "yes");
    48 add_option("scwp_show_titles", "true", "", "yes");
    49 add_option("scwp_scroll_amount", "2", "", "yes");
    50 add_option("scwp_default_link", "", "", "yes");
    51 add_option("scwp_list", "", "", "yes");
     48add_action('admin_enqueue_scripts',  function () {
     49    wp_enqueue_script('jquery-ui-core', ['jquery']);
     50    wp_enqueue_script('jquery-ui-sortable', ['jquery', 'jquery-ui-core']);
     51    wp_enqueue_script('sponsors-carousel-admin', plugins_url('/js/sponsors-carousel-admin.js', __FILE__), ['jquery', 'jquery-ui-core', 'jquery-ui-sortable']);
     52    wp_enqueue_style('sponsors-carousel-admin', plugins_url('/css/sponsors-carousel-admin.css', __FILE__));
     53});
    5254
    53 //  New option for opening links in new window / tab
    54 //  Default new
    55 add_option("scwp_link_target", "new");
     55add_action('admin_menu', function () {
     56    global $scwp_plugin_name;
     57    wp_enqueue_media();
     58    add_menu_page($scwp_plugin_name, $scwp_plugin_name, 'manage_options', 'sponsors_carousel', 'scwp_options_page', 'dashicons-format-gallery', 55);
     59});
    5660
    57 //  New option for auto scrolling speed
    58 //  Default off
    59 add_option("scwp_auto_scroll", 0);
     61add_action('wp_ajax_sponsors_carousel_change_link', function () {
     62    if (!is_admin()) die();
     63    $post = array(
     64        'ID'           => intval($_POST['image_id']),
     65        'post_excerpt'   => $_POST['link'],
     66    );
     67    wp_update_post($post);
     68    echo 'Saved';
     69    wp_die();
     70});
    6071
    61 /*****************************
    62 * Enqueue jQuery & Scripts
    63 */
    64 if (!is_admin()) {
    65     add_action('init', 'sponsors_carousel_enqueue_scripts');
     72// Show options page
     73function scwp_options_page() {
     74
     75    if (isset($_POST['save'])) { // Update options
     76        $sponsors_carousel = new SponsorsCarousel($id);
     77        if ($sponsors_carousel->update($_POST)) {
     78            echo "<div class='updated fade'><p><strong>" . __('Options updated', 'sponsors-carousel') . "</strong></p></div>";
     79        }
     80    }
     81
     82    if (isset($_GET['delete']) && isset($_GET['id']) && intval($_GET['id']) == intval($_GET['delete'])) { // Delete carousel
     83        echo SponsorsCarousel::delete(intval($_GET['delete']));
     84        die();
     85    }
     86
     87    global $scwp_plugin_name;
     88    echo '<h2>' . sprintf(__('%s Settings', 'sponsors-carousel'), $scwp_plugin_name) . '</h2>';
     89    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     90    echo SponsorsCarousel::showButtons($id);
     91    $option = get_option('sponsors-carousel-' . $id);
     92    if ($option == false) $sponsors_carousel = new SponsorsCarousel($id);
     93    else $sponsors_carousel = unserialize($option);
     94    echo $sponsors_carousel->getForm();
    6695}
    6796
    68 function sponsors_carousel_enqueue_scripts() {
    69     if ( function_exists('plugin_url') )
    70         $plugin_url = plugin_url();
    71     else
    72         $plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
    73 
    74     // jquery
    75     //~ wp_deregister_script('jquery');
    76     //~ wp_register_script('jquery', ($plugin_url  . '/jquery-1.4.2.min.js'), false, '1.4.2');
    77     wp_enqueue_script('jquery');
     97function sponsors_carousel($id = 0) {
     98    $id = intval($id);
     99    $option = get_option('sponsors-carousel-' . $id);
     100    if ($option == false) return false;
     101    $sponsors_carousel = unserialize($option);
     102    return $sponsors_carousel->show();
    78103}
    79104
    80 
    81 function sponsors_carousel_header() {
    82     if ( function_exists('plugin_url') )
    83         $plugin_url = plugin_url();
    84     else
    85         $plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
    86 
    87     echo '<link href="' . $plugin_url . '/skins/tango/skin.css" rel="stylesheet" type="text/css" />' . "\n";
    88     echo '<script type="text/javascript" src="' . $plugin_url . '/jquery.jcarousel.min.js"></script>' . "\n";
    89 }
    90 
    91 function sponsors_carousel($output=null, $attr=null) {
    92 
    93     /**
    94     * Get list
    95     */
    96     global $post;
    97 
    98     $scwp_array = explode (' ', get_option('scwp_list')) ;
    99 
    100     if ( empty($scwp_array) )
    101         return '';
    102     /**
    103     * Start output
    104     */
    105     $output = "\t
    106     <!-- Begin Sponsors Carousel -->";
    107     $randomid ="".rand();
    108     $output .= '<ul id="mycarousel'.$randomid.'" class="jcarousel-skin-tango" >';
    109     $thumb_size = array(125,75);
    110     foreach ( $scwp_array as $id) {
    111 //      wp_get_attachment_link($id, $size, true);
    112         if (get_post($id)->post_excerpt <> '')$link = get_post($id)->post_excerpt;
    113         else $link = get_option('scwp_default_link');
    114         //  Relay link building code to include target
    115         $output .= "<li><a ";
    116         if ('new' == get_option('scwp_link_target')) {
    117             $output .= 'target="_blank"';
    118         }
    119         $output .= " id=\"item".$i. "\" href=\"".$link."\" class=\"jcarousel-item\">";
    120         if (get_option('scwp_show_titles')=='true') $output .= wp_get_attachment_image( $id,$thumb_size );
    121         else $output .= wp_get_attachment_image( $id,$thumb_size, false, array(title=>"") );
    122         $output .= "</a></li>\n";
    123         $n++;
    124 
    125     }
    126     $output .= "</ul>\n";
    127 
    128 
    129     /**
    130     * Initialize
    131     */
    132     $output .= "
    133 <script type='text/javascript'>\n
    134 
    135 
    136 
    137     jQuery(document).ready(function() {";
    138 
    139         if (get_option('scwp_animation_speed') == 'slow' || get_option('scwp_animation_speed') == 'fast') {
    140            $speed = '"'.stripslashes(get_option('scwp_animation_speed')).'"';
    141         }
    142         else {
    143           $speed = stripslashes(get_option('scwp_animation_speed'));
    144         }
    145         if (get_option('scwp_auto_scroll')=='1')
    146             $auto = "0.001
    147             ,easing: 'linear'";
    148         else
    149             $auto = stripslashes(get_option('scwp_auto_scroll'));
    150 
    151         $output .= "jQuery('#mycarousel".$randomid."').jcarousel({
    152             scroll: ".stripslashes(get_option('scwp_scroll_amount'))."
    153             ,animation: ".$speed."
    154             ,wrap: 'circular'
    155              ,auto: " . $auto . "
    156 
    157         });
    158 
    159 
    160     });
    161     </script>
    162     ";
    163 
    164 
    165     $output .= "
    166         <br style='clear: both;' />
    167 
    168     <!-- End Sponsors Carousel -->\n
    169     ";
    170 
    171 
    172     return $output;
    173 
    174 }
    175 
    176 
    177 
    178 
    179 
    180 function scwp_admin_init() {
    181     if ( function_exists('register_setting') ) {
    182         register_setting('scwp_settings', 'option-1', '');
    183 
    184     }
    185 }
    186 
    187 
    188 
    189 function add_scwp_option_page() {
    190     global $wpdb;
    191     global $scwp_plugin_name;
    192     if( function_exists( 'add_meta_box' )) {
    193         add_meta_box('linkadvanceddiv', __('Advanced'), 'custom_link_advanced_meta_box', 'link', 'normal', 'core');
    194         wp_enqueue_script('quicktags');
    195         add_thickbox();
    196     }
    197     wp_enqueue_media();
    198 
    199     add_options_page($scwp_plugin_name . ' ' . __('Options', 'sponsors-carousel'), $scwp_plugin_name, 8, basename(__FILE__), 'scwp_options_page');
    200 
    201 }
    202 
    203 // Options function
    204 function scwp_options_page() {
    205 
    206     if (isset($_POST['info_update']))
    207     {
    208 
    209         // Update options
    210         $scwp_animation_speed = $_POST["scwp_animation_speed"];
    211         update_option("scwp_animation_speed", $scwp_animation_speed);
    212 
    213         $scwp_show_titles = $_POST["scwp_show_titles"];
    214         update_option("scwp_show_titles", $scwp_show_titles);
    215 
    216         $scwp_scroll_amount = $_POST["scwp_scroll_amount"];
    217         update_option("scwp_scroll_amount", $scwp_scroll_amount);
    218 
    219         $scwp_default_link = $_POST["scwp_default_link"];
    220         update_option("scwp_default_link", $scwp_default_link);
    221 
    222         //  Save link target
    223         $scwp_link_target = $_POST["scwp_link_target"];
    224         update_option("scwp_link_target", $scwp_link_target);
    225 
    226         //  Auto scrolling speed
    227         $scwp_auto_scroll = $_POST["scwp_auto_scroll"];
    228         update_option("scwp_auto_scroll", $scwp_auto_scroll);
    229 
    230 
    231         $scwp_link_image = $_POST["scwp_link_image"];
    232         if ($scwp_link_image > "")
    233         {
    234             if (substr_count($scwp_link_image,get_option('siteurl')) < 1)
    235                      $scwp_link_image = get_option('siteurl').$scwp_link_image;
    236             global $wpdb;
    237 
    238             $thepost = $wpdb->get_row( $wpdb->prepare( "SELECT *
    239             FROM $wpdb->posts WHERE guid = '".$scwp_link_image."'" ) );
    240             if (isset($thepost->ID))
    241             {
    242                 $scwp_list = get_option('scwp_list');
    243                 if ($scwp_list>"") $scwp_list.=" ";
    244                 $scwp_list .= $thepost->ID;
    245                 update_option("scwp_list", $scwp_list);
    246             }
    247 
    248         }
    249 
    250     // Give an updated message
    251         echo "<div class='updated fade'><p><strong>" . __('Options updated', 'sponsors-carousel') . "</strong></p></div>";
    252 
    253     }
    254 
    255     if (isset($_GET['move']))
    256     {
    257 
    258         // Move images
    259         $scwp_move = $_GET["move"];
    260         $scwp_image = $_GET["image"];
    261         $scwp_id_array = explode (' ', get_option('scwp_list')) ;
    262         $scwp_key = array_search ($scwp_image, $scwp_id_array);
    263         if(in_array($scwp_image, $scwp_id_array))
    264         {
    265             if ($scwp_move == "up" && $scwp_key > 0)
    266             {
    267                 $scwp_id_temp = $scwp_id_array[$scwp_key-1];
    268                 $scwp_id_array[$scwp_key-1] = $scwp_id_array[$scwp_key];
    269                 $scwp_id_array[$scwp_key] = $scwp_id_temp;
    270             }
    271 
    272             if ($scwp_move == "down" && $scwp_key < count($scwp_id_array)-1)
    273             {
    274                 $scwp_id_temp = $scwp_id_array[$scwp_key+1];
    275                 $scwp_id_array[$scwp_key+1] = $scwp_id_array[$scwp_key];
    276                 $scwp_id_array[$scwp_key] = $scwp_id_temp;
    277             }
    278             $scwp_list ="";
    279             foreach ($scwp_id_array as $scwp_id)
    280             {
    281             if (($scwp_move == "out" && $scwp_id==$scwp_image)==false)
    282                 $scwp_list .=$scwp_id." ";
    283             }
    284             $scwp_list = substr($scwp_list, 0, strlen($scwp_list)-1);
    285             update_option("scwp_list", $scwp_list);
    286         }
    287 
    288     }
    289 
    290     // Show options page
    291     ?>
    292 
    293         <div class="wrap">
    294 
    295             <div class="options">
    296             <hr>
    297 
    298                 <form method="post" action="options-general.php?page=<?php global $scwp_plugin_filename; echo $scwp_plugin_filename; ?>">
    299 
    300                 <h2><?php global $scwp_plugin_name; printf(__('%s Settings', 'sponsors-carousel'), $scwp_plugin_name); ?></h2>
    301 
    302                     <p><?php _e("Speed:", 'sponsors-carousel'); ?>
    303                     <input type="text" size="10" name="scwp_animation_speed" id="scwp_animation_speed" value="<?php echo stripslashes(get_option('scwp_animation_speed')) ?>" />
    304                     <a title="<?php _e("The speed of the animation. Options: 'fast', 'slow', or a number. 0 is instant, 10000 is very slow.", 'sponsors-carousel') ?>" />?</a>
    305                     </p>
    306                     <p><?php _e("Show Titles:", 'sponsors-carousel'); ?>
    307                     <label>
    308                     <?php
    309                     echo "<input type='radio' ";
    310                     echo "name='scwp_show_titles' ";
    311                     echo "id='scwp_show_titles_0' ";
    312                     echo "value='true' ";
    313                     echo "true" == get_option('scwp_show_titles') ? ' checked="checked"' : "";
    314                     echo " />";
    315                     ?>
    316                     <?php _e("Yes, show image titles.", 'sponsors-carousel'); ?>
    317                     </label>
    318 
    319                     <label>
    320                     <?php
    321                     echo "<input type='radio' ";
    322                     echo "name='scwp_show_titles' ";
    323                     echo "id='scwp_show_titles_1' ";
    324                     echo "value='false' ";
    325                     echo "false" == get_option('scwp_show_titles') ? ' checked="checked"' : "";
    326                     echo " />";
    327                     ?>
    328                     <?php _e("No, hide image titles. ", 'sponsors-carousel'); ?>
    329                     </label>
    330                     <a title="<?php _e("Should the title of each image be shown?", 'sponsors-carousel') ?>"/>?</a>
    331                     </p>
    332                      <p><?php _e("Scroll Amount:", 'sponsors-carousel'); ?>
    333                     <input type="text" size="10" name="scwp_scroll_amount" id="scwp_scroll_amount" value="<?php echo stripslashes(get_option('scwp_scroll_amount')) ?>" />
    334                     <a title="<?php _e("How many items should the carousel scroll", 'sponsors-carousel') ?>" />?</a>
    335                     </p>
    336             <?php
    337             //  Output new option field for scrolling speed
    338             ?>
    339                     <p><?php _e("Auto scroll:", 'sponsors-carousel'); ?>
    340                     <select type="select" name="scwp_auto_scroll" id="scwp_auto_scroll">
    341                         <option value="0" <?php if ('0' == stripslashes(get_option('scwp_auto_scroll'))) {  echo 'selected="selected"'; }?>><?php _e("Off", 'sponsors-carousel'); ?></option>
    342                         <option value="1" <?php if ('1' == stripslashes(get_option('scwp_auto_scroll'))) {  echo 'selected="selected"'; }?>><?php _e("Continuous", 'sponsors-carousel'); ?></option>
    343                         <option value="3" <?php if ('3' == stripslashes(get_option('scwp_auto_scroll'))) {  echo 'selected="selected"'; }?>><?php _e("Fast", 'sponsors-carousel'); ?></option>
    344                         <option value="6" <?php if ('6' == stripslashes(get_option('scwp_auto_scroll'))) {  echo 'selected="selected"'; }?>><?php _e("Medium", 'sponsors-carousel'); ?></option>
    345                         <option value="10" <?php if ('10' == stripslashes(get_option('scwp_auto_scroll'))) {  echo 'selected="selected"'; }?>><?php _e("Slow", 'sponsors-carousel'); ?></option>
    346                     </select>
    347                     <a title="<?php _e("Select the auto scrolling speed.", 'sponsors-carousel') ?>" />?</a>
    348                     </p>
    349             <?php
    350             //  Output new option field for link target
    351             ?>
    352                     <p><?php _e("Link target:", 'sponsors-carousel'); ?>
    353                     <select type="select" name="scwp_link_target" id="scwp_link_target">
    354                         <option value="new" <?php if ('new' == stripslashes(get_option('scwp_link_target'))) {  echo 'selected="selected"'; }?>><?php _e("New Window or tab", 'sponsors-carousel'); ?></option>
    355                         <option value="" <?php if ('' == stripslashes(get_option('scwp_link_target'))) {  echo 'selected="selected"'; }?>><?php _e("Same Window or tab", 'sponsors-carousel'); ?></option>
    356                     </select>
    357                     <a title="<?php _e("Choose whether the links should open in the current window.", 'sponsors-carousel') ?>" />?</a>
    358                     </p>
    359                      <p><?php _e("Default link:", 'sponsors-carousel'); ?>
    360                     <input type="text" size="50" name="scwp_default_link" id="scwp_default_link" value="<?php echo stripslashes(get_option('scwp_default_link')) ?>" />
    361                     <a title="<?php _e("Link to sponsors page. You can add custom link in image caption.", 'sponsors-carousel') ?>" />?</a>
    362                     </p>
    363                     <?php _e("New (select *full size* before insert): ", 'sponsors-carousel'); ?>
    364                     <input type="text" name="scwp_link_image" id="scwp_link_image" size="50" value="" style="width: 80%"  />
    365                     </div>
    366 
    367 
    368                     <script type="text/javascript">
    369                         jQuery(document).ready(function($){
    370                             var custom_uploader;
    371                             $('#scwp_link_image').click(function(e) {
    372                                 e.preventDefault();
    373                                 if (custom_uploader) {
    374                                     custom_uploader.open();
    375                                     return;
    376                                 }
    377                                 custom_uploader = wp.media.frames.file_frame = wp.media({
    378                                     title: 'Choose Image',
    379                                     button: {
    380                                         text: 'Choose Image'
    381                                     },
    382                                     multiple: false
    383                                 });
    384                                 custom_uploader.on('select', function() {
    385                                     console.log(custom_uploader.state().get('selection').toJSON());
    386                                     attachment = custom_uploader.state().get('selection').first().toJSON();
    387                                     $('#scwp_link_image').val(attachment.url);
    388                                 });
    389                                 custom_uploader.open();
    390 
    391                             });
    392                         });
    393                     </script>
    394 
    395                     <p class="submit">
    396                         <?php if ( function_exists('settings_fields') ) settings_fields('scwp_settings'); ?>
    397                         <input type='submit' name='info_update' value="<?php _e('Save Changes', 'sponsors-carousel'); ?>" />
    398                     </p>
    399 
    400                 </form>
    401 
    402 
    403             <?php //.options ?>
    404 
    405 
    406         <div id='scwp_logos'>
    407         <table style="width:90%;td{padding:5px;}">
    408         <?php
    409             if ( function_exists('plugin_url') ) $plugin_url = plugin_url();
    410                 else $plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
    411 
    412             $scwp_id_array = explode (' ', get_option('scwp_list')) ;
    413 
    414             $scwp_id_num=1;
    415             if ($scwp_id_array[0]<>"")
    416             foreach ($scwp_id_array as $scwp_id)
    417             {
    418             if ($scwp_id_num % 2 == 1)  echo "<tr style='background-color:#eee'>";
    419                 else echo "<tr style='background-color:#ddd'>";
    420             echo "<td  style='width:30px'>";
    421             if ($scwp_id_num<>1) echo " <a href='?page=sponsors-carousel.php&image=".$scwp_id."&move=up'><img src='".$plugin_url."/images/up.png'></a> ";
    422             echo "</td><td   style='width:30px'>";
    423             if ($scwp_id_num<count($scwp_id_array)) echo " <a href='?page=sponsors-carousel.php&image=".$scwp_id."&move=down'><img src='".$plugin_url."/images/down.png'></a> ";
    424             echo "</td>";
    425 
    426             echo "<td style='padding:10px;width:40px;'><a href='media.php?attachment_id=".$scwp_id."&action=edit'>".wp_get_attachment_image( $scwp_id,array(125,75)) ."</a></td>";
    427             $scwp_id_num++;
    428             echo "<td style='padding:10px;'>".get_post($scwp_id)->post_excerpt."</td>";
    429             echo "<td   style='width:40px'>";
    430             echo " <a href='?page=sponsors-carousel.php&image=".$scwp_id."&move=out'><img src='".$plugin_url."/images/delete.png'></a></td></tr>\n ";
    431             }
    432         ?>
    433         </table>
    434         </div>
    435     </div>
    436 
    437 <?php
    438 }
    439 
Note: See TracChangeset for help on using the changeset viewer.