Changeset 2829606
- Timestamp:
- 12/06/2022 09:04:53 PM (3 years ago)
- Location:
- bg-rutube-embed
- Files:
-
- 14 added
- 3 edited
-
tags/1.6.2 (added)
-
tags/1.6.2/bg-rutube.php (added)
-
tags/1.6.2/css (added)
-
tags/1.6.2/css/bg_rutube.css (added)
-
tags/1.6.2/css/play.svg (added)
-
tags/1.6.2/inc (added)
-
tags/1.6.2/inc/options.php (added)
-
tags/1.6.2/js (added)
-
tags/1.6.2/js/bg_rutube.js (added)
-
tags/1.6.2/languages (added)
-
tags/1.6.2/languages/bg-rutube-embed-ru_RU.mo (added)
-
tags/1.6.2/languages/bg-rutube-embed-ru_RU.po (added)
-
tags/1.6.2/languages/bg-rutube-embed.pot (added)
-
tags/1.6.2/readme.txt (added)
-
trunk/bg-rutube.php (modified) (14 diffs)
-
trunk/inc/options.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bg-rutube-embed/trunk/bg-rutube.php
r2826273 r2829606 4 4 Plugin URI: http://bogaiskov.ru/plugin-bg-rutube-embed/ 5 5 Description: The plugin is the easiest way to embed RuTube videos in WordPress. 6 Version: 1.6. 16 Version: 1.6.2 7 7 Author: VBog 8 8 Author URI: http://bogaiskov.ru … … 39 39 die( 'Sorry, you are not allowed to access this page directly.' ); 40 40 } 41 define('BG_RUTUBE_VERSION', '1.6. 1');41 define('BG_RUTUBE_VERSION', '1.6.2'); 42 42 43 43 // Подключаем CSS и JS … … 96 96 description - описание плейлиста 97 97 sort='on' - сортировать плейлист по алфавиту 98 perpage - количество элементов на странице 99 limit - max размер плейлиста 98 100 mode - режим запуска видео при загрузке страницы 99 101 'preview' - заставка 100 102 'load' - загрузить видео во фрейм 101 103 'play' - загрузить видео во фрейм и воспроизвести 102 '' - в соответствии с настройками плагина 104 105 perpage, limit, mode = '' - в соответствии с настройками плагина 103 106 104 107 ******************************************************************************************/ … … 111 114 'sort' => '', 112 115 'perpage' => '', 116 'limit' => '', 113 117 'mode' => '' 114 118 ), $atts ) ); … … 120 124 121 125 // Формируем список фильмов с RuTube из шорткода 122 if (empty($id)) return ""; // Фильм не указан123 elseif (strlen($id) < 32) $playlist = bg_rutube_get_playlist ($id );// Плейлист RuTube124 else $playlist = bg_rutube_create_playlist ($id, $title, $description );// Фильм или список фильмов125 126 if (empty($id)) return ""; // Фильм не указан 127 elseif (strlen($id) < 32) $playlist = bg_rutube_get_playlist ($id, $limit); // Плейлист RuTube 128 else $playlist = bg_rutube_create_playlist ($id, $title, $description, $limit); // Фильм или список фильмов 129 126 130 if(!$playlist || empty($playlist)) { 127 131 $quote = "<div class='tube-error'><p class='warning'>".__('Sorry, the video is temporarily unavailable.', 'bg-rutube-embed')."</p></div>"; … … 178 182 179 183 ******************************************************************************************/ 180 function bg_rutube_get_playlist ( $playlist_id ) {184 function bg_rutube_get_playlist ( $playlist_id, $limit='' ) { 181 185 $playlist = array(); 182 186 $tracks = array(); … … 187 191 $transient = $val ? $val['transient'] : false; 188 192 $singular = $val ? $val['singular'] : false; 193 if (empty($limit) && $limit != '0') $limit = $val ? $val['limit'] : 0; 189 194 190 195 if (is_singular() || !$singular) { … … 226 231 } 227 232 $page++; 233 if ($limit && count($tracks) >= $limit) { 234 $tracks = array_slice($tracks, 0, $limit); 235 break; 236 } 228 237 } 229 238 if (!empty($tracks)) { … … 232 241 $playlist['description'] = $info['description']; 233 242 $playlist['thumbnail'] = $info['thumbnail_url']; 234 $playlist['count'] = $info['videos_count']; 243 if ($limit) $playlist['count'] = $limit; 244 else $playlist['count'] = $info['videos_count']; 235 245 $playlist['tracks'] = $tracks; 236 246 … … 242 252 $playlist['description'] = $info['description']; 243 253 $playlist['thumbnail'] = $info['thumbnail_url']; 244 $playlist['count'] = $info['videos_count']; 254 if ($limit) $playlist['count'] = $limit; 255 else $playlist['count'] = $info['videos_count']; 245 256 if (!$playlist['description']) $playlist['description'] = $playlist['title']; 246 257 } … … 253 264 254 265 ******************************************************************************************/ 255 function bg_rutube_create_playlist ($ids, $title='', $description='' ) {266 function bg_rutube_create_playlist ($ids, $title='', $description='', $limit='') { 256 267 $playlist = array(); 257 268 $tracks = array(); … … 261 272 $transient = $val ? $val['transient'] : false; 262 273 $singular = $val ? $val['singular'] : false; 274 if (empty($limit) && $limit != '0') $limit = $val ? $val['limit'] : 0; 263 275 264 276 if (is_singular() || !$singular) { … … 300 312 error_log("Metadata. Empty or error answer from RuTube: ". $json." for ".$videoID, 0); 301 313 } 314 if ($limit && count($tracks) >= $limit) break; 302 315 } 303 316 if (!empty($tracks)) { … … 382 395 $last_no = $current_page*$perpage; 383 396 if ($last_no > $playlist['count']) $last_no = $playlist['count']; 384 $total = ((int) $playlist['count']/$perpage)+1;397 $total =(int) ceil((int) $playlist['count']/$perpage); 385 398 386 399 $base_url = strtok(get_permalink(), '?'); -
bg-rutube-embed/trunk/inc/options.php
r2826261 r2829606 1 1 <?php 2 2 /** 3 * Страница настроек плагина 3 * Страница настроек плагина. Версия 1.6.2 4 4 */ 5 5 add_action('admin_menu', 'add_bg_rutube_options_page'); … … 41 41 add_settings_field('bg_rutube_field3', __('Caching response of the RuTube API', 'bg-rutube-embed'), 'fill_bg_rutube_field3', 'bg_rutube_page', 'bg_rutube_section_id' ); 42 42 add_settings_field('bg_rutube_field5', __('Paginate playlist', 'bg-rutube-embed'), 'fill_bg_rutube_field5', 'bg_rutube_page', 'bg_rutube_section_id' ); 43 add_settings_field('bg_rutube_field7', __('Max playlist length', 'bg-rutube-embed'), 'fill_bg_rutube_field7', 'bg_rutube_page', 'bg_rutube_section_id' ); 43 44 } 44 45 … … 86 87 } 87 88 89 ## Заполняем опцию 7 90 function fill_bg_rutube_field7(){ 91 $val = get_option('bg_rutube_options'); 92 $limit = ($val && !empty($val['limit'])) ? $val['limit'] : 0; 93 ?> 94 <label><input type="number" id="limit" name="bg_rutube_options[limit]" value="<?php echo $limit; ?>" min="0" style="width:5em;" /> <?php _e( '(0 - not limited)', 'bg-rutube-embed'); ?></label> 95 <?php 96 } 97 88 98 ## Очистка данных 89 99 function bg_rutube_sanitize_callback( $options ){ -
bg-rutube-embed/trunk/readme.txt
r2826273 r2829606 7 7 Requires at least: 3.0.1 8 8 Tested up to: 6.1.1 9 Stable tag: 1.6. 19 Stable tag: 1.6.2 10 10 License: GPLv2 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 Plugin allowed to embed [RuTube](https://rutube.ru/) videos in WordPress. Just specify the **uuid** of the playlist or video in the shortcode. You can also specify a list of **uuid** separated by commas. 19 19 20 `[rutube id="{uuid}" title="" description="" sort="" perpage="" ]`20 `[rutube id="{uuid}" title="" description="" sort="" perpage="" limit="" mode="" ]` 21 21 22 22 * `id` - **uuid** of the video or playlist, or list of videos **uuid** separated by commas; … … 25 25 * `sort="on"`- sort playlist by ABC (default: `sort=""` - don't sort); 26 26 * `perpage` - number of items per page (default: *empty* - use plugin's settings); 27 * `mode` - mode of start video on page load: 28 * `'preview'` - preview image, 29 * `'load'` - load video into the frame, 30 * `'play'` - load video into the frame and play, 31 * `''` (empty) - use plugin's settings (by default). 27 * `limit` - playlist size limit (default: *empty* - use plugin's settings); 28 * `mode` - mode of start video on page load: 29 * `"preview"` - preview image, 30 * `"load"` - load video into the frame, 31 * `"play"` - load video into the frame and play, 32 * `''` (*empty*) - use plugin's settings (by default). 32 33 33 34 34 35 To embed a single video or playlist, just enter its URL (https://rutube.ru/video/{**uuid**}/ or https://rutube.ru/plst/{**uuid**}/) оn a separate line. 35 36 36 You can paginate videos in playlists. Choose number of items per page in the settings. 0 (zero) - don't paginate (by default).37 You can choose mode of start video on page load in settings and shortcode. 37 38 38 You can set number of items per page for each playlist in shortcode. 39 То paginate playlist сhoose number of items per page in the settings or shortcode. 0 (zero) - don't paginate (by default). 40 41 If the playlist size is very large, you can limit it with "Max playlist size" option in the settings or shortcode. 0 (zero) - not limited (by default). 39 42 40 43 == Installation == … … 56 59 == Changelog == 57 60 61 = 1.6.2 = 62 63 * New plugin option and shortcode parameter: mode of start video on page load. 64 58 65 = 1.6.1 = 59 66 … … 62 69 = 1.6 = 63 70 64 * New plugin option and shortcode parameter: mode of start video on page load.71 * New plugin option and shortcode parameter: playlist size limit. 65 72 66 73 = 1.5.1 =
Note: See TracChangeset
for help on using the changeset viewer.