Changeset 2801917
- Timestamp:
- 10/20/2022 01:49:40 PM (3 years ago)
- Location:
- bg-rutube-embed
- Files:
-
- 15 added
- 4 edited
-
tags/1.5 (added)
-
tags/1.5/bg-rutube.php (added)
-
tags/1.5/css (added)
-
tags/1.5/css/bg_rutube.css (added)
-
tags/1.5/css/blank.html (added)
-
tags/1.5/css/play.svg (added)
-
tags/1.5/inc (added)
-
tags/1.5/inc/options.php (added)
-
tags/1.5/js (added)
-
tags/1.5/js/bg_rutube.js (added)
-
tags/1.5/languages (added)
-
tags/1.5/languages/bg-rutube-embed-ru_RU.mo (added)
-
tags/1.5/languages/bg-rutube-embed-ru_RU.po (added)
-
tags/1.5/languages/bg-rutube-embed.pot (added)
-
tags/1.5/readme.txt (added)
-
trunk/bg-rutube.php (modified) (7 diffs)
-
trunk/css/bg_rutube.css (modified) (1 diff)
-
trunk/inc/options.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bg-rutube-embed/trunk/bg-rutube.php
r2801058 r2801917 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. 4.46 Version: 1.5 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. 4.4');41 define('BG_RUTUBE_VERSION', '1.5'); 42 42 43 43 // Подключаем CSS и JS … … 104 104 'title' => '', 105 105 'description' => '', 106 'sort' => '' 106 'sort' => '', 107 'perpage' => '' 107 108 ), $atts ) ); 108 109 … … 125 126 }); 126 127 } 127 $quote = bg_rutube_playlist_show ( $playlist );128 $quote = bg_rutube_playlist_show ( $playlist, $perpage ); 128 129 } 129 130 return $quote; … … 305 306 306 307 ******************************************************************************************/ 307 function bg_rutube_playlist_show ( $playlist) { 308 function bg_rutube_playlist_show ( $playlist, $perpage = '') { 309 static $id=999; 310 308 311 // Выводим на экран 309 312 if (empty($playlist)) return ""; 310 313 $val = get_option('bg_rutube_options'); 311 314 $singular = $val ? $val['singular'] : false; 315 if (empty($perpage) && $perpage != '0') $perpage = ($val && !empty($val['perpage'])) ? $val['perpage'] : 0; 312 316 313 317 ob_start(); 314 318 if (is_singular() || !$singular) { 315 $uuid = '_'. random_int(1000, 9999); 316 $track = $playlist['tracks'][0]; 319 $id++; 320 $uuid = '_'.$id; 321 322 if ($perpage > 0) { 323 if (isset($_GET['v'.$uuid])) $current_page = $_GET['v'.$uuid]; 324 else $current_page = 1; 325 $track_no = ($current_page-1)*$perpage; 326 $last_no = $current_page*$perpage; 327 if ($last_no > $playlist['count']) $last_no = $playlist['count']; 328 $total = ((int) $playlist['count']/$perpage)+1; 329 330 $base_url = strtok(get_permalink(), '?'); 331 $args = [ 332 'base' => $base_url.'%_%', 333 'format' => '?v'.$uuid.'=%#%#bg_rutube_playlistContainer'.$uuid, 334 'total' => $total, 335 'current' => $current_page, 336 'prev_next' => false, 337 'type' => 'list', 338 ]; 339 } else { 340 $track_no = 0; 341 $last_no = $playlist['count']; 342 } 343 344 $track = $playlist['tracks'][$track_no]; 317 345 $thumbnail = $track['thumbnail']; 318 346 319 347 ?> 320 <div id="bg_rutube_playlistContainer<?php echo esc_attr($uuid); ?>" class="bg_rutube_playlistContainer" data-uuid="<?php echo esc_attr($uuid); ?>" data-movie="<?php echo esc_attr($playlist['tracks'][ 0]['uuid']); ?>">348 <div id="bg_rutube_playlistContainer<?php echo esc_attr($uuid); ?>" class="bg_rutube_playlistContainer" data-uuid="<?php echo esc_attr($uuid); ?>" data-movie="<?php echo esc_attr($playlist['tracks'][$track_no]['uuid']); ?>"> 321 349 <div class="bg_rutube_centerVideo"> 322 350 <div id="bg_rutube_videoContainer<?php echo esc_attr($uuid); ?>" class="bg_rutube_videoContainer" style="background-image: url('<?php echo esc_url($track['thumbnail']); ?>');"> … … 340 368 <div class="bg_rutube_videoPlayList"> 341 369 <table class="bg_rutube_videoPlayListTable"> 342 <?php foreach ($playlist['tracks'] as $track): ?> 370 <?php 371 for (; $track_no < $last_no && $track_no < $playlist['count']; $track_no++) : 372 $track = $playlist['tracks'][$track_no]; 373 ?> 374 343 375 <tr class="bg_rutube_showRuTubeVideoLink<?php echo esc_attr($uuid); ?>" title="<?php _e( 'Play', 'bg-rutube-embed'); ?>: <?php echo esc_html($track['title']);?>" data-movie="<?php echo esc_attr($track['uuid']); ?>"> 344 376 <td style="background-image: url('<?php echo esc_url($track['thumbnail']); ?>');"> … … 351 383 </td> 352 384 </tr> 353 <?php endforeach; ?> 385 386 <?php endfor; ?> 354 387 </table> 388 <?php if ($perpage > 0) echo '<div class="bg_rutube_paginate">'. paginate_links( $args ) .'</div>'; ?> 355 389 </div> 356 390 <?php endif; ?> -
bg-rutube-embed/trunk/css/bg_rutube.css
r2790474 r2801917 120 120 } 121 121 122 /* ============================ 123 PAGINATION BUTTONS 124 ============================ */ 125 .bg_rutube_paginate { 126 text-align: center; } 127 .bg_rutube_paginate ul { 128 list-style: none; 129 margin: 0; 130 padding: 0; 131 text-align: center; } 132 .bg_rutube_paginate li { 133 display: inline; } 134 .bg_rutube_paginate a { 135 border-radius: 3px; 136 box-shadow: rgba(0, 0, 0, 0.2) 0 0 0 1px; 137 margin: 1px 2px; 138 padding: 5px 10px; 139 display: inline-block; 140 border-top: 1px solid #fff; 141 text-decoration: none; 142 color: #717171; 143 font-size: smaller; 144 font-family: "Helvetica Neueu", Helvetica, Arial, sans-serif; 145 text-shadow: white 0 1px 0; 146 background-color: #f5f5f5; 147 background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#eaeaea)); 148 background-image: -webkit-linear-gradient(top, #f9f9f9, #eaeaea); 149 background-image: -moz-linear-gradient(top, #f9f9f9, #eaeaea); 150 background-image: -ms-linear-gradient(top, #f9f9f9, #eaeaea); 151 background-image: -o-linear-gradient(top, #f9f9f9, #eaeaea); 152 background-image: linear-gradient(top, #f9f9f9, #eaeaea); 153 filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f9f9f9', EndColorStr='#eaeaea'); } 154 .bg_rutube_paginate a:first-child, .bg_rutube_paginate a.first { 155 margin-left: 0; } 156 .bg_rutube_paginate a:last-child, .bg_rutube_paginate a.last { 157 margin-right: 0; } 158 .bg_rutube_paginate a:hover, .bg_rutube_paginate a:focus { 159 border-color: #fff; 160 background-color: #fdfdfd; 161 background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#fafafa)); 162 background-image: -webkit-linear-gradient(top, #fefefe, #fafafa); 163 background-image: -moz-linear-gradient(top, #fefefe, #fafafa); 164 background-image: -ms-linear-gradient(top, #fefefe, #fafafa); 165 background-image: -o-linear-gradient(top, #fefefe, #fafafa); 166 background-image: linear-gradient(top, #fefefe, #fafafa); 167 filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fefefe', EndColorStr='#fafafa'); } 168 .bg_rutube_paginate a.more { 169 box-shadow: 0 0 0 0 transparent; 170 border: 0 none; 171 background: transparent; 172 margin-left: 0; 173 margin-right: 0; } 174 .bg_rutube_paginate a.current { 175 box-shadow: rgba(0, 0, 0, 0.75) 0 0 0 0 inset; 176 border-color: #505050; 177 color: #f2f2f2; 178 text-shadow: black 0 1px 0; 179 background-color: #676767; 180 background-image: -webkit-gradient(linear, left top, left bottom, from(#5f5f5f), to(#5c5c5c)); 181 background-image: -webkit-linear-gradient(top, #5f5f5f, #5c5c5c); 182 background-image: -moz-linear-gradient(top, #5f5f5f, #5c5c5c); 183 background-image: -ms-linear-gradient(top, #5f5f5f, #5c5c5c); 184 background-image: -o-linear-gradient(top, #5f5f5f, #5c5c5c); 185 background-image: linear-gradient(top, #5f5f5f, #5c5c5c); 186 filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#5f5f5f', EndColorStr='#5c5c5c'); } -
bg-rutube-embed/trunk/inc/options.php
r2713422 r2801917 39 39 add_settings_field('bg_rutube_field1', __('Videos on post pages only', 'bg-rutube-embed'), 'fill_bg_rutube_field1', 'bg_rutube_page', 'bg_rutube_section_id' ); 40 40 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' ); 41 add_settings_field('bg_rutube_field5', __('Paginate videos', 'bg-rutube-embed'), 'fill_bg_rutube_field5', 'bg_rutube_page', 'bg_rutube_section_id' ); 41 42 } 42 43 … … 59 60 } 60 61 62 ## Заполняем опцию 5 63 function fill_bg_rutube_field5(){ 64 $val = get_option('bg_rutube_options'); 65 $perpage = ($val && !empty($val['perpage'])) ? $val['perpage'] : 0; 66 ?> 67 <label><input type="number" id="perpage" name="bg_rutube_options[perpage]" value="<?php echo $perpage; ?>" min="0" style="width:5em;" /> <?php _e( 'per page<br>(0 - don\'t paginate)', 'bg-rutube-embed'); ?></label> 68 <?php 69 } 70 61 71 ## Очистка данных 62 72 function bg_rutube_sanitize_callback( $options ){ -
bg-rutube-embed/trunk/readme.txt
r2801058 r2801917 7 7 Requires at least: 3.0.1 8 8 Tested up to: 6.0.3 9 Stable tag: 1. 4.49 Stable tag: 1.5 10 10 License: GPLv2 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 23 23 * `title` - playlist title (for list of **uuid** only); 24 24 * `description` - playlist description (for list of **uuid** only); 25 * `sort="on"`- sort playlist by ABC (default: `sort=""` - don't sort). 25 * `sort="on"`- sort playlist by ABC (default: `sort=""` - don't sort); 26 * `perpage` - number of items per page (default: 0 (zero) - don't paginate). 26 27 27 28 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. 28 29 30 You can paginate videos in playlists. Choose number of items per page in the settings. 0 (zero) - don't paginate (by default). 31 32 You can set number of items per page for each playlist in shortcode. 29 33 30 34 == Installation == … … 45 49 46 50 == Changelog == 51 52 = 1.5 = 53 54 * Pagination video in playlists. 47 55 48 56 = 1.4.4 =
Note: See TracChangeset
for help on using the changeset viewer.